History log of /freebsd-current/sys/dev/vt/hw/fb/vt_fb.c
Revision Date Author Comments
# fdafd315 24-Nov-2023 Warner Losh <imp@FreeBSD.org>

sys: Automated cleanup of cdefs and other formatting

Apply the following automated changes to try to eliminate
no-longer-needed sys/cdefs.h includes as well as now-empty
blank lines in a row.

Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/
Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/
Remove /\n+#if.*\n#endif.*\n+/
Remove /^#if.*\n#endif.*\n/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/

Sponsored by: Netflix


# 685dc743 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

sys: Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


# 4d846d26 10-May-2023 Warner Losh <imp@FreeBSD.org>

spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD

The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch
up to that fact and revert to their recommended match of BSD-2-Clause.

Discussed with: pfg
MFC After: 3 days
Sponsored by: Netflix


# 29ab1945 14-Jan-2023 Jean-Sébastien Pédron <dumbbell@FreeBSD.org>

vt(4): Return errors from `vt_{,de}allocate()`

This is useful to the DRM drivers to let them know if a device is
effectively used by the console.

Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D38089


# b9f3b63a 25-Nov-2021 Leandro Lupori <luporl@FreeBSD.org>

vt: export RGB offsets with FBIO_GETRGBOFFS

Add a new ioctl to vt to make it possible to export RGB offsets
set by vt drivers. This is needed to fix colors on X and Mesa
on some machines, especially on modern PowerPC64 BE ones.

With the appropriate changes in SCFB, to use this ioctl to find
out the correct RGB offsets, this fixes wrong colors on Talos II
and Blackbird, when used with their built-in video cards.

Reviewed by: alfredo
Sponsored by: Instituto de Pesquisas Eldorado (eldorado.org.br)
Differential Revision: https://reviews.freebsd.org/D29000


# dbc7ca59 22-Sep-2021 Ed Maste <emaste@FreeBSD.org>

vt: bound buffer access in redraw optimization

PR: 248628
Reported by: oleg
Reviewed by: cem, oleg (both earlier)
Fixes: ee97b2336aa4 ("Speed up vt(4) by keeping...")
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D32059


# 9feff969 08-Aug-2021 Ed Maste <emaste@FreeBSD.org>

Remove "All Rights Reserved" from FreeBSD Foundation sys/ copyrights

These ones were unambiguous cases where the Foundation was the only
listed copyright holder (in the associated license block).

Sponsored by: The FreeBSD Foundation


# f9cc8410 18-Sep-2020 Eric van Gyzen <vangyzen@FreeBSD.org>

vm_ooffset_t is now unsigned

vm_ooffset_t is now unsigned. Remove some tests for negative values,
or make other adjustments accordingly.

Reported by: Coverity
Reviewed by: kib markj
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D26214


# 2efe3be9 03-Apr-2020 Ed Maste <emaste@FreeBSD.org>

vt: avoid overrun when stride is not a multiple of bytes per pixel

The reporter is developing a frame buffer driver for hardware using
3 bytes per pixel, but a stride that's a multiple of 256. Previously
this resulted in writing beyond the end of each stride. On the last
row this attempted to write past the end of the frame buffer, triggering
the assertion in vt_fb_mem_wr1().

PR: 243533
MFC after: 2 weeks
Submitted by: Thomas Skibo


# 29f7096d 26-Sep-2019 Toomas Soome <tsoome@FreeBSD.org>

vt: use proper return value check with TUNABLE_INT_FETCH

The TUNABLE_INT_FETCH is macro around getenv_int() and we will get
return value 0 or 1 for failure or success, we can use it to decide
which background color to use.


# df1bc27a 25-Sep-2019 Toomas Soome <tsoome@FreeBSD.org>

vt: use colors from terminal emulator

Instead of hardcoded colors, use terminal state. This also means,
we need to record the pointer to terminal state with vtbuf.


# ee97b233 25-Aug-2018 Colin Percival <cperciva@FreeBSD.org>

Speed up vt(4) by keeping a record of the most recently drawn character and
the foreground and background colours. In bitblt_text functions, compare
values to this cache and don't re-draw the characters if they haven't changed.
When invalidating the display, clear this cache in order to force characters
to be redrawn; also force full redraws between suspend/resume pairs since odd
artifacts can otherwise result.

