History log of /freebsd-10-stable/sys/dev/vt/vt_core.c
Revision Date Author Comments
# 321198 19-Jul-2017 emaste

MFC r303043: Increase vt(4) framebuffer maximum size

PR: 210382
Relnotes: Yes


# 303633 01-Aug-2016 emaste

MFC r303338: vt: lock Giant around kbd calls in CONS_GETINFO

Note that keyboards are stored in an array and are not freed (just
"unregistered" by clearing some fields) so a race would be limited to
obtaining stale information about an unregistered keyboard.

Reported by: CTurt


# 287782 14-Sep-2015 ray

MFC: r272715
Allow vt(4) to disable terminal bell with `sysctl kern.vt.bell_enable=0`,
similar as syscons(4) do.

Submitted by: Tiwei Bie <btw@mail.ustc.edu.cn>
Sponsored by: The FreeBSD Foundation


# 287128 25-Aug-2015 marcel

MFC r286808, r286809, r286867, r286868

- Improve support for Macs that have a stride not equal to the
horizonal resolution (width).
- Support frame buffers that are larger than the default screen
size.
- Support large frame buffers: add 24 more page table pages we
allocate on boot-up.

PR: 193745


# 286742 13-Aug-2015 emaste

MFC r276282: Support ALT_BREAK_TO_DEBUGGER in vt(4)

PR: 196511


# 283187 21-May-2015 hselasky

MFC r282645, r282646 and r282730:
* Prevent switching to NULL or own window in the "vt_proc_window_switch"
function. This fixes an issue where X11 keyboard input can appear
stuck. The cause of the problem is a duplicate TTY device window
switch IOCTL during boot, which leaves the "vt_switch_timer" running,
because the current window is already selected. While at it factor out
some NULL checks.
* The "SYSCTL_INT()" default value is only used for read only SYSCTLs
and is not applicable unless the integer pointer is NULL. Set it to
zero to avoid confusion. While at it remove extra semicolon at the end
of the "VT_SYSCTL_INT()" macro.
* Ensure the result from signed subtraction under modulus does not
become negative.

PR: 200032


# 282823 12-May-2015 emaste

MFC r281944: vt(4): Simplify mouse area detection

vt_is_cursor_in_area needs to return true if any part of the mouse
cursor is visible in the rectangle area. Replace the existing test with
a simpler version of a test for overlapping rectangles.

Sponsored by: The FreeBSD Foundation


# 282750 11-May-2015 avg

MFC r277796: hook userland threads suspend + resume into acpi suspend code


# 282749 11-May-2015 avg

MFC r277795,278849: vt(4): Use power_{suspend,resume} event handlers


# 278106 02-Feb-2015 delphij

MFC r277806:

Use unsigned int for index value.

Without this change a local attacker could trigger a panic by
tricking the kernel into accessing undefined kernel memory.

We would like to acknowledge Francisco Falcon from CORE Security
Technologies who discovered the issue and reported to the
FreeBSD Security Team.

More information can be found at CORE Security's advisory at:
http://www.coresecurity.com/content/freebsd-kernel-multiple-vulnerabilities

This is an errata candidate for releng/10.1 and releng/9.3. Earlier
releases are not affected.

Reported by: Francisco Falcon from CORE Security Technologies
Security: CVE-2014-0998
Reviewed by: dumbbell


# 276972 11-Jan-2015 hselasky

MFC r276534:
The "vt_suspend_flush_timer()" function is sometimes called locked
which prevents us from doing a "callout_drain()" call. The callout in
question has a lock associated with it and we are not freeing the
callout. That means we can use the "callout_stop()" function to
atomically stop the callback iff the "callout_stop()" function is
called locked. This patch applies proper locking to "callout_stop()"
and replaces a "callout_drain()" with a "callout_stop()".


# 274861 22-Nov-2014 dumbbell

vt(4): Fix keyboard allocation when kbdmux(4) isn't used

The problem was that only the kbdmux keyboard index was saved in
vd->vd_keyboard. This index is -1 when kbdmux isn't used. In this
case, the keyboard was correctly allocated, but the returned index was
discarded.

PR: 194718
MFC of: r273973


# 274860 22-Nov-2014 dumbbell

vt(4): Adjust the cursor position after changing the window size

A new terminal_set_cursor() is added: it wraps the existing
teken_set_cursor() function.

