cryptospore / rpms / qemu-kvm

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