History log of /freebsd-current/stand/efi/loader/framebuffer.c
Revision Date Author Comments
# 3e15b01d 22-Feb-2024 Warner Losh <imp@FreeBSD.org>

libsa: Remove redundant sys/cdefs.h

Sponsored by: Netflix


# 7edbf69b 23-Jan-2024 Dag-Erling Smørgrav <des@FreeBSD.org>

stand: Add 1440p to the list of known resolutions.

MFC after: 1 week
Reviewed by: manu, kevans, imp
Differential Revision: https://reviews.freebsd.org/D43391


# 1d386b48 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: one-line .c pattern

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


# df065f69 26-Aug-2022 Warner Losh <imp@FreeBSD.org>

stand: More sensible defaults when ConOut is missing

When ConOut is missing, we used to default to serial. Except we did it
in the worst way possible by just setting the howto bits and not
updating the console setting, which lead to weird behavior where we'd
get some things on the video port, others on serial.

Instead, set console to "efi,comconsole" for this case. Also set
RB_MULTIPLE always (so we get dual consoles from the kernel) and or in
RB_SERIAL when we can't find GOPs that suggest the precense of a video
console. This will put output in the most places and have a sensible
default for 'primary' console.

Sponsored by: Netflix
Reviewed by: emaste, manu
Differential Revision: https://reviews.freebsd.org/D36299


# a765ac11 30-Jun-2022 Ed Maste <emaste@FreeBSD.org>

Remove "All Rights Reserved" from Foundation copyrights

MFC after: 1 week
Sponsored by: The FreeBSD Foundation


# 221376db 17-Dec-2021 Toomas Soome <tsoome@FreeBSD.org>

loader.efi: to preserve heap space, use AllocatePages() for shadow_fb

shadow FB size could be rather large and depends on resolution,
instead of using heap, allocate dedicated space outside of heap.

Reviewed by: manu
Differential Revision: https://reviews.freebsd.org/D33600
MFC after: 2 weeks


# 02732f94 16-Dec-2021 Alexander Motin <mav@FreeBSD.org>

loader.efi: Do not use as frame buffer BLT-only GOPs.

Kernel needs physical frame buffer address and size, which Block
Transfer-only Graphics Output Protocol instances do not have.

Some recent ASUS boards like PRIME Z690M-PLUS D4 and PRIME H570-Plus
report two GOPs, out of which the second one support ConOut protocol,
that made it preferable, but is BLT-only, that made console unusable.

Discussed with: tsoome (previous version)
MFC after: 1 week


# 6102f43c 06-Dec-2021 Toomas Soome <tsoome@FreeBSD.org>

loader: framebuffer should only be written into

Reading from Write Combining memory can be very-very slow. Try to use
shadow buffer to avoid such reads.

MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D33305


# becaac39 20-Feb-2021 Toomas Soome <tsoome@FreeBSD.org>

loader: use display pixel density for font autoselection

Calculate font size from 16 density independent pixels (dp) by using:
size = 16 * ppi/160 * display_factor

We are specifying font size 16dp, and assuming 1dp = 160ppi.
Also apply scaling factor 2 (display_factor).

MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D28849


# 52ec89a9 17-Jan-2021 Toomas Soome <tsoome@FreeBSD.org>

loader.efi: commands gop, uga and autoresize should use cached data

We are setting up pointers for gop or uga protocol in
efi_find_framebuffer(), reuse those pointers.


# 9adce1ae 17-Jan-2021 Toomas Soome <tsoome@FreeBSD.org>

loader.efi: variable 'hlist' is uninitialized

framebuffer.c:481:65: error: variable 'hlist' is uninitialized


# fb3a792a 17-Jan-2021 Toomas Soome <tsoome@FreeBSD.org>

loader.efi: unused variable 'mode'

framebuffer.c:707:8: error: unused variable 'mode' [-Wunused-variable]
u_int mode;


# ef698fab 16-Jan-2021 Toomas Soome <tsoome@FreeBSD.org>

loader.efi: handle multiple gop instances

Some systems may provide multiple GOP instances and not all are
bound to hardware. The current loader is picking up the first GOP,
which may not be usable. Instead we load the GOP handle array,
and test every handle to have registered ConOut protocol. If ConOut is
present, we can use this GOP handle to open GOP protocol.


# 50180d2b 11-Jan-2021 Toomas Soome <tsoome@FreeBSD.org>

loader.efi: reworked framebuffer setup

Pass gfx_state to efi_find_framebuffer(), so we can pick between
GOP and UGA in efi_find_framebuffer(), also we can then
set up struct gen_fb in gfx_state from efifb and isolate efi fb data
processing into framebuffer.c.

This change does allow us to clean up efi_cons_init() and reduce
BS->LocateProtocol() calls.

A little downside is that we now need to translate gen_fb back to
efifb in bootinfo.c (for passing to kernel), and we need to add few
-I options to CFLAGS.


# 1a816c75 11-Jan-2021 Toomas Soome <tsoome@FreeBSD.org>

loader.efi: efifb_mask_from_pixfmt is missing PixelBltOnly

We are missing way to set RGB masks for BLT only framebuffer.


