From:       Klemens Nanni <kl3 () posteo ! org>
Date:       2017-09-16 13:58:21
Message-ID: <[email protected]>
>Updated diff introducing efi_gop_setmode() as helper to reduce duplicate
>code and enhance readability.
>
>This code continues to work on three different UEFI implementations
>without any regression.
>
>Has anyone tested this on their machine by any chance?

I tested this diff in combination with your "Implement machine gop command"
diff on a Dell PowerEdge R230 and a VirtualBox VM (EFI enabled).  No
regressions, however 'machine gop' doesn't work quite how I expected it to
-- it seems the video mode set with it only applies to the bootloader, and
once the kernel loads, it sets a different mode (possibly a bad one).  I
was hoping the kernel would use the mode I just set.

Sometimes the 800x600 and 640x480 modes either have parts of the screen cut
off, or show a blank screen (but the resolution does change).  Not a huge
deal, since the default 1024x768 mode works fine; also, the FreeBSD loader
has the same issue.

It seems that the 'machine video' setting (e.g. 80x25, 100x31, etc.) is
independent of 'machine gop', and they can trample each other: changing the
"gop" mode does not resize the "video" mode, but changing the "video" mode
always resets the "gop" mode to 1024x768.

Here are the available modes in VirtualBox:
====
>> OpenBSD/amd64 BOOTX64 3.35
boot> machine video
Mode 0: 80 x 25
Mode 2: 100 x 31
Mode 3: 128 x 40

Current Mode = 2
boot> machine gop
Mode 0: 640 x 480 (stride = 640)
Mode 1: 800 x 600 (stride = 800)
Mode 2: 1024 x 768 (stride = 1024)
Mode 3: 1280 x 1024 (stride = 1280)
Mode 4: 1440 x 900 (stride = 1440)
Mode 5: 1920 x 1200 (stride = 1920)

Current Mode = 2
====
All of them work properly, with the caveats described above.  Once the
kernel loads, it switches to 1920x1200 with a windowboxed 100x31 console.


The Dell R230 only has video mode 0 (80x25); the gop modes listed vary
depending on whether the BIOS setting "Load Legacy Video Option ROM" is
enabled.  With it enabled, it only lists modes 0-2, defaulting to 2
(1024x768).  With it disabled, there are additional modes for 1280x960 and
1280x1024 (our rackmount KVM monitor is 1280x1024 native, but specifies a
preferred mode of 1024x768 in its EDID).

All these modes work properly in the bootloader (640x480 & 800x600 have the
same issues as VirtualBox, but everything else is fine), but once the
OpenBSD kernel loads, it sets the resolution to 1024x768, and scrambles the
video output (regardless of gop mode) as mentioned at [1][2] if the legacy
video ROM is disabled. Since that posting, the spontaneous reboot has been
fixed, and serial console support was added to the EFI bootloader, so I was
able to install OpenBSD in EFI mode, and recently randomly discovered that
toggling this BIOS setting "fixes" the OpenBSD console.

This setting is described in the manual [3, p. 44] as:
Load Legacy Video Option ROM
-----------------------------
“Enables you to determine whether the system BIOS loads the legacy video
(INT 10H) option ROM from the video controller. Selecting[sic] Enabled [if]
the operating system does not support UEFI video output standards. This
field is available only for UEFI boot mode. You cannot set the option to
Enabled if UEFI Secure Boot mode is enabled."

With it enabled, the kernel sets a 1024x768 mode (100x31 letterboxed) and
displays mostly correctly (some stray garbage on the leftmost 2 pixels).
With it disabled (the default), video is scrambled to a thin purple line
and efifb(4) is listed as not configured; X still works in either case.
FreeBSD & Linux consoles are fine even with the legacy video ROM disabled.
I've included the dmesgs for both cases.


Thanks,

Andrew

[1] https://marc.info/?l=openbsd-misc&m=146343624320665&w=2
[2] https://marc.info/?l=openbsd-misc&m=148723613906289&w=2
[3] http://topics-cdn.dell.com/pdf/poweredge-r230_owner's%20manual_en-us.pdf

Attachment: dmesg.legacy-vbios
Description: Binary data

Attachment: dmesg.no-vbios
Description: Binary data

Reply via email to