qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: kraxel@redhat.com
Subject: [PATCH 5/8] vga: optimize horizontal pel panning in 256-color modes
Date: Sun, 31 Dec 2023 10:39:15 +0100	[thread overview]
Message-ID: <20231231093918.239549-6-pbonzini@redhat.com> (raw)
In-Reply-To: <20231231093918.239549-1-pbonzini@redhat.com>

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



  parent reply	other threads:[~2023-12-31  9:40 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-31  9:39 [PATCH 0/8] vga: improve emulation fidelity Paolo Bonzini
2023-12-31  9:39 ` [PATCH 1/8] vga: remove unused macros Paolo Bonzini
2023-12-31 16:01   ` BALATON Zoltan
2024-01-02 15:13     ` Paolo Bonzini
2023-12-31  9:39 ` [PATCH 2/8] vga: introduce VGADisplayParams Paolo Bonzini
2024-01-02  9:59   ` Philippe Mathieu-Daudé
2023-12-31  9:39 ` [PATCH 3/8] vga: mask addresses in non-VESA modes to 256k Paolo Bonzini
2023-12-31 16:13   ` BALATON Zoltan
2023-12-31  9:39 ` [PATCH 4/8] vga: implement horizontal pel panning in graphics modes Paolo Bonzini
2023-12-31  9:39 ` Paolo Bonzini [this message]
2023-12-31 16:27   ` [PATCH 5/8] vga: optimize horizontal pel panning in 256-color modes BALATON Zoltan
2024-01-01 19:02     ` Paolo Bonzini
2024-01-02 11:45       ` BALATON Zoltan
2023-12-31  9:39 ` [PATCH 6/8] vga: reindent memory access code Paolo Bonzini
2024-01-02 10:00   ` Philippe Mathieu-Daudé
2023-12-31  9:39 ` [PATCH 7/8] vga: use latches in odd/even mode too Paolo Bonzini
2023-12-31  9:39 ` [PATCH 8/8] vga: sort-of implement word and double-word access modes Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231231093918.239549-6-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).