History log of /openbsd-current/sys/dev/wscons/wsdisplayvar.h
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.38 13-Sep-2020 fcambus

Fix various typos in wscons(4) comments.


# 1.37 25-May-2020 jsg

change wsdisplay attribute type from long to uint32_t

miod explained it was initially a long as it was thought drivers may
need to allocate storage but in practice they don't need more than
32 bits for an attribute.

suggested and reviewed by miod@


# 1.36 25-May-2020 jsg

rename wsdisplay alloc_attr() to pack_attr()

Suggested by John Carmack. miod agrees a rename would make sense and
explained it was initially thought drivers may need to allocate storage
but in practice they don't need more than 32 bits for an attribute.

ok mpi@


Revision tags: OPENBSD_6_7_BASE
# 1.35 19-Apr-2020 kettenis

Move logic to change brightness level in reasonable steps from acpivout(4)
into wsdisplay(4). This code is now exposed through
wsdisplay_brightness_{step,zero,cycle} functions that can be called by
any driver that handles brightnes "hotkeys". These functions take
a wsdisplay(4) device pointer as their first argument, which should be
provided if a clear association between events and a particular display
exist. This is used in wskbd(4). Otherwise NULL can be passed and
the code will direct the request at the first wsdisplay(4) that
implements brightness adjustment.

Tested by many. Fixes brightness keys on x395 and other thinkpads with
AMD graphics.

ok patrick@


# 1.34 13-Oct-2019 kettenis

Move ws_get_param/ws_set_param into wsdisplay code.

ok deraadt@, jsg@


Revision tags: OPENBSD_6_6_BASE
# 1.33 01-Jul-2019 kn

Use timeout_add_msec(9)

Trivial conversion from ticks to milliseconds where macros already come in
milliseconds and timeout values only need reduction by hz to use the new API.

OK mpi


# 1.32 04-May-2019 kettenis

Improve the interaction between efifb(4), inteldrm(4) and radeondrm(4)
when we have a serial console by introducing the notion of a "primary"
graphics device. The primary graphics device is the one set up and
used by firmware (BIOS, UEFI).

The goal is to make sure that wsdisplay0 and drm0 reliably attach to
the primary graphics device such that X works out of the box even
if you have multiple cards or if you are using a serial console.

This also fixes the situation where inteldrm(4) or radeondrm(4) would
take over the console on UEFI systems even if the kernel was booted
with a serial console.

ok jsg@


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.31 19-Jul-2017 kettenis

Add a enter_ddb() "accessop" to wsdisplay(4) to allow KMS drivers to bypass
the modeset lock when entering ddb. This avoids triggering various asserts
when the kernel panics while running X.

ok deraadt@


Revision tags: OPENBSD_6_1_BASE
# 1.30 04-Sep-2016 tedu

remove some more sparc remnants. ok deraadt


Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.29 04-Nov-2013 miod

Better defaults for the screen burner settings: all unblank actions enabled,
but burning still disabled by default. Setting display.screen_off to a nonzero
value with wsconsctl will be enough to enable screen blanking after the
given time.


# 1.28 20-Oct-2013 miod

No longer store fonts added with the WSDISPLAYIO_LDFONT ioctl into the
wsdisplay softc. Instead, since the knowledge about available fonts lies in
the parent driver itself, introduce a list_font wsdisplay_accessop which
queries a font index, suitable to use within the WSDISPLAYIO_LSFONT ioctl.

With this in place:
- there is no global wsdisplay limit on the number of fonts loaded. Such a
limit will be enforced by the display drivers themselves.
- built-in kernel fonts will now appear in the list of fonts.

Grow a list_font accesop for rasops, which relies upon wsfont_enum(), which
is turned into something useful (and abortable if you do not need to iterate
further). Not used by any rasops driver yet.


# 1.27 20-Aug-2013 kettenis

Define WS_DEFAULT_FG and WS_DEFAULT_BG as default colors (black on white for
sparc/sparc64, white on black for everybody else), and use them to construct
a default color attribute in the rasops(4) code.

ok miod@


Revision tags: OPENBSD_5_4_BASE
# 1.26 06-Jul-2013 kettenis

s/wsemuldisplaysubmatch/wsemuldisplaydevsubmatch/g


# 1.25 05-Jul-2013 kettenis

Add submatch function for use with config_found_sm(9).

ok miod@


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE
# 1.24 30-Mar-2010 oga

Prevent the apmd/x races for good.

When we hit suspend time, go through all wsdisplays on the system. if
they are in mode MAPPED, but not MODE_DUMBFB then if possible do a full
vt switch to a !mapped vt, and prevent switching back until resume time.
This has to be called from MD code because this involves userland
running so that X can run the vt switch signal handler. This way, any
case where we are using the "poke registers from userland" model, we
will not be on the hardware when we go down, so the kernel can actually
handle thing properly.

Tested on several acpi laptops (by kettenis@ and ian@), x40 (me and
beck@ at LEAST) and zaurus (me). Maybe others, but if so I forgot who at
this time..

Idea from deraadt somewhere over the Faroe Islands (I thought of a
similar thing myself a while ago). Much prompting from him. Ok and
comments miod@


Revision tags: OPENBSD_4_7_BASE
# 1.23 05-Sep-2009 miod

Change the wsdisplay_emulops return types from void to int; emulops will now
return zero on success and nonzero on failure.
This commit only performs mechanical changes for the existing emulops to
always return zero.


Revision tags: OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.22 02-Dec-2006 miod

Fix ri_devcmap[] to allow WSCOL_BLACK and WSCOL_WHITE to not have to be
different for sparc{,64} systems.


# 1.21 29-Nov-2006 miod

Change the getchar wsdisplay_accessops function to not return a
display-dependent value, but instead fill a structure with the chaarcter
and a valid attribute, suitable for use with unpack_attr.

Adapt the wsmoused code to these changes, and remove all knowledge of
the text-mode style pc video attributes in it.

This will eventually allow wsmoused to be used on non-pcdisplay devices.


# 1.20 29-Nov-2006 miod

Add an unpack_attr function to struct wsdisplay_emulops, to match the
existing alloc_attr function. This allows rasops_unpack_attr to be kept
private to rasops, yet available to the screen drivers.


# 1.19 29-Nov-2006 miod

Add a new member to struct wsemuldisplaydev_attach_args, for a frame buffer
driver to be able to tell how many wscons screens to attach to it,
instead of WSDISPLAY_DEFAULTSCREENS which is a global setting.


Revision tags: OPENBSD_4_0_BASE
# 1.18 30-Jun-2006 miod

For 32bit sun frame buffers, tweak ri_devcmap to get the BoW palette instead
of needing different WSCOL_{BLACK,WHITE} values than 8bit frame buffers.

This allows us to not special case the alloc_attr() invocations depending
on the color depth, and to make WSCOL_{BLACK,WHITE} constants again in the
wsemul_sun land.


# 1.17 29-Jun-2006 miod

No need to keep specific variables for the kernel messages colors on sun
emulation, we can reuse the existing WSCOL_xxx codes, and WSCOL_BLACK and
WSCOL_WHITE will point to variables anyway.


Revision tags: OPENBSD_3_9_BASE
# 1.16 27-Sep-2005 miod

More non-emulating wsdisplay tentacles removal.


Revision tags: OPENBSD_3_8_BASE
# 1.15 15-May-2005 miod

Partial sync to the NetBSD wscons code, bringing a better wsmux behaviour
and bugfixes (the kqueue code, /dev/wsmuxctl and screen border color changes
have not been picked), keeping local changes.

Tested by many on alpha/cats/hp300/i386/macppc/sparc/sparc64/zaurus if not more.


Revision tags: OPENBSD_3_2_BASE OPENBSD_3_3_BASE OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE SMP_SYNC_A SMP_SYNC_B UBC_SYNC_A UBC_SYNC_B
# 1.14 25-Jul-2002 miod

Rework the color usage in wsemul_sun displays, to match SunOS and Solaris
text mode colors.
This means black text on white background, even for the kernel messages.

Initially based on a patch from jason@, then some tinkering by me.


Revision tags: OPENBSD_3_1_BASE
# 1.13 27-Mar-2002 jbm

Add X-Window support to wsmoused(8). This allows running wsmoused(8) and
X-Window at the same time, removing the need to kill wsmoused(8) before
starting X-Window.


# 1.12 14-Mar-2002 millert

Final __P removal plus some cosmetic fixups


# 1.11 14-Mar-2002 millert

First round of __P removal in sys