When scrolling the display (which is where most time is spent within the vt
driver) this yields a significant performance improvement if most lines are
less than the width of the terminal, since this avoids re-drawing blanks on
top of blanks.

(Note that "re-drawing" here includes writing to the VGA text mode buffer; on
virtualized systems this can be extremely slow since it triggers a glyph
being rendered onto a 640x480 screen).

On a c5.4xlarge EC2 instance (with emulated text mode VGA) this cuts the time
spent in vt(4) during the kernel boot from 1200 ms to 700ms; on my laptop
(with a 3200x1800 display) the corresponding time is reduced from 970 ms down
to 155 ms.

Reviewed by: imp, cem
Approved by: re (gjb)
Relnotes: Significant speedup in vt(4) and the system boot generally.
Differential Revision: https://reviews.freebsd.org/D16723


# 823cdec7 05-Dec-2017 Justin Hibbits <jhibbits@FreeBSD.org>

Allow custom overrides of mmap attribute for VT framebuffer

Summary:
As in /dev/fb, allow the framebuffer driver to override the default memattr for
mmap(2). This is analogous to the change in 306555.

Reviewed By: ray
Differential Revision: https://reviews.freebsd.org/D13331


# 718cf2cc 27-Nov-2017 Pedro F. Giffuni <pfg@FreeBSD.org>

sys/dev: further adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.


# f41bde66 19-Jul-2016 Conrad Meyer <cem@FreeBSD.org>

Increase vt(4) framebuffer maximum size

And rename "DEFAULT" constants to the more accurate "MAX."

PR: 210382
Submitted by: Felix <felixphew0 at gmail.com>
Reviewed by: wblock, cem
Tested by: Dave Cottlehuber <dch at skunkwerks.at>


# ec6b1f6a 17-Aug-2015 Marcel Moolenaar <marcel@FreeBSD.org>

Support frame buffers that are larger than the default screen
size as defined by VT_FB_DEFAULT_WIDTH and VT_FB_DEFAULT_HEIGHT
(at this time 2048x1200). The default is really a max. We cap
the height and width to those defaults and position the screen
in the center of the frame buffer.

Ideally we use a bigger font to utility the entire real estate
that is the frame buffer, but that's seen as an improvement over
making it work first.

PR: 193745


# 0309276c 27-Jul-2015 Marius Strobl <marius@FreeBSD.org>

- Nuke dupe $FreeBSD$.
- Fix whitespace.

MFC after: 3 days


# 2c48063b 29-Apr-2015 Ed Maste <emaste@FreeBSD.org>

vt: fix vt_fb_bitblt_bitmap mask corruption

Previously the mask wrapped when one or more of the mask bytes extended
past the right edge of the window. Simplify the logic and use the same
byte offset and bit in both the pattern and mask.

PR: 199648
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D2360


# a985ae9b 07-Mar-2015 Hans Petter Selasky <hselasky@FreeBSD.org>

Add support for USB display link adapters to the FB and VT drivers.
The vtophys() function is used to get the physical page address for
the virtually allocated frame buffers when a physically continuous
memory area is not available. This change also allows removing the
masking of the FB_FLAG_NOMMAP flag in the PS3 syscons driver.

The FB and VT drivers were tested using X.org/xf86-video-scfb and
syscons.


# 76e2f976 28-Feb-2015 Jean-Sébastien Pédron <dumbbell@FreeBSD.org>

vt(4): Add support to "downgrade" from eg. vt_fb to vt_vga

The main purpose of this feature is to be able to unload a KMS driver.

When going back from the current vt(4) backend to the previous backend,
the previous backend is reinitialized with the special VDF_DOWNGRADE
flag set. Then the current driver is terminated with the new "vd_fini"
callback.

In the case of vt_fb and vt_vga, this allows the former to pass the
vgapci device vt_fb used to vt_vga so the device can be rePOSTed.

Differential Revision: https://reviews.freebsd.org/D687


# 6dfa4578 27-Jan-2015 Andriy Gapon <avg@FreeBSD.org>

vt(4): Use power_{suspend,resume} event handlers to implement
suspend/resume

The goal is to avoid that the vt(4) resume happens before the video
display is resumed. The original patch was provided by Andriy Gapon.

