qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH v2 5/5] qxl: screendump: use provided Monitor


From: Alon Levy
Subject: [Qemu-devel] [PATCH v2 5/5] qxl: screendump: use provided Monitor
Date: Sun, 11 Mar 2012 21:26:44 +0200

This fixes the hmp loose end by suspending the monitor and resuming it
after ppm_save has been called.

For qmp this is redundant, and actually wrong, since a qmp command ends
up suspending the hmp monitor and then resuming it. On the other hand
I'm not sure how much of a problem this is. The real problem is that qmp
users still end up with a completed "screendump" before ppm_save has
completed.

Signed-off-by: Alon Levy <address@hidden>
---
 hw/qxl-render.c    |   12 +++++++++---
 hw/qxl.c           |    4 ++--
 hw/qxl.h           |    2 +-
 ui/spice-display.h |    1 +
 4 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/hw/qxl-render.c b/hw/qxl-render.c
index b281766..16340d0 100644
--- a/hw/qxl-render.c
+++ b/hw/qxl-render.c
@@ -154,7 +154,8 @@ typedef struct QXLPPMSaveBHData {
 
 static void qxl_render_ppm_save_bh(void *opaque);
 
-static QXLCookie *qxl_cookie_render_new(PCIQXLDevice *qxl, const char 
*filename)
+static QXLCookie *qxl_cookie_render_new(PCIQXLDevice *qxl, const char 
*filename,
+                                        Monitor *mon)
 {
     QXLPPMSaveBHData *ppm_save_bh_data;
     QEMUBH *ppm_save_bh;
@@ -169,6 +170,8 @@ static QXLCookie *qxl_cookie_render_new(PCIQXLDevice *qxl, 
const char *filename)
         ppm_save_bh = qemu_bh_new(qxl_render_ppm_save_bh, ppm_save_bh_data);
         cookie->u.render.filename = g_strdup(filename);
         cookie->u.render.ppm_save_bh = ppm_save_bh;
+        cookie->u.render.mon = mon;
+        monitor_suspend(mon);
     }
     return cookie;
 }
@@ -176,6 +179,9 @@ static QXLCookie *qxl_cookie_render_new(PCIQXLDevice *qxl, 
const char *filename)
 static void qxl_cookie_render_free(PCIQXLDevice *qxl, QXLCookie *cookie)
 {
     g_free(cookie->u.render.filename);
+    if (cookie->u.render.mon) {
+        monitor_resume(cookie->u.render.mon);
+    }
     g_free(cookie);
     --qxl->render_update_cookie_num;
 }
@@ -204,7 +210,7 @@ static void qxl_render_ppm_save_bh(void *opaque)
  * callbacks are called by spice_server thread, defering to bh called from the
  * io thread.
  */
-void qxl_render_update(PCIQXLDevice *qxl, const char *filename)
+void qxl_render_update(PCIQXLDevice *qxl, const char *filename, Monitor *mon)
 {
     QXLCookie *cookie;
 
@@ -223,7 +229,7 @@ void qxl_render_update(PCIQXLDevice *qxl, const char 
*filename)
     qxl->guest_primary.commands = 0;
     qxl->render_update_cookie_num++;
     qemu_mutex_unlock(&qxl->ssd.lock);
-    cookie = qxl_cookie_render_new(qxl, filename);
+    cookie = qxl_cookie_render_new(qxl, filename, mon);
     qxl_spice_update_area(qxl, 0, &cookie->u.render.area, NULL,
                           0, 1 /* clear_dirty_region */, QXL_ASYNC, cookie);
 }
diff --git a/hw/qxl.c b/hw/qxl.c
index d21b508..fae5be8 100644
--- a/hw/qxl.c
+++ b/hw/qxl.c
@@ -1471,7 +1471,7 @@ static void qxl_hw_update(void *opaque)
         break;
     case QXL_MODE_COMPAT:
     case QXL_MODE_NATIVE:
-        qxl_render_update(qxl, NULL);
+        qxl_render_update(qxl, NULL, NULL);
         break;
     default:
         break;
@@ -1495,7 +1495,7 @@ static void qxl_hw_screen_dump(void *opaque, const char 
*filename, bool cswitch,
     switch (qxl->mode) {
     case QXL_MODE_COMPAT:
     case QXL_MODE_NATIVE:
-        qxl_render_update(qxl, filename);
+        qxl_render_update(qxl, filename, mon);
         break;
     case QXL_MODE_VGA:
         vga->screen_dump(vga, filename, cswitch, mon);
diff --git a/hw/qxl.h b/hw/qxl.h
index 417ab28..219e149 100644
--- a/hw/qxl.h
+++ b/hw/qxl.h
@@ -147,7 +147,7 @@ void qxl_log_command(PCIQXLDevice *qxl, const char *ring, 
QXLCommandExt *ext);
 
 /* qxl-render.c */
 void qxl_render_resize(PCIQXLDevice *qxl);
-void qxl_render_update(PCIQXLDevice *qxl, const char *filename);
+void qxl_render_update(PCIQXLDevice *qxl, const char *filename, Monitor *mon);
 void qxl_render_cursor(PCIQXLDevice *qxl, QXLCommandExt *ext);
 void qxl_render_update_area_done(PCIQXLDevice *qxl, QXLCookie *cookie);
 void qxl_render_update_area_bh(void *opaque);
diff --git a/ui/spice-display.h b/ui/spice-display.h
index ec1fc24..2d01f51 100644
--- a/ui/spice-display.h
+++ b/ui/spice-display.h
@@ -64,6 +64,7 @@ typedef struct QXLCookie {
             int redraw;
             char *filename;
             QEMUBH *ppm_save_bh;
+            Monitor *mon;
         } render;
     } u;
 } QXLCookie;
-- 
1.7.9.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]