Revision tags: OPENBSD_3_0_BASE UBC_BASE
# 1.10 08-May-2001 mickey

branches: 1.10.2; 1.10.6;
inplement screen burner in screenblank(1) style (no program though).
disabled by default, also supports vsync blanking, disabled by default.
aaron@ looked at it a while back and i fixed problems he had indicated.


Revision tags: OPENBSD_2_9_BASE
# 1.9 14-Apr-2001 aaron

Kernel support for console mouse functionality which will be controlled by
the wsmoused daemon (replacement for moused which was used with PCVT). Adds
a "getchar" method to the display drivers which returns the value of the
character currently under the cursor (e.g., so it may be inversed). From jbm@.

Still needs a bit of cleanup and improvement, especially X cohabitation
features. The pointer moves to fast as well. These sorts of issues will be
corrected in-tree.


# 1.8 14-Mar-2001 mickey

allow listing and soon deleting fonts; aaron@ ok


# 1.7 10-Feb-2001 mickey

sync w/ netbsd; aaron@ ok


# 1.6 08-Feb-2001 aaron

Cause keypresses to reset the screen in case we are in scrollback (previously
the screen was only restored if a new character was actually displayed on the
screen); jcs@rt.fm. This brings us closer to the behavior of PCVT. Also, while
I'm here, add some #ifdef so wskbd does not depend on wsdisplay (pointed out
to me by fgsch@).


# 1.5 31-Jan-2001 aaron

OpenBSD does have paddr_t, I can't explain why I thought it didn't; art@


# 1.4 31-Jan-2001 aaron

Some int -> u_long (I incorrectly converted paddr_t to int when porting this).


# 1.3 15-Nov-2000 aaron

Support console scrollback in wscons through a new "scrollback" accessop that
hooks into the lower-level display driver. The updated vga(4) driver I'm about
to commit has support for this. This is a fairly unobtrusive way to implement
scrollback while maintaining the abstraction of the wscons system.


Revision tags: OPENBSD_2_8_BASE
# 1.2 01-Aug-2000 mickey

update wscons, nothing serious, mostly api fixes for us; from netbsd through aaron@


# 1.1 16-May-2000 mickey

import newer wscons source from netbsd.
art@ said it will make his life easier in alpha
rhands@ said it is not used in powerpc for now
bjc@ said that it would make vax port easier
mickey@ said other platforms can use it, and it's faster


# 1.37 25-May-2020 jsg

change wsdisplay attribute type from long to uint32_t

miod explained it was initially a long as it was thought drivers may
need to allocate storage but in practice they don't need more than
32 bits for an attribute.

suggested and reviewed by miod@


# 1.36 25-May-2020 jsg

rename wsdisplay alloc_attr() to pack_attr()

Suggested by John Carmack. miod agrees a rename would make sense and
explained it was initially thought drivers may need to allocate storage
but in practice they don't need more than 32 bits for an attribute.

ok mpi@


Revision tags: OPENBSD_6_7_BASE
# 1.35 19-Apr-2020 kettenis

Move logic to change brightness level in reasonable steps from acpivout(4)
into wsdisplay(4). This code is now exposed through
wsdisplay_brightness_{step,zero,cycle} functions that can be called by
any driver that handles brightnes "hotkeys". These functions take
a wsdisplay(4) device pointer as their first argument, which should be
provided if a clear association between events and a particular display
exist. This is used in wskbd(4). Otherwise NULL can be passed and
the code will direct the request at the first wsdisplay(4) that
implements brightness adjustment.

Tested by many. Fixes brightness keys on x395 and other thinkpads with
AMD graphics.

ok patrick@


# 1.34 13-Oct-2019 kettenis

Move ws_get_param/ws_set_param into wsdisplay code.

ok deraadt@, jsg@


Revision tags: OPENBSD_6_6_BASE
# 1.33 01-Jul-2019 kn

Use timeout_add_msec(9)

Trivial conversion from ticks to milliseconds where macros already come in
milliseconds and timeout values only need reduction by hz to use the new API.

OK mpi


# 1.32 04-May-2019 kettenis

Improve the interaction between efifb(4), inteldrm(4) and radeondrm(4)
when we have a serial console by introducing the notion of a "primary"
graphics device. The primary graphics device is the one set up and
used by firmware (BIOS, UEFI).

The goal is to make sure that wsdisplay0 and drm0 reliably attach to
the primary graphics device such that X works out of the box even
if you have multiple cards or if you are using a serial console.

This also fixes the situation where inteldrm(4) or radeondrm(4) would
take over the console on UEFI systems even if the kernel was booted
with a serial console.

ok jsg@


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.31 19-Jul-2017 kettenis

Add a enter_ddb() "accessop" to wsdisplay(4) to allow KMS drivers to bypass
the modeset lock when entering ddb. This avoids triggering various asserts
when the kernel panics while running X.

ok deraadt@


Revision tags: OPENBSD_6_1_BASE
# 1.30 04-Sep-2016 tedu

remove some more sparc remnants. ok deraadt


Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.29 04-Nov-2013 miod

Better defaults for the screen burner settings: all unblank actions enabled,
but burning still disabled by default. Setting display.screen_off to a nonzero
value with wsconsctl will be enough to enable screen blanking after the
given time.


# 1.28 20-Oct-2013 miod

No longer store fonts added with the WSDISPLAYIO_LDFONT ioctl into the
wsdisplay softc. Instead, since the knowledge about available fonts lies in
the parent driver itself, introduce a list_font wsdisplay_accessop which
queries a font index, suitable to use within the WSDISPLAYIO_LSFONT ioctl.

With this in place:
- there is no global wsdisplay limit on the number of fonts loaded. Such a
limit will be enforced by the display drivers themselves.
- built-in kernel fonts will now appear in the list of fonts.

Grow a list_font accesop for rasops, which relies upon wsfont_enum(), which
is turned into something useful (and abortable if you do not need to iterate
further). Not used by any rasops driver yet.


# 1.27 20-Aug-2013 kettenis

Define WS_DEFAULT_FG and WS_DEFAULT_BG as default colors (black on white for
sparc/sparc64, white on black for everybody else), and use them to construct
a default color attribute in the rasops(4) code.

ok miod@


Revision tags: OPENBSD_5_4_BASE
# 1.26 06-Jul-2013 kettenis

s/wsemuldisplaysubmatch/wsemuldisplaydevsubmatch/g


# 1.25 05-Jul-2013 kettenis

Add submatch function for use with config_found_sm(9).

ok miod@


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE
# 1.24 30-Mar-2010 oga

Prevent the apmd/x races for good.

When we hit suspend time, go through all wsdisplays on the system. if
they are in mode MAPPED, but not MODE_DUMBFB then if possible do a full
vt switch to a !mapped vt, and prevent switching back until resume time.
This has to be called from MD code because this involves userland
running so that X can run the vt switch signal handler. This way, any
case where we are using the "poke registers from userland" model, we
will not be on the hardware when we go down, so the kernel can actually
handle thing properly.

Tested on several acpi laptops (by kettenis@ and ian@), x40 (me and
beck@ at LEAST) and zaurus (me). Maybe others, but if so I forgot who at
this time..

Idea from deraadt somewhere over the Faroe Islands (I thought of a
similar thing myself a while ago). Much prompting from him. Ok and
comments miod@


Revision tags: OPENBSD_4_7_BASE
# 1.23 05-Sep-2009 miod

Change the wsdisplay_emulops return types from void to int; emulops will now
return zero on success and nonzero on failure.
This commit only performs mechanical changes for the existing emulops to
always return zero.


Revision tags: OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.22 02-Dec-2006 miod

Fix ri_devcmap[] to allow WSCOL_BLACK and WSCOL_WHITE to not have to be
different for sparc{,64} systems.


# 1.21 29-Nov-2006 miod

Change the getchar wsdisplay_accessops function to not return a
display-dependent value, but instead fill a structure with the chaarcter
and a valid attribute, suitable for use with unpack_attr.

Adapt the wsmoused code to these changes, and remove all knowledge of
the text-mode style pc video attributes in it.

This will eventually allow wsmoused to be used on non-pcdisplay devices.


# 1.20 29-Nov-2006 miod

Add an unpack_attr function to struct wsdisplay_emulops, to match the
existing alloc_attr function. This allows rasops_unpack_attr to be kept
private to rasops, yet available to the screen drivers.


# 1.19 29-Nov-2006 miod

