46 lines
1.9 KiB
Diff
46 lines
1.9 KiB
Diff
|
|
From d996226ded0190b96cce09169291cc696a390832 Mon Sep 17 00:00:00 2001
|
||
|
|
From: tangbinzy <tangbin_yewu@cmss.chinamobile.com>
|
||
|
|
Date: Wed, 13 Mar 2024 02:51:28 +0000
|
||
|
|
Subject: [PATCH] vga: fix incorrect line height in 640x200x2 mode mainline
|
||
|
|
inclusion commit 37e7b86766244b62a406747bb78e049390d0b528 category: bugfix
|
||
|
|
|
||
|
|
---------------------------------------------------------------
|
||
|
|
|
||
|
|
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>
|
||
|
|
|
||
|
|
Signed-off-by: tangbinzy <tangbin_yewu@cmss.chinamobile.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 9d1f66af40..33765148d9 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.27.0
|
||
|
|
|