History log of /freebsd-10.3-release/sys/dev/vt/hw/ofwfb/ofwfb.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 296373 04-Mar-2016 marius

- Copy stable/10@296371 to releng/10.3 in preparation for 10.3-RC1
builds.
- Update newvers.sh to reflect RC1.
- Update __FreeBSD_version to reflect 10.3.
- Update default pkg(8) configuration to use the quarterly branch.

Approved by: re (implicit)

# 271952 22-Sep-2014 ray

MFC 271381-271382,271385,271463-271466,271485,271506

o Add sysctls to enable/disable potentially dengerous key combinations, like
reboot/halt/debug.
o Add support for most key combinations supported by syscons(4).
o Some spelling fixes
o Remove stray whitespaces.
o Switch vt(4) to traditional behaviour with copy-paste same as syscons(4) do.
o Fix stray char on paste.
o Fix 'function declaration isn't a prototype' warning.
o vt(4): Enclose vt_mouse_paste() prototype inside #ifndef SC_NO_CUTPASTE/#endif

Approved by: re (gjb)
Sponsored by: The FreeBSD Foundation


# 271128 04-Sep-2014 emaste

MFC vt(4) improvements / sync with HEAD

These are largely dumbbell@'s changes. Most significantly they address
the extreme performance degradation with VGA hardware.

SVN revisions in this MFC:
269471 270290 270293 270322 270324 270329 270331 270336 270338 270340
270341 270342 270343 270388 270390 270404 270411 270412 270413 270431
270446 270448 270485 270587 270589 270613 270618 270620 270667 270702
270707 270708 270720 270721 270785 270786

Detailed commit list:

r270290: Test if the cursor is shown only once

Later, we just see if the "struct mouse_cursor" pointer is set. This
avoids the need to mess with all the conditions several times; this
has been error prone.

While here, rename the variable "m" to a more meaningful "cursor",
like it's done elsewhere in the code.

r270293: Rename the "mouse_cursor" structure to "vt_mouse_cursor"

At the same time, "w" and "h" members are now called "width" and
"height". The goal is to have a more "public" structure, because it
will soon be passed as argument to a new callback, replacing
vd_bitbltchr_t.

r269471 (ray):

Fix vt_vga driver to draw not-8-bit-aligned fonts correctly.
Still one bug here: mouse left some gaps on track when moving left.

r270322:

Add new vd_bitblt_text_t callback, and implement it for vt_vga

Compared to the deprecated vd_bitbltchr_t callback, vd_bitblt_text_t
receives:
o the whole text buffer
o the dirty area
o the mouse cursor (map, position, colors)

This allows the backend to perform optimization on how to draw things.
The goal is to remove vd_bitbltchr_t and vd_putchar_t, once all driver
are converted (only vt_vga is included in this commit).

In vt_vga, this allows to draw the text and the cursor in one pass,
without ever reading from video memory (because it has all the context).
The main benefit is the speed improvement: no more slideshow during
boot!

Other bugs fixed in vt_vga are:
o left-most characters are drawn properly (the left-most pixels were
missing with bold characters and some wide letters such as 'm')
o no more black square around the cursor
o no cursor flickering when the text is scrolling

There are still many problems to fix: the known issues are marked with
"FIXME" inside the code.

r270411:

vt_fb: Implement vd_bitblt_text_t for vt_fb and derivatives

r270412:

creator_fb: Implement vd_bitblt_text_t

r270413: ofwfb: Implement vd_bitblt_text_t

r270324: vt_vga: Clip the draw area to never draw offscreen

This fixes a bug when two windows use different fonts, but a longer-
term solution is required. The dirty area should be stored as pixels,
not character cells, because such coordinates don't have the same
meaning in all windows, when using different fonts.

r270329: Mark new mouse position as dirty only when it's actually displayed

r270331: Store cursor bitmap & colors in struct vt_device

This removes the need to specify them to each call to vd_bitblt_text_t
and, therefore, simplifies the API.

r270336: Give the window to vd_bitblt_text_t callback

... instead of both the buffer and the font. Again, this simplifies
the API.

r270338: The offset to center the text area is per-window now

The previous global offset, based on the last loaded font, had no
meaning for other windows. This caused a shifted text area, often
partly out-of-screen.

r270341: vt_vga: Remove a "FIXME" comment; the issue was solved in r270338

r270340: Don't run vt_set_border() and vt_flush() concurrently

In the case of vt_vga, the two concurrent calls were writing to the
same VGA registers, causing incorrect refresh of the screen.