# 3630506b 20-Dec-2020 Toomas Soome <tsoome@FreeBSD.org>

loader: implement framebuffer console

Draw console on efi.
Add vbe framebuffer for BIOS loader (vbe off, vbe on, vbe list,
vbe set xxx).
autoload font (/boot/fonts) based on resolution and font size.
Add command loadfont (set font by file) and
variable screen.font (set font by size). Pass loaded font to kernel.

Export variables:
screen.height
screen.width
screen.depth

Add gfx primitives to draw the screen and put png image on the screen.
Rework menu draw to iterate list of consoles to enamble device specific
output.

Probably something else I forgot...

Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D27420


# 7f3d93b5 14-Jun-2020 Toomas Soome <tsoome@FreeBSD.org>

loader.efi: update console after gfx mode change

The gfx mode change should be coordinated with console setup.


# 110d56cb 06-Aug-2019 Toomas Soome <tsoome@FreeBSD.org>

loader.efi: replace HandleProtocol() with OpenProtocol()

The HandleProtocol() is deprecated interface and we should use OpenProtocol()
instead. Moreover, in some firmware implementation(s), the HandleProtocol()
does return device path using static storage, so we can not keep the value
returned there. With same firmware, the OpenProtocol() does return data we
do not need to clone.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D21162


# 37528fb4 04-Aug-2018 Kyle Evans <kevans@FreeBSD.org>

efi-autoresizecons: Don't fail the boot w/o GOP or UGA

efi-autoresizecons is currently executed for every boot. If it fails, we
risk failing the boot, and we really shouldn't do that unless we absolutely
must.

Not being able to locate GOP or UGA is not a significant enough failure to
kill the boot. We always have the option to fall back to resizing ConOut to
a higher text mode resolution (if available), so do that.

This was detected by Doug [1] while attempting a bhyve + UEFI + PXE boot.
This patch was effectively also submitted by Doug, but I expanded the
comment he had originally sent me a little bit to indicate why this is an OK
idea.

Reported by: Doug Ambrisko <ambrisko@ambrisko.com> [1]


# 807dbf2b 18-Apr-2018 Kyle Evans <kevans@FreeBSD.org>

efi loader: Address two nits with recent graphics changes

- We should be setting a known graphics mode on conout, but we aren't.
- We shouldn't be setting gop mode if we didn't find a good resolution to
set, but we were. This made efi_max_resolution=1x1 effectively worthless,
since it would always set gop mode 0 if nothing else.


# 76e00374 26-Mar-2018 Kyle Evans <kevans@FreeBSD.org>

loader efifb: implement uga_autoresize as a call to text_autoresize

UGA does not have the same kind of mode enumeration that GOP does. Implement
it instead as a call to text_autoresize so that firmwares with only UGA
present still get some kind of autoresizing behavior.

While here, rename a typo'd "gop" to "uga", although it will remain unused
for the time being.


# 1c169279 23-Mar-2018 Kyle Evans <kevans@FreeBSD.org>

efi loader: Choose a console mode instead if hw.vga.textmode is set

Not all systems use efifb; pull hw.vga.textmode and choose a good console
mode instead if it's set to something non-zero. This is basically a revival
of the code that used to live in boot1, but instead rebased onto this
different way of doing mode selection in loader.efi.

Interestingly enough, the regression that was previously introduced where
GOP would not reflect the console setting does not seem to exist when
console mode selection is done here. I've not done any investigation as to
why this is the case. Nevertheless, boot1.efi is still not the best place to
do mode selection.


# 05e8899d 23-Mar-2018 Kyle Evans <kevans@FreeBSD.org>

efi loader: Respect efi_max_resolution in loader.conf(5)

Default the max resolution to 1080p, we'll accept Width x Height
specifications along with the following presets:

- 480p
- 720p
- 1080p
- 2160p or 4k
- 5k

PR: 224825
Differential Revision: https://reviews.freebsd.org/D14801


# 5f8cfbe1 21-Mar-2018 Kyle Evans <kevans@FreeBSD.org>

UEFI: Ditch console mode setting, choose optimal GOP mode later in boot

boot1 is too early to be deciding a good resolution. Console modes don't map
cleanly/predictably to actual screen resolutions, and GOP does not reflect
the actual screen resolution after a console mode change. Rip it out.

Add an efi-autoresizecons command to loader to choose an optimal screen
resolution based on the current environment. We'll explicitly execute this
later, preferably before we draw anything of value but after we load config
and pick up any tunables we may need to decide where we're going.

This method also allows us to actually pass the correct framebuffer
information on to the kernel.

UGA autoresizing is not implemented because it doesn't have the kind of mode
enumeration that GOP does. If an interested person with relevant hardware
could get in contact, we can take a look at implementing UGA autoresize.

This effectively "fixes" the breakage caused by r327058, but doesn't
actually set the resolution correctly until the interpreter calls
efi-autoresizcons. The lualoader version of this has been included for
reference; the forth equivalent will follow.

Reviewed by: imp (with some hestitation), manu
Differential Revision: https://reviews.freebsd.org/D14788


# ca987d46 14-Nov-2017 Warner Losh <imp@FreeBSD.org>

Move sys/boot to stand. Fix all references to new location

Sponsored by: Netflix