On 03/10/2024, 14:05, "Daniel P. Berrangé" <berra...@redhat.com> wrote:

> The QEMU VNC code has logic which rounds up display sizes to a multiple
> of 16:
>
>  static int vnc_width(VncDisplay *vd)
>  {
>      return MIN(VNC_MAX_WIDTH, ROUND_UP(surface_width(vd->ds),
>                                         VNC_DIRTY_PIXELS_PER_BIT));
>  }
>
> Separately, it also tracks the "true" width, but untangling which it
> uses where & the implications is hard to do. ie i'm not going to try
> to explain it further, as I don't know what's going on without spending
> some hours to trace through it all :-)

On a hunch I revisited Frediano's patch (mentioned in the original post). I had 
focused on the change to the VNC functions but he also had a small change to 
the masking of the display width in the VGA code. I've applied a similar change 
and … I now get a proper display!

Patch is simply

diff --git a/hw/display/vga.c b/hw/display/vga.c
index 892fedc8dc..ea659e2812 100644
--- a/hw/display/vga.c
+++ b/hw/display/vga.c
@@ -581,14 +581,14 @@ static void vbe_fixup_regs(VGACommonState *s)
     }

     /* check width */
-    r[VBE_DISPI_INDEX_XRES] &= ~7u;
+    r[VBE_DISPI_INDEX_XRES] &= ~1u;
     if (r[VBE_DISPI_INDEX_XRES] == 0) {
         r[VBE_DISPI_INDEX_XRES] = 8;
     }
     if (r[VBE_DISPI_INDEX_XRES] > VBE_DISPI_MAX_XRES) {
         r[VBE_DISPI_INDEX_XRES] = VBE_DISPI_MAX_XRES;
     }
-    r[VBE_DISPI_INDEX_VIRT_WIDTH] &= ~7u;
+    r[VBE_DISPI_INDEX_VIRT_WIDTH] &= ~1u;
     if (r[VBE_DISPI_INDEX_VIRT_WIDTH] > VBE_DISPI_MAX_XRES) {
         r[VBE_DISPI_INDEX_VIRT_WIDTH] = VBE_DISPI_MAX_XRES;
     }

I don't know how functional correct this is.
Regards
Simon

Reply via email to