[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 5/8] vga: optimize horizontal pel panning in 256-color modes
From: |
Paolo Bonzini |
Subject: |
[PATCH 5/8] vga: optimize horizontal pel panning in 256-color modes |
Date: |
Sun, 31 Dec 2023 10:39:15 +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 | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/hw/display/vga-helpers.h b/hw/display/vga-helpers.h
index 29933562c45..60ddb27d946 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;
--
2.43.0
- [PATCH 0/8] vga: improve emulation fidelity, Paolo Bonzini, 2023/12/31
- [PATCH 3/8] vga: mask addresses in non-VESA modes to 256k, Paolo Bonzini, 2023/12/31
- [PATCH 1/8] vga: remove unused macros, Paolo Bonzini, 2023/12/31
- [PATCH 7/8] vga: use latches in odd/even mode too, Paolo Bonzini, 2023/12/31
- [PATCH 2/8] vga: introduce VGADisplayParams, Paolo Bonzini, 2023/12/31
- [PATCH 4/8] vga: implement horizontal pel panning in graphics modes, Paolo Bonzini, 2023/12/31
- [PATCH 5/8] vga: optimize horizontal pel panning in 256-color modes,
Paolo Bonzini <=
- [PATCH 6/8] vga: reindent memory access code, Paolo Bonzini, 2023/12/31
- [PATCH 8/8] vga: sort-of implement word and double-word access modes, Paolo Bonzini, 2023/12/31