From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:41078) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QYcOc-00037n-Ke for qemu-devel@nongnu.org; Mon, 20 Jun 2011 07:11:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QYcOb-0003wf-PU for qemu-devel@nongnu.org; Mon, 20 Jun 2011 07:11:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:12345) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QYcOb-0003wW-8Y for qemu-devel@nongnu.org; Mon, 20 Jun 2011 07:11:57 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p5KBBuNh026702 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 20 Jun 2011 07:11:56 -0400 From: Alon Levy Date: Mon, 20 Jun 2011 13:11:51 +0200 Message-Id: <1308568312-5463-2-git-send-email-alevy@redhat.com> In-Reply-To: <1308568312-5463-1-git-send-email-alevy@redhat.com> References: <1308568312-5463-1-git-send-email-alevy@redhat.com> Subject: [Qemu-devel] [PATCH 1/2] qxl: interface_get_command: fix reported mode List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: yhalperi@redhat.com, kraxel@redhat.com report correct mode when in undefined mode. introduces qxl_mode_to_string, and uses it in another place that looks helpful (qxl_post_load) --- hw/qxl.c | 21 ++++++++++++++++++--- 1 files changed, 18 insertions(+), 3 deletions(-) diff --git a/hw/qxl.c b/hw/qxl.c index 1906e84..ca5c8b3 100644 --- a/hw/qxl.c +++ b/hw/qxl.c @@ -336,6 +336,21 @@ static void interface_get_init_info(QXLInstance *sin, QXLDevInitInfo *info) info->n_surfaces = NUM_SURFACES; } +static const char *qxl_mode_to_string(int mode) +{ + switch (mode) { + case QXL_MODE_COMPAT: + return "compat"; + case QXL_MODE_NATIVE: + return "native"; + case QXL_MODE_UNDEFINED: + return "undefined"; + case QXL_MODE_VGA: + return "vga"; + } + return "unknown"; +} + /* called from spice server thread context only */ static int interface_get_command(QXLInstance *sin, struct QXLCommandExt *ext) { @@ -364,8 +379,7 @@ static int interface_get_command(QXLInstance *sin, struct QXLCommandExt *ext) case QXL_MODE_COMPAT: case QXL_MODE_NATIVE: case QXL_MODE_UNDEFINED: - dprint(qxl, 2, "%s: %s\n", __FUNCTION__, - qxl->cmdflags ? "compat" : "native"); + dprint(qxl, 2, "%s: %s\n", __FUNCTION__, qxl_mode_to_string(qxl->mode)); ring = &qxl->ram->cmd_ring; if (SPICE_RING_IS_EMPTY(ring)) { return false; @@ -1378,7 +1392,8 @@ static int qxl_post_load(void *opaque, int version) d->modes = (QXLModes*)((uint8_t*)d->rom + d->rom->modes_offset); - dprint(d, 1, "%s: restore mode\n", __FUNCTION__); + dprint(d, 1, "%s: restore mode (%s)\n", __FUNCTION__, + qxl_mode_to_string(d->mode)); newmode = d->mode; d->mode = QXL_MODE_UNDEFINED; switch (newmode) { -- 1.7.5.2