In vtbuf_grow(), the cursor position is adjusted at the end of the
function. In vt_change_font(), we call terminal_set_cursor() just after
terminal_set_winsize_blank(), while the terminal is mute.

This fixes a bug where, after loading a kernel video driver which
increases the terminal window size, the cursor remains at its old
position, in other words, in the middle of the display content.

PR: 194421
MFC of: r273932


# 273921 31-Oct-2014 dumbbell

vt(4): Add PIO_VFONT_DEFAULT ioctl to restore the default builtin font

To restore the default font using vidcontrol(1), use the "-f" flag
without an argument:
vidcontrol -f < /dev/ttyv0

PR: 193910
Differential Revision: https://reviews.freebsd.org/D971
Submitted by: Marcin Cieslak <saper@saper.info>
Reviewed by: ray@, emaste@
Approved by: ray@
MFC of: r273544


# 273545 23-Oct-2014 dumbbell

vt(4): Refuse to load a font if hw.vga.textmode is selected

Before, the font was loaded and the window size recalculated, giving an
unusable terminal, even if the actual font didn't change.

Reported by: beeessdee@ruggedinbox.com
MFC of: r273330


# 273296 19-Oct-2014 emaste

MFC r273219: Do nothing in vt_upgrade if there is no vt driver

Previously, if no drivers attached at boot we would panic with
"vtbuf_fill_locked begin.tp_row 0 must be < screen height 0".

PR: 192248


# 273037 13-Oct-2014 dumbbell

vt(4): Don't recalculate buffer size if we don't know screen size

(MFC of r272537)

When the screen size is unknown, it's set to 0x0. We can't use that as
the buffer size, otherwise, functions such as vtbuf_fill() will fail.

This fixes a panic on RaspberryPi, where there's no vt(4) backend
configured early in boot.

PR: 193981
Tested by: danilo@


# 273036 13-Oct-2014 dumbbell

vt(4): Save/restore keyboard mode & LED states when switching window

(MFC of r272416)

Add new functions to manipulate these mode & state, instead of calling
kbdd_ioctl() everyhere.

This fixes at least two bugs:

1. The state of the Scroll Lock LED and the state of scroll mode
could be out-of-sync. For instance, if one enables scroll mode on
window #1 and switches to window #2, the LED would remain on, but
the window wouldn't be in scroll mode.

Similarily, when switching between a console and an X.Org
session, the LED states could be inconsistent with the real
state.

2. When exiting from an X.Org session, the user could be unable to
type anything. The workaround was to switch to another console
window and come back.

Differential Revision: https://reviews.freebsd.org/D821
Reviewed by: ray@
Approved by: ray@
Tested by: kwm@


# 271973 22-Sep-2014 dumbbell

vt(4): Merge several bug fixes and improvements

SVN revisions in this MFC:
271756 271758 271868 271871 271872 271899

Detailed commit list:

r271756:
vt(4): Fix out-of-bounds array access in VT_ACTIVATE ioctl handling

CID: 1229964

r271758
vt(4): Use strncpy() to copy into a fixed-size buffer

CID: 1230007

r271868:
vt(4): Remove vt_buf->vb_dirtymask

This structure and the associated functions were unused since the
implementation of vd_bitblt_text_t callbacks.

r271871:
vt(4): Rewrite history scrolling

It's now possible to scroll up the 500 hard-coded lines of history, not
just a fraction of them. For instance, one can reach the top of the boot
process.

Sometimes, when scrolling or when changing the screen size (by changing
the font or loading a KMS driver for instance), one could see the
history cycling (old content appeared below latest lines). This is
fixed.

Now, when the resolution changes are more lines can be shown, the
displayed area is adjusted so that, if the screen was filled with
content before, it's filled with content after as well: more history
is visible, instead of having blank lines below the previously visible
content.

r271872:
vt(4): Remove superfluous word in comment

Submitted by: brueffer@

r271899:
Make gcc happy by initialising the variable only set in a couple of
case statements without a default.

Approved by: re (marius)


# 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


# 271769 18-Sep-2014 dumbbell

vt(4): Merge several bug fixes and improvements

SVN revisions in this MFC:
269779 270705 270706 271180 271250 271253 271682 271684

Detailed commit list:

r269779:
fbd: Fix a bug where vt_fb_attach() success would be considered a failure

vt_fb_attach() currently always returns 0, but it could return a code
defined in errno.h. However, it doesn't return a CN_* code. So checking
its return value against CN_DEAD (which is 0) is incorrect, and in this
case, a success becomes a failure.

