WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH][QEMU] Clear bios framebuffer with minimal writes

To: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH][QEMU] Clear bios framebuffer with minimal writes
From: Ben Guthro <bguthro@xxxxxxxxxxxxxxx>
Date: Wed, 24 Oct 2007 17:04:03 -0400
Cc: Gary Grebus <ggrebus@xxxxxxxxxxxxxxx>
Delivery-date: Wed, 24 Oct 2007 14:20:53 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird 2.0.0.5 (X11/20070719)
Support for VGA bios to clear framebuffer with minimal writes.

Signed-off-by: Ben Guthro <bguthro@xxxxxxxxxxxxxx>
Signed-off-by: Gary Grebus <ggrebus@xxxxxxxxxxxxxxx>

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,
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel