aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2014-12-29 14:46:59 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2024-01-18 10:43:14 +0100
commit4d6c310502a4d825ae27a3bf8905e70447d74671 (patch)
tree78c09e66e36895a39e7324284cf7ffb126ce05de
parent973a724eb006f674301a0c45f34b3c08dee0fe49 (diff)
downloadqemu-4d6c310502a4d825ae27a3bf8905e70447d74671.zip
qemu-4d6c310502a4d825ae27a3bf8905e70447d74671.tar.gz
qemu-4d6c310502a4d825ae27a3bf8905e70447d74671.tar.bz2
vga: optimize horizontal pel panning in 256-color modes
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>
-rw-r--r--hw/display/vga-helpers.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/hw/display/vga-helpers.h b/hw/display/vga-helpers.h
index 2993356..2029b61 100644
--- a/hw/display/vga-helpers.h
+++ b/hw/display/vga-helpers.h
@@ -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;