]> git.proxmox.com Git - qemu.git/commitdiff
x86,MIPS: make vmware_vga optional
authorBlue Swirl <blauwirbel@gmail.com>
Sat, 5 Feb 2011 14:34:37 +0000 (14:34 +0000)
committerBlue Swirl <blauwirbel@gmail.com>
Sat, 12 Feb 2011 08:28:22 +0000 (08:28 +0000)
Allow failure with vmware_vga device creation and use standard
VGA instead.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
hw/mips_malta.c
hw/pc.c
hw/vmware_vga.h

index 2d3f242cc8d580055b80c52e0367167ff51274b7..930c51c74d4e89e6d0c7610394cb4e527ff80038 100644 (file)
@@ -957,7 +957,11 @@ void mips_malta_init (ram_addr_t ram_size,
     if (cirrus_vga_enabled) {
         pci_cirrus_vga_init(pci_bus);
     } else if (vmsvga_enabled) {
-        pci_vmsvga_init(pci_bus);
+        if (!pci_vmsvga_init(pci_bus)) {
+            fprintf(stderr, "Warning: vmware_vga not available,"
+                    " using standard VGA instead\n");
+            pci_vga_init(pci_bus);
+        }
     } else if (std_vga_enabled) {
         pci_vga_init(pci_bus);
     }
diff --git a/hw/pc.c b/hw/pc.c
index 4dfdc0be5332fea5db763ab93899978053278fa6..fcee09a005d1c2fd3a0daada7246267fa5c7d656 100644 (file)
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -1053,10 +1053,15 @@ void pc_vga_init(PCIBus *pci_bus)
             isa_cirrus_vga_init();
         }
     } else if (vmsvga_enabled) {
-        if (pci_bus)
-            pci_vmsvga_init(pci_bus);
-        else
+        if (pci_bus) {
+            if (!pci_vmsvga_init(pci_bus)) {
+                fprintf(stderr, "Warning: vmware_vga not available,"
+                        " using standard VGA instead\n");
+                pci_vga_init(pci_bus);
+            }
+        } else {
             fprintf(stderr, "%s: vmware_vga: no PCI bus\n", __FUNCTION__);
+        }
 #ifdef CONFIG_SPICE
     } else if (qxl_enabled) {
         if (pci_bus)
index e7bcb22146f4c2d7e290e5eee33d9c16f1dc1127..5132573a56f3ad239642201cf568c19e24629110 100644 (file)
@@ -4,9 +4,16 @@
 #include "qemu-common.h"
 
 /* vmware_vga.c */
-static inline void pci_vmsvga_init(PCIBus *bus)
+static inline bool pci_vmsvga_init(PCIBus *bus)
 {
-    pci_create_simple(bus, -1, "vmware-svga");
+    PCIDevice *dev;
+
+    dev = pci_try_create(bus, -1, "vmware-svga");
+    if (!dev || qdev_init(&dev->qdev) < 0) {
+        return false;
+    } else {
+        return true;
+    }
 }
 
 #endif