All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH][HVM] remove qemu shadow_vram patch for performance
@ 2007-03-15  3:30 Zhai, Edwin
  2007-03-15 10:50 ` Keir Fraser
  0 siblings, 1 reply; 14+ messages in thread
From: Zhai, Edwin @ 2007-03-15  3:30 UTC (permalink / raw)
  To: Ian Pratt; +Cc: xen-devel

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


remove qemu shadow_vram patch and force a whole screen update each time for 
performance.

W/O this patch, there is huge performance drop in HVM domain when adding other 
guest(windows or linux with xwindow).

shadow_vram_revert.patch - revert the shadow_vram patch
shadow_vram_force_update.patch - explictly redraw screen each time

Signed-off-by: Liang, Kan <kan.liang@intel.com>
Signed-off-by: Zhai, Edwin <edwin.zhai@intel.com>

-- 
best rgds,
edwin

[-- Attachment #2: shadow_vram_revert.patch --]
[-- Type: text/plain, Size: 4466 bytes --]

# HG changeset patch
# User Edwin Zhai <edwin.zhai@intel.com>
# Date 1173862864 -28800
# Node ID 6c4f61e2be6f8bf4a12d4044c97f47eb1d14b860
# Parent  3c38150de7fd4328a1d8e95b70b966d2ac481e12
revert shadow_vram patch

diff -r 3c38150de7fd -r 6c4f61e2be6f tools/ioemu/hw/vga.c
--- a/tools/ioemu/hw/vga.c	Tue Mar 13 15:55:37 2007 +0000
+++ b/tools/ioemu/hw/vga.c	Wed Mar 14 17:01:04 2007 +0800
@@ -1359,105 +1359,6 @@ void vga_invalidate_scanlines(VGAState *
     }
 }
 
-static inline int cmp_vram(VGAState *s, int offset, int n)
-{
-    long *vp, *sp;
-
-    if (s->vram_shadow == NULL)
-        return 1;
-    vp = (long *)(s->vram_ptr + offset);
-    sp = (long *)(s->vram_shadow + offset);
-    while ((n -= sizeof(*vp)) >= 0) {
-        if (*vp++ != *sp++) {
-            memcpy(sp - 1, vp - 1, n + sizeof(*vp));
-            return 1;
-        }
-    }
-    return 0;
-}
-
-#ifdef USE_SSE2
-
-#include <signal.h>
-#include <setjmp.h>
-#include <emmintrin.h>
-
-int sse2_ok = 1;
-
-static inline unsigned int cpuid_edx(unsigned int op)
-{
-    unsigned int eax, edx;
-
-#ifdef __x86_64__
-#define __bx "rbx"
-#else
-#define __bx "ebx"
-#endif
-    __asm__("push %%"__bx"; cpuid; pop %%"__bx
-            : "=a" (eax), "=d" (edx)
-            : "0" (op)
-            : "cx");
-#undef __bx
-
-    return edx;
-}
-
-jmp_buf sse_jbuf;
-
-void intr(int sig)
-{
-    sse2_ok = 0;
-    longjmp(sse_jbuf, 1);
-}
-
-void check_sse2(void)
-{
-    /* Check 1: What does CPUID say? */
-    if ((cpuid_edx(1) & 0x4000000) == 0) {
-        sse2_ok = 0;
-        return;
-    }
-
-    /* Check 2: Can we use SSE2 in anger? */
-    signal(SIGILL, intr);
-    if (setjmp(sse_jbuf) == 0)
-        __asm__("xorps %xmm0,%xmm0\n");
-}
-
-int vram_dirty(VGAState *s, int offset, int n)
-{
-    __m128i *sp, *vp;
-
-    if (s->vram_shadow == NULL)
-        return 1;
-    if (sse2_ok == 0)
-        return cmp_vram(s, offset, n);
-    vp = (__m128i *)(s->vram_ptr + offset);
-    sp = (__m128i *)(s->vram_shadow + offset);
-    while ((n -= sizeof(*vp)) >= 0) {
-        if (_mm_movemask_epi8(_mm_cmpeq_epi8(*sp, *vp)) != 0xffff) {
-            while (n >= 0) {
-                _mm_store_si128(sp++, _mm_load_si128(vp++));
-                n -= sizeof(*vp);
-            }
-            return 1;
-        }
-        sp++;
-        vp++;
-    }
-    return 0;
-}
-#else /* !USE_SSE2 */
-int vram_dirty(VGAState *s, int offset, int n)
-{
-    return cmp_vram(s, offset, n);
-}
-
-void check_sse2(void)
-{
-}
-#endif /* !USE_SSE2 */
-
 /* 
  * graphic modes
  */
@@ -1554,11 +1455,6 @@ static void vga_draw_graphic(VGAState *s
     printf("w=%d h=%d v=%d line_offset=%d cr[0x09]=0x%02x cr[0x17]=0x%02x linecmp=%d sr[0x01]=0x%02x\n",
            width, height, v, line_offset, s->cr[9], s->cr[0x17], s->line_compare, s->sr[0x01]);
 #endif
-
-    for (y = 0; y < s->vram_size; y += TARGET_PAGE_SIZE)
-        if (vram_dirty(s, y, TARGET_PAGE_SIZE))
-            cpu_physical_memory_set_dirty(s->vram_offset + y);
-
     addr1 = (s->start_addr * 4);
     bwidth = width * 4;
     y_start = -1;
@@ -1994,14 +1890,6 @@ void vga_common_init(VGAState *s, Displa
 
     vga_reset(s);
 
-    check_sse2();
-    s->vram_shadow = qemu_malloc(vga_ram_size+TARGET_PAGE_SIZE+1);
-    if (s->vram_shadow == NULL)
-        fprintf(stderr, "Cannot allocate %d bytes for VRAM shadow, "
-                "mouse will be slow\n", vga_ram_size);
-    s->vram_shadow = (uint8_t *)((long)(s->vram_shadow + TARGET_PAGE_SIZE - 1)
-                                 & ~(TARGET_PAGE_SIZE - 1));
-
     /* Video RAM must be 128-bit aligned for SSE optimizations later */
     s->vram_alloc = qemu_malloc(vga_ram_size + 15);
     s->vram_ptr = (uint8_t *)((long)(s->vram_alloc + 15) & ~15L);
diff -r 3c38150de7fd -r 6c4f61e2be6f tools/ioemu/hw/vga_int.h
--- a/tools/ioemu/hw/vga_int.h	Tue Mar 13 15:55:37 2007 +0000
+++ b/tools/ioemu/hw/vga_int.h	Wed Mar 14 17:01:04 2007 +0800
@@ -80,7 +80,6 @@
 #define VGA_STATE_COMMON                                                \
     uint8_t *vram_alloc;                                                \
     uint8_t *vram_ptr;                                                  \
-    uint8_t *vram_shadow;                                               \
     unsigned long vram_offset;                                          \
     unsigned int vram_size;                                             \
     unsigned long bios_offset;                                          \

[-- Attachment #3: shadow_vram_force_update.patch --]
[-- Type: text/plain, Size: 788 bytes --]

# HG changeset patch
# User Edwin Zhai <edwin.zhai@intel.com>
# Date 1173872741 -28800
# Node ID c23a03f6ae56dd4699451766b12ca7d54ef6e703
# Parent  6c4f61e2be6f8bf4a12d4044c97f47eb1d14b860
explict redraw screen as no shadow_vram now

diff -r 6c4f61e2be6f -r c23a03f6ae56 tools/ioemu/hw/vga.c
--- a/tools/ioemu/hw/vga.c	Wed Mar 14 17:01:04 2007 +0800
+++ b/tools/ioemu/hw/vga.c	Wed Mar 14 19:45:41 2007 +0800
@@ -1486,6 +1486,9 @@ static void vga_draw_graphic(VGAState *s
         }
         /* explicit invalidation for the hardware cursor */
         update |= (s->invalidated_y_table[y >> 5] >> (y & 0x1f)) & 1;
+
+        /* force vga update as no shadow vram now */
+        update |= VGA_DIRTY_FLAG;
         if (update) {
             if (y_start < 0)
                 y_start = y;

[-- Attachment #4: 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] 14+ messages in thread

end of thread, other threads:[~2007-03-23  0:38 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-15  3:30 [PATCH][HVM] remove qemu shadow_vram patch for performance Zhai, Edwin
2007-03-15 10:50 ` Keir Fraser
2007-03-16  3:04   ` Zhai, Edwin
2007-03-20  8:38     ` [PATCH][HVM] remove qemu shadow_vram patch forperformance Li, Xin B
2007-03-20  8:47       ` Keir Fraser
2007-03-20  9:36         ` Li, Xin B
2007-03-20  9:45           ` Keir Fraser
2007-03-20  9:48             ` Li, Xin B
2007-03-21  2:38             ` Zhai, Edwin
2007-03-21 20:50             ` [PATCH][HVM] remove qemu shadow_vram patchforperformance Dong, Eddie
2007-03-22 23:40         ` [PATCH][HVM] remove qemu shadow_vram patch forperformance Christian Limpach
2007-03-23  0:38           ` [PATCH][HVM] remove qemu shadow_vram patchforperformance Dong, Eddie
2007-03-21 21:09   ` [PATCH][HVM] remove qemu shadow_vram patch for performance Anthony Liguori
2007-03-21 21:09   ` Anthony Liguori

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.