This new patch registers the handlers in vt_upgrade(). This is done
once, thanks to the VDF_ASYNC flag. I abused this flag because it was
already abused by the keyboard allocation. The event handlers then call
the backend if it provides callbacks for suspend/resume.

Differential Revision: https://reviews.freebsd.org/D1004
On behalf of: dumbbell
MFC after: 2 weeks


# f1d2752f 04-Jan-2015 Nathan Whitehorn <nwhitehorn@FreeBSD.org>

Make PS3 work with the userspace kboot loader. loader.ps3 will disappear
from the tree in the near future.

Done at: Hackathon


# 1365d077 16-Sep-2014 Jean-Sébastien Pédron <dumbbell@FreeBSD.org>

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
MFC after: 2 days


# 84d623c6 27-Aug-2014 Jean-Sébastien Pédron <dumbbell@FreeBSD.org>

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.

MFC after: 1 week


# 83fbb296 25-Aug-2014 Jean-Sébastien Pédron <dumbbell@FreeBSD.org>

vt(4): 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.

MFC after: 1 week


# 631bb572 23-Aug-2014 Jean-Sébastien Pédron <dumbbell@FreeBSD.org>

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.

MFC after: 1 week


# c285e4a5 23-Aug-2014 Jean-Sébastien Pédron <dumbbell@FreeBSD.org>

vt_fb: Implement vd_bitblt_text_t for vt_fb and derivatives

MFC after: 1 week


# 19e2ce2d 10-Aug-2014 Jean-Sébastien Pédron <dumbbell@FreeBSD.org>

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

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

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

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

This commit includes a fix to creator_vt.c, submitted by Nathan
Whitehorn: fb_cmsize is set to 16. Before this, the generated palette
would be overwritte. This fixes colors on sparc64 with a Creator3D
adapter.

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

Submitted by: nwhitehorn (fix to creator_vt.c)
MFC after: 1 week


# 0f3ec4da 07-Aug-2014 Nathan Whitehorn <nwhitehorn@FreeBSD.org>

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.


# 9ed297c8 05-Aug-2014 Nathan Whitehorn <nwhitehorn@FreeBSD.org>

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


# 2661dd32 02-Aug-2014 Nathan Whitehorn <nwhitehorn@FreeBSD.org>

Don't assume that the framebuffer driver is using vt_fb_blank() when blanking
the screen during init.

MFC after: 1 week


# 35e6436e 16-Jul-2014 Nathan Whitehorn <nwhitehorn@FreeBSD.org>

Fix embarassing typos I made.

Submitted by: rayddteam


# 60d7ea3d 16-Jul-2014 Nathan Whitehorn <nwhitehorn@FreeBSD.org>

Allow console drivers active from early boot to be used with xf86-video-scfb,
rather than only drivers attached later on. This involves a small amount of
code duplication with dev/fb/fbd.c, which will fixed later on.

Also improve performance of vt_blank() by making it not read from the
framebuffer unnecessarily.


# 4dde1640 05-May-2014 Aleksandr Rybalko <ray@FreeBSD.org>

Switch fb and efifb drivers to use names and new vt(4) driver probe method.

Sponsored by: The FreeBSD Foundation


# 9e497e7b 06-Feb-2014 Aleksandr Rybalko <ray@FreeBSD.org>

Add two new vt(9) driver methods: vd_drawrect and vd_setpixel.
Implement vd_drawrect and vd_setpixel for vt_fb driver.

Sponsored by: The FreeBSD Foundation


# 5beb07ab 20-Jan-2014 Aleksandr Rybalko <ray@FreeBSD.org>

Style(9) fix.
No functional changes.

Sponsored by: The FreeBSD Foundation


# 7a1a32c4 23-Dec-2013 Aleksandr Rybalko <ray@FreeBSD.org>

o Add virtual terminal mmap request handler.
o Forward termianl framebuffer ioctl to fbd.
o Forward terminal mmap request to fbd.
o Move inclusion of sys/conf.h to vt.h.

Sponsored by: The FreeBSD Foundation


# 27cf7d04 05-Dec-2013 Aleksandr Rybalko <ray@FreeBSD.org>

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

Reviewed by: nwhitehorn
MFC_to_10_after: re approval

Sponsored by: The FreeBSD Foundation