yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-vga-Add-mechanism-to-force-the-use-of-a-shadow-surfa.patch

5d360b
From 3067d5947bd28c5c05ba8dc7c87b70edc6157a27 Mon Sep 17 00:00:00 2001
12e206
From: Gerd Hoffmann <kraxel@redhat.com>
12e206
Date: Fri, 20 Oct 2017 11:06:17 +0200
5d360b
Subject: [PATCH 2/7] vga: Add mechanism to force the use of a shadow surface
12e206
12e206
RH-Author: Gerd Hoffmann <kraxel@redhat.com>
12e206
Message-id: <20171020110619.2541-10-kraxel@redhat.com>
12e206
Patchwork-id: 77409
12e206
O-Subject: [RHEL-7.5 qemu-kvm PATCH 09/11] vga: Add mechanism to force the use of a shadow surface
5d360b
Bugzilla: 1501295
12e206
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
12e206
RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
12e206
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
12e206
12e206
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12e206
12e206
This prevents surface sharing which will be necessary to
12e206
fix cirrus HW cursor support.
12e206
12e206
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12e206
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12e206
(cherry picked from commit 5508099397c480f1c3b4f14b0e64593ebe284b26)
12e206
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
12e206
---
12e206
 hw/display/vga.c     | 17 +++++++++++++++--
12e206
 hw/display/vga_int.h |  1 +
12e206
 2 files changed, 16 insertions(+), 2 deletions(-)
12e206
12e206
diff --git a/hw/display/vga.c b/hw/display/vga.c
12e206
index dda3f5f..a343a0a 100644
12e206
--- a/hw/display/vga.c
12e206
+++ b/hw/display/vga.c
12e206
@@ -1510,6 +1510,7 @@ static void vga_draw_graphic(VGACommonState *s, int full_update)
12e206
     uint8_t *d;
12e206
     uint32_t v, addr1, addr;
12e206
     vga_draw_line_func *vga_draw_line;
12e206
+    bool share_surface;
12e206
 #if defined(TARGET_WORDS_BIGENDIAN)
12e206
     static const bool big_endian_fb = true;
12e206
 #else
12e206
@@ -1558,18 +1559,30 @@ static void vga_draw_graphic(VGACommonState *s, int full_update)
12e206
     }
12e206
 
12e206
     depth = s->get_bpp(s);
12e206
+
12e206
+    share_surface = (!s->force_shadow) &&
12e206
+            ( depth == 32 || (depth == 16 && !byteswap) );
12e206
     if (s->line_offset != s->last_line_offset ||
12e206
         disp_width != s->last_width ||
12e206
         height != s->last_height ||
12e206
-        s->last_depth != depth) {
12e206
-        if (depth == 32 || (depth == 16 && !byteswap)) {
12e206
+        s->last_depth != depth ||
12e206
+        share_surface != is_buffer_shared(surface)) {
12e206
+        if (share_surface) {
12e206
             surface = qemu_create_displaysurface_from(disp_width,
12e206
                     height, depth, s->line_offset,
12e206
                     s->vram_ptr + (s->start_addr * 4), byteswap);
12e206
             dpy_gfx_replace_surface(s->con, surface);
12e206
+#ifdef DEBUG_VGA
12e206
+            printf("VGA: Using shared surface for depth=%d swap=%d\n",
12e206
+                   depth, byteswap);
12e206
+#endif
12e206
         } else {
12e206
             qemu_console_resize(s->con, disp_width, height);
12e206
             surface = qemu_console_surface(s->con);
12e206
+#ifdef DEBUG_VGA
12e206
+            printf("VGA: Using shadow surface for depth=%d swap=%d\n",
12e206
+                   depth, byteswap);
12e206
+#endif
12e206
         }
12e206
         s->last_scr_width = disp_width;
12e206
         s->last_scr_height = height;
12e206
diff --git a/hw/display/vga_int.h b/hw/display/vga_int.h
12e206
index 94add2f..5b9ca87 100644
12e206
--- a/hw/display/vga_int.h
12e206
+++ b/hw/display/vga_int.h
12e206
@@ -149,6 +149,7 @@ typedef struct VGACommonState {
12e206
     uint32_t last_width, last_height; /* in chars or pixels */
12e206
     uint32_t last_scr_width, last_scr_height; /* in pixels */
12e206
     uint32_t last_depth; /* in bits */
12e206
+    bool force_shadow;
12e206
     uint8_t cursor_start, cursor_end;
12e206
     bool cursor_visible_phase;
12e206
     int64_t cursor_blink_time;
12e206
-- 
12e206
1.8.3.1
12e206