r270342: Use the actual size of the mouse when marking its position as dirty

This fixes a bug where part of the cursor was not erased.

r270343: Remove "FIXME" about multiple locking of vt_buf in vt_flush()

After some testing, it appears that acquiring the lock once and keeping
it longer is slower than taking it multiple times.

While here, fix a typo in another comment.

r270388: vt_vga: Give only the character part of term_char_t to vga_get_cp437()

This fixes a bug where vga_get_cp437() was called with an invalid
argument. The screen was then filled with '?' instead of the actual
character.

r270390: Fix a crash in vt_mark_mouse_position_as_dirty() when in textmode

In textmode, no font is loaded, thus the page fault in
vt_mark_mouse_position_as_dirty() when it wants the font width/height.

For now, create a fake area for the textmode. This needs to be
modified if vt_vga gains mouse support in textmode.

While here, fix a build failure when SC_NO_CUTPASTE is defined:
vt_mark_mouse_position_as_dirty() must not be included in this case.

r270404: Fix cursor handling in vt_flush()

There were situations where the cursor was not erased/redrawn or its
position was marked as dirty even though it's not displayed. The code
is now more straightforward.

At the same, add a function to determine if the cursor covers a given
area. This is used by backends to know if they need to draw the
cursor.

This new function should be paired with a new state in struct
vt_device, called vd_mshown, which indicates if the cursor should be
displayed. This again simplifies vd_bitblt_text_t callback's API.

r270431: vt(4): Add vd_bitblt_bmp_t callback

The code was already there in all backends, we just expose it. This is
used to display the splash screen.

r270446: Remove vd_bitbltchr_t

It's replaced by vd_bitblt_text_t, which gives more context to the
backend and allows it to perform more efficiently when redrawing a
given area.

r270448: Fix order of arguments (x <-> y) when showing the splash screen

r270485: vt_vga: Fix the display of the splash screen

r270587: Take font offset into account in vt_is_cursor_in_area()

This fixes a "General protection fault" in vt_vga, where
vt_is_cursor_in_area() erroneously reported that the cursor was over
the text. This led to negative integers stored in "unsigned int" and
chaos.

r270589: The cursor coordinates are relative to the drawn area

... not the whole screen. Don't use font offsets in
vt_mark_mouse_position_as_dirty().

This fixes a bug where the mouse position wasn't marked as dirty when
approaching the borders of the drawn area.

r270613: Store a rectangle for the drawable area, not just the top-left corner

This allows backends to verify they do not draw outside of this area.
This fixes a bug in vt_vga where the text was happily drawn over the
right and bottom margins, when using the Gallant font.

r270618: Intialize drawable area rectangle each time a font is loaded

This also fixes a problem where early in boot, the area was zero,
leading to nothing displayed for a few seconds.

r270620: vt_vga: Use Write Mode 0 to draw group of 8 pixels using 3 or more colors

This replaces the method based on Write Mode 3, which required reads
from the video memory to load the latches.

r270667: When creating a window buffer, fill it entirely

... not just the visible part.

This fixes a bug where, when switching from eg. vt_vga to vt_fb (ie.
the resolution goes up), the originally hidden, uninitialized area of
the buffer is displayed on the screen. This leads to a missing text
cursor when it's over an unitialized area.

This was also visible when selecting text: the uninitialized area was
not highlighted.

Internally, this area was zeroed: characters were all 0x00000000,
meaning the foreground and background color was black. Now, everything
is filled with a space with a gray foreground color, like the visible
area.

While here, remove the check for the mute flag and always use
TERMINAL_NORM_ATTR as the character attribute (ie. gray foreground,
black background).

r270702: Implement basic support for KDSETMODE ioctl

With the current implementation, this allows an X11 server to tell
the console it switches a particular window in "graphics mode". This
information is used by the mouse handling code to ignore sysmouse events
in the window taken by the X server: only him should receive those
events.

r270707: Pause the vt_flush() timer when the screen is up-to-date

The timer is restarted whenever a window buffer is marked as dirty or
the mouse cursor moves.

There's still room for improvement. For instance, we should not mark a
window buffer as dirty when this window isn't displayed.

r270708: vt(4): Recompute the drawable area when the resolution changes

This was only done when the font changed.

r270720: vt(4): Fix mouse cursor handling in vt_fb/creator_vt/ofwfb