The consequence was unimportant, because the caller (drm_fb_helper.c)
would only log an error message in this case. The console would still
work.

Approved by: nwhitehorn

r270705:
vt(4): Add cngrab() and cnungrab() callbacks

They are used when a panic occurs or when entering a DDB session for
instance.

cngrab() forces a vt-switch to the console window, no matter if the
original window is another terminal or an X session. However, cnungrab()
doesn't vt-switch back to the original window currently.

r270706:
drm: Don't "taskqueue" vt-switch if under DDB/panic situation

If DDB is active, we can't use a taskqueue thread to switch away from
the X window, because this thread can't run.

Reviewed by: ray@
Approved by: ray@

r271180:
vt_vga: vd_setpixel_t and vd_drawrect_t are noop in text mode

r271250:
vt(4): Change the terminal and buffer sizes, even without a font

This fixes a bug where scroll lock would not work for tty #0 when using
vt_vga's textmode. The reason was that this window is created with a
static 256x100 buffer, larger than the real size of 80x25.

Now, in vt_change_font() and vt_compute_drawable_area(), we still
perform operations even of the window has no font loaded (this is the
case in textmode here vw->vw_font == NULL). One of these operation
resizes the buffer accordingly.

In vt_compute_drawable_area(), we take the terminal size as is (ie.
80x25) for the drawable area.

The font argument to vt_set_border() is removed (it was never used) and
the code now uses the computed drawable area instead of re-doing its own
calculation.

Reported by: Harald Schmalzbauer <h.schmalzbauer_omnilan.de>
Tested by: Harald Schmalzbauer <h.schmalzbauer_omnilan.de>

r271253:
pause_sbt(): Take the cold path (ie. use DELAY()) if KDB is active

This fixes a panic in the i915 driver when one uses debug.kdb.enter=1
under vt(4).

PR: 193269
Reported by: emaste@
Submitted by: avg@

r271682:
vt(4): Fix a LOR which occurs during a call to vt_upgrade()

Reported by: kib@
Review: https://reviews.freebsd.org/D785
Reviewed by: ray@
Approved by: ray@

r271684:
vt(4): Use vt_fb_drawrect() and vt_fb_setpixel() in all vt_fb-derivative

Review: https://reviews.freebsd.org/D789
Reviewed by: nwhitehorn
Approved by: nwhitehorn

Approved by: re (gjb)


# 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


# 271023 03-Sep-2014 emaste

MFC r270280 by dumbbell: vt(4): Pause the flush timer while swithing window

This fixes bad looking refresh when switching window: squares instead
of text, flashing screen, and so on. In the worst case, vt_flush() came
at a very inappropriate timing and the screen was not refreshed at all
(leaving squares all over the place).

This doesn't fix the flickering of the screen with vt_vga, because the
sync signal is temporarily stopped and the video memory is cleared.

Sponsored by: The FreeBSD Foundation


# 271022 03-Sep-2014 emaste

MFC vt(4) mouse cursor improvements from dumbbell:

r270269:

vt(4): Handle global and per-window mouse cursor toggle in one place

Before the global flag was set/unset using the CONS_MOUSECTL ioctl,
and the per-window flag through the MOUSE_SETLEVEL or MOUSE_SETMODE
ioctls.

Also, if the cursor is already enabled/disabled, return immediatly.
This avoids to reset the cursor's position to the center of the
screen.

This matches syscons' behavior.

While here, remove a trailing space and a redundant variable
declaration.

r270271:

vt(4): Mark cursor old position as dirty before reading the dirty area

Otherwise, the redraw is done during the next vt_flush run.

r270272:

vt(4): If the cursor is globally disabled, don't mark its position as dirty

This avoids unnecessary redraw. In particular, during boot, where the
cursor is disabled and its fake position is [0;0], this triggered a
refresh of the whole screen each time vt_flush() is called.

r270273:

vt(4): If the cursor didn't move, don't mark its position as dirty

Currently, this has no effect, because the cursor is always redrawn
anyway. But this will be useful after improvements to the
vd_bitbltchr_t callback API.

The vt_device structure members used to store the position of the
cursor as of the last redraw are renamed from vd_mdirty{x,y} to
vd_mold{x,y}. The associated comment is fixed too. Also, their value
is now expressed in pixels, not in character columns/row.

r270275:

vt(4): Mark the current cursor position as dirty

Like r270273, this has no effect for now, because the cursor is always
drawn. This is in preparation of future changes to vd_bitbltchr_t API.

r270278:

vt(4): Mark cursor position as dirty when we enable/disable it

Sponsored by: The FreeBSD Foundation


# 271019 03-Sep-2014 emaste

MFC vt(4) work from ray@:

r269188: [Rework vb_buffer and vb_rows assignment]

r269192: Remove special handling of console window size.

It's done in vt_upgrade() for all windows.

r269193: Update comments.

r269194: Revise font initialization handling.

Sponsored by: The FreeBSD Foundation


# 270986 02-Sep-2014 emaste

MFC r269186 by ray@: Remove useless debug string.

Fix indent.

Sponsored by: The FreeBSD Foundation


# 269064 24-Jul-2014 emaste

MFC r268947: Hide syscons-specific workaround under DEV_SC


# 268941 21-Jul-2014 emaste

MFC r268460 by ray:

Fix inconsistent token parameters for kbd_allocate() and kbd_release()
in vt(4).

PR: 191306
Submitted by: jau789 at gmail.com
Sponsored by: The FreeBSD Foundation


# 268366 07-Jul-2014 ray

267622 Log:
Rename vt(4) vga module to dismiss interference with syscons(4) vga module.
267623 Log:
Remove stale link to deleted vt(4) xboxfb driver.
267624 Log:
syscons(4) and vt(4) can be built together now.
267625 Log:
Allow to disable syscons(4) if "hw.syscons.disable" kenv is set.
267626 Log:
Suspend vt(4) initialization if "kern.vt.disable" kenv is set.
267965 by emaste@ Log:
Use a common tunable to choose between vt(4)/sc(4)
With this change and previous work from ray@ it will be possible to put
both in GENERIC, and have one enabled by default, but allow the other to
be selected via the loader.
(The previous implementation had separate kern.vt.disable and
hw.syscons.disable tunables, and would panic if both drivers were
compiled in and neither was explicitly disabled.)
268175 by emaste@ Log:
Fix vt(4) detection in kbdcontrol and vidcontrol
As sc(4) and vt(4) coexist and are both enabled in GENERIC, the existence
of a vt(4) sysctl is not sufficient to determine that vt(4) is in use.
Reported by: Trond Endrestøl
268045 by emaste@ Log:
Add vt(4) to GENERIC and retire the separate VT config
vt(4) and sc(4) can now coexist in the same kernel. To choose the vt
driver, set the loader tunable kern.vty=vt .

Sponsored by: The FreeBSD Foundation


# 268037 30-Jun-2014 marius

MFC: r267978