Add a new member to struct wsemuldisplaydev_attach_args, for a frame buffer
driver to be able to tell how many wscons screens to attach to it,
instead of WSDISPLAY_DEFAULTSCREENS which is a global setting.


Revision tags: OPENBSD_4_0_BASE
# 1.18 30-Jun-2006 miod

For 32bit sun frame buffers, tweak ri_devcmap to get the BoW palette instead
of needing different WSCOL_{BLACK,WHITE} values than 8bit frame buffers.

This allows us to not special case the alloc_attr() invocations depending
on the color depth, and to make WSCOL_{BLACK,WHITE} constants again in the
wsemul_sun land.


# 1.17 29-Jun-2006 miod

No need to keep specific variables for the kernel messages colors on sun
emulation, we can reuse the existing WSCOL_xxx codes, and WSCOL_BLACK and
WSCOL_WHITE will point to variables anyway.


Revision tags: OPENBSD_3_9_BASE
# 1.16 27-Sep-2005 miod

More non-emulating wsdisplay tentacles removal.


Revision tags: OPENBSD_3_8_BASE
# 1.15 15-May-2005 miod

Partial sync to the NetBSD wscons code, bringing a better wsmux behaviour
and bugfixes (the kqueue code, /dev/wsmuxctl and screen border color changes
have not been picked), keeping local changes.

Tested by many on alpha/cats/hp300/i386/macppc/sparc/sparc64/zaurus if not more.


Revision tags: OPENBSD_3_2_BASE OPENBSD_3_3_BASE OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE SMP_SYNC_A SMP_SYNC_B UBC_SYNC_A UBC_SYNC_B
# 1.14 25-Jul-2002 miod

Rework the color usage in wsemul_sun displays, to match SunOS and Solaris
text mode colors.
This means black text on white background, even for the kernel messages.

Initially based on a patch from jason@, then some tinkering by me.


Revision tags: OPENBSD_3_1_BASE
# 1.13 27-Mar-2002 jbm

Add X-Window support to wsmoused(8). This allows running wsmoused(8) and
X-Window at the same time, removing the need to kill wsmoused(8) before
starting X-Window.


# 1.12 14-Mar-2002 millert

Final __P removal plus some cosmetic fixups


# 1.11 14-Mar-2002 millert

First round of __P removal in sys


Revision tags: OPENBSD_3_0_BASE UBC_BASE
# 1.10 08-May-2001 mickey

branches: 1.10.2; 1.10.6;
inplement screen burner in screenblank(1) style (no program though).
disabled by default, also supports vsync blanking, disabled by default.
aaron@ looked at it a while back and i fixed problems he had indicated.


Revision tags: OPENBSD_2_9_BASE
# 1.9 14-Apr-2001 aaron

Kernel support for console mouse functionality which will be controlled by
the wsmoused daemon (replacement for moused which was used with PCVT). Adds
a "getchar" method to the display drivers which returns the value of the
character currently under the cursor (e.g., so it may be inversed). From jbm@.

Still needs a bit of cleanup and improvement, especially X cohabitation
features. The pointer moves to fast as well. These sorts of issues will be
corrected in-tree.


# 1.8 14-Mar-2001 mickey

allow listing and soon deleting fonts; aaron@ ok


# 1.7 10-Feb-2001 mickey

sync w/ netbsd; aaron@ ok


# 1.6 08-Feb-2001 aaron

Cause keypresses to reset the screen in case we are in scrollback (previously
the screen was only restored if a new character was actually displayed on the
screen); jcs@rt.fm. This brings us closer to the behavior of PCVT. Also, while
I'm here, add some #ifdef so wskbd does not depend on wsdisplay (pointed out
to me by fgsch@).


# 1.5 31-Jan-2001 aaron

OpenBSD does have paddr_t, I can't explain why I thought it didn't; art@


# 1.4 31-Jan-2001 aaron

Some int -> u_long (I incorrectly converted paddr_t to int when porting this).


# 1.3 15-Nov-2000 aaron

Support console scrollback in wscons through a new "scrollback" accessop that
hooks into the lower-level display driver. The updated vga(4) driver I'm about
to commit has support for this. This is a fairly unobtrusive way to implement
scrollback while maintaining the abstraction of the wscons system.


Revision tags: OPENBSD_2_8_BASE
# 1.2 01-Aug-2000 mickey

update wscons, nothing serious, mostly api fixes for us; from netbsd through aaron@


# 1.1 16-May-2000 mickey

import newer wscons source from netbsd.
art@ said it will make his life easier in alpha
rhands@ said it is not used in powerpc for now
bjc@ said that it would make vax port easier
mickey@ said other platforms can use it, and it's faster


# 1.35 19-Apr-2020 kettenis

Move logic to change brightness level in reasonable steps from acpivout(4)
into wsdisplay(4). This code is now exposed through
wsdisplay_brightness_{step,zero,cycle} functions that can be called by
any driver that handles brightnes "hotkeys". These functions take
a wsdisplay(4) device pointer as their first argument, which should be
provided if a clear association between events and a particular display
exist. This is used in wskbd(4). Otherwise NULL can be passed and
the code will direct the request at the first wsdisplay(4) that
implements brightness adjustment.

Tested by many. Fixes brightness keys on x395 and other thinkpads with
AMD graphics.

ok patrick@


# 1.34 13-Oct-2019 kettenis

Move ws_get_param/ws_set_param into wsdisplay code.

ok deraadt@, jsg@


Revision tags: OPENBSD_6_6_BASE
# 1.33 01-Jul-2019 kn

Use timeout_add_msec(9)

Trivial conversion from ticks to milliseconds where macros already come in
milliseconds and timeout values only need reduction by hz to use the new API.

OK mpi


# 1.32 04-May-2019 kettenis

Improve the interaction between efifb(4), inteldrm(4) and radeondrm(4)
when we have a serial console by introducing the notion of a "primary"
graphics device. The primary graphics device is the one set up and
used by firmware (BIOS, UEFI).

The goal is to make sure that wsdisplay0 and drm0 reliably attach to
the primary graphics device such that X works out of the box even
if you have multiple cards or if you are using a serial console.

This also fixes the situation where inteldrm(4) or radeondrm(4) would
take over the console on UEFI systems even if the kernel was booted
with a serial console.

ok jsg@


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.31 19-Jul-2017 kettenis

Add a enter_ddb() "accessop" to wsdisplay(4) to allow KMS drivers to bypass
the modeset lock when entering ddb. This avoids triggering various asserts
when the kernel panics while running X.

ok deraadt@


Revision tags: OPENBSD_6_1_BASE
# 1.30 04-Sep-2016 tedu

remove some more sparc remnants. ok deraadt


Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.29 04-Nov-2013 miod

Better defaults for the screen burner settings: all unblank actions enabled,
but burning still disabled by default. Setting display.screen_off to a nonzero
value with wsconsctl will be enough to enable screen blanking after the
given time.


# 1.28 20-Oct-2013 miod

No longer store fonts added with the WSDISPLAYIO_LDFONT ioctl into the
wsdisplay softc. Instead, since the knowledge about available fonts lies in
the parent driver itself, introduce a list_font wsdisplay_accessop which
queries a font index, suitable to use within the WSDISPLAYIO_LSFONT ioctl.

With this in place:
- there is no global wsdisplay limit on the number of fonts loaded. Such a
limit will be enforced by the display drivers themselves.
- built-in kernel fonts will now appear in the list of fonts.

Grow a list_font accesop for rasops, which relies upon wsfont_enum(), which
is turned into something useful (and abortable if you do not need to iterate
further). Not used by any rasops driver yet.


# 1.27 20-Aug-2013 kettenis

Define WS_DEFAULT_FG and WS_DEFAULT_BG as default colors (black on white for
sparc/sparc64, white on black for everybody else), and use them to construct
a default color attribute in the rasops(4) code.

ok miod@


Revision tags: OPENBSD_5_4_BASE
# 1.26 06-Jul-2013 kettenis

s/wsemuldisplaysubmatch/wsemuldisplaydevsubmatch/g


# 1.25 05-Jul-2013 kettenis

Add submatch function for use with config_found_sm(9).

ok miod@


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE
# 1.24 30-Mar-2010 oga

Prevent the apmd/x races for good.

When we hit suspend time, go through all wsdisplays on the system. if
they are in mode MAPPED, but not MODE_DUMBFB then if possible do a full
vt switch to a !mapped vt, and prevent switching back until resume time.
This has to be called from MD code because this involves userland
running so that X can run the vt switch signal handler. This way, any
case where we are using the "poke registers from userland" model, we
will not be on the hardware when we go down, so the kernel can actually
handle thing properly.

