Skip to contentSkip to conversation

Add VGA acceleration support forcirrus logic device model

Xen-changelog Jiang, Yunhong 1 participant 1 message Sep 25, 2005

lore
Share & tools
lore
#0 lore raw
Quoted 20 lines · Hollis Blanchard

I didn't review the whole patch, but some comments from a quick skim:

Quoted 16 lines · Xen patchbot -unstable

# HG changeset patch
# User [email protected]
# Node ID 8a757f283fb8013e220bd89848d78fdbd2362195 # Parent 94c6fc048d8ed548b552be415f23c68162f30ab0 Add VGA acceleration support for cirrus logic device model

diff -r 94c6fc048d8e -r 8a757f283fb8 tools/ioemu/hw/cirrus_vga.c

tools/ioemu/hw/cirrus_vga.c +0 -0
 -2447,6 +2449,10 @@ {
     unsigned mode;
Quoted 7 lines
Quoted 3 lines

+ extern void unset_vram_mapping(unsigned long addr, unsigned
long end); + extern void set_vram_mapping(unsigned long addr,
unsigned long end); + extern int vga_accelerate;

It would be better style to move this stuff into a header. All too often function prototypes are changed without finding and updating all the local declarations.

I will change it later. Thanks very much.

Quoted 16 lines
Quoted 16 lines
     if ((s->sr[0x17] & 0x44) == 0x44) {
         goto generic_io;
     } else if (s->cirrus_srcptr != s->cirrus_srcptr_end) { @@
     -2454,17 +2460,21 @@ } else {
tools/ioemu/hw/cirrus_vga.c +3 -6
 	if ((s->gr[0x0B] & 0x14) == 0x14) {
             goto generic_io;
-	} else if (s->gr[0x0B] & 0x02) {
-            goto generic_io;
-        }
-
-	mode = s->gr[0x05] & 0x7;
-	if (mode < 4 || mode > 5 || ((s->gr[0x0B] & 0x4) == 0)) {
+    } else if (s->gr[0x0B] & 0x02) {
+        goto generic_io;
+    }
Quoted 8 lines
Quoted 6 lines
tools/ioemu/hw/cirrus_vga.c +4 -0
+
+    mode = s->gr[0x05] & 0x7;
+    if (mode < 4 || mode > 5 || ((s->gr[0x0B] & 0x4) == 0)) {
+            if (vga_accelerate && s->cirrus_lfb_addr &&

s->cirrus_lfb_end) + set_vram_mapping(s->cirrus_lfb_addr, s->cirrus_lfb_end);

That's an awful lot of magic numbers. Some #defines please?

Thanks for your suggestion very much, but I think it will not be some #define just for this part, but a totoally clean for the whole cirrus_vga.c/vga.c, because too much bit operation for vga code and all of them are hardcoded. ( I dind't change the code, but just a few tabs->space changes) . Just concern that if we change the DM code too much, it will cause difficult when updating to newer qemu code (maybe I should left this code unchanged, although it makes the patch has a bit problem on format).

Quoted 15 lines

tools/ioemu/hw/vga.c

Quoted 12 lines

diff -r 94c6fc048d8e -r 8a757f283fb8 tools/ioemu/hw/vga.c

tools/ioemu/hw/vga.c +2 -0
             +1568,8 @@ s->graphic_mode = graphic_mode;
             full_update = 1;
         }
+
+        full_update = 1;
         switch(graphic_mode) {
         case GMODE_TEXT:
             vga_draw_text(s, full_update);

That "full_update" stuff should be removed entirely, and vga_draw_*() functions updated to match. It's worthless code now.

No, this full_update is needed here, before we provide a better solution for it.
The reason is, currently, the vga_draw_*() will only update those field that has changed since last refresh. However, when we add the vga acceleration, the framebuffer is accessed by guest directly, the DM will have no idea what part is changed, so the DM need to update every time. One direct result whithout this change is, when windows, sometimes the window will refresh just 1/3 screen.
Another solution is to using the shadow page to notify the DM what part is changed. It is much more complex, and is still on way. But this small change also provide accepetable, or it can be called good user experience :-)

Quoted 10 lines

tools/ioemu/hw/vga.c line 1855

Quoted 8 lines
tools/ioemu/hw/vga.c +1 -0
@@ -1848,6 +1850,7 @@
                      unsigned long vga_ram_offset, int
     vga_ram_size)  { int i, j, v, b;
+    extern void* shared_vram;
 
     for(i = 0;i < 256; i++) {
         v = 0;

Again, belongs in a header file...