Blame 0404-qxl-don-t-render-stuff-when-the-vm-is-stopped.patch

Hans de Goede 56753f
From 29fdb0f3a401e5590e465a0cc37d82383f3d5f07 Mon Sep 17 00:00:00 2001
Hans de Goede 56753f
From: Gerd Hoffmann <kraxel@redhat.com>
Hans de Goede 56753f
Date: Wed, 15 Feb 2012 14:04:44 +0100
Hans de Goede 56753f
Subject: [PATCH 404/434] qxl: don't render stuff when the vm is stopped.
Hans de Goede 56753f
Hans de Goede 56753f
This patch fixes the local qxl renderer to not kick spice-server
Hans de Goede 56753f
in case the vm is stopped.  First it is largely pointless because
Hans de Goede 56753f
we ask spice-server to process all not-yet processed commands when
Hans de Goede 56753f
the vm is stopped, so there isn't much do do anyway.  Second we
Hans de Goede 56753f
avoid triggering an assert in spice-server.
Hans de Goede 56753f
Hans de Goede 56753f
The patch makes sure we still honor redraw requests, even if we don't
Hans de Goede 56753f
ask spice-server for updates.  This is needed to handle displaysurface
Hans de Goede 56753f
changes with a stopped vm correctly.
Hans de Goede 56753f
Hans de Goede 56753f
With this patch applied it is possible to take screen shots (via
Hans de Goede 56753f
screendump monitor command) from a qxl gpu even in case the guest
Hans de Goede 56753f
is stopped.
Hans de Goede 56753f
Hans de Goede 56753f
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Hans de Goede 56753f
---
Hans de Goede 56753f
 hw/qxl-render.c |   12 +++++-------
Hans de Goede 56753f
 1 file changed, 5 insertions(+), 7 deletions(-)
Hans de Goede 56753f
Hans de Goede 56753f
diff --git a/hw/qxl-render.c b/hw/qxl-render.c
Hans de Goede 56753f
index 2c51ba9..a7891b2 100644
Hans de Goede 56753f
--- a/hw/qxl-render.c
Hans de Goede 56753f
+++ b/hw/qxl-render.c
Hans de Goede 56753f
@@ -121,19 +121,17 @@ void qxl_render_update(PCIQXLDevice *qxl)
Hans de Goede 56753f
         dpy_resize(vga->ds);
Hans de Goede 56753f
     }
Hans de Goede 56753f
 
Hans de Goede 56753f
-    if (!qxl->guest_primary.commands) {
Hans de Goede 56753f
-        return;
Hans de Goede 56753f
-    }
Hans de Goede 56753f
-    qxl->guest_primary.commands = 0;
Hans de Goede 56753f
-
Hans de Goede 56753f
     update.left   = 0;
Hans de Goede 56753f
     update.right  = qxl->guest_primary.surface.width;
Hans de Goede 56753f
     update.top    = 0;
Hans de Goede 56753f
     update.bottom = qxl->guest_primary.surface.height;
Hans de Goede 56753f
 
Hans de Goede 56753f
     memset(dirty, 0, sizeof(dirty));
Hans de Goede 56753f
-    qxl_spice_update_area(qxl, 0, &update,
Hans de Goede 56753f
-                          dirty, ARRAY_SIZE(dirty), 1, QXL_SYNC);
Hans de Goede 56753f
+    if (runstate_is_running() && qxl->guest_primary.commands) {
Hans de Goede 56753f
+        qxl->guest_primary.commands = 0;
Hans de Goede 56753f
+        qxl_spice_update_area(qxl, 0, &update,
Hans de Goede 56753f
+                              dirty, ARRAY_SIZE(dirty), 1, QXL_SYNC);
Hans de Goede 56753f
+    }
Hans de Goede 56753f
     if (redraw) {
Hans de Goede 56753f
         memset(dirty, 0, sizeof(dirty));
Hans de Goede 56753f
         dirty[0] = update;
Hans de Goede 56753f
-- 
Hans de Goede 56753f
1.7.10
Hans de Goede 56753f