From patchwork Mon May 21 09:04:48 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alon Levy X-Patchwork-Id: 160337 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 EC4C4B6EEC for ; Mon, 21 May 2012 19:06:21 +1000 (EST) Received: from localhost ([::1]:43332 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SWOZG-0006ND-Bz for incoming@patchwork.ozlabs.org; Mon, 21 May 2012 05:06:18 -0400 Received: from eggs.gnu.org ([208.118.235.92]:52292) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SWOYz-0006Ei-PL for qemu-devel@nongnu.org; Mon, 21 May 2012 05:06:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SWOYt-0006vi-2g for qemu-devel@nongnu.org; Mon, 21 May 2012 05:06:01 -0400 Received: from mx1.redhat.com ([209.132.183.28]:12662) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SWOYs-0006s9-Qc for qemu-devel@nongnu.org; Mon, 21 May 2012 05:05:54 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q4L95rcJ026846 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 21 May 2012 05:05:53 -0400 Received: from garlic.tlv.redhat.com (dhcp-4-119.tlv.redhat.com [10.35.4.119]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q4L95ogo024170; Mon, 21 May 2012 05:05:52 -0400 From: Alon Levy To: qemu-devel@nongnu.org Date: Mon, 21 May 2012 12:04:48 +0300 Message-Id: <1337591088-18667-2-git-send-email-alevy@redhat.com> In-Reply-To: <1337591088-18667-1-git-send-email-alevy@redhat.com> References: <1337591088-18667-1-git-send-email-alevy@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: kraxel@redhat.com Subject: [Qemu-devel] [RFC 2/2] hmp/qxl: info spice: add qxl0_mode & qxl0_guest_bug 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 Signed-off-by: Alon Levy --- hmp.c | 7 +++++++ hw/qxl.c | 17 +++++++++++++++++ qapi-schema.json | 32 ++++++++++++++++++++++++++++++-- ui/qemu-spice.h | 4 ++++ ui/spice-core.c | 3 +++ 5 files changed, 61 insertions(+), 2 deletions(-) diff --git a/hmp.c b/hmp.c index 1f9fe0e..690da83 100644 --- a/hmp.c +++ b/hmp.c @@ -353,6 +353,13 @@ void hmp_info_spice(Monitor *mon) monitor_printf(mon, " mouse-mode: %s\n", SpiceQueryMouseMode_lookup[info->mouse_mode]); + if (info->qxl0_guest_bug != -1 && info->qxl0_mode != -1) { + monitor_printf(mon, " qxl0\n"); + monitor_printf(mon, " guest_bug: %"PRIu64"d\n", info->qxl0_guest_bug); + monitor_printf(mon, " mode: %s\n", + SpiceQueryQXLMode_lookup[info->qxl0_mode]); + } + if (!info->has_channels || info->channels == NULL) { monitor_printf(mon, "Channels: none\n"); } else { diff --git a/hw/qxl.c b/hw/qxl.c index a9a7778..ddb1633 100644 --- a/hw/qxl.c +++ b/hw/qxl.c @@ -1700,6 +1700,23 @@ static DisplayChangeListener display_listener = { .dpy_refresh = display_refresh, }; +/* helpers for spice_info. only show first device */ +int qxl0_guest_bug(void) +{ + if (!qxl0) { + return -1; + } + return qxl0->guest_bug; +} + +int qxl0_mode(void) +{ + if (!qxl0) { + return -1; + } + return qxl0->mode; +} + static void qxl_init_ramsize(PCIQXLDevice *qxl, uint32_t ram_min_mb) { /* vga ram (bar 0) */ diff --git a/qapi-schema.json b/qapi-schema.json index 4279259..edc958a 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -636,7 +636,7 @@ ## # @SpiceQueryMouseMode # -# An enumation of Spice mouse states. +# An enumeration of Spice mouse states. # # @client: Mouse cursor position is determined by the client. # @@ -653,6 +653,29 @@ 'data': [ 'client', 'server', 'unknown' ] } ## +# @SpiceQueryQXLMode +# +# An enumeration of QXL States. +# +# @undefined: guest driver in control but no primary device. Reached after a destroy primary IO +# from native mode. +# +# @vga: no device driver in control. default mode, returns to it after any vga port access. +# +# @compat: No information is available about mouse mode used by +# the spice server. +# +# @native: guest driver in control of device. Reached after a create primary IO. +# +# Note: hw/qxl.h has a qxl_mode enum, name chose to not confuse the two. +# +# Since: 1.1 +## +{ 'enum': 'SpiceQueryQXLMode', + 'data': [ 'undefined', 'vga', 'compat', 'native' ] } + + +## # @SpiceInfo # # Information about the SPICE session. @@ -681,12 +704,17 @@ # # @channels: a list of @SpiceChannel for each active spice channel # +# @qxl0_mode: Mode of the primary qxl device. +# +# @qxl0_guest_bug: Guest bug status of primary qxl device. +# # Since: 0.14.0 ## { 'type': 'SpiceInfo', 'data': {'enabled': 'bool', '*host': 'str', '*port': 'int', '*tls-port': 'int', '*auth': 'str', '*compiled-version': 'str', - 'mouse-mode': 'SpiceQueryMouseMode', '*channels': ['SpiceChannel']} } + 'mouse-mode': 'SpiceQueryMouseMode', '*channels': ['SpiceChannel'], + 'qxl0_mode': 'SpiceQueryQXLMode', 'qxl0_guest_bug': 'int'} } ## # @query-spice diff --git a/ui/qemu-spice.h b/ui/qemu-spice.h index 3299da8..e2f894b 100644 --- a/ui/qemu-spice.h +++ b/ui/qemu-spice.h @@ -47,6 +47,10 @@ void do_info_spice(Monitor *mon, QObject **ret_data); CharDriverState *qemu_chr_open_spice(QemuOpts *opts); +/* implemented in hw/qxl.c */ +int qxl0_guest_bug(void); +int qxl0_mode(void); + #else /* CONFIG_SPICE */ #include "monitor.h" diff --git a/ui/spice-core.c b/ui/spice-core.c index 4fc48f8..5616fe6 100644 --- a/ui/spice-core.c +++ b/ui/spice-core.c @@ -453,6 +453,9 @@ SpiceInfo *qmp_query_spice(Error **errp) SPICE_SERVER_VERSION & 0xff); info->compiled_version = g_strdup(version_string); + info->qxl0_mode = qxl0_mode(); + info->qxl0_guest_bug = qxl0_guest_bug(); + if (port) { info->has_port = true; info->port = port;