There were two issues:
1. The area given to vt_is_cursor_in_area() was adding the drawable
area offset, something already handled by this function.
2. The cursor was shifted on the screen by the offset of this area
and thus was misplaced or not erased. Furthermore, when reaching
the bottom or right borders, the cursor was either totally
removed or not erased correctly.

r270721: vt(4): If the terminal shrinks, make sure the mouse is inside
the new area

r270785: vt(4): Change vb_history_size from "int" to "unsigned int"

CID: 1230002, 1230003

r270786: Indicate that KDSETRAD case falls through the next case

CID: 1229953

Relnotes: Yes


# 271120 04-Sep-2014 emaste

MFC r269685 (nwhitehorn): Retire vd_maskbitbltchr.

The same functionality can be obtained by testing for mask != NULL in
vd_bitbltchr, which all implementations of vd_bitbltchr() were doing
anyway.

Sponsored by: The FreeBSD Foundation


# 271118 04-Sep-2014 emaste

MFC r269636 by nwhitehorn:

Set fb_pbase properly on PowerPC in the case where we have to guess at
the right register bank for the framebuffer. Disable the assigned-
addresses path on SPARC since it is just a hack for IBM PPC systems
and was neither relevant for nor worked on SPARC anyway.

Sponsored by: The FreeBSD Foundation


# 271117 04-Sep-2014 emaste

MFC fbd(4) and vt_fb disentanglement:

r268472 (ray):

Should check fb_read method presence instead of double check for fb_write.

r269620 (nwhitehorn):

Retire various intertwined bits of fbd(4) and vt_fb, in particular the
pixel modification indirection. No actual drivers use it and those
that might (e.g. creatorfb) use custom implementations of
vd_bitbltchr().

Relnotes: No
Sponsored by: The FreeBSD Foundation


# 271116 04-Sep-2014 emaste

MFC r269278 (nwhitehorn):

Make mmap() of the console device when using ofwfb work like other
supported framebuffer drivers. This lets ofwfb work with
xf86-video-scfb and makes the driver much more generic and less
PCI-centric. This changes some user-visible behavior and will require
updates to the xorg-server port on PowerPC when using ATI graphics
cards.

Relnotes: Yes
Sponsored by: The FreeBSD Foundation


# 271115 04-Sep-2014 emaste

MFC r268350 (nwhitehorn):

Use common vt_fb parts in ofwfb as far as we are able without
sacrificing performance.

Sponsored by: The FreeBSD Foundation


# 270262 21-Aug-2014 dumbbell

vt(4): Colors are indexed against a console palette, not a VGA palette

Rename vt_generate_vga_palette() to vt_generate_cons_palette() and
change it to build a palette where the color index is the same than in
terminal escape codes, not the VGA index. That's what TCHAR_CREATE()
uses and passes to vt(4).

The main differences between both orders are:
o Blue and red are swapped (1 <-> 4)
o Yellow and cyan are swapped (3 <-> 6)

The problem remained unnoticed, because the RGB bit indexes passed to
vt_generate_vga_palette() were reversed. This inversion was cancelled
by the colors inversions in the generated palette. For instance, red
(0xff0000) and blue (0x0000ff) have bytes in opposite order, but were
swapped in the palette. But after changing the value of blue (see last
paragraph), the modified color was in fact the red one.

While here, tune the palette to better match console colors and improve
the readability (especially the dark blue).

This is an MFC of r269783 and r269791.


# 267538 16-Jun-2014 ray

MFC 262785 263183 264182 264999 265391 265392 265395 265397 265398 265402 265403
265442 265546 265680 265681 265719 265862 265864 265867 265927 266010 266495
266540 266835 266856 266861 266862 267007 267310.

