From patchwork Fri Jun 24 13:02:47 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alon Levy X-Patchwork-Id: 101789 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 9714BB6F86 for ; Fri, 24 Jun 2011 23:07:06 +1000 (EST) Received: from localhost ([::1]:50642 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qa66B-00062z-El for incoming@patchwork.ozlabs.org; Fri, 24 Jun 2011 09:07:03 -0400 Received: from eggs.gnu.org ([140.186.70.92]:49272) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qa62W-00061s-TR for qemu-devel@nongnu.org; Fri, 24 Jun 2011 09:03:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qa62R-0001oj-Jh for qemu-devel@nongnu.org; Fri, 24 Jun 2011 09:03:16 -0400 Received: from mx1.redhat.com ([209.132.183.28]:6755) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qa62R-0001oJ-0A for qemu-devel@nongnu.org; Fri, 24 Jun 2011 09:03:11 -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 p5OD3ANr011242 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 24 Jun 2011 09:03:10 -0400 Received: from bow.redhat.com (vpn-11-77.rdu.redhat.com [10.11.11.77]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p5OD34Sv021276; Fri, 24 Jun 2011 09:03:08 -0400 From: Alon Levy To: qemu-devel@nongnu.org Date: Fri, 24 Jun 2011 15:02:47 +0200 Message-Id: <1308920577-31569-3-git-send-email-alevy@redhat.com> In-Reply-To: <1308920577-31569-1-git-send-email-alevy@redhat.com> References: <1308920577-31569-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 Cc: yhalperi@redhat.com, kraxel@redhat.com Subject: [Qemu-devel] [PATCH v2] qxl: interface_get_command: fix reported mode 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 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 | 23 ++++++++++++++++++++--- 1 files changed, 20 insertions(+), 3 deletions(-) diff --git a/hw/qxl.c b/hw/qxl.c index e45f33a..e2b07dd 100644 --- a/hw/qxl.c +++ b/hw/qxl.c @@ -335,6 +335,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 "INVALID"; +} + /* called from spice server thread context only */ static int interface_get_command(QXLInstance *sin, struct QXLCommandExt *ext) { @@ -357,18 +372,19 @@ static int interface_get_command(QXLInstance *sin, struct QXLCommandExt *ext) } qemu_mutex_unlock(&qxl->ssd.lock); if (ret) { + dprint(qxl, 2, "%s %s\n", __FUNCTION__, qxl_mode_to_string(qxl->mode)); qxl_log_command(qxl, "vga", ext); } return ret; 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, 4, "%s: %s\n", __FUNCTION__, qxl_mode_to_string(qxl->mode)); ring = &qxl->ram->cmd_ring; if (SPICE_RING_IS_EMPTY(ring)) { return false; } + dprint(qxl, 2, "%s: %s\n", __FUNCTION__, qxl_mode_to_string(qxl->mode)); SPICE_RING_CONS_ITEM(ring, cmd); ext->cmd = *cmd; ext->group_id = MEMSLOT_GROUP_GUEST; @@ -1500,7 +1516,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) {