Tested on several acpi laptops (by kettenis@ and ian@), x40 (me and
beck@ at LEAST) and zaurus (me). Maybe others, but if so I forgot who at
this time..

Idea from deraadt somewhere over the Faroe Islands (I thought of a
similar thing myself a while ago). Much prompting from him. Ok and
comments miod@


Revision tags: OPENBSD_4_7_BASE
# 1.23 05-Sep-2009 miod

Change the wsdisplay_emulops return types from void to int; emulops will now
return zero on success and nonzero on failure.
This commit only performs mechanical changes for the existing emulops to
always return zero.


Revision tags: OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.22 02-Dec-2006 miod

Fix ri_devcmap[] to allow WSCOL_BLACK and WSCOL_WHITE to not have to be
different for sparc{,64} systems.


# 1.21 29-Nov-2006 miod

Change the getchar wsdisplay_accessops function to not return a
display-dependent value, but instead fill a structure with the chaarcter
and a valid attribute, suitable for use with unpack_attr.

Adapt the wsmoused code to these changes, and remove all knowledge of
the text-mode style pc video attributes in it.

This will eventually allow wsmoused to be used on non-pcdisplay devices.


# 1.20 29-Nov-2006 miod

Add an unpack_attr function to struct wsdisplay_emulops, to match the
existing alloc_attr function. This allows rasops_unpack_attr to be kept
private to rasops, yet available to the screen drivers.


# 1.19 29-Nov-2006 miod

Add a new member to struct wsemuldisplaydev_attach_args, for a frame buffer
driver to be able to tell how many wscons screens to attach to it,
instead of WSDISPLAY_DEFAULTSCREENS which is a global setting.


Revision tags: OPENBSD_4_0_BASE
# 1.18 30-Jun-2006 miod

For 32bit sun frame buffers, tweak ri_devcmap to get the BoW palette instead
of needing different WSCOL_{BLACK,WHITE} values than 8bit frame buffers.

This allows us to not special case the alloc_attr() invocations depending
on the color depth, and to make WSCOL_{BLACK,WHITE} constants again in the
wsemul_sun land.


# 1.17 29-Jun-2006 miod

No need to keep specific variables for the kernel messages colors on sun
emulation, we can reuse the existing WSCOL_xxx codes, and WSCOL_BLACK and
WSCOL_WHITE will point to variables anyway.


Revision tags: OPENBSD_3_9_BASE
# 1.16 27-Sep-2005 miod

More non-emulating wsdisplay tentacles removal.


Revision tags: OPENBSD_3_8_BASE
# 1.15 15-May-2005 miod

Partial sync to the NetBSD wscons code, bringing a better wsmux behaviour
and bugfixes (the kqueue code, /dev/wsmuxctl and screen border color changes
have not been picked), keeping local changes.

Tested by many on alpha/cats/hp300/i386/macppc/sparc/sparc64/zaurus if not more.


Revision tags: OPENBSD_3_2_BASE OPENBSD_3_3_BASE OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE SMP_SYNC_A SMP_SYNC_B UBC_SYNC_A UBC_SYNC_B
# 1.14 25-Jul-2002 miod

Rework the color usage in wsemul_sun displays, to match SunOS and Solaris
text mode colors.
This means black text on white background, even for the kernel messages.

Initially based on a patch from jason@, then some tinkering by me.


Revision tags: OPENBSD_3_1_BASE
# 1.13 27-Mar-2002 jbm

Add X-Window support to wsmoused(8). This allows running wsmoused(8) and
X-Window at the same time, removing the need to kill wsmoused(8) before
starting X-Window.


# 1.12 14-Mar-2002 millert

Final __P removal plus some cosmetic fixups


# 1.11 14-Mar-2002 millert

First round of __P removal in sys


Revision tags: OPENBSD_3_0_BASE UBC_BASE
# 1.10 08-May-2001 mickey

branches: 1.10.2; 1.10.6;
inplement screen burner in screenblank(1) style (no program though).
disabled by default, also supports vsync blanking, disabled by default.
aaron@ looked at it a while back and i fixed problems he had indicated.


Revision tags: OPENBSD_2_9_BASE
# 1.9 14-Apr-2001 aaron

Kernel support for console mouse functionality which will be controlled by
the wsmoused daemon (replacement for moused which was used with PCVT). Adds
a "getchar" method to the display drivers which returns the value of the
character currently under the cursor (e.g., so it may be inversed). From jbm@.

Still needs a bit of cleanup and improvement, especially X cohabitation
features. The pointer moves to fast as well. These sorts of issues will be
corrected in-tree.


# 1.8 14-Mar-2001 mickey

allow listing and soon deleting fonts; aaron@ ok


# 1.7 10-Feb-2001 mickey

sync w/ netbsd; aaron@ ok


# 1.6 08-Feb-2001 aaron

Cause keypresses to reset the screen in case we are in scrollback (previously
the screen was only restored if a new character was actually displayed on the
screen); jcs@rt.fm. This brings us closer to the behavior of PCVT. Also, while
I'm here, add some #ifdef so wskbd does not depend on wsdisplay (pointed out
to me by fgsch@).


# 1.5 31-Jan-2001 aaron

OpenBSD does have paddr_t, I can't explain why I thought it didn't; art@


# 1.4 31-Jan-2001 aaron

Some int -> u_long (I incorrectly converted paddr_t to int when porting this).


# 1.3 15-Nov-2000 aaron

Support console scrollback in wscons through a new "scrollback" accessop that
hooks into the lower-level display driver. The updated vga(4) driver I'm about
to commit has support for this. This is a fairly unobtrusive way to implement
scrollback while maintaining the abstraction of the wscons system.


Revision tags: OPENBSD_2_8_BASE
# 1.2 01-Aug-2000 mickey

update wscons, nothing serious, mostly api fixes for us; from netbsd through aaron@


# 1.1 16-May-2000 mickey

import newer wscons source from netbsd.
art@ said it will make his life easier in alpha
rhands@ said it is not used in powerpc for now
bjc@ said that it would make vax port easier
mickey@ said other platforms can use it, and it's faster


# 1.34 13-Oct-2019 kettenis

Move ws_get_param/ws_set_param into wsdisplay code.

ok deraadt@, jsg@


Revision tags: OPENBSD_6_6_BASE
# 1.33 01-Jul-2019 kn

Use timeout_add_msec(9)

Trivial conversion from ticks to milliseconds where macros already come in
milliseconds and timeout values only need reduction by hz to use the new API.

OK mpi


# 1.32 04-May-2019 kettenis

Improve the interaction between efifb(4), inteldrm(4) and radeondrm(4)
when we have a serial console by introducing the notion of a "primary"
graphics device. The primary graphics device is the one set up and
used by firmware (BIOS, UEFI).

The goal is to make sure that wsdisplay0 and drm0 reliably attach to
the primary graphics device such that X works out of the box even
if you have multiple cards or if you are using a serial console.

This also fixes the situation where inteldrm(4) or radeondrm(4) would
take over the console on UEFI systems even if the kernel was booted
with a serial console.

ok jsg@


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.31 19-Jul-2017 kettenis

Add a enter_ddb() "accessop" to wsdisplay(4) to allow KMS drivers to bypass
the modeset lock when entering ddb. This avoids triggering various asserts
when the kernel panics while running X.

ok deraadt@


Revision tags: OPENBSD_6_1_BASE
# 1.30 04-Sep-2016 tedu

remove some more sparc remnants. ok deraadt


Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.29 04-Nov-2013 miod

Better defaults for the screen burner settings: all unblank actions enabled,
but burning still disabled by default. Setting display.screen_off to a nonzero
value with wsconsctl will be enough to enable screen blanking after the
given time.


# 1.28 20-Oct-2013 miod

No longer store fonts added with the WSDISPLAYIO_LDFONT ioctl into the
wsdisplay softc. Instead, since the knowledge about available fonts lies in
the parent driver itself, introduce a list_font wsdisplay_accessop which
queries a font index, suitable to use within the WSDISPLAYIO_LSFONT ioctl.

With this in place:
- there is no global wsdisplay limit on the number of fonts loaded. Such a
limit will be enforced by the display drivers themselves.
- built-in kernel fonts will now appear in the list of fonts.

Grow a list_font accesop for rasops, which relies upon wsfont_enum(), which
is turned into something useful (and abortable if you do not need to iterate
further). Not used by any rasops driver yet.


