]> git.proxmox.com Git - mirror_qemu.git/commitdiff
vga: optimize horizontal pel panning in 256-color modes
authorPaolo Bonzini <pbonzini@redhat.com>
Mon, 29 Dec 2014 13:46:59 +0000 (14:46 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 18 Jan 2024 09:43:14 +0000 (10:43 +0100)
Do not go through the panning buffer unless the address wraps in the middle
of the line.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
hw/display/vga-helpers.h

index 29933562c45037eb9fbb5bc2ac1ab8eb1ad6f4a2..2029b61791bf0749e8d9139aadc838d4f9c330c3 100644 (file)
@@ -265,6 +265,18 @@ static void *vga_draw_line8d2(VGACommonState *vga, uint8_t *d,
 
     palette = vga->last_palette;
     hpel = (hpel >> 1) & 3;
+
+    /* For 256 color modes, we can adjust the source address and write directly
+     * to the destination, even if horizontal pel panning is active.  However,
+     * the loop below assumes that the address does not wrap in the middle of a
+     * plane.  If that happens...
+     */
+    if (addr + (width >> 3) * 4 < VGA_VRAM_SIZE) {
+        addr += hpel * 4;
+        hpel = 0;
+    }
+
+    /* ... use the panning buffer as in planar modes.  */
     if (hpel) {
         width += 8;
         d = vga->panning_buf;