[SeaBIOS] [PATCH 0/3] vgabios: three fixes for Cirrus chips

Christian Quante posted 3 patches 1 day, 18 hours ago
There is a newer version of this series
vgasrc/clext.c   | 55 +++++++++++++++++++++++++++++++-----------------
vgasrc/vbe.c     |  2 +-
vgasrc/vgahw.h   |  6 ++++++
vgasrc/vgautil.h |  1 +
4 files changed, 44 insertions(+), 20 deletions(-)
[SeaBIOS] [PATCH 0/3] vgabios: three fixes for Cirrus chips
Posted by Christian Quante 1 day, 18 hours ago
Three fixes for the Cirrus part of SeaVGABIOS (vgasrc/clext.c, and
vgasrc/vbe.c for the VBE window granularity), found while running OS/2
2.1 and OS/2 Warp 3 with their Cirrus display drivers on QEMU's
cirrus-vga and isa-cirrus-vga.

Patch 1: int 10h ax=12xxh bl=80h reads CR27 on each call.  In a DOS
session in a window under OS/2 2.1, before the Cirrus display driver is
installed, the VGA ports are virtualized, the read does not return the
chip id, and SeaVGABIOS reports 0xff (unknown chip).  The installer of
the OS/2 display driver package for the CL-GD5436/46 runs its chip check
(IDCHIP.EXE) in such a session and stops.  The patch reads CR27 once at
init time, as is done for the memory size.

Patch 2: SeaVGABIOS sets 16K bank granularity for the Cirrus modes.  In
my measurements, the Cirrus BIOS uses 4K for modes up to 1MB and 16K
above, for int 10h mode sets and VBE alike, and VBE 4f01h reports the
matching value.  The patch does the same.  Software that switches banks
by itself after a BIOS mode set depends on it; OS/2 2.1 draws its
desktop in bands without it.

Patch 3: SeaVGABIOS writes 0x04 to SR12 for every Cirrus mode, which
selects the 64x64 hardware cursor.  The Cirrus BIOS writes 0x00 to SR12
and SR13 on each mode set that I measured.  The WIN-OS/2 full screen
drivers of OS/2 Warp 3 load a 32x32 cursor and change only bit 0 and
bit 1 of SR12; with SeaVGABIOS the mouse pointer is a white block
instead of the arrow.  The patch writes 0x00 to SR12 and SR13 as the
Cirrus BIOS does.

Tests, each with SeaBIOS master (81ec9ec0) and with the patches,
SeaVGABIOS built with QEMU's config.vga-cirrus, on QEMU 11.1.2 or QEMU
master.  My pending Cirrus patches for QEMU do not touch the registers
that these tests read:

 - Register state after 13 mode sets (int 10h 5fh 5ch 60h 6dh 64h 74h,
   VBE 101h 103h 105h 107h 111h 114h 117h), read by a boot sector test:
   GR0B, the VBE granularity and GR9 after 4f05h are the same as with
   the CL-GD5436/46 PCI VGA BIOS 1.25 on cirrus-vga and with the
   CL-GD543x VGA BIOS 1.00a on isa-cirrus-vga.  SR12 and SR13 after the
   same mode sets and after int 10h 03h, 12h and 13h are the same too.
 - IDCHIP.EXE in an OS/2 2.1 DOS window, cirrus-vga: "Chiptype is
   0xff" -> "Chiptype is 0x39".
 - OS/2 2.1 "SVGA ON": SVGADATA.PMI records GR0B = 0x20 -> 0x00 for the
   256 color modes; the desktop at 1024x768 is in bands -> correct.
   OS/2 2.1 knows only the CL-GD5422, CL-GD5424 and CL-GD5426, so I ran
   this with a local QEMU build in which isa-cirrus-vga reports a
   CL-GD5426.  OS/2 also needs my QEMU patch "hw/display/cirrus_vga:
   read back the cursor position bits of SR10/SR11" to find the Cirrus
   chip; I will send it to qemu-devel soon.
 - OS/2 Warp 3 on isa-cirrus-vga, desktop 1024x768 with 65536 colors,
   WIN-OS/2 full screen, TCG: white 64x64 block -> arrow, which follows
   the mouse.  Warp 3 with its Cirrus driver also needs that QEMU patch.
 - Windows for Workgroups 3.11 with the CL-GD5436/46 driver for Windows
   3.1, and OS/2 2.1 with the CL-GD5436/46 display driver: both work
   with patches 1 and 2 (they use the linear frame buffer).  With patch
   3, Windows shows the same picture as without it.  Windows for
   Workgroups with this driver needs my Cirrus patches for QEMU (the
   first series is <20261018050643.9288-1-christian@quante.one>).
 - All nine vgabios configurations of QEMU build without new warnings.

The patches apply to rel-1.17.0 as well.

Christian Quante (3):
  clext: report the chip id that was read at init time
  clext: set the bank granularity per mode, as the Cirrus BIOS does
  clext: leave the hardware cursor off and at 32x32 after a mode set

 vgasrc/clext.c   | 55 +++++++++++++++++++++++++++++++-----------------
 vgasrc/vbe.c     |  2 +-
 vgasrc/vgahw.h   |  6 ++++++
 vgasrc/vgautil.h |  1 +
 4 files changed, 44 insertions(+), 20 deletions(-)

-- 
2.53.0

_______________________________________________
SeaBIOS mailing list -- seabios@seabios.org
To unsubscribe send an email to seabios-leave@seabios.org
[SeaBIOS] Re: [PATCH 0/3] vgabios: three fixes for Cirrus chips
Posted by Kevin O'Connor via SeaBIOS 1 day, 5 hours ago
On Sun, Oct 18, 2026 at 07:19:44AM +0200, Christian Quante wrote:
> Three fixes for the Cirrus part of SeaVGABIOS (vgasrc/clext.c, and
> vgasrc/vbe.c for the VBE window granularity), found while running OS/2
> 2.1 and OS/2 Warp 3 with their Cirrus display drivers on QEMU's
> cirrus-vga and isa-cirrus-vga.
[...]

Just as background information, as near as I can tell, the SeaVGABIOS
behavior described here is unchanged since the original port of the
"16bit gpl vgabios" code to SeaVGABIOS.

I'm not able to meaningfully review the original behavior nor the new
behavior implemented here.  That said, your description and testing
methodology all look good to me.  So, I'm okay with making these
changes.

I have a minor code comment on patch 2, and the other two patches seem
fine to me.

Thanks for working on this.
-Kevin

_______________________________________________
SeaBIOS mailing list -- seabios@seabios.org
To unsubscribe send an email to seabios-leave@seabios.org