Skip to contentSkip to conversation

drm/bochs: fix blanking

PATCH In review Gerd Hoffmann 2 participants 2 messages Sep 6, 2022 – Sep 7, 2022

Subsystems (4)
lore
Share & tools
lore

Gerd Hoffmann

author maintainer
#0 lore raw

PATCH 1/1 drm/bochs: fix blanking

VGA_IS1_RC is the color mode register (VGA_IS1_RM the one for monochrome mode, note C vs. M at the end). So when using VGA_IS1_RC make sure the vga device is actually in color mode and set the corresponding bit in the misc register.

Reproducible when booting VMs in UEFI mode with some edk2 versions (edk2 fix is on the way too). Doesn't happen in BIOS mode because in that case the vgabios already flips the bit.

Fixes 250e743915d4 ("drm/bochs: Add screen blanking support")
---
 drivers/gpu/drm/tiny/bochs.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/tiny/bochs.c +2 -0
index 08de13774862..a51262289aef 100644
@@ -309,6 +309,8 @@ static void bochs_hw_fini(struct drm_device *dev)
 static void bochs_hw_blank(struct bochs_device *bochs, bool blank)
 {
 	DRM_DEBUG_DRIVER("hw_blank %d\n", blank);
+	/* enable color bit (so VGA_IS1_RC access works) */
+	bochs_vga_writeb(bochs, VGA_MIS_W, VGA_MIS_COLOR);
 	/* discard ar_flip_flop */
 	(void)bochs_vga_readb(bochs, VGA_IS1_RC);
 	/* blank or unblank; we need only update index and set 0x20 */
Signature · 1 line
2.37.3
maintainer Acked-by on v1 1/1
#1 lore raw

Am 06.09.22 um 16:29 schrieb Gerd Hoffmann:

Quoted 11 lines

VGA_IS1_RC is the color mode register (VGA_IS1_RM the one for monochrome mode, note C vs. M at the end). So when using VGA_IS1_RC make sure the vga device is actually in color mode and set the corresponding bit in the misc register.

Reproducible when booting VMs in UEFI mode with some edk2 versions (edk2 fix is on the way too). Doesn't happen in BIOS mode because in that case the vgabios already flips the bit.

Fixes 250e743915d4 ("drm/bochs: Add screen blanking support")
Quoted 17 lines
---
  drivers/gpu/drm/tiny/bochs.c | 2 ++
  1 file changed, 2 insertions(+)
drivers/gpu/drm/tiny/bochs.c +2 -0
index 08de13774862..a51262289aef 100644
@@ -309,6 +309,8 @@ static void bochs_hw_fini(struct drm_device *dev)
  static void bochs_hw_blank(struct bochs_device *bochs, bool blank)
  {
  	DRM_DEBUG_DRIVER("hw_blank %d\n", blank);
+	/* enable color bit (so VGA_IS1_RC access works) */
+	bochs_vga_writeb(bochs, VGA_MIS_W, VGA_MIS_COLOR);
  	/* discard ar_flip_flop */
  	(void)bochs_vga_readb(bochs, VGA_IS1_RC);
  	/* blank or unblank; we need only update index and set 0x20 */
Signature · 6 lines
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev