qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: Korneliusz Osmenda <korneliuszo@gmail.com>
Subject: [PULL 2/6] vga: fix incorrect line height in 640x200x2 mode
Date: Fri, 29 Jul 2022 17:04:34 +0200	[thread overview]
Message-ID: <20220729150438.20293-3-pbonzini@redhat.com> (raw)
In-Reply-To: <20220729150438.20293-1-pbonzini@redhat.com>

When in CGA modes, QEMU wants to ignore the maximum scan field (bits 0..4) of
the maximum scan length register in the CRTC.  It is not clear why this is
needed---for example, Bochs ignores bit 7 instead.  The issue is that the
CGA modes are not detected correctly, and in particular mode 6 results in
multi_scan==3 according to how SeaBIOS programs it.  The right way to check
for CGA graphics modes is to check whether bit 13 of the address is special
cased by the CRT controller to achieve line interleaving, i.e. whether bit 0
of the CRTC mode control register is clear.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1020
Reported-by: Korneliusz Osmenda <korneliuszo@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/display/vga.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/hw/display/vga.c b/hw/display/vga.c
index 5dca2d1528..50ecb1ad02 100644
--- a/hw/display/vga.c
+++ b/hw/display/vga.c
@@ -1514,9 +1514,10 @@ static void vga_draw_graphic(VGACommonState *s, int full_update)
         force_shadow = true;
     }
 
+    /* bits 5-6: 0 = 16-color mode, 1 = 4-color mode, 2 = 256-color mode.  */
     shift_control = (s->gr[VGA_GFX_MODE] >> 5) & 3;
     double_scan = (s->cr[VGA_CRTC_MAX_SCAN] >> 7);
-    if (shift_control != 1) {
+    if (s->cr[VGA_CRTC_MODE] & 1) {
         multi_scan = (((s->cr[VGA_CRTC_MAX_SCAN] & 0x1f) + 1) << double_scan)
             - 1;
     } else {
-- 
2.36.1




  parent reply	other threads:[~2022-07-29 15:07 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-29 15:04 [PULL 0/6] Fixes for QEMU 7.1-rc1 Paolo Bonzini
2022-07-29 15:04 ` [PULL 1/6] ui: dbus-display requires CONFIG_GBM Paolo Bonzini
2022-07-29 15:04 ` Paolo Bonzini [this message]
2022-07-29 15:04 ` [PULL 3/6] stubs: update replay-tools to match replay.h types Paolo Bonzini
2022-07-29 15:04 ` [PULL 4/6] configure: Fix ppc container_cross_cc substitution Paolo Bonzini
2022-07-29 15:04 ` [PULL 5/6] kvm: don't use perror() without useful errno Paolo Bonzini
2022-07-29 15:04 ` [PULL 6/6] configure: pass correct cflags to container-based cross compilers Paolo Bonzini
2022-07-29 17:30 ` [PULL 0/6] Fixes for QEMU 7.1-rc1 Richard Henderson

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=20220729150438.20293-3-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=korneliuszo@gmail.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).