Re: EFI GOP lying about screen resolution?
Posted: Thu Mar 14, 2024 2:45 am
I try to cover as much ground as possible.zaval wrote: To linuxine. You overcomplicated all heavily.
UEFI hasn't deprecated/outlawed text-mode. In fact, the spec requires all outputzaval wrote: There is no "text" mode in UEFI.
devices to implement 80x25 text-mode, at least.
STOP explicitly says it is meant for controlling "text-based ConsoleOut device".
GOP says:
"A unique Graphics Output protocol must represent each video frame buffer in
the system that is driven out to one or more video output devices."
The spec does not mandate that the ConOut be based on a frame-buffer, or
have its framebuffer be the same as, the GOP provided framebuffer.
Hence, it should be okay for the firmware to expose the VGA text-mode as ConOut,
or to utilize a ConOut framebuffer different in size than that setup by GOP.
In both of these cases, either ConsoleControlProtocol.SetMode, or GOP.SetMode,
or LocateProtocol for GOP, or some other out-of-band indication is required, in
order to inform the firmware that its client wants to switch away from the
ConOut.
I think CCP must have been introduced specifically for this purpose: switching
between text-mode and graphics-mode.
Intel's Dxe graphics-driver [1] from the now-deprecated EDK1 further
distinguishes between "text-based STO" and "video/GOP/UGA based STO".
Such a differentiation seems reasonable given the spec. They rely on
ConsoleControlProtocol to switch their screens b/w text and graphics mode.
VMware [2] also implements and utilizes ConsoleControlProtocol in order to
switch their virtual screens b/w text and graphics mode.
Given that Windows has no troubles with its bootup screens on this laptop, do wezaval wrote: The spec doesn't require from loaders to worry about STOP and GOP coexistence. If there are no bugs, they coexist normally.
think it assumes that STOP and GOP coexist? If it did, it would have run into
the same problem as belliash and limine did.
STOP isn't necessarily pixel-addressible, while GOP is. They cannot be assumed
to coexist on a single output device.
---
Does the firmware on this laptop implement the ConsoleControlProtocol? If so,
it can be instructed to switch the screen b/w graphics and text mode. Although
this is non-std, it seems that many loaders including grub, rEFInd, systemd-boot
do check for CCP, and behave accordingly.
Nevertheless, drawing the fonts ourselves after an explicit GOP.SetMode
shouldn't be too hard.
---
Edit: edk2 has "Graphics Console Driver" [3], that consumes GOP and produces
an STOP. But this is specifically implemented as such; it does not rely on the
assumption that GOP and STOP coexist on the same output device.
Its source is at [4].
----
Edit2: limine thinks that Gop.QueryMode can return EFI_NOT_STARTED.
But the UEFI 2.10 (latest at this time) spec shows only
EFI_SUCCESS, EFI_DEVICE_ERROR, or EFI_INVALID_PARAMETER
as return values for Gop.QueryMode. The limine loader itself isn't
following the spec!
belliash's comment about requiring EFI_NOT_STARTED is based on
what?
Does the spec mandate that a mode must be "active" on the display to
be able to query it? I think not.
----
[1] https://android.googlesource.com/device ... hics.c#416
[2] https://communities.vmware.com/t5/VMwar ... d-p/864677
[3] https://github.com/tianocore-docs/edk2- ... drivers.md
[4] https://github.com/tianocore/edk2/tree/ ... ConsoleDxe