Patchwork [v3,04/17] vl.c: check for qxl availability

login
register
mail settings
Submitter Aurelien Jarno
Date Sept. 11, 2012, 7:10 p.m.
Message ID <1347390642-17434-5-git-send-email-aurelien@aurel32.net>
Download mbox | patch
Permalink /patch/183194/
State New
Headers show

Comments

Aurelien Jarno - Sept. 11, 2012, 7:10 p.m.
Check for qxl availability in vl.c. This will allow to remove #ifdef
CONFIG_SPICE .. #endif later in this series

Cc: Anthony Liguori <aliguori@us.ibm.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
---
 vl.c |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

Patch

diff --git a/vl.c b/vl.c
index f7eed7a..ba2fa9f 100644
--- a/vl.c
+++ b/vl.c
@@ -1704,6 +1704,11 @@  static bool vmware_vga_available(void)
     return object_class_by_name("vmware-svga");
 }
 
+static bool qxl_vga_available(void)
+{
+    return object_class_by_name("qxl-vga");
+}
+
 static void select_vgahw (const char *p)
 {
     const char *opts;
@@ -1733,7 +1738,12 @@  static void select_vgahw (const char *p)
     } else if (strstart(p, "xenfb", &opts)) {
         vga_interface_type = VGA_XENFB;
     } else if (strstart(p, "qxl", &opts)) {
-        vga_interface_type = VGA_QXL;
+        if (qxl_vga_available()) {
+            vga_interface_type = VGA_QXL;
+        } else {
+            fprintf(stderr, "Error: QXL VGA not available\n");
+            exit(0);
+        }
     } else if (!strstart(p, "none", &opts)) {
     invalid_vga:
         fprintf(stderr, "Unknown vga type: %s\n", p);