diff mbox

[PATCHv2,1/4] qxl: interface_get_command: fix reported mode

Message ID 1303979358-4421-2-git-send-email-alevy@redhat.com
State New
Headers show

Commit Message

Alon Levy April 28, 2011, 8:29 a.m. UTC
report correct mode when in undefined mode.
---
 hw/qxl.c |   18 ++++++++++++++++--
 1 files changed, 16 insertions(+), 2 deletions(-)

Comments

Gerd Hoffmann April 29, 2011, 12:01 p.m. UTC | #1
> +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";

Make that "INVALID"?  There never ever should be another move value ...

cheers,
   Gerd
Alon Levy April 29, 2011, 9:53 p.m. UTC | #2
On Fri, Apr 29, 2011 at 02:01:16PM +0200, Gerd Hoffmann wrote:
> >+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";
> 
> Make that "INVALID"?  There never ever should be another move value ...
True, will do.

> 
> cheers,
>   Gerd
diff mbox

Patch

diff --git a/hw/qxl.c b/hw/qxl.c
index fe4212b..63e295b 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)
 {
@@ -358,8 +373,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;