265391
Define a new method for probing vt(4) driver before attach it at early stage.
265392
Create dataset for vt(4) drivers.
265395
Set of updates to vt(4) core part.
o Declare vt(4) drivers dataset.
o Create single static structures for all early drivers.
o Add vt(4) to be by default in the kernel consoles list.
o Create one more sysinit point, to be able to initialize memory and lock
requirement of early drivers.
o Implement early drivers select. (Only best available will be selected).
o Fix one missed "return (0)" for VTYLOCK.
o Improve locking for cases when one driver replace another.
o Make driver replacement notification less debug-look-like.
o Minor spell fixes.
265397
Switch fb and efifb drivers to use names and new vt(4) driver probe method.
265398
Add vt(4) driver name for ofwfb driver.
265402
Revert r264997 and r265026. It is not required anymore.
265403
Switch vga drivers to use names and new vt(4) driver probe method.
265442
Implement KDMKTONE ioctl.
265546
Fix possible divide by zero.
265680
No need to assign fields required and checked on probe.
265681
Fix scrollback.
265719
Hide debug messages under VT_DEBUG.
265927
Update terminal sizes in any case when new vt(4) driver arrive.
(Plus remove one unused newline)
266010
Remove extra newlines.
No functional changes.
266495
Fix tty locking.
o Correct expected values for VT_LOCKSWITCH ioctl.
o Check current window for locked state.
266540
Proper fix of VT_LOCKSWITCH ioctl.
266835
Remove driver as unused.
267007
Fix case when vt(4) started w/o driver assigned.
o Always init locks and cv ASAP.
o Initialize driver-independent parts even if driver probing fail.
o Allow to call vt_upgrade anytime, for later loaded drivers.
o New window flag VWF_READY, to track if window already initialized.
Other updates:
o Pass vd as a cookie for kbd_allocate.
o Do not blank window on driver replacement.

Sponsored by: The FreeBSD Foundation


# 262861 06-Mar-2014 jhb

MFC 259016,259019,259049,259071,259102,259110,259129,259130,259178,259179,
259203,259221,259261,259532,259615,259650,259651,259667,259680,259727,
259761,259772,259776,259777,259830,259882,259915,260160,260449,260450,
260688,260888,260953,261269,261547,261551,261552,261553,261585:
Merge the vt(4) driver (newcons) to stable/10.

Approved by: ray


# 259016 05-Dec-2013 ray

Merge VT(9) project (a.k.a. newcons).

Reviewed by: nwhitehorn
MFC_to_10_after: re approval

Sponsored by: The FreeBSD Foundation


# 258782 30-Nov-2013 nwhitehorn

Fix build.


# 257988 11-Nov-2013 ray

Update vd_bitbltchr_t type to handle operation mask (to not touch pixels which
is not defined in mask) and bpl (bytes per source line).
Only vt_fb driver handle handle bpl yet.
Add protector for case when blitting image can be drawn partially out of screen,
like mouse cursor.

Mouse cursor and its movements works fine, copy/paste not yet.

Sponsored by: The FreeBSD Foundation


# 257211 27-Oct-2013 nwhitehorn

Get colors right on mac framebuffers.


# 256896 22-Oct-2013 ray

Hardware specific drivers have bigger priority (over VGA for example).

Sponsored by: The FreeBSD Foundation


# 256684 17-Oct-2013 nwhitehorn

Use vt_generate_vga_palette() instead of a hard-coded mapping.


# 256681 17-Oct-2013 nwhitehorn

Sync with ofw_syscons.c: provide support for IBM framebuffers like that in
the QEMU pSeries emulated platform.


# 256527 15-Oct-2013 ray

o Rename bitblt method to bitbltchr, since it used to copy char with bg/fg colors
from font table, but not bitmap copy.
o Fix small mistake in comment.

Sponsored by: The FreeBSD Foundation


# 256314 11-Oct-2013 ray

Fix off-by-one-huge-fb-line copy-pasted to every driver.
TODO: defaulting to single implementation for all FB devices.

Sponsored by: The FreeBSD Foundation


# 256145 08-Oct-2013 ray

o Implement history buffer.
o Join history buffer with screen buffer. Same type of things.
o Reimplement buffer as an array of rows. Make it circular, so no overflow
tracking.
o Implement VT_PROCESS mode. Locking of VT switching by owner process.
o Add debug and deadtimer sysctls. deadtimer - defaulting to 15 seconds, time
to wait process answer in VT_PROCESS mode, to do VT switch in case when
process hang.
o Implement later console attach.
o Fix (partially yet) keyboard allocation.
o Add drivers priority. Disallow to replace KMS driver with VGA.
o Add ability to resize terminals.

Sponsored by: The FreeBSD Foundation


# 230440 21-Jan-2012 nwhitehorn

Checkpoint SPARC support. This seems to inexplicably crash fairly early on
somewhere outside of ofwfb.c. It is in no way clear why.


# 230434 21-Jan-2012 nwhitehorn

Make ofwfb static framebuffer much smaller by actually reading how you
are supposed to do this kind of thing.


# 230428 21-Jan-2012 nwhitehorn

Add a vt(4) framebuffer for Open Firmware linear framebuffer devices (i.e.
all graphics on PowerPC Apple systems). This will also work on some sparc64
graphics hardware with a small amount of modification.