All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH][QEMU] Clear bios framebuffer with minimal writes
@ 2007-10-24 21:04 Ben Guthro
  2007-10-25 14:20 ` Keir Fraser
  0 siblings, 1 reply; 6+ messages in thread
From: Ben Guthro @ 2007-10-24 21:04 UTC (permalink / raw)
  To: xen-devel; +Cc: Gary Grebus

[-- Attachment #1: Type: text/plain, Size: 169 bytes --]

Support for VGA bios to clear framebuffer with minimal writes.

Signed-off-by: Ben Guthro <bguthro@virtualron.com>
Signed-off-by: Gary Grebus <ggrebus@virtualiron.com>


[-- Attachment #2: qemu-vga-fb-clear.patch --]
[-- Type: text/x-patch, Size: 3584 bytes --]

diff -r abca07dac924 tools/firmware/hvmloader/Makefile
--- a/tools/firmware/hvmloader/Makefile	Tue Aug 07 09:24:25 2007 -0400
+++ b/tools/firmware/hvmloader/Makefile	Tue Aug 07 09:27:14 2007 -0400
@@ -51,10 +51,10 @@ acpi/acpi.a:
 acpi/acpi.a:
 	$(MAKE) -C acpi
 
-roms.h:	../rombios/BIOS-bochs-latest ../vgabios/VGABIOS-lgpl-latest.bin ../vgabios/VGABIOS-lgpl-latest.cirrus.bin ../vmxassist/vmxassist.bin ../etherboot/eb-rtl8139.zrom.h
+roms.h:	../rombios/BIOS-bochs-latest ../vgabios/VGABIOS-lgpl-latest$(DEBUG_ROM).bin ../vgabios/VGABIOS-lgpl-latest.cirrus$(DEBUG_ROM).bin ../vmxassist/vmxassist.bin ../etherboot/eb-rtl8139.zrom.h
 	sh ./mkhex rombios ../rombios/BIOS-bochs-latest > roms.h
-	sh ./mkhex vgabios_stdvga ../vgabios/VGABIOS-lgpl-latest.bin >> roms.h
-	sh ./mkhex vgabios_cirrusvga ../vgabios/VGABIOS-lgpl-latest.cirrus.bin >> roms.h
+	sh ./mkhex vgabios_stdvga ../vgabios/VGABIOS-lgpl-latest$(DEBUG_ROM).bin >> roms.h
+	sh ./mkhex vgabios_cirrusvga ../vgabios/VGABIOS-lgpl-latest.cirrus$(DEBUG_ROM).bin >> roms.h
 	sh ./mkhex vmxassist ../vmxassist/vmxassist.bin >> roms.h
 	cat ../etherboot/eb-rtl8139.zrom.h >> roms.h
 
diff -r abca07dac924 tools/firmware/vgabios/clext.c
--- a/tools/firmware/vgabios/clext.c	Tue Aug 07 09:24:25 2007 -0400
+++ b/tools/firmware/vgabios/clext.c	Tue Aug 07 09:24:25 2007 -0400
@@ -1489,19 +1489,31 @@ cirrus_clear_vram_1:
   mov dx, #0x3ce
   out dx, ax
   push ax
-  mov cx, #0xa000
-  mov es, cx
-  xor di, di
+
+;; Windows Vista appears to be emulating this sequence as part of changing 
+;; screen resolution, but it generates 4096 writes per iteration.
+;; Instead, use a magic register sequence to write the whole bank.
+;; to avoid 
+;;mov cx, #0xa000
+;;mov es, cx
+;;xor di, di
+;;mov ax, si
+;;mov cx, #8192
+;;cld
+;;rep
+;;    stosw
   mov ax, si
-  mov cx, #8192
-  cld
-  rep
-      stosw
+  shl ax, #8
+  mov al, #0xfe
+  out dx, ax	;; Low byte of value to be written to the bank
+  mov ax, si
+  mov al, #0xff  
+  out dx, ax    ;; High byte and trigger the write
+
   pop ax
   inc ah
   cmp ah, bl
   jne cirrus_clear_vram_1
-
   pop es
   popa
   ret
@@ -1628,6 +1640,6 @@ static void cirrus_debugmsg(DI, SI, BP, 
   Bit16u DI, SI, BP, SP, BX, DX, CX, AX, ES, DS, FLAGS;
 {
  if((GET_AH()!=0x0E)&&(GET_AH()!=0x02)&&(GET_AH()!=0x09)&&(AX!=0x4F05))
-  printf("vgabios call ah%02x al%02x bx%04x cx%04x dx%04x\n",GET_AH(),GET_AL(),BX,CX,DX);
+  printf("cirrusbios call ah%02x al%02x bx%04x cx%04x dx%04x\n",GET_AH(),GET_AL(),BX,CX,DX);
 }
 #endif
diff -r abca07dac924 tools/ioemu/hw/cirrus_vga.c
--- a/tools/ioemu/hw/cirrus_vga.c	Tue Aug 07 09:24:25 2007 -0400
+++ b/tools/ioemu/hw/cirrus_vga.c	Tue Aug 07 09:24:25 2007 -0400
@@ -294,6 +294,7 @@ void *shared_vram;
 
 static void cirrus_bitblt_reset(CirrusVGAState *s);
 static void cirrus_update_memory_access(CirrusVGAState *s);
+static void cirrus_vga_mem_writew(void *opaque, target_phys_addr_t addr, uint32_t val);
 
 /***************************************
  *
@@ -1497,6 +1498,17 @@ cirrus_hook_write_gr(CirrusVGAState * s,
     case 0x31:			// BLT STATUS/START
 	cirrus_write_bitblt(s, reg_value);
 	break;
+
+	// Extension to allow BIOS to clear 16K VRAM bank in one operation
+    case 0xFE:
+	s->gr[reg_index] = reg_value;  // Lower byte of value to be written
+	break;
+    case 0xFF: {
+	target_phys_addr_t addr;
+	for (addr = 0xa0000; addr < 0xa4000; addr+=2)
+	    cirrus_vga_mem_writew(s, addr, (reg_value << 8) | s->gr[0xFE]);
+        }
+	break;
     default:
 #ifdef DEBUG_CIRRUS
 	printf("cirrus: outport gr_index %02x, gr_value %02x\n", reg_index,

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2007-10-30 17:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-24 21:04 [PATCH][QEMU] Clear bios framebuffer with minimal writes Ben Guthro
2007-10-25 14:20 ` Keir Fraser
2007-10-25 15:23   ` Gary Grebus
2007-10-25 15:34     ` Keir Fraser
2007-10-25 17:14       ` Gary Grebus
2007-10-30 17:52         ` Gary Grebus

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.