In order to get vt(4) a bit closer to the feature set provided by sc(4),
implement options TERMINAL_{KERN,NORM}_ATTR. These are aliased to
SC_{KERNEL_CONS,NORM}_ATTR and like these latter, allow to change the
default colors of normal and kernel text respectively.
Note on the naming: Although affecting the output of vt(4), technically
kern/subr_terminal.c is primarily concerned with changing default colors
so it would be inconsistent to term these options VT_{KERN,NORM}_ATTR.
Actually, if the architecture and abstraction of terminal+teken+vt would
be perfect, dev/vt/* wouldn't be touched by this commit at all.

Reviewed by: emaste
Sponsored by: Bally Wulff Games & Entertainment GmbH


# 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


# 264611 17-Apr-2014 ray

MFC r264258

Fix cursor color in reverse video mode.

Sponsored by: The FreeBSD Foundation


# 264455 14-Apr-2014 ray

MFC 264242,264244,264259

Fix panic on load new driver while vt(4) is in VGA textmode.
o Mute terminal while vt(4) driver change in progress.
o Reset VDF_TEXTMODE before init new driver.
o Assign default font, if new driver is not in TEXTMODE.
o Do not update screen while driver changing.
o Unmute terminal when done with driver replacement.
o Move init fonts to early point.
o Minor cleanup.
o Do not fill screen, while muted. (kern/subr_terminal.c)

Sponsored by: The FreeBSD Foundation


# 264112 04-Apr-2014 ray

MFC r263885

o Add new vd_driver method to do bitblt with mask, named vd_maskbitbltchr.
o Move vd_bitbltchr vga's driver method to vd_maskbitbltchr.
o Implement new vd_bitbltchr method for vga driver. (It do single write for 8
pixels, have to be a bit faster).

Sponsored by: The FreeBSD Foundation


# 264071 03-Apr-2014 ray

MFC r263809

Fix crash on resume in vt(9).
Statically allocated terminal window have not initialized callout handler, so we
have to initialize it even for existing window if it is console window.

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


# 287782 14-Sep-2015 ray

MFC: r272715
Allow vt(4) to disable terminal bell with `sysctl kern.vt.bell_enable=0`,
similar as syscons(4) do.

Submitted by: Tiwei Bie <btw@mail.ustc.edu.cn>
Sponsored by: The FreeBSD Foundation


# 287128 25-Aug-2015 marcel

MFC r286808, r286809, r286867, r286868

- Improve support for Macs that have a stride not equal to the
horizonal resolution (width).
- Support frame buffers that are larger than the default screen
size.
- Support large frame buffers: add 24 more page table pages we
allocate on boot-up.

PR: 193745


# 286742 13-Aug-2015 emaste

MFC r276282: Support ALT_BREAK_TO_DEBUGGER in vt(4)

PR: 196511


# 283187 21-May-2015 hselasky

MFC r282645, r282646 and r282730:
* Prevent switching to NULL or own window in the "vt_proc_window_switch"
function. This fixes an issue where X11 keyboard input can appear
stuck. The cause of the problem is a duplicate TTY device window
switch IOCTL during boot, which leaves the "vt_switch_timer" running,
because the current window is already selected. While at it factor out
some NULL checks.
* The "SYSCTL_INT()" default value is only used for read only SYSCTLs
and is not applicable unless the integer pointer is NULL. Set it to
zero to avoid confusion. While at it remove extra semicolon at the end
of the "VT_SYSCTL_INT()" macro.
* Ensure the result from signed subtraction under modulus does not
become negative.

PR: 200032


# 282823 12-May-2015 emaste

MFC r281944: vt(4): Simplify mouse area detection

vt_is_cursor_in_area needs to return true if any part of the mouse
cursor is visible in the rectangle area. Replace the existing test with
a simpler version of a test for overlapping rectangles.

Sponsored by: The FreeBSD Foundation


# 282750 11-May-2015 avg

MFC r277796: hook userland threads suspend + resume into acpi suspend code


# 282749 11-May-2015 avg

MFC r277795,278849: vt(4): Use power_{suspend,resume} event handlers


# 278106 02-Feb-2015 delphij

MFC r277806:

Use unsigned int for index value.

Without this change a local attacker could trigger a panic by
tricking the kernel into accessing undefined kernel memory.

We would like to acknowledge Francisco Falcon from CORE Security
Technologies who discovered the issue and reported to the
FreeBSD Security Team.

More information can be found at CORE Security's advisory at:
http://www.coresecurity.com/content/freebsd-kernel-multiple-vulnerabilities

This is an errata candidate for releng/10.1 and releng/9.3. Earlier
releases are not affected.

Reported by: Francisco Falcon from CORE Security Technologies
Security: CVE-2014-0998
Reviewed by: dumbbell


# 276972 11-Jan-2015 hselasky

MFC r276534:
The "vt_suspend_flush_timer()" function is sometimes called locked
which prevents us from doing a "callout_drain()" call. The callout in
question has a lock associated with it and we are not freeing the
callout. That means we can use the "callout_stop()" function to
atomically stop the callback iff the "callout_stop()" function is
called locked. This patch applies proper locking to "callout_stop()"
and replaces a "callout_drain()" with a "callout_stop()".


# 274861 22-Nov-2014 dumbbell

vt(4): Fix keyboard allocation when kbdmux(4) isn't used

The problem was that only the kbdmux keyboard index was saved in
vd->vd_keyboard. This index is -1 when kbdmux isn't used. In this
case, the keyboard was correctly allocated, but the returned index was
discarded.

PR: 194718
MFC of: r273973


# 274860 22-Nov-2014 dumbbell

vt(4): Adjust the cursor position after changing the window size

A new terminal_set_cursor() is added: it wraps the existing
teken_set_cursor() function.

In vtbuf_grow(), the cursor position is adjusted at the end of the
function. In vt_change_font(), we call terminal_set_cursor() just after
terminal_set_winsize_blank(), while the terminal is mute.

This fixes a bug where, after loading a kernel video driver which
increases the terminal window size, the cursor remains at its old
position, in other words, in the middle of the display content.

PR: 194421
MFC of: r273932


# 273921 31-Oct-2014 dumbbell

vt(4): Add PIO_VFONT_DEFAULT ioctl to restore the default builtin font

To restore the default font using vidcontrol(1), use the "-f" flag
without an argument:
vidcontrol -f < /dev/ttyv0

PR: 193910
Differential Revision: https://reviews.freebsd.org/D971
Submitted by: Marcin Cieslak <saper@saper.info>
Reviewed by: ray@, emaste@
Approved by: ray@
MFC of: r273544


# 273545 23-Oct-2014 dumbbell

vt(4): Refuse to load a font if hw.vga.textmode is selected

Before, the font was loaded and the window size recalculated, giving an
unusable terminal, even if the actual font didn't change.

Reported by: beeessdee@ruggedinbox.com
MFC of: r273330


# 273296 19-Oct-2014 emaste

MFC r273219: Do nothing in vt_upgrade if there is no vt driver

Previously, if no drivers attached at boot we would panic with
"vtbuf_fill_locked begin.tp_row 0 must be < screen height 0".

PR: 192248


# 273037 13-Oct-2014 dumbbell

vt(4): Don't recalculate buffer size if we don't know screen size

(MFC of r272537)

When the screen size is unknown, it's set to 0x0. We can't use that as
the buffer size, otherwise, functions such as vtbuf_fill() will fail.

This fixes a panic on RaspberryPi, where there's no vt(4) backend
configured early in boot.

PR: 193981
Tested by: danilo@


# 273036 13-Oct-2014 dumbbell

vt(4): Save/restore keyboard mode & LED states when switching window

(MFC of r272416)

Add new functions to manipulate these mode & state, instead of calling
kbdd_ioctl() everyhere.

This fixes at least two bugs:

1. The state of the Scroll Lock LED and the state of scroll mode
could be out-of-sync. For instance, if one enables scroll mode on
window #1 and switches to window #2, the LED would remain on, but
the window wouldn't be in scroll mode.

Similarily, when switching between a console and an X.Org
session, the LED states could be inconsistent with the real
state.

2. When exiting from an X.Org session, the user could be unable to
type anything. The workaround was to switch to another console
window and come back.

Differential Revision: https://reviews.freebsd.org/D821
Reviewed by: ray@
Approved by: ray@
Tested by: kwm@


# 271973 22-Sep-2014 dumbbell

vt(4): Merge several bug fixes and improvements

SVN revisions in this MFC:
271756 271758 271868 271871 271872 271899

Detailed commit list:

r271756:
vt(4): Fix out-of-bounds array access in VT_ACTIVATE ioctl handling

CID: 1229964

r271758
vt(4): Use strncpy() to copy into a fixed-size buffer

CID: 1230007

r271868:
vt(4): Remove vt_buf->vb_dirtymask

This structure and the associated functions were unused since the
implementation of vd_bitblt_text_t callbacks.

r271871:
vt(4): Rewrite history scrolling

It's now possible to scroll up the 500 hard-coded lines of history, not
just a fraction of them. For instance, one can reach the top of the boot
process.

Sometimes, when scrolling or when changing the screen size (by changing
the font or loading a KMS driver for instance), one could see the
history cycling (old content appeared below latest lines). This is
fixed.

Now, when the resolution changes are more lines can be shown, the
displayed area is adjusted so that, if the screen was filled with
content before, it's filled with content after as well: more history
is visible, instead of having blank lines below the previously visible
content.

r271872:
vt(4): Remove superfluous word in comment

Submitted by: brueffer@

r271899:
Make gcc happy by initialising the variable only set in a couple of
case statements without a default.

Approved by: re (marius)


# 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


# 271769 18-Sep-2014 dumbbell

vt(4): Merge several bug fixes and improvements

SVN revisions in this MFC:
269779 270705 270706 271180 271250 271253 271682 271684

Detailed commit list:

r269779:
fbd: Fix a bug where vt_fb_attach() success would be considered a failure

vt_fb_attach() currently always returns 0, but it could return a code
defined in errno.h. However, it doesn't return a CN_* code. So checking
its return value against CN_DEAD (which is 0) is incorrect, and in this
case, a success becomes a failure.

The consequence was unimportant, because the caller (drm_fb_helper.c)
would only log an error message in this case. The console would still
work.

Approved by: nwhitehorn

r270705:
vt(4): Add cngrab() and cnungrab() callbacks

They are used when a panic occurs or when entering a DDB session for
instance.

cngrab() forces a vt-switch to the console window, no matter if the
original window is another terminal or an X session. However, cnungrab()
doesn't vt-switch back to the original window currently.

r270706:
drm: Don't "taskqueue" vt-switch if under DDB/panic situation

If DDB is active, we can't use a taskqueue thread to switch away from
the X window, because this thread can't run.

Reviewed by: ray@
Approved by: ray@

r271180:
vt_vga: vd_setpixel_t and vd_drawrect_t are noop in text mode

r271250:
vt(4): Change the terminal and buffer sizes, even without a font

This fixes a bug where scroll lock would not work for tty #0 when using
vt_vga's textmode. The reason was that this window is created with a
static 256x100 buffer, larger than the real size of 80x25.

Now, in vt_change_font() and vt_compute_drawable_area(), we still
perform operations even of the window has no font loaded (this is the
case in textmode here vw->vw_font == NULL). One of these operation
resizes the buffer accordingly.

In vt_compute_drawable_area(), we take the terminal size as is (ie.
80x25) for the drawable area.

The font argument to vt_set_border() is removed (it was never used) and
the code now uses the computed drawable area instead of re-doing its own
calculation.

Reported by: Harald Schmalzbauer <h.schmalzbauer_omnilan.de>
Tested by: Harald Schmalzbauer <h.schmalzbauer_omnilan.de>

r271253:
pause_sbt(): Take the cold path (ie. use DELAY()) if KDB is active

This fixes a panic in the i915 driver when one uses debug.kdb.enter=1
under vt(4).

PR: 193269
Reported by: emaste@
Submitted by: avg@

r271682:
vt(4): Fix a LOR which occurs during a call to vt_upgrade()

Reported by: kib@
Review: https://reviews.freebsd.org/D785
Reviewed by: ray@
Approved by: ray@

r271684:
vt(4): Use vt_fb_drawrect() and vt_fb_setpixel() in all vt_fb-derivative

Review: https://reviews.freebsd.org/D789
Reviewed by: nwhitehorn
Approved by: nwhitehorn

Approved by: re (gjb)


# 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


# 271023 03-Sep-2014 emaste

MFC r270280 by dumbbell: vt(4): Pause the flush timer while swithing window

This fixes bad looking refresh when switching window: squares instead
of text, flashing screen, and so on. In the worst case, vt_flush() came
at a very inappropriate timing and the screen was not refreshed at all
(leaving squares all over the place).

This doesn't fix the flickering of the screen with vt_vga, because the
sync signal is temporarily stopped and the video memory is cleared.

Sponsored by: The FreeBSD Foundation


# 271022 03-Sep-2014 emaste

MFC vt(4) mouse cursor improvements from dumbbell:

r270269:

vt(4): Handle global and per-window mouse cursor toggle in one place

Before the global flag was set/unset using the CONS_MOUSECTL ioctl,
and the per-window flag through the MOUSE_SETLEVEL or MOUSE_SETMODE
ioctls.

Also, if the cursor is already enabled/disabled, return immediatly.
This avoids to reset the cursor's position to the center of the
screen.

This matches syscons' behavior.

While here, remove a trailing space and a redundant variable
declaration.

r270271:

vt(4): Mark cursor old position as dirty before reading the dirty area

Otherwise, the redraw is done during the next vt_flush run.

r270272:

vt(4): If the cursor is globally disabled, don't mark its position as dirty

This avoids unnecessary redraw. In particular, during boot, where the
cursor is disabled and its fake position is [0;0], this triggered a
refresh of the whole screen each time vt_flush() is called.

r270273:

vt(4): If the cursor didn't move, don't mark its position as dirty

Currently, this has no effect, because the cursor is always redrawn
anyway. But this will be useful after improvements to the
vd_bitbltchr_t callback API.

The vt_device structure members used to store the position of the
cursor as of the last redraw are renamed from vd_mdirty{x,y} to
vd_mold{x,y}. The associated comment is fixed too. Also, their value
is now expressed in pixels, not in character columns/row.

r270275:

vt(4): Mark the current cursor position as dirty

Like r270273, this has no effect for now, because the cursor is always
drawn. This is in preparation of future changes to vd_bitbltchr_t API.

r270278:

vt(4): Mark cursor position as dirty when we enable/disable it

Sponsored by: The FreeBSD Foundation


# 271019 03-Sep-2014 emaste

MFC vt(4) work from ray@:

r269188: [Rework vb_buffer and vb_rows assignment]

r269192: Remove special handling of console window size.

It's done in vt_upgrade() for all windows.

r269193: Update comments.

r269194: Revise font initialization handling.

Sponsored by: The FreeBSD Foundation


# 270986 02-Sep-2014 emaste

MFC r269186 by ray@: Remove useless debug string.

Fix indent.

Sponsored by: The FreeBSD Foundation


# 269064 24-Jul-2014 emaste

MFC r268947: Hide syscons-specific workaround under DEV_SC


# 268941 21-Jul-2014 emaste

MFC r268460 by ray:

Fix inconsistent token parameters for kbd_allocate() and kbd_release()
in vt(4).

PR: 191306
Submitted by: jau789 at gmail.com
Sponsored by: The FreeBSD Foundation


# 268366 07-Jul-2014 ray

267622 Log:
Rename vt(4) vga module to dismiss interference with syscons(4) vga module.
267623 Log:
Remove stale link to deleted vt(4) xboxfb driver.
267624 Log:
syscons(4) and vt(4) can be built together now.
267625 Log:
Allow to disable syscons(4) if "hw.syscons.disable" kenv is set.
267626 Log:
Suspend vt(4) initialization if "kern.vt.disable" kenv is set.
267965 by emaste@ Log:
Use a common tunable to choose between vt(4)/sc(4)
With this change and previous work from ray@ it will be possible to put
both in GENERIC, and have one enabled by default, but allow the other to
be selected via the loader.
(The previous implementation had separate kern.vt.disable and
hw.syscons.disable tunables, and would panic if both drivers were
compiled in and neither was explicitly disabled.)
268175 by emaste@ Log:
Fix vt(4) detection in kbdcontrol and vidcontrol
As sc(4) and vt(4) coexist and are both enabled in GENERIC, the existence
of a vt(4) sysctl is not sufficient to determine that vt(4) is in use.
Reported by: Trond Endrestøl
268045 by emaste@ Log:
Add vt(4) to GENERIC and retire the separate VT config
vt(4) and sc(4) can now coexist in the same kernel. To choose the vt
driver, set the loader tunable kern.vty=vt .

Sponsored by: The FreeBSD Foundation


# 268037 30-Jun-2014 marius

MFC: r267978

In order to get vt(4) a bit closer to the feature set provided by sc(4),
implement options TERMINAL_{KERN,NORM}_ATTR. These are aliased to
SC_{KERNEL_CONS,NORM}_ATTR and like these latter, allow to change the
default colors of normal and kernel text respectively.
Note on the naming: Although affecting the output of vt(4), technically
kern/subr_terminal.c is primarily concerned with changing default colors
so it would be inconsistent to term these options VT_{KERN,NORM}_ATTR.
Actually, if the architecture and abstraction of terminal+teken+vt would
be perfect, dev/vt/* wouldn't be touched by this commit at all.

Reviewed by: emaste
Sponsored by: Bally Wulff Games & Entertainment GmbH


# 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


# 264611 17-Apr-2014 ray

MFC r264258

Fix cursor color in reverse video mode.

Sponsored by: The FreeBSD Foundation


# 264455 14-Apr-2014 ray

MFC 264242,264244,264259

Fix panic on load new driver while vt(4) is in VGA textmode.
o Mute terminal while vt(4) driver change in progress.
o Reset VDF_TEXTMODE before init new driver.
o Assign default font, if new driver is not in TEXTMODE.
o Do not update screen while driver changing.
o Unmute terminal when done with driver replacement.
o Move init fonts to early point.
o Minor cleanup.
o Do not fill screen, while muted. (kern/subr_terminal.c)

Sponsored by: The FreeBSD Foundation


# 264112 04-Apr-2014 ray

MFC r263885

o Add new vd_driver method to do bitblt with mask, named vd_maskbitbltchr.
o Move vd_bitbltchr vga's driver method to vd_maskbitbltchr.
o Implement new vd_bitbltchr method for vga driver. (It do single write for 8
pixels, have to be a bit faster).

Sponsored by: The FreeBSD Foundation


# 264071 03-Apr-2014 ray

MFC r263809

Fix crash on resume in vt(9).
Statically allocated terminal window have not initialized callout handler, so we
have to initialize it even for existing window if it is console window.

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