Seems win8 doesn't like it. With this patch win8 guests allow to set the screen resolution to something != 1024x768.
Signed-off-by: Gerd Hoffmann kraxel@redhat.com --- vgasrc/vbe.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/vgasrc/vbe.c b/vgasrc/vbe.c index d962333..b0ee002 100644 --- a/vgasrc/vbe.c +++ b/vgasrc/vbe.c @@ -142,6 +142,7 @@ vbe_104f01(struct bregs *regs) framebuffer = GET_GLOBAL(VBE_framebuffer); if (framebuffer) mode_attr |= VBE_MODE_ATTRIBUTE_LINEAR_FRAME_BUFFER_MODE; + pages = 1; break; } SET_FARVAR(seg, info->mode_attributes, mode_attr);
On Mon, Sep 09, 2013 at 09:24:40AM +0200, Gerd Hoffmann wrote:
Seems win8 doesn't like it. With this patch win8 guests allow to set the screen resolution to something != 1024x768.
Signed-off-by: Gerd Hoffmann kraxel@redhat.com
vgasrc/vbe.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/vgasrc/vbe.c b/vgasrc/vbe.c index d962333..b0ee002 100644 --- a/vgasrc/vbe.c +++ b/vgasrc/vbe.c @@ -142,6 +142,7 @@ vbe_104f01(struct bregs *regs) framebuffer = GET_GLOBAL(VBE_framebuffer); if (framebuffer) mode_attr |= VBE_MODE_ATTRIBUTE_LINEAR_FRAME_BUFFER_MODE;
} SET_FARVAR(seg, info->mode_attributes, mode_attr);pages = 1; break;
That's odd. According to the vbe spec:
The NumberOfImagePages field specifies the "total number minus one (-1)" of complete display images that will fit into the frame buffer memory.
The existing code matches the original bochs vbe code and matches what the spec says. I'm surprised win8 would require such an odd value.
-Kevin
On Mo, 2013-09-09 at 12:48 -0400, Kevin O'Connor wrote:
On Mon, Sep 09, 2013 at 09:24:40AM +0200, Gerd Hoffmann wrote:
Seems win8 doesn't like it. With this patch win8 guests allow to set the screen resolution to something != 1024x768.
Signed-off-by: Gerd Hoffmann kraxel@redhat.com
vgasrc/vbe.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/vgasrc/vbe.c b/vgasrc/vbe.c index d962333..b0ee002 100644 --- a/vgasrc/vbe.c +++ b/vgasrc/vbe.c @@ -142,6 +142,7 @@ vbe_104f01(struct bregs *regs) framebuffer = GET_GLOBAL(VBE_framebuffer); if (framebuffer) mode_attr |= VBE_MODE_ATTRIBUTE_LINEAR_FRAME_BUFFER_MODE;
} SET_FARVAR(seg, info->mode_attributes, mode_attr);pages = 1; break;
That's odd. According to the vbe spec:
The NumberOfImagePages field specifies the "total number minus one (-1)" of complete display images that will fit into the frame buffer memory.
Odd indeed. But maybe nobody bothers too much. Linux (vesafb) for example prints it at boot, but otherwise doesn't use it. Instead it looks at the total_memory value reported by 0x4f00.
The existing code matches the original bochs vbe code and matches what the spec says. I'm surprised win8 would require such an odd value.
I'm surprised too, but that bit really makes the difference.
When reporting the number of pages fitting into memory win8 is fixed at 1024x748, when reporting a single page only win8 offers the whole range of vesa resolutions supported by the vesa bios ...
I have no idea why that is the case though, maybe the root cause it something different and this patch just papers over it.
cheers, Gerd
On Tue, Sep 10, 2013 at 07:48:08AM +0200, Gerd Hoffmann wrote:
On Mo, 2013-09-09 at 12:48 -0400, Kevin O'Connor wrote:
That's odd. According to the vbe spec:
The NumberOfImagePages field specifies the "total number minus one (-1)" of complete display images that will fit into the frame buffer memory.
Odd indeed. But maybe nobody bothers too much. Linux (vesafb) for example prints it at boot, but otherwise doesn't use it. Instead it looks at the total_memory value reported by 0x4f00.
The existing code matches the original bochs vbe code and matches what the spec says. I'm surprised win8 would require such an odd value.
I'm surprised too, but that bit really makes the difference.
When reporting the number of pages fitting into memory win8 is fixed at 1024x748, when reporting a single page only win8 offers the whole range of vesa resolutions supported by the vesa bios ...
I have no idea why that is the case though, maybe the root cause it something different and this patch just papers over it.
FYI, I ran some tests on qemu and my e350m1 (with an AMD vgabios). Interestingly, it doesn't look like AMD ever reports a "pages=0".
-Kevin
==================== results =================
Original Cirrus: VESA 2.0 VENDOR: VGABIOS Cirrus extension PRODUCT: VGABIOS Cirrus extension mem=4194304 mode=101 x=640 y=480 d=8 pages=11 mode=110 x=640 y=480 d=15 pages=5 mode=111 x=640 y=480 d=16 pages=5 mode=112 x=640 y=480 d=24 pages=3 mode=103 x=800 y=600 d=8 pages=7 mode=113 x=800 y=600 d=15 pages=3 mode=114 x=800 y=600 d=16 pages=3 mode=115 x=800 y=600 d=24 pages=1 mode=105 x=1024 y=768 d=8 pages=4 mode=116 x=1024 y=768 d=15 pages=1 mode=117 x=1024 y=768 d=16 pages=1 mode=118 x=1024 y=768 d=24 pages=0 mode=107 x=1280 y=1024 d=8 pages=2 mode=119 x=1280 y=1024 d=15 pages=0 mode=11a x=1280 y=1024 d=16 pages=0
SeaVGABIOS cirrus: VESA 3.0 VENDOR: SeaBIOS Developers PRODUCT: SeaBIOS VBE Adapter mem=4194304 mode=101 x=640 y=480 d=8 pages=11 mode=111 x=640 y=480 d=16 pages=5 mode=110 x=640 y=480 d=15 pages=5 mode=112 x=640 y=480 d=24 pages=3 mode=103 x=800 y=600 d=8 pages=7 mode=114 x=800 y=600 d=16 pages=3 mode=113 x=800 y=600 d=15 pages=3 mode=105 x=1024 y=768 d=8 pages=4 mode=117 x=1024 y=768 d=16 pages=1 mode=116 x=1024 y=768 d=15 pages=1 mode=115 x=800 y=600 d=24 pages=1 mode=118 x=1024 y=768 d=24 pages=0 mode=107 x=1280 y=1024 d=8 pages=2 mode=119 x=1280 y=1024 d=15 pages=0 mode=11a x=1280 y=1024 d=16 pages=0 mode=00 x=40 y=25 d=4 pages=0 mode=01 x=40 y=25 d=4 pages=0 mode=02 x=80 y=25 d=4 pages=0 mode=03 x=80 y=25 d=4 pages=0 mode=04 x=320 y=200 d=2 pages=0 mode=05 x=320 y=200 d=2 pages=0 mode=06 x=640 y=200 d=1 pages=0 mode=07 x=80 y=25 d=4 pages=0 mode=0d x=320 y=200 d=4 pages=15 mode=0e x=640 y=200 d=4 pages=15 mode=0f x=640 y=350 d=1 pages=15 mode=10 x=640 y=350 d=4 pages=15 mode=11 x=640 y=480 d=1 pages=15 mode=12 x=640 y=480 d=4 pages=15 mode=13 x=320 y=200 d=8 pages=63 mode=6a x=800 y=600 d=4 pages=15
Original bochsvga: VESA 2.0 VENDOR: Bochs/Plex86 Developers PRODUCT: Bochs/Plex86 VBE Adapter mem=16777216 mode=100 x=640 y=400 d=8 pages=64 mode=101 x=640 y=480 d=8 pages=53 mode=102 x=800 y=600 d=4 pages=68 mode=103 x=800 y=600 d=8 pages=33 mode=104 x=1024 y=768 d=4 pages=41 mode=105 x=1024 y=768 d=8 pages=20 mode=106 x=1280 y=1024 d=4 pages=24 mode=107 x=1280 y=1024 d=8 pages=11 mode=10d x=320 y=200 d=15 pages=130 mode=10e x=320 y=200 d=16 pages=130 mode=10f x=320 y=200 d=24 pages=86 mode=110 x=640 y=480 d=15 pages=26 mode=111 x=640 y=480 d=16 pages=26 mode=112 x=640 y=480 d=24 pages=17 mode=113 x=800 y=600 d=15 pages=16 mode=114 x=800 y=600 d=16 pages=16 mode=115 x=800 y=600 d=24 pages=10 mode=116 x=1024 y=768 d=15 pages=9 mode=117 x=1024 y=768 d=16 pages=9 mode=118 x=1024 y=768 d=24 pages=6 mode=119 x=1280 y=1024 d=15 pages=5 mode=11a x=1280 y=1024 d=16 pages=5 mode=11b x=1280 y=1024 d=24 pages=3 mode=11c x=1600 y=1200 d=8 pages=7 mode=11d x=1600 y=1200 d=15 pages=3 mode=11e x=1600 y=1200 d=16 pages=3 mode=11f x=1600 y=1200 d=24 pages=1 mode=140 x=320 y=200 d=32 pages=64 mode=141 x=640 y=400 d=32 pages=15 mode=142 x=640 y=480 d=32 pages=12 mode=143 x=800 y=600 d=32 pages=7 mode=144 x=1024 y=768 d=32 pages=4 mode=145 x=1280 y=1024 d=32 pages=2 mode=146 x=320 y=200 d=8 pages=5 mode=147 x=1600 y=1200 d=32 pages=1 mode=148 x=1152 y=864 d=8 pages=15 mode=149 x=1152 y=864 d=15 pages=7 mode=14a x=1152 y=864 d=16 pages=7 mode=14b x=1152 y=864 d=24 pages=4 mode=14c x=1152 y=864 d=32 pages=3 mode=178 x=1280 y=800 d=16 pages=7 mode=179 x=1280 y=800 d=24 pages=4 mode=17a x=1280 y=800 d=32 pages=3 mode=17b x=1280 y=960 d=16 pages=5 mode=17c x=1280 y=960 d=24 pages=3 mode=17d x=1280 y=960 d=32 pages=2 mode=17e x=1440 y=900 d=16 pages=5 mode=17f x=1440 y=900 d=24 pages=3 mode=180 x=1440 y=900 d=32 pages=2 mode=181 x=1400 y=1050 d=16 pages=4 mode=182 x=1400 y=1050 d=24 pages=2 mode=183 x=1400 y=1050 d=32 pages=1 mode=184 x=1680 y=1050 d=16 pages=3 mode=185 x=1680 y=1050 d=24 pages=2 mode=186 x=1680 y=1050 d=32 pages=1 mode=187 x=1920 y=1200 d=16 pages=2 mode=188 x=1920 y=1200 d=24 pages=1 mode=189 x=1920 y=1200 d=32 pages=0 mode=18a x=2560 y=1600 d=16 pages=1 mode=18b x=2560 y=1600 d=24 pages=0 mode=18c x=2560 y=1600 d=32 pages=0
SeaVGABIOS bochsvga: VESA 3.0 VENDOR: SeaBIOS Developers PRODUCT: SeaBIOS VBE Adapter mem=16777216 mode=100 x=640 y=400 d=8 pages=63 mode=101 x=640 y=480 d=8 pages=50 mode=102 x=800 y=600 d=4 pages=63 mode=103 x=800 y=600 d=8 pages=31 mode=104 x=1024 y=768 d=4 pages=31 mode=105 x=1024 y=768 d=8 pages=20 mode=106 x=1280 y=1024 d=4 pages=20 mode=107 x=1280 y=1024 d=8 pages=11 mode=10d x=320 y=200 d=15 pages=127 mode=10e x=320 y=200 d=16 pages=127 mode=10f x=320 y=200 d=24 pages=84 mode=110 x=640 y=480 d=15 pages=24 mode=111 x=640 y=480 d=16 pages=24 mode=112 x=640 y=480 d=24 pages=16 mode=113 x=800 y=600 d=15 pages=16 mode=114 x=800 y=600 d=16 pages=16 mode=115 x=800 y=600 d=24 pages=10 mode=116 x=1024 y=768 d=15 pages=9 mode=117 x=1024 y=768 d=16 pages=9 mode=118 x=1024 y=768 d=24 pages=6 mode=119 x=1280 y=1024 d=15 pages=5 mode=11a x=1280 y=1024 d=16 pages=5 mode=11b x=1280 y=1024 d=24 pages=3 mode=11c x=1600 y=1200 d=8 pages=7 mode=11d x=1600 y=1200 d=15 pages=3 mode=11e x=1600 y=1200 d=16 pages=3 mode=11f x=1600 y=1200 d=24 pages=1 mode=140 x=320 y=200 d=32 pages=63 mode=141 x=640 y=400 d=32 pages=15 mode=142 x=640 y=480 d=32 pages=12 mode=143 x=800 y=600 d=32 pages=7 mode=144 x=1024 y=768 d=32 pages=4 mode=145 x=1280 y=1024 d=32 pages=2 mode=146 x=320 y=200 d=8 pages=255 mode=147 x=1600 y=1200 d=32 pages=1 mode=148 x=1152 y=864 d=8 pages=15 mode=149 x=1152 y=864 d=15 pages=7 mode=14a x=1152 y=864 d=16 pages=7 mode=14b x=1152 y=864 d=24 pages=4 mode=14c x=1152 y=864 d=32 pages=3 mode=178 x=1280 y=800 d=16 pages=7 mode=179 x=1280 y=800 d=24 pages=4 mode=17a x=1280 y=800 d=32 pages=3 mode=17b x=1280 y=960 d=16 pages=5 mode=17c x=1280 y=960 d=24 pages=3 mode=17d x=1280 y=960 d=32 pages=2 mode=17e x=1440 y=900 d=16 pages=5 mode=17f x=1440 y=900 d=24 pages=3 mode=180 x=1440 y=900 d=32 pages=2 mode=181 x=1400 y=1050 d=16 pages=4 mode=182 x=1400 y=1050 d=24 pages=2 mode=183 x=1400 y=1050 d=32 pages=1 mode=184 x=1680 y=1050 d=16 pages=3 mode=185 x=1680 y=1050 d=24 pages=2 mode=186 x=1680 y=1050 d=32 pages=1 mode=187 x=1920 y=1200 d=16 pages=2 mode=188 x=1920 y=1200 d=24 pages=1 mode=189 x=1920 y=1200 d=32 pages=0 mode=18a x=2560 y=1600 d=16 pages=1 mode=18b x=2560 y=1600 d=24 pages=0 mode=18c x=2560 y=1600 d=32 pages=0 mode=00 x=40 y=25 d=4 pages=0 mode=01 x=40 y=25 d=4 pages=0 mode=02 x=80 y=25 d=4 pages=0 mode=03 x=80 y=25 d=4 pages=0 mode=04 x=320 y=200 d=2 pages=0 mode=05 x=320 y=200 d=2 pages=0 mode=06 x=640 y=200 d=1 pages=0 mode=07 x=80 y=25 d=4 pages=0 mode=0d x=320 y=200 d=4 pages=63 mode=0e x=640 y=200 d=4 pages=63 mode=0f x=640 y=350 d=1 pages=63 mode=10 x=640 y=350 d=4 pages=63 mode=11 x=640 y=480 d=1 pages=63 mode=12 x=640 y=480 d=4 pages=63 mode=13 x=320 y=200 d=8 pages=255 mode=6a x=800 y=600 d=4 pages=63
01.131: VESA 3.0 01.132: VENDOR: (C) 1988-2010, AMD Technologies Inc. 01.131: PRODUCT: WRESTLER mem=16777216 01.132: mode=100 x=640 y=400 d=8 pages=63 01.132: mode=101 x=640 y=480 d=8 pages=50 01.132: mode=103 x=800 y=600 d=8 pages=31 01.132: mode=105 x=1024 y=768 d=8 pages=18 01.133: mode=107 x=1280 y=1024 d=8 pages=11 01.133: mode=110 x=640 y=480 d=16 pages=24 01.133: mode=111 x=640 y=480 d=16 pages=24 01.133: mode=113 x=800 y=600 d=16 pages=16 01.134: mode=114 x=800 y=600 d=16 pages=16 01.134: mode=116 x=1024 y=768 d=16 pages=9 01.134: mode=117 x=1024 y=768 d=16 pages=9 01.134: mode=119 x=1280 y=1024 d=16 pages=5 01.135: mode=11a x=1280 y=1024 d=16 pages=5 01.135: mode=10d x=320 y=200 d=16 pages=127 01.135: mode=10e x=320 y=200 d=16 pages=127 01.135: mode=120 x=320 y=200 d=32 pages=63 01.136: mode=193 x=320 y=240 d=8 pages=127 01.136: mode=195 x=320 y=240 d=16 pages=84 01.136: mode=196 x=320 y=240 d=32 pages=50 01.136: mode=1b3 x=512 y=384 d=8 pages=63 01.137: mode=1b5 x=512 y=384 d=16 pages=35 01.137: mode=1b6 x=512 y=384 d=32 pages=18 01.137: mode=1c3 x=640 y=350 d=8 pages=63 01.137: mode=1c5 x=640 y=350 d=16 pages=35 01.138: mode=1c6 x=640 y=350 d=32 pages=17 01.138: mode=133 x=720 y=400 d=8 pages=50 01.138: mode=135 x=720 y=400 d=16 pages=27 01.138: mode=136 x=720 y=400 d=32 pages=13 01.139: mode=153 x=1152 y=864 d=8 pages=15 01.139: mode=155 x=1152 y=864 d=16 pages=7 01.139: mode=156 x=1152 y=864 d=32 pages=3 01.139: mode=163 x=1280 y=960 d=8 pages=12 01.140: mode=165 x=1280 y=960 d=16 pages=5 01.140: mode=166 x=1280 y=960 d=32 pages=2 01.140: mode=121 x=640 y=480 d=32 pages=12 01.140: mode=122 x=800 y=600 d=32 pages=7 01.140: mode=123 x=1024 y=768 d=32 pages=4 01.140: mode=124 x=1280 y=1024 d=32 pages=2 01.141: mode=143 x=1400 y=1050 d=8 pages=10 01.141: mode=145 x=1400 y=1050 d=16 pages=4 01.141: mode=146 x=1400 y=1050 d=32 pages=1 01.142: mode=173 x=1600 y=1200 d=8 pages=7 01.142: mode=175 x=1600 y=1200 d=16 pages=3 01.142: mode=176 x=1600 y=1200 d=32 pages=1 01.142: mode=183 x=1792 y=1344 d=8 pages=5 01.143: mode=185 x=1792 y=1344 d=16 pages=2 01.143: mode=186 x=1792 y=1344 d=32 pages=1 01.143: mode=1d3 x=1856 y=1392 d=8 pages=5 01.143: mode=1d5 x=1856 y=1392 d=16 pages=2 01.144: mode=1d6 x=1856 y=1392 d=32 pages=1 01.144: mode=1e3 x=1920 y=1440 d=8 pages=4 01.144: mode=1e5 x=1920 y=1440 d=16 pages=2 01.144: mode=1e6 x=1920 y=1440 d=32 pages=1
==================== diff =================
diff --git a/src/bootsplash.c b/src/bootsplash.c index bd91102..4f94b08 100644 --- a/src/bootsplash.c +++ b/src/bootsplash.c @@ -34,6 +34,62 @@ call16_int10(struct bregs *br) * VGA text / graphics console ****************************************************************/
+static void +dump_videomodes(void) +{ + struct vbe_info *vesa_info = malloc_tmplow(sizeof(*vesa_info)); + struct vbe_mode_info *mode_info = malloc_tmplow(sizeof(*mode_info)); + if (!vesa_info || !mode_info) { + warn_noalloc(); + goto done; + } + + /* Check whether we have a VESA 2.0 compliant BIOS */ + memset(vesa_info, 0, sizeof(struct vbe_info)); + vesa_info->signature = VBE2_SIGNATURE; + struct bregs br; + memset(&br, 0, sizeof(br)); + br.ax = 0x4f00; + br.di = FLATPTR_TO_OFFSET(vesa_info); + br.es = FLATPTR_TO_SEG(vesa_info); + call16_int10(&br); + if (vesa_info->signature != VESA_SIGNATURE) { + dprintf(1,"No VBE2 found.\n"); + goto done; + } + + /* Print some debugging information about our card. */ + char *vendor = SEGOFF_TO_FLATPTR(vesa_info->oem_vendor_string); + char *product = SEGOFF_TO_FLATPTR(vesa_info->oem_product_string); + dprintf(1, "VESA %d.%d\nVENDOR: %s\nPRODUCT: %s mem=%d\n", + vesa_info->version>>8, vesa_info->version&0xff, + vendor, product, vesa_info->total_memory * 64*1024); + + u16 *videomodes = SEGOFF_TO_FLATPTR(vesa_info->video_mode); + for (;; videomodes++) { + u16 videomode = *videomodes; + if (videomode == 0xffff) + return; + struct bregs br; + memset(&br, 0, sizeof(br)); + br.ax = 0x4f01; + br.cx = videomode; + br.di = FLATPTR_TO_OFFSET(mode_info); + br.es = FLATPTR_TO_SEG(mode_info); + call16_int10(&br); + if (br.ax != 0x4f) { + dprintf(1, "get_mode failed.\n"); + continue; + } + dprintf(1, "mode=%02x x=%d y=%d d=%d pages=%d\n", videomode + , mode_info->xres, mode_info->yres, mode_info->bits_per_pixel + , mode_info->pages); + } +done: + free(vesa_info); + free(mode_info); +} + void enable_vga_console(void) { @@ -48,6 +104,7 @@ enable_vga_console(void) // Write to screen. printf("SeaBIOS (version %s)\n", VERSION); display_uuid(); + dump_videomodes(); }
static int
Hi,
The existing code matches the original bochs vbe code and matches what the spec says. I'm surprised win8 would require such an odd value.
I'm surprised too, but that bit really makes the difference.
When reporting the number of pages fitting into memory win8 is fixed at 1024x748, when reporting a single page only win8 offers the whole range of vesa resolutions supported by the vesa bios ...
I have no idea why that is the case though, maybe the root cause it something different and this patch just papers over it.
FYI, I ran some tests on qemu and my e350m1 (with an AMD vgabios). Interestingly, it doesn't look like AMD ever reports a "pages=0".
Retested, figured with seavgabios win8 modeswitching works just fine, even without the patch. /me is puzzled, I'm sure I've tried that before and it didn't work.
dprintf(1, "mode=%02x x=%d y=%d d=%d pages=%d\n", videomode
, mode_info->xres, mode_info->yres, mode_info->bits_per_pixel
, mode_info->pages);
While wading through the source I've noticed mode_info has not only "pages", but also "linear_pages" and "bank_pages" fields (new for vbe3). seavgabios doesn't set them. Should it?
cheers, Gerd
On Wed, Sep 11, 2013 at 12:45:27PM +0200, Gerd Hoffmann wrote:
Retested, figured with seavgabios win8 modeswitching works just fine, even without the patch. /me is puzzled, I'm sure I've tried that before and it didn't work.
Okay, so no patch is necessary? I think it might be worthwhile to clamp the pages value to a number between 1-127 - see the patch I sent separately.
dprintf(1, "mode=%02x x=%d y=%d d=%d pages=%d\n", videomode
, mode_info->xres, mode_info->yres, mode_info->bits_per_pixel
, mode_info->pages);
While wading through the source I've noticed mode_info has not only "pages", but also "linear_pages" and "bank_pages" fields (new for vbe3). seavgabios doesn't set them. Should it?
I don't know. The VBE3 support is fairly limited - if the spec calls for it then I'd say it makes sense to fill it in. In practice, I suspect very few programs (if any) care what VBE reports.
-Kevin