peterdelevoryas / rpms / qemu

Forked from rpms/qemu 2 years ago
Clone

Blame 0007-qxl-fix-local-renderer.patch

840b28
From 909d4a71878f3568b6c636a07d9f4f2c97a5de12 Mon Sep 17 00:00:00 2001
840b28
From: Gerd Hoffmann <kraxel@redhat.com>
840b28
Date: Thu, 5 Sep 2013 21:57:19 +0200
840b28
Subject: [PATCH] qxl: fix local renderer
840b28
840b28
The local spice renderer assumes the primary surface is located at the
840b28
start of the "ram" bar.  This used to be a requirement in qxl hardware
840b28
revision 1.  In revision 2+ this is relaxed.  Nevertheless guest drivers
840b28
continued to use the traditional location, for historical and backward
840b28
compatibility reasons.  The qxl kms driver doesn't though as it depends
840b28
on qxl revision 4+ anyway.
840b28
840b28
Result is that local rendering is hosed for recent linux guests, you'll
840b28
get pixel garbage with non-spice ui (gtk, sdl, vnc) and when doing
840b28
screendumps.  Fix that by doing a proper mapping of the guest-specified
840b28
memory location.
840b28
840b28
https://bugzilla.redhat.com/show_bug.cgi?id=948717
840b28
840b28
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
840b28
(cherry picked from commit c58c7b959b93b864a27fd6b3646ee1465ab8832b)
840b28
---
840b28
 hw/display/qxl-render.c | 15 ++++++++++-----
840b28
 1 file changed, 10 insertions(+), 5 deletions(-)
840b28
840b28
diff --git a/hw/display/qxl-render.c b/hw/display/qxl-render.c
840b28
index 269b1a7..d34b0c4 100644
840b28
--- a/hw/display/qxl-render.c
840b28
+++ b/hw/display/qxl-render.c
840b28
@@ -31,10 +31,6 @@ static void qxl_blit(PCIQXLDevice *qxl, QXLRect *rect)
840b28
     if (is_buffer_shared(surface)) {
840b28
         return;
840b28
     }
840b28
-    if (!qxl->guest_primary.data) {
840b28
-        trace_qxl_render_blit_guest_primary_initialized();
840b28
-        qxl->guest_primary.data = memory_region_get_ram_ptr(&qxl->vga.vram);
840b28
-    }
840b28
     trace_qxl_render_blit(qxl->guest_primary.qxl_stride,
840b28
             rect->left, rect->right, rect->top, rect->bottom);
840b28
     src = qxl->guest_primary.data;
840b28
@@ -104,7 +100,12 @@ static void qxl_render_update_area_unlocked(PCIQXLDevice *qxl)
840b28
 
840b28
     if (qxl->guest_primary.resized) {
840b28
         qxl->guest_primary.resized = 0;
840b28
-        qxl->guest_primary.data = memory_region_get_ram_ptr(&qxl->vga.vram);
840b28
+        qxl->guest_primary.data = qxl_phys2virt(qxl,
840b28
+                                                qxl->guest_primary.surface.mem,
840b28
+                                                MEMSLOT_GROUP_GUEST);
840b28
+        if (!qxl->guest_primary.data) {
840b28
+            return;
840b28
+        }
840b28
         qxl_set_rect_to_surface(qxl, &qxl->dirty[0]);
840b28
         qxl->num_dirty_rects = 1;
840b28
         trace_qxl_render_guest_primary_resized(
840b28
@@ -128,6 +129,10 @@ static void qxl_render_update_area_unlocked(PCIQXLDevice *qxl)
840b28
         }
840b28
         dpy_gfx_replace_surface(vga->con, surface);
840b28
     }
840b28
+
840b28
+    if (!qxl->guest_primary.data) {
840b28
+        return;
840b28
+    }
840b28
     for (i = 0; i < qxl->num_dirty_rects; i++) {
840b28
         if (qemu_spice_rect_is_empty(qxl->dirty+i)) {
840b28
             break;