# 1.27 20-Aug-2013 kettenis

Define WS_DEFAULT_FG and WS_DEFAULT_BG as default colors (black on white for
sparc/sparc64, white on black for everybody else), and use them to construct
a default color attribute in the rasops(4) code.

ok miod@


Revision tags: OPENBSD_5_4_BASE
# 1.26 06-Jul-2013 kettenis

s/wsemuldisplaysubmatch/wsemuldisplaydevsubmatch/g


# 1.25 05-Jul-2013 kettenis

Add submatch function for use with config_found_sm(9).

ok miod@


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE
# 1.24 30-Mar-2010 oga

Prevent the apmd/x races for good.

When we hit suspend time, go through all wsdisplays on the system. if
they are in mode MAPPED, but not MODE_DUMBFB then if possible do a full
vt switch to a !mapped vt, and prevent switching back until resume time.
This has to be called from MD code because this involves userland
running so that X can run the vt switch signal handler. This way, any
case where we are using the "poke registers from userland" model, we
will not be on the hardware when we go down, so the kernel can actually
handle thing properly.

Tested on several acpi laptops (by kettenis@ and ian@), x40 (me and
beck@ at LEAST) and zaurus (me). Maybe others, but if so I forgot who at
this time..

Idea from deraadt somewhere over the Faroe Islands (I thought of a
similar thing myself a while ago). Much prompting from him. Ok and
comments miod@


Revision tags: OPENBSD_4_7_BASE
# 1.23 05-Sep-2009 miod

Change the wsdisplay_emulops return types from void to int; emulops will now
return zero on success and nonzero on failure.
This commit only performs mechanical changes for the existing emulops to
always return zero.


Revision tags: OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.22 02-Dec-2006 miod

Fix ri_devcmap[] to allow WSCOL_BLACK and WSCOL_WHITE to not have to be
different for sparc{,64} systems.


# 1.21 29-Nov-2006 miod

Change the getchar wsdisplay_accessops function to not return a
display-dependent value, but instead fill a structure with the chaarcter
and a valid attribute, suitable for use with unpack_attr.

Adapt the wsmoused code to these changes, and remove all knowledge of
the text-mode style pc video attributes in it.

This will eventually allow wsmoused to be used on non-pcdisplay devices.


# 1.20 29-Nov-2006 miod

Add an unpack_attr function to struct wsdisplay_emulops, to match the
existing alloc_attr function. This allows rasops_unpack_attr to be kept
private to rasops, yet available to the screen drivers.


# 1.19 29-Nov-2006 miod

Add a new member to struct wsemuldisplaydev_attach_args, for a frame buffer
driver to be able to tell how many wscons screens to attach to it,
instead of WSDISPLAY_DEFAULTSCREENS which is a global setting.


Revision tags: OPENBSD_4_0_BASE
# 1.18 30-Jun-2006 miod

For 32bit sun frame buffers, tweak ri_devcmap to get the BoW palette instead
of needing different WSCOL_{BLACK,WHITE} values than 8bit frame buffers.

This allows us to not special case the alloc_attr() invocations depending
on the color depth, and to make WSCOL_{BLACK,WHITE} constants again in the
wsemul_sun land.


# 1.17 29-Jun-2006 miod

No need to keep specific variables for the kernel messages colors on sun
emulation, we can reuse the existing WSCOL_xxx codes, and WSCOL_BLACK and
WSCOL_WHITE will point to variables anyway.


Revision tags: OPENBSD_3_9_BASE
# 1.16 27-Sep-2005 miod

More non-emulating wsdisplay tentacles removal.


Revision tags: OPENBSD_3_8_BASE
# 1.15 15-May-2005 miod

Partial sync to the NetBSD wscons code, bringing a better wsmux behaviour
and bugfixes (the kqueue code, /dev/wsmuxctl and screen border color changes
have not been picked), keeping local changes.

Tested by many on alpha/cats/hp300/i386/macppc/sparc/sparc64/zaurus if not more.


Revision tags: OPENBSD_3_2_BASE OPENBSD_3_3_BASE OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE SMP_SYNC_A SMP_SYNC_B UBC_SYNC_A UBC_SYNC_B
# 1.14 25-Jul-2002 miod

Rework the color usage in wsemul_sun displays, to match SunOS and Solaris
text mode colors.
This means black text on white background, even for the kernel messages.

Initially based on a patch from jason@, then some tinkering by me.


Revision tags: OPENBSD_3_1_BASE
# 1.13 27-Mar-2002 jbm

Add X-Window support to wsmoused(8). This allows running wsmoused(8) and
X-Window at the same time, removing the need to kill wsmoused(8) before
starting X-Window.


# 1.12 14-Mar-2002 millert

Final __P removal plus some cosmetic fixups


# 1.11 14-Mar-2002 millert

First round of __P removal in sys


Revision tags: OPENBSD_3_0_BASE UBC_BASE
# 1.10 08-May-2001 mickey

branches: 1.10.2; 1.10.6;
inplement screen burner in screenblank(1) style (no program though).
disabled by default, also supports vsync blanking, disabled by default.
aaron@ looked at it a while back and i fixed problems he had indicated.


Revision tags: OPENBSD_2_9_BASE
# 1.9 14-Apr-2001 aaron

Kernel support for console mouse functionality which will be controlled by
the wsmoused daemon (replacement for moused which was used with PCVT). Adds
a "getchar" method to the display drivers which returns the value of the
character currently under the cursor (e.g., so it may be inversed). From jbm@.

Still needs a bit of cleanup and improvement, especially X cohabitation
features. The pointer moves to fast as well. These sorts of issues will be
corrected in-tree.


# 1.8 14-Mar-2001 mickey

allow listing and soon deleting fonts; aaron@ ok


# 1.7 10-Feb-2001 mickey

sync w/ netbsd; aaron@ ok


# 1.6 08-Feb-2001 aaron

Cause keypresses to reset the screen in case we are in scrollback (previously
the screen was only restored if a new character was actually displayed on the
screen); jcs@rt.fm. This brings us closer to the behavior of PCVT. Also, while
I'm here, add some #ifdef so wskbd does not depend on wsdisplay (pointed out
to me by fgsch@).


# 1.5 31-Jan-2001 aaron

OpenBSD does have paddr_t, I can't explain why I thought it didn't; art@


# 1.4 31-Jan-2001 aaron

Some int -> u_long (I incorrectly converted paddr_t to int when porting this).


# 1.3 15-Nov-2000 aaron

Support console scrollback in wscons through a new "scrollback" accessop that
hooks into the lower-level display driver. The updated vga(4) driver I'm about
to commit has support for this. This is a fairly unobtrusive way to implement
scrollback while maintaining the abstraction of the wscons system.


Revision tags: OPENBSD_2_8_BASE
# 1.2 01-Aug-2000 mickey

update wscons, nothing serious, mostly api fixes for us; from netbsd through aaron@


# 1.1 16-May-2000 mickey

import newer wscons source from netbsd.
art@ said it will make his life easier in alpha
rhands@ said it is not used in powerpc for now
bjc@ said that it would make vax port easier
mickey@ said other platforms can use it, and it's faster


# 1.33 01-Jul-2019 kn

Use timeout_add_msec(9)

Trivial conversion from ticks to milliseconds where macros already come in
milliseconds and timeout values only need reduction by hz to use the new API.

OK mpi


# 1.32 04-May-2019 kettenis

Improve the interaction between efifb(4), inteldrm(4) and radeondrm(4)
when we have a serial console by introducing the notion of a "primary"
graphics device. The primary graphics device is the one set up and
used by firmware (BIOS, UEFI).

The goal is to make sure that wsdisplay0 and drm0 reliably attach to
the primary graphics device such that X works out of the box even
if you have multiple cards or if you are using a serial console.

This also fixes the situation where inteldrm(4) or radeondrm(4) would
take over the console on UEFI systems even if the kernel was booted
with a serial console.

ok jsg@


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.31 19-Jul-2017 kettenis

Add a enter_ddb() "accessop" to wsdisplay(4) to allow KMS drivers to bypass
the modeset lock when entering ddb. This avoids triggering various asserts
when the kernel panics while running X.

ok deraadt@


Revision tags: OPENBSD_6_1_BASE
# 1.30 04-Sep-2016 tedu

remove some more sparc remnants. ok deraadt


Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.29 04-Nov-2013 miod

Better defaults for the screen burner settings: all unblank actions enabled,
but burning still disabled by default. Setting display.screen_off to a nonzero
value with wsconsctl will be enough to enable screen blanking after the
given time.


