From patchwork Sun Mar 11 19:26:44 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alon Levy X-Patchwork-Id: 146008 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id AB7B7B6EEA for ; Mon, 12 Mar 2012 06:47:25 +1100 (EST) Received: from localhost ([::1]:49742 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S6oQL-0002kr-E1 for incoming@patchwork.ozlabs.org; Sun, 11 Mar 2012 15:27:21 -0400 Received: from eggs.gnu.org ([208.118.235.92]:33320) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S6oQ1-0002DC-Oa for qemu-devel@nongnu.org; Sun, 11 Mar 2012 15:27:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S6oPz-0008IY-Re for qemu-devel@nongnu.org; Sun, 11 Mar 2012 15:27:01 -0400 Received: from mx1.redhat.com ([209.132.183.28]:29209) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S6oPz-0008IF-K1 for qemu-devel@nongnu.org; Sun, 11 Mar 2012 15:26:59 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q2BJQwt6010391 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sun, 11 Mar 2012 15:26:58 -0400 Received: from garlic.redhat.com (vpn-200-153.tlv.redhat.com [10.35.200.153]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q2BJQkF1032029; Sun, 11 Mar 2012 15:26:56 -0400 From: Alon Levy To: qemu-devel@nongnu.org, kraxel@redhat.com, lcapitulino@redhat.com, aliguori@us.ibm.com Date: Sun, 11 Mar 2012 21:26:44 +0200 Message-Id: <1331494004-26177-6-git-send-email-alevy@redhat.com> In-Reply-To: <1331494004-26177-1-git-send-email-alevy@redhat.com> References: <1331483977-18910-1-git-send-email-alevy@redhat.com> <1331494004-26177-1-git-send-email-alevy@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 5/5] qxl: screendump: use provided Monitor X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 --- 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;