vga: fix incorrect line height in 640x200x2 mode
commit37e7b86766244b62a406747bb78e049390d0b528
authorPaolo Bonzini <pbonzini@redhat.com>
Thu, 28 Jul 2022 13:32:18 +0000 (28 15:32 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 28 Jul 2022 13:36:17 +0000 (28 15:36 +0200)
tree3e313037939504902220733f6726ecb6e3d42eae
parentd82b11f69953cf15cee819bcf02dfd87325980a9
vga: fix incorrect line height in 640x200x2 mode

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