# 1.28 20-Oct-2013 miod

No longer store fonts added with the WSDISPLAYIO_LDFONT ioctl into the
wsdisplay softc. Instead, since the knowledge about available fonts lies in
the parent driver itself, introduce a list_font wsdisplay_accessop which
queries a font index, suitable to use within the WSDISPLAYIO_LSFONT ioctl.

With this in place:
- there is no global wsdisplay limit on the number of fonts loaded. Such a
limit will be enforced by the display drivers themselves.
- built-in kernel fonts will now appear in the list of fonts.

Grow a list_font accesop for rasops, which relies upon wsfont_enum(), which
is turned into something useful (and abortable if you do not need to iterate
further). Not used by any rasops driver yet.


# 1.27 20-Aug-2013 kettenis

Define WS_DEFAULT_FG and WS_DEFAULT_BG as default colors (black on white for
sparc/sparc64, white on black for everybody else), and use them to construct
a default color attribute in the rasops(4) code.

ok miod@


Revision tags: OPENBSD_5_4_BASE
# 1.26 06-Jul-2013 kettenis

s/wsemuldisplaysubmatch/wsemuldisplaydevsubmatch/g


# 1.25 05-Jul-2013 kettenis

Add submatch function for use with config_found_sm(9).

ok miod@


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE
# 1.24 30-Mar-2010 oga

Prevent the apmd/x races for good.

When we hit suspend time, go through all wsdisplays on the system. if
they are in mode MAPPED, but not MODE_DUMBFB then if possible do a full
vt switch to a !mapped vt, and prevent switching back until resume time.
This has to be called from MD code because this involves userland
running so that X can run the vt switch signal handler. This way, any
case where we are using the "poke registers from userland" model, we
will not be on the hardware when we go down, so the kernel can actually
handle thing properly.

Tested on several acpi laptops (by kettenis@ and ian@), x40 (me and
beck@ at LEAST) and zaurus (me). Maybe others, but if so I forgot who at
this time..

Idea from deraadt somewhere over the Faroe Islands (I thought of a
similar thing myself a while ago). Much prompting from him. Ok and
comments miod@


Revision tags: OPENBSD_4_7_BASE
# 1.23 05-Sep-2009 miod

Change the wsdisplay_emulops return types from void to int; emulops will now
return zero on success and nonzero on failure.
This commit only performs mechanical changes for the existing emulops to
always return zero.


Revision tags: OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.22 02-Dec-2006 miod

Fix ri_devcmap[] to allow WSCOL_BLACK and WSCOL_WHITE to not have to be
different for sparc{,64} systems.


# 1.21 29-Nov-2006 miod

Change the getchar wsdisplay_accessops function to not return a
display-dependent value, but instead fill a structure with the chaarcter
and a valid attribute, suitable for use with unpack_attr.

Adapt the wsmoused code to these changes, and remove all knowledge of
the text-mode style pc video attributes in it.

This will eventually allow wsmoused to be used on non-pcdisplay devices.


# 1.20 29-Nov-2006 miod

Add an unpack_attr function to struct wsdisplay_emulops, to match the
existing alloc_attr function. This allows rasops_unpack_attr to be kept
private to rasops, yet available to the screen drivers.


# 1.19 29-Nov-2006 miod

Add a new member to struct wsemuldisplaydev_attach_args, for a frame buffer
driver to be able to tell how many wscons screens to attach to it,
instead of WSDISPLAY_DEFAULTSCREENS which is a global setting.


Revision tags: OPENBSD_4_0_BASE
# 1.18 30-Jun-2006 miod

For 32bit sun frame buffers, tweak ri_devcmap to get the BoW palette instead
of needing different WSCOL_{BLACK,WHITE} values than 8bit frame buffers.

This allows us to not special case the alloc_attr() invocations depending
on the color depth, and to make WSCOL_{BLACK,WHITE} constants again in the
wsemul_sun land.


# 1.17 29-Jun-2006 miod

No need to keep specific variables for the kernel messages colors on sun
emulation, we can reuse the existing WSCOL_xxx codes, and WSCOL_BLACK and
WSCOL_WHITE will point to variables anyway.


Revision tags: OPENBSD_3_9_BASE
# 1.16 27-Sep-2005 miod

More non-emulating wsdisplay tentacles removal.


Revision tags: OPENBSD_3_8_BASE
# 1.15 15-May-2005 miod

Partial sync to the NetBSD wscons code, bringing a better wsmux behaviour
and bugfixes (the kqueue code, /dev/wsmuxctl and screen border color changes
have not been picked), keeping local changes.

Tested by many on alpha/cats/hp300/i386/macppc/sparc/sparc64/zaurus if not more.


Revision tags: OPENBSD_3_2_BASE OPENBSD_3_3_BASE OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE SMP_SYNC_A SMP_SYNC_B UBC_SYNC_A UBC_SYNC_B
# 1.14 25-Jul-2002 miod

Rework the color usage in wsemul_sun displays, to match SunOS and Solaris
text mode colors.
This means black text on white background, even for the kernel messages.

Initially based on a patch from jason@, then some tinkering by me.


Revision tags: OPENBSD_3_1_BASE
# 1.13 27-Mar-2002 jbm

Add X-Window support to wsmoused(8). This allows running wsmoused(8) and
X-Window at the same time, removing the need to kill wsmoused(8) before
starting X-Window.


# 1.12 14-Mar-2002 millert

Final __P removal plus some cosmetic fixups


# 1.11 14-Mar-2002 millert

First round of __P removal in sys


Revision tags: OPENBSD_3_0_BASE UBC_BASE
# 1.10 08-May-2001 mickey

branches: 1.10.2; 1.10.6;
inplement screen burner in screenblank(1) style (no program though).
disabled by default, also supports vsync blanking, disabled by default.
aaron@ looked at it a while back and i fixed problems he had indicated.


Revision tags: OPENBSD_2_9_BASE
# 1.9 14-Apr-2001 aaron

Kernel support for console mouse functionality which will be controlled by
the wsmoused daemon (replacement for moused which was used with PCVT). Adds
a "getchar" method to the display drivers which returns the value of the
character currently under the cursor (e.g., so it may be inversed). From jbm@.

Still needs a bit of cleanup and improvement, especially X cohabitation
features. The pointer moves to fast as well. These sorts of issues will be
corrected in-tree.


# 1.8 14-Mar-2001 mickey

allow listing and soon deleting fonts; aaron@ ok


# 1.7 10-Feb-2001 mickey

sync w/ netbsd; aaron@ ok


# 1.6 08-Feb-2001 aaron

Cause keypresses to reset the screen in case we are in scrollback (previously
the screen was only restored if a new character was actually displayed on the
screen); jcs@rt.fm. This brings us closer to the behavior of PCVT. Also, while
I'm here, add some #ifdef so wskbd does not depend on wsdisplay (pointed out
to me by fgsch@).


# 1.5 31-Jan-2001 aaron

OpenBSD does have paddr_t, I can't explain why I thought it didn't; art@


# 1.4 31-Jan-2001 aaron

Some int -> u_long (I incorrectly converted paddr_t to int when porting this).


# 1.3 15-Nov-2000 aaron

Support console scrollback in wscons through a new "scrollback" accessop that
hooks into the lower-level display driver. The updated vga(4) driver I'm about
to commit has support for this. This is a fairly unobtrusive way to implement
scrollback while maintaining the abstraction of the wscons system.


Revision tags: OPENBSD_2_8_BASE
# 1.2 01-Aug-2000 mickey

update wscons, nothing serious, mostly api fixes for us; from netbsd through aaron@


# 1.1 16-May-2000 mickey

import newer wscons source from netbsd.
art@ said it will make his life easier in alpha
rhands@ said it is not used in powerpc for now
bjc@ said that it would make vax port easier
mickey@ said other platforms can use it, and it's faster


# 1.32 04-May-2019 kettenis

Improve the interaction between efifb(4), inteldrm(4) and radeondrm(4)
when we have a serial console by introducing the notion of a "primary"
graphics device. The primary graphics device is the one set up and
used by firmware (BIOS, UEFI).

The goal is to make sure that wsdisplay0 and drm0 reliably attach to
the primary graphics device such that X works out of the box even
if you have multiple cards or if you are using a serial console.

This also fixes the situation where inteldrm(4) or radeondrm(4) would
take over the console on UEFI systems even if the kernel was booted
with a serial console.

