cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
9ae3a8
From 4a19f6aff24c38ede727026ee6695e561aef1366 Mon Sep 17 00:00:00 2001
9ae3a8
From: Gerd Hoffmann <kraxel@redhat.com>
9ae3a8
Date: Thu, 12 Sep 2013 09:12:56 +0200
9ae3a8
Subject: [PATCH 01/11] qxl: fix local renderer
9ae3a8
9ae3a8
RH-Author: Gerd Hoffmann <kraxel@redhat.com>
9ae3a8
Message-id: <1378977176-19133-2-git-send-email-kraxel@redhat.com>
9ae3a8
Patchwork-id: 54333
9ae3a8
O-Subject: [RHEL-7 qemu-kvm PATCH 1/1] qxl: fix local renderer
9ae3a8
Bugzilla: 1005036
9ae3a8
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
9ae3a8
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
9ae3a8
RH-Acked-by: Hans de Goede <hdegoede@redhat.com>
9ae3a8
9ae3a8
The local spice renderer assumes the primary surface is located at the
9ae3a8
start of the "ram" bar.  This used to be a requirement in qxl hardware
9ae3a8
revision 1.  In revision 2+ this is relaxed.  Nevertheless guest drivers
9ae3a8
continued to use the traditional location, for historical and backward
9ae3a8
compatibility reasons.  The qxl kms driver doesn't though as it depends
9ae3a8
on qxl revision 4+ anyway.
9ae3a8
9ae3a8
Result is that local rendering is hosed for recent linux guests, you'll
9ae3a8
get pixel garbage with non-spice ui (gtk, sdl, vnc) and when doing
9ae3a8
screendumps.  Fix that by doing a proper mapping of the guest-specified
9ae3a8
memory location.
9ae3a8
9ae3a8
https://bugzilla.redhat.com/show_bug.cgi?id=948717
9ae3a8
9ae3a8
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9ae3a8
(cherry picked from commit c58c7b959b93b864a27fd6b3646ee1465ab8832b)
9ae3a8
---
9ae3a8
 hw/display/qxl-render.c | 15 ++++++++++-----
9ae3a8
 1 file changed, 10 insertions(+), 5 deletions(-)
9ae3a8
9ae3a8
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
---
9ae3a8
 hw/display/qxl-render.c |   15 ++++++++++-----
9ae3a8
 1 files changed, 10 insertions(+), 5 deletions(-)
9ae3a8
9ae3a8
diff --git a/hw/display/qxl-render.c b/hw/display/qxl-render.c
9ae3a8
index f511a62..f654476 100644
9ae3a8
--- a/hw/display/qxl-render.c
9ae3a8
+++ b/hw/display/qxl-render.c
9ae3a8
@@ -31,10 +31,6 @@ static void qxl_blit(PCIQXLDevice *qxl, QXLRect *rect)
9ae3a8
     if (is_buffer_shared(surface)) {
9ae3a8
         return;
9ae3a8
     }
9ae3a8
-    if (!qxl->guest_primary.data) {
9ae3a8
-        trace_qxl_render_blit_guest_primary_initialized();
9ae3a8
-        qxl->guest_primary.data = memory_region_get_ram_ptr(&qxl->vga.vram);
9ae3a8
-    }
9ae3a8
     trace_qxl_render_blit(qxl->guest_primary.qxl_stride,
9ae3a8
             rect->left, rect->right, rect->top, rect->bottom);
9ae3a8
     src = qxl->guest_primary.data;
9ae3a8
@@ -104,7 +100,12 @@ static void qxl_render_update_area_unlocked(PCIQXLDevice *qxl)
9ae3a8
 
9ae3a8
     if (qxl->guest_primary.resized) {
9ae3a8
         qxl->guest_primary.resized = 0;
9ae3a8
-        qxl->guest_primary.data = memory_region_get_ram_ptr(&qxl->vga.vram);
9ae3a8
+        qxl->guest_primary.data = qxl_phys2virt(qxl,
9ae3a8
+                                                qxl->guest_primary.surface.mem,
9ae3a8
+                                                MEMSLOT_GROUP_GUEST);
9ae3a8
+        if (!qxl->guest_primary.data) {
9ae3a8
+            return;
9ae3a8
+        }
9ae3a8
         qxl_set_rect_to_surface(qxl, &qxl->dirty[0]);
9ae3a8
         qxl->num_dirty_rects = 1;
9ae3a8
         trace_qxl_render_guest_primary_resized(
9ae3a8
@@ -128,6 +129,10 @@ static void qxl_render_update_area_unlocked(PCIQXLDevice *qxl)
9ae3a8
         }
9ae3a8
         dpy_gfx_replace_surface(vga->con, surface);
9ae3a8
     }
9ae3a8
+
9ae3a8
+    if (!qxl->guest_primary.data) {
9ae3a8
+        return;
9ae3a8
+    }
9ae3a8
     for (i = 0; i < qxl->num_dirty_rects; i++) {
9ae3a8
         if (qemu_spice_rect_is_empty(qxl->dirty+i)) {
9ae3a8
             break;
9ae3a8
-- 
9ae3a8
1.7.1
9ae3a8