Skip to contentSkip to conversation

cirrusfb: proper "Attribute Controller Toggle Readback" register behaviour

Qemu-devel Marcelo Tosatti 2 participants 2 messages May 7, 2008 – May 8, 2008

lore
Share & tools
lore
#0 lore raw

The cirrusfb Linux driver uses the toggle readback register to determine whether to flip 0xC30 to data/address mode.

Without proper implementation the VGA mode will be erroneously set to blank resulting in crashes when starting BITBLT.

3d4h index 24h (R): Attribute Controller Toggle Readback Register
bit 7 If set the Attribute Controller will next access a data register, if
clear it'll access the index register

qemu/hw/cirrus_vga.c +3 -1
index e14ec35..5baac2f 100644
@@ -1606,13 +1606,15 @@ cirrus_hook_read_cr(CirrusVGAState * s, unsigned reg_index, int *reg_value)
     case 0x17:			// Standard VGA
     case 0x18:			// Standard VGA
 	return CIRRUS_HOOK_NOT_HANDLED;
+    case 0x24:			// Attribute Controller Toggle Readback (R)
+        *reg_value = (s->ar_flip_flop << 7);
+        break;
     case 0x19:			// Interlace End
     case 0x1a:			// Miscellaneous Control
     case 0x1b:			// Extended Display Control
     case 0x1c:			// Sync Adjust and Genlock
     case 0x1d:			// Overlay Extended Control
     case 0x22:			// Graphics Data Latches Readback (R)
-    case 0x24:			// Attribute Controller Toggle Readback (R)
     case 0x25:			// Part Status
     case 0x27:			// Part ID (R)
 	*reg_value = s->cr[reg_index];
#1 lore raw

Thanks Marcelo,
here is the koji scratch build of F9 kvm RPM with your patch included:
http://koji.fedoraproject.org/koji/taskinfo?taskID=600393

This fixes vnc console blanking after cirrusfb kmod is loaded. But we still have already reported edge-case:
after cirrusfb is loaded, vbetool post or vbetool vgamode produces:

Program received signal SIGFPE, Arithmetic exception.

[Switching to Thread 0x964a3b90 (LWP 3608)]

0x080987e4 in cirrus_bitblt_start (s=0xa7811e4)

at /usr/src/debug/kvm-65/qemu/hw/cirrus_vga.c:715

715 sx = (src % (width * depth)) / depth;