ok jsg@


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.31 19-Jul-2017 kettenis

Add a enter_ddb() "accessop" to wsdisplay(4) to allow KMS drivers to bypass
the modeset lock when entering ddb. This avoids triggering various asserts
when the kernel panics while running X.

ok deraadt@


Revision tags: OPENBSD_6_1_BASE
# 1.30 04-Sep-2016 tedu

remove some more sparc remnants. ok deraadt


Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.29 04-Nov-2013 miod

Better defaults for the screen burner settings: all unblank actions enabled,
but burning still disabled by default. Setting display.screen_off to a nonzero
value with wsconsctl will be enough to enable screen blanking after the
given time.


# 1.28 20-Oct-2013 miod

No longer store fonts added with the WSDISPLAYIO_LDFONT ioctl into the
wsdisplay softc. Instead, since the knowledge about available fonts lies in
the parent driver itself, introduce a list_font wsdisplay_accessop which
queries a font index, suitable to use within the WSDISPLAYIO_LSFONT ioctl.

With this in place:
- there is no global wsdisplay limit on the number of fonts loaded. Such a
limit will be enforced by the display drivers themselves.
- built-in kernel fonts will now appear in the list of fonts.

Grow a list_font accesop for rasops, which relies upon wsfont_enum(), which
is turned into something useful (and abortable if you do not need to iterate
further). Not used by any rasops driver yet.


# 1.27 20-Aug-2013 kettenis

Define WS_DEFAULT_FG and WS_DEFAULT_BG as default colors (black on white for
sparc/sparc64, white on black for everybody else), and use them to construct
a default color attribute in the rasops(4) code.

ok miod@


Revision tags: OPENBSD_5_4_BASE
# 1.26 06-Jul-2013 kettenis

s/wsemuldisplaysubmatch/wsemuldisplaydevsubmatch/g


# 1.25 05-Jul-2013 kettenis

Add submatch function for use with config_found_sm(9).

ok miod@


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE
# 1.24 30-Mar-2010 oga

Prevent the apmd/x races for good.

When we hit suspend time, go through all wsdisplays on the system. if
they are in mode MAPPED, but not MODE_DUMBFB then if possible do a full
vt switch to a !mapped vt, and prevent switching back until resume time.
This has to be called from MD code because this involves userland
running so that X can run the vt switch signal handler. This way, any
case where we are using the "poke registers from userland" model, we
will not be on the hardware when we go down, so the kernel can actually
handle thing properly.

Tested on several acpi laptops (by kettenis@ and ian@), x40 (me and
beck@ at LEAST) and zaurus (me). Maybe others, but if so I forgot who at
this time..

Idea from deraadt somewhere over the Faroe Islands (I thought of a
similar thing myself a while ago). Much prompting from him. Ok and
comments miod@


Revision tags: OPENBSD_4_7_BASE
# 1.23 05-Sep-2009 miod

Change the wsdisplay_emulops return types from void to int; emulops will now
return zero on success and nonzero on failure.
This commit only performs mechanical changes for the existing emulops to
always return zero.


Revision tags: OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.22 02-Dec-2006 miod

Fix ri_devcmap[] to allow WSCOL_BLACK and WSCOL_WHITE to not have to be
different for sparc{,64} systems.


# 1.21 29-Nov-2006 miod

Change the getchar wsdisplay_accessops function to not return a
display-dependent value, but instead fill a structure with the chaarcter
and a valid attribute, suitable for use with unpack_attr.

Adapt the wsmoused code to these changes, and remove all knowledge of
the text-mode style pc video attributes in it.

This will eventually allow wsmoused to be used on non-pcdisplay devices.


# 1.20 29-Nov-2006 miod

Add an unpack_attr function to struct wsdisplay_emulops, to match the
existing alloc_attr function. This allows rasops_unpack_attr to be kept
private to rasops, yet available to the screen drivers.


# 1.19 29-Nov-2006 miod

Add a new member to struct wsemuldisplaydev_attach_args, for a frame buffer
driver to be able to tell how many wscons screens to attach to it,
instead of WSDISPLAY_DEFAULTSCREENS which is a global setting.


Revision tags: OPENBSD_4_0_BASE
# 1.18 30-Jun-2006 miod

For 32bit sun frame buffers, tweak ri_devcmap to get the BoW palette instead
of needing different WSCOL_{BLACK,WHITE} values than 8bit frame buffers.

This allows us to not special case the alloc_attr() invocations depending
on the color depth, and to make WSCOL_{BLACK,WHITE} constants again in the
wsemul_sun land.


# 1.17 29-Jun-2006 miod

No need to keep specific variables for the kernel messages colors on sun
emulation, we can reuse the existing WSCOL_xxx codes, and WSCOL_BLACK and
WSCOL_WHITE will point to variables anyway.


Revision tags: OPENBSD_3_9_BASE
# 1.16 27-Sep-2005 miod

More non-emulating wsdisplay tentacles removal.


Revision tags: OPENBSD_3_8_BASE
# 1.15 15-May-2005 miod

Partial sync to the NetBSD wscons code, bringing a better wsmux behaviour
and bugfixes (the kqueue code, /dev/wsmuxctl and screen border color changes
have not been picked), keeping local changes.

Tested by many on alpha/cats/hp300/i386/macppc/sparc/sparc64/zaurus if not more.


Revision tags: OPENBSD_3_2_BASE OPENBSD_3_3_BASE OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE SMP_SYNC_A SMP_SYNC_B UBC_SYNC_A UBC_SYNC_B
# 1.14 25-Jul-2002 miod

Rework the color usage in wsemul_sun displays, to match SunOS and Solaris
text mode colors.
This means black text on white background, even for the kernel messages.

Initially based on a patch from jason@, then some tinkering by me.


Revision tags: OPENBSD_3_1_BASE
# 1.13 27-Mar-2002 jbm

Add X-Window support to wsmoused(8). This allows running wsmoused(8) and
X-Window at the same time, removing the need to kill wsmoused(8) before
starting X-Window.


# 1.12 14-Mar-2002 millert

Final __P removal plus some cosmetic fixups


# 1.11 14-Mar-2002 millert

First round of __P removal in sys


Revision tags: OPENBSD_3_0_BASE UBC_BASE
# 1.10 08-May-2001 mickey

branches: 1.10.2; 1.10.6;
inplement screen burner in screenblank(1) style (no program though).
disabled by default, also supports vsync blanking, disabled by default.
aaron@ looked at it a while back and i fixed problems he had indicated.


Revision tags: OPENBSD_2_9_BASE
# 1.9 14-Apr-2001 aaron

Kernel support for console mouse functionality which will be controlled by
the wsmoused daemon (replacement for moused which was used with PCVT). Adds
a "getchar" method to the display drivers which returns the value of the
character currently under the cursor (e.g., so it may be inversed). From jbm@.

Still needs a bit of cleanup and improvement, especially X cohabitation
features. The pointer moves to fast as well. These sorts of issues will be
corrected in-tree.


# 1.8 14-Mar-2001 mickey

allow listing and soon deleting fonts; aaron@ ok


# 1.7 10-Feb-2001 mickey

sync w/ netbsd; aaron@ ok


# 1.6 08-Feb-2001 aaron

Cause keypresses to reset the screen in case we are in scrollback (previously
the screen was only restored if a new character was actually displayed on the
screen); jcs@rt.fm. This brings us closer to the behavior of PCVT. Also, while
I'm here, add some #ifdef so wskbd does not depend on wsdisplay (pointed out
to me by fgsch@).


# 1.5 31-Jan-2001 aaron

OpenBSD does have paddr_t, I can't explain why I thought it didn't; art@


# 1.4 31-Jan-2001 aaron

Some int -> u_long (I incorrectly converted paddr_t to int when porting this).


# 1.3 15-Nov-2000 aaron

Support console scrollback in wscons through a new "scrollback" accessop that
hooks into the lower-level display driver. The updated vga(4) driver I'm about
to commit has support for this. This is a fairly unobtrusive way to implement
scrollback while maintaining the abstraction of the wscons system.


Revision tags: OPENBSD_2_8_BASE
# 1.2 01-Aug-2000 mickey

update wscons, nothing serious, mostly api fixes for us; from netbsd through aaron@


# 1.1 16-May-2000 mickey

import newer wscons source from netbsd.
art@ said it will make his life easier in alpha
rhands@ said it is not used in powerpc for now
bjc@ said that it would make vax port easier
mickey@ said other platforms can use it, and it's faster


Revision tags: OPENBSD_6_2_BASE
# 1.31 19-Jul-2017 kettenis

Add a enter_ddb() "accessop" to wsdisplay(4) to allow KMS drivers to bypass
the modeset lock when entering ddb. This avoids triggering various asserts
when the kernel panics while running X.

ok deraadt@


Revision tags: OPENBSD_6_1_BASE
# 1.30 04-Sep-2016 tedu

remove some more sparc remnants. ok deraadt


Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.29 04-Nov-2013 miod

Better defaults for the screen burner settings: all unblank actions enabled,
but burning still disabled by default. Setting display.screen_off to a nonzero
value with wsconsctl will be enough to enable screen blanking after the
given time.


# 1.28 20-Oct-2013 miod

No longer store fonts added with the WSDISPLAYIO_LDFONT ioctl into the
wsdisplay softc. Instead, since the knowledge about available fonts lies in
the parent driver itself, introduce a list_font wsdisplay_accessop which
queries a font index, suitable to use within the WSDISPLAYIO_LSFONT ioctl.

With this in place:
- there is no global wsdisplay limit on the number of fonts loaded. Such a
limit will be enforced by the display drivers themselves.
- built-in kernel fonts will now appear in the list of fonts.

Grow a list_font accesop for rasops, which relies upon wsfont_enum(), which
is turned into something useful (and abortable if you do not need to iterate
further). Not used by any rasops driver yet.


# 1.27 20-Aug-2013 kettenis

Define WS_DEFAULT_FG and WS_DEFAULT_BG as default colors (black on white for
sparc/sparc64, white on black for everybody else), and use them to construct
a default color attribute in the rasops(4) code.

ok miod@


Revision tags: OPENBSD_5_4_BASE
# 1.26 06-Jul-2013 kettenis

s/wsemuldisplaysubmatch/wsemuldisplaydevsubmatch/g


# 1.25 05-Jul-2013 kettenis

Add submatch function for use with config_found_sm(9).

ok miod@


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE
# 1.24 30-Mar-2010 oga

Prevent the apmd/x races for good.

When we hit suspend time, go through all wsdisplays on the system. if
they are in mode MAPPED, but not MODE_DUMBFB then if possible do a full
vt switch to a !mapped vt, and prevent switching back until resume time.
This has to be called from MD code because this involves userland
running so that X can run the vt switch signal handler. This way, any
case where we are using the "poke registers from userland" model, we
will not be on the hardware when we go down, so the kernel can actually
handle thing properly.

Tested on several acpi laptops (by kettenis@ and ian@), x40 (me and
beck@ at LEAST) and zaurus (me). Maybe others, but if so I forgot who at
this time..

Idea from deraadt somewhere over the Faroe Islands (I thought of a
similar thing myself a while ago). Much prompting from him. Ok and
comments miod@


Revision tags: OPENBSD_4_7_BASE
# 1.23 05-Sep-2009 miod

Change the wsdisplay_emulops return types from void to int; emulops will now
return zero on success and nonzero on failure.
This commit only performs mechanical changes for the existing emulops to
always return zero.


Revision tags: OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.22 02-Dec-2006 miod

Fix ri_devcmap[] to allow WSCOL_BLACK and WSCOL_WHITE to not have to be
different for sparc{,64} systems.


# 1.21 29-Nov-2006 miod

Change the getchar wsdisplay_accessops function to not return a
display-dependent value, but instead fill a structure with the chaarcter
and a valid attribute, suitable for use with unpack_attr.

Adapt the wsmoused code to these changes, and remove all knowledge of
the text-mode style pc video attributes in it.

This will eventually allow wsmoused to be used on non-pcdisplay devices.


# 1.20 29-Nov-2006 miod

Add an unpack_attr function to struct wsdisplay_emulops, to match the
existing alloc_attr function. This allows rasops_unpack_attr to be kept
private to rasops, yet available to the screen drivers.


# 1.19 29-Nov-2006 miod

Add a new member to struct wsemuldisplaydev_attach_args, for a frame buffer
driver to be able to tell how many wscons screens to attach to it,
instead of WSDISPLAY_DEFAULTSCREENS which is a global setting.


Revision tags: OPENBSD_4_0_BASE
# 1.18 30-Jun-2006 miod

For 32bit sun frame buffers, tweak ri_devcmap to get the BoW palette instead
of needing different WSCOL_{BLACK,WHITE} values than 8bit frame buffers.

This allows us to not special case the alloc_attr() invocations depending
on the color depth, and to make WSCOL_{BLACK,WHITE} constants again in the
wsemul_sun land.


# 1.17 29-Jun-2006 miod

No need to keep specific variables for the kernel messages colors on sun
emulation, we can reuse the existing WSCOL_xxx codes, and WSCOL_BLACK and
WSCOL_WHITE will point to variables anyway.


Revision tags: OPENBSD_3_9_BASE
# 1.16 27-Sep-2005 miod

More non-emulating wsdisplay tentacles removal.


Revision tags: OPENBSD_3_8_BASE
# 1.15 15-May-2005 miod

Partial sync to the NetBSD wscons code, bringing a better wsmux behaviour
and bugfixes (the kqueue code, /dev/wsmuxctl and screen border color changes
have not been picked), keeping local changes.

Tested by many on alpha/cats/hp300/i386/macppc/sparc/sparc64/zaurus if not more.


Revision tags: OPENBSD_3_2_BASE OPENBSD_3_3_BASE OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE SMP_SYNC_A SMP_SYNC_B UBC_SYNC_A UBC_SYNC_B
# 1.14 25-Jul-2002 miod

Rework the color usage in wsemul_sun displays, to match SunOS and Solaris
text mode colors.
This means black text on white background, even for the kernel messages.

Initially based on a patch from jason@, then some tinkering by me.


Revision tags: OPENBSD_3_1_BASE
# 1.13 27-Mar-2002 jbm

Add X-Window support to wsmoused(8). This allows running wsmoused(8) and
X-Window at the same time, removing the need to kill wsmoused(8) before
starting X-Window.


# 1.12 14-Mar-2002 millert

Final __P removal plus some cosmetic fixups


# 1.11 14-Mar-2002 millert

First round of __P removal in sys


Revision tags: OPENBSD_3_0_BASE UBC_BASE
# 1.10 08-May-2001 mickey

branches: 1.10.2; 1.10.6;
inplement screen burner in screenblank(1) style (no program though).
disabled by default, also supports vsync blanking, disabled by default.
aaron@ looked at it a while back and i fixed problems he had indicated.


Revision tags: OPENBSD_2_9_BASE
# 1.9 14-Apr-2001 aaron

Kernel support for console mouse functionality which will be controlled by
the wsmoused daemon (replacement for moused which was used with PCVT). Adds
a "getchar" method to the display drivers which returns the value of the
character currently under the cursor (e.g., so it may be inversed). From jbm@.

Still needs a bit of cleanup and improvement, especially X cohabitation
features. The pointer moves to fast as well. These sorts of issues will be
corrected in-tree.


# 1.8 14-Mar-2001 mickey

allow listing and soon deleting fonts; aaron@ ok


# 1.7 10-Feb-2001 mickey

sync w/ netbsd; aaron@ ok


# 1.6 08-Feb-2001 aaron

Cause keypresses to reset the screen in case we are in scrollback (previously
the screen was only restored if a new character was actually displayed on the
screen); jcs@rt.fm. This brings us closer to the behavior of PCVT. Also, while
I'm here, add some #ifdef so wskbd does not depend on wsdisplay (pointed out
to me by fgsch@).


# 1.5 31-Jan-2001 aaron

OpenBSD does have paddr_t, I can't explain why I thought it didn't; art@


# 1.4 31-Jan-2001 aaron

Some int -> u_long (I incorrectly converted paddr_t to int when porting this).


# 1.3 15-Nov-2000 aaron

Support console scrollback in wscons through a new "scrollback" accessop that
hooks into the lower-level display driver. The updated vga(4) driver I'm about
to commit has support for this. This is a fairly unobtrusive way to implement
scrollback while maintaining the abstraction of the wscons system.


Revision tags: OPENBSD_2_8_BASE
# 1.2 01-Aug-2000 mickey

update wscons, nothing serious, mostly api fixes for us; from netbsd through aaron@


# 1.1 16-May-2000 mickey

import newer wscons source from netbsd.
art@ said it will make his life easier in alpha
rhands@ said it is not used in powerpc for now
bjc@ said that it would make vax port easier
mickey@ said other platforms can use it, and it's faster