Re: [PATCH] x86/video: Preserve the default VGA fallback for legacy modes
From: Thomas Zimmermann
Date: Fri Oct 30 2026 - 06:15:28 EST
Hi
Am 30.10.26 um 10:24 schrieb Hengyu Liang:
Hi Thomas,
On Fri, Oct 30, 2026 at 09:48:19AM +0100, Thomas Zimmermann wrote:
Am 29.10.26 um 17:23 schrieb Hengyu Liang:I agree that the device is still the primary display in text mode. The
However, screen_info_resources() also returns legacy I/O and memoryIf the BIOS booted in text mode or VGA graphics mode, the rsp device is
ranges for VGA text modes. These ranges are not PCI BARs, so the resource
lookup fails and the default VGA fallback is skipped.
still the primary display device. So the current matching code is not
necessarily incorrect. (But also not necessarily correct either. :)
patch gets that from the vga_default_device() fallback, since the legacy
ranges can't be matched against BARs.
It doesn't match vkms. As you say, vkms isn't a PCI device, sodiff --git a/arch/x86/video/video-common.c b/arch/x86/video/video-common.cFurther below in that code is a call to pci_find_resource(). [1] Why
index 8ed82fff7638..b8f83346dfe8 100644
--- a/arch/x86/video/video-common.c
+++ b/arch/x86/video/video-common.c
@@ -45,7 +45,7 @@ bool video_is_primary_device(struct device *dev)
#ifdef CONFIG_SCREEN_INFO
numres = screen_info_resources(si, res, ARRAY_SIZE(res));
- if (numres > 0) {
+ if (numres > 0 && __screen_info_has_lfb(screen_info_video_type(si))) {
for (i = 0; i < numres; ++i) {
if (!(res[i].flags & IORESOURCE_MEM))
continue;
does it match with vkms? Vkms is not even on a PCI device.
video_is_primary_device() returns false for it at the dev_is_pci() check.
The problem is on the bochs side. In text mode, screen_info_resources()
returns the legacy VGA ranges, pci_find_resource() doesn't find them in
the BARs, and the function returns false there as well. So no device is
primary, and fbcon stays on the first registered framebuffer. In this
setup that is vkms (fb0), so the console is never remapped to bochs (fb1).
I see. That makes sense. Thanks for clarifying.
Reviewed-by: Thomas Zimmermann <tzimmermann@xxxxxxx>
Best regards
Thomas
vkms only makes the console part visible. Without vkms, tty1 has the same
size with and without the patch, but boot_display is still missing without
it.
Thanks,
Hengyu
--
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com
GF: Stefan Gaiser, Jochen Jaser, Abhinav Puri, (HRB 36809, AG Nürnberg)