[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 19/63] vga: optimize computation of dirty memory region
|
From: |
Paolo Bonzini |
|
Subject: |
[PULL 19/63] vga: optimize computation of dirty memory region |
|
Date: |
Tue, 23 Apr 2024 17:09:07 +0200 |
The depth == 0 and depth == 15 have to be special cased because
width * depth / 8 does not provide the correct scanline length.
However, thanks to the recent reorganization of vga_draw_graphic()
the correct value of VRAM bits per pixel is available in "bits".
Use it (via the same "bwidth" computation that is used later in
the function), thus restricting the slow path to the wraparound case.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
hw/display/vga.c | 24 +++++++-----------------
1 file changed, 7 insertions(+), 17 deletions(-)
diff --git a/hw/display/vga.c b/hw/display/vga.c
index 77f59e8c113..77d709a3d69 100644
--- a/hw/display/vga.c
+++ b/hw/display/vga.c
@@ -1574,22 +1574,16 @@ static void vga_draw_graphic(VGACommonState *s, int
full_update)
/* Horizontal pel panning bit 3 is only used in text mode. */
hpel = bits <= 8 ? s->params.hpel & 7 : 0;
+ bwidth = DIV_ROUND_UP(width * bits, 8); /* scanline length */
+ if (hpel) {
+ bwidth += 4;
+ }
region_start = (s->params.start_addr * 4);
- region_end = region_start + (ram_addr_t)s->params.line_offset * height;
- region_end += width * depth / 8; /* scanline length */
- region_end -= s->params.line_offset;
- if (hpel) {
- region_end += 4;
- }
- if (region_end > s->vbe_size || depth == 0 || depth == 15) {
+ region_end = region_start + (ram_addr_t)s->params.line_offset * (height -
1) + bwidth;
+ if (region_end > s->vbe_size) {
/*
- * We land here on:
- * - wraps around (can happen with cirrus vbe modes)
- * - depth == 0 (256 color palette video mode)
- * - depth == 15
- *
- * Take the safe and slow route:
+ * On wrap around take the safe and slow route:
* - create a dirty bitmap snapshot for all vga memory.
* - force shadowing (so all vga memory access goes
* through vga_read_*() helpers).
@@ -1667,10 +1661,6 @@ static void vga_draw_graphic(VGACommonState *s, int
full_update)
s->params.line_compare, sr(s, VGA_SEQ_CLOCK_MODE));
#endif
addr1 = (s->params.start_addr * 4);
- bwidth = DIV_ROUND_UP(width * bits, 8);
- if (hpel) {
- bwidth += 4;
- }
y_start = -1;
d = surface_data(surface);
linesize = surface_stride(surface);
--
2.44.0
- [PULL 05/63] yank: only build if needed, (continued)
- [PULL 05/63] yank: only build if needed, Paolo Bonzini, 2024/04/23
- [PULL 07/63] hw/core: Move system emulation files to system_ss, Paolo Bonzini, 2024/04/23
- [PULL 08/63] hw: Include minimal source set in user emulation build, Paolo Bonzini, 2024/04/23
- [PULL 12/63] semihosting: move stubs out of stubs/, Paolo Bonzini, 2024/04/23
- [PULL 13/63] ramfb: move stubs out of stubs/, Paolo Bonzini, 2024/04/23
- [PULL 14/63] memory-device: move stubs out of stubs/, Paolo Bonzini, 2024/04/23
- [PULL 22/63] hw: Add compat machines for 9.1, Paolo Bonzini, 2024/04/23
- [PULL 27/63] target/i386: Add new CPU model SierraForest, Paolo Bonzini, 2024/04/23
- [PULL 33/63] i386/sev: Switch to use confidential_guest_kvm_init(), Paolo Bonzini, 2024/04/23
- [PULL 32/63] confidential guest support: Add kvm_init() and kvm_reset() in class, Paolo Bonzini, 2024/04/23
- [PULL 19/63] vga: optimize computation of dirty memory region,
Paolo Bonzini <=
- [PULL 17/63] stubs: include stubs only if needed, Paolo Bonzini, 2024/04/23
- [PULL 21/63] kvm: use configs/ definition to conditionalize debug support, Paolo Bonzini, 2024/04/23
- [PULL 34/63] ppc/pef: switch to use confidential_guest_kvm_init/reset(), Paolo Bonzini, 2024/04/23
- [PULL 10/63] hw/usb: move stubs out of stubs/, Paolo Bonzini, 2024/04/23
- [PULL 11/63] hw/virtio: move stubs out of stubs/, Paolo Bonzini, 2024/04/23
- [PULL 29/63] pci-host/q35: Move PAM initialization above SMRAM initialization, Paolo Bonzini, 2024/04/23
- [PULL 36/63] scripts/update-linux-headers: Add setup_data.h to import list, Paolo Bonzini, 2024/04/23
- [PULL 56/63] kvm/tdx: Don't complain when converting vMMIO region to shared, Paolo Bonzini, 2024/04/23
- [PULL 58/63] target/i386/host-cpu: Consolidate the use of warn_report_once(), Paolo Bonzini, 2024/04/23
- [PULL 41/63] KVM: remove kvm_arch_cpu_check_are_resettable, Paolo Bonzini, 2024/04/23