qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alon Levy <alevy@redhat.com>
To: qemu-devel@nongnu.org, kraxel@redhat.com, lcapitulino@redhat.com,
	aliguori@us.ibm.com
Subject: [Qemu-devel] [PATCH v2 5/5] qxl: screendump: use provided Monitor
Date: Sun, 11 Mar 2012 21:26:44 +0200	[thread overview]
Message-ID: <1331494004-26177-6-git-send-email-alevy@redhat.com> (raw)
In-Reply-To: <1331494004-26177-1-git-send-email-alevy@redhat.com>

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 <alevy@redhat.com>
---
 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

  parent reply	other threads:[~2012-03-11 19:27 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-11 16:39 [Qemu-devel] [PATCH 0/4] fix qxl screendump using monitor_suspend Alon Levy
2012-03-11 16:39 ` [Qemu-devel] [PATCH 1/4] qxl: switch qxl.c to trace-events Alon Levy
2012-03-11 16:39 ` [Qemu-devel] [PATCH 2/4] qxl/qxl_render.c: add trace events Alon Levy
2012-03-11 16:39 ` [Qemu-devel] [PATCH 3/4] console: pass Monitor to vga_hw_screen_dump/hw_vga_dump Alon Levy
2012-03-11 16:39 ` [Qemu-devel] [PATCH 4/4] qxl-render: call ppm_save on bh Alon Levy
2012-03-11 19:26 ` [Qemu-devel] [PATCH v2 0/5] fix qxl screendump using monitor_suspend Alon Levy
2012-03-11 19:26   ` [Qemu-devel] [PATCH v2 1/5] qxl: switch qxl.c to trace-events Alon Levy
2012-03-12 10:20     ` Gerd Hoffmann
2012-03-12 11:43       ` Alon Levy
2012-03-12 15:50         ` Alon Levy
2012-03-13  6:42           ` Gerd Hoffmann
2012-03-13  9:35             ` Alon Levy
2012-03-13  9:47               ` Gerd Hoffmann
2012-03-13 10:18                 ` Alon Levy
2012-03-13 10:26                 ` Alon Levy
2012-03-11 19:26   ` [Qemu-devel] [PATCH v2 2/5] qxl/qxl_render.c: add trace events Alon Levy
2012-03-11 19:26   ` [Qemu-devel] [PATCH v2 3/5] qxl-render: call ppm_save on bh Alon Levy
2012-03-13 13:22     ` Luiz Capitulino
2012-03-11 19:26   ` [Qemu-devel] [PATCH v2 4/5] console: pass Monitor to vga_hw_screen_dump/hw_vga_dump Alon Levy
2012-03-13 13:35     ` Luiz Capitulino
2012-03-13 14:46       ` Alon Levy
2012-03-13 15:59         ` Luiz Capitulino
2012-03-13 17:35           ` Alon Levy
2012-03-13 18:07             ` Luiz Capitulino
2012-03-14  8:25             ` Gerd Hoffmann
2012-03-14  8:32               ` Alon Levy
2012-03-14  8:14         ` Gerd Hoffmann
2012-03-14  8:37           ` Daniel P. Berrange
2012-03-14 12:32             ` Luiz Capitulino
2012-03-14 13:14               ` Alon Levy
2012-03-14 13:17                 ` Daniel P. Berrange
2012-03-14 13:18                 ` Luiz Capitulino
2012-03-14 13:43                   ` Alon Levy
2012-03-11 19:26   ` Alon Levy [this message]
2012-03-11 19:33 ` [Qemu-devel] [PATCH 0/4] fix qxl screendump using monitor_suspend Alon Levy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1331494004-26177-6-git-send-email-alevy@redhat.com \
    --to=alevy@redhat.com \
    --cc=aliguori@us.ibm.com \
    --cc=kraxel@redhat.com \
    --cc=lcapitulino@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).