From patchwork Mon Mar 5 14:16:21 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alon Levy X-Patchwork-Id: 144684 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 D0088B6F9F for ; Tue, 6 Mar 2012 01:16:53 +1100 (EST) Received: from localhost ([::1]:55872 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S4YiV-00017Q-W4 for incoming@patchwork.ozlabs.org; Mon, 05 Mar 2012 09:16:47 -0500 Received: from eggs.gnu.org ([208.118.235.92]:57409) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S4YiE-00016t-Fn for qemu-devel@nongnu.org; Mon, 05 Mar 2012 09:16:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S4YiC-000386-9D for qemu-devel@nongnu.org; Mon, 05 Mar 2012 09:16:30 -0500 Received: from mx1.redhat.com ([209.132.183.28]:55601) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S4YiC-00037l-0X for qemu-devel@nongnu.org; Mon, 05 Mar 2012 09:16:28 -0500 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q25EGPeR027617 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 5 Mar 2012 09:16:25 -0500 Received: from garlic.tlv.redhat.com (spice-ovirt.tlv.redhat.com [10.35.4.71]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q25EGLS2025471; Mon, 5 Mar 2012 09:16:24 -0500 From: Alon Levy To: qemu-devel@nongnu.org, lcapitulino@redhat.com, anthony@codemonkey.ws, kraxel@redhat.com Date: Mon, 5 Mar 2012 16:16:21 +0200 Message-Id: <1330956981-5001-2-git-send-email-alevy@redhat.com> In-Reply-To: <1330956981-5001-1-git-send-email-alevy@redhat.com> References: <1330956981-5001-1-git-send-email-alevy@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 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 2/2] add qmp screendump-async 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 Uses a new console.h function, vga_hw_screen_dump_async. vga_hw_screen_dump_async falls back to hw_vga_screen_dump if there is no hw_vga_screen_dump_async callback provided to graphic_console_init. This is the only case right now, but the up side is that the interface is already implemented. The QEVENT_SCREEN_DUMP event is used to notify of completion. Signed-off-by: Alon Levy --- console.c | 19 +++++++++++++++++-- monitor.c | 5 +++++ qapi-schema.json | 20 ++++++++++++++++++++ qmp-commands.hx | 26 ++++++++++++++++++++++++++ 4 files changed, 68 insertions(+), 2 deletions(-) diff --git a/console.c b/console.c index 9a49e93..5102573 100644 --- a/console.c +++ b/console.c @@ -176,7 +176,7 @@ void vga_hw_invalidate(void) active_console->hw_invalidate(active_console->hw); } -void vga_hw_screen_dump(const char *filename) +static void vga_hw_screen_dump_helper(const char *filename, bool async) { TextConsole *previous_active_console; bool cswitch; @@ -189,8 +189,13 @@ void vga_hw_screen_dump(const char *filename) if (cswitch) { console_select(0); } - if (consoles[0] && consoles[0]->hw_screen_dump) { + if (async && consoles[0] && consoles[0]->hw_screen_dump_async) { + consoles[0]->hw_screen_dump_async(consoles[0]->hw, filename, cswitch); + } else if (consoles[0] && consoles[0]->hw_screen_dump) { consoles[0]->hw_screen_dump(consoles[0]->hw, filename, cswitch); + if (async) { + monitor_protocol_screen_dump_complete_event(filename); + } } else { error_report("screen dump not implemented"); } @@ -200,6 +205,16 @@ void vga_hw_screen_dump(const char *filename) } } +void vga_hw_screen_dump(const char *filename) +{ + vga_hw_screen_dump_helper(filename, false); +} + +void vga_hw_screen_dump_async(const char *filename) +{ + vga_hw_screen_dump_helper(filename, true); +} + void vga_hw_text_update(console_ch_t *chardata) { if (active_console && active_console->hw_text_update) diff --git a/monitor.c b/monitor.c index a8c84c0..1c3bd2a 100644 --- a/monitor.c +++ b/monitor.c @@ -901,6 +901,11 @@ static int do_screen_dump(Monitor *mon, const QDict *qdict, QObject **ret_data) return 0; } +void qmp_screendump_async(const char *filename, Error **errp) +{ + vga_hw_screen_dump_async(filename); +} + static void do_logfile(Monitor *mon, const QDict *qdict) { cpu_set_log_filename(qdict_get_str(qdict, "filename")); diff --git a/qapi-schema.json b/qapi-schema.json index dd9e0e5..60dae67 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -1633,3 +1633,23 @@ { 'command': 'qom-list-types', 'data': { '*implements': 'str', '*abstract': 'bool' }, 'returns': [ 'ObjectTypeInfo' ] } + +## +## @screendump-async: +# +# This command will perform a screen dump of the first console to the givem +# filename. The additional parameters are unused at this time. +# +# @filename name of output file to write screen dump to +# +# Since: 1.1 +# +# Notes: This command is experimental and may change syntax in future releases. +# +# This command is the same as the qmp/hmp screendump command, except that on +# successful completion of the scren dump the SCREEN_DUMP_COMPLETE event is +# emitted. +# +## +{ 'command': 'screendump-async', + 'data': { 'filename': 'str' } } diff --git a/qmp-commands.hx b/qmp-commands.hx index 0c9bfac..94ee1ae 100644 --- a/qmp-commands.hx +++ b/qmp-commands.hx @@ -170,6 +170,32 @@ Example: EQMP { + .name = "screendump-async", + .args_type = "filename:F", + .params = "filename", + .help = "save screen into PPM image 'filename'", + .user_print = monitor_user_noop, + .mhandler.cmd_new = qmp_marshal_input_screendump_async, + }, + +SQMP +screendump-async +---------------- + +Save screen into PPM image. Fires a SCREEN_DUMP_COMPLETE event on completion. + +Arguments: + +- "filename": file path (json-string) + +Example: + +-> { "execute": "screendump-async", "arguments": { "filename": "/tmp/image" } } +<- { "return": {} } + +EQMP + + { .name = "stop", .args_type = "", .mhandler.cmd_new = qmp_marshal_input_stop,