[Spice-devel] [RFC PATCH] qemu: Use heads parameter for QXL driver

Frediano Ziglio fziglio at redhat.com
Thu Jun 11 04:39:50 PDT 2015


Allow to specify maximum number of head to QXL driver.

Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 src/qemu/qemu_capabilities.c                     |  2 ++
 src/qemu/qemu_capabilities.h                     |  1 +
 src/qemu/qemu_command.c                          | 11 +++++++++++
 tests/qemucapabilitiesdata/caps_1.2.2-1.caps     |  1 +
 tests/qemucapabilitiesdata/caps_1.2.2-1.replies  |  8 ++++++++
 tests/qemucapabilitiesdata/caps_1.3.1-1.caps     |  1 +
 tests/qemucapabilitiesdata/caps_1.3.1-1.replies  |  8 ++++++++
 tests/qemucapabilitiesdata/caps_1.4.2-1.caps     |  1 +
 tests/qemucapabilitiesdata/caps_1.4.2-1.replies  |  8 ++++++++
 tests/qemucapabilitiesdata/caps_1.5.3-1.caps     |  1 +
 tests/qemucapabilitiesdata/caps_1.5.3-1.replies  |  8 ++++++++
 tests/qemucapabilitiesdata/caps_1.6.0-1.caps     |  1 +
 tests/qemucapabilitiesdata/caps_1.6.0-1.replies  |  8 ++++++++
 tests/qemucapabilitiesdata/caps_1.6.50-1.caps    |  1 +
 tests/qemucapabilitiesdata/caps_1.6.50-1.replies |  8 ++++++++
 tests/qemucapabilitiesdata/caps_2.1.1-1.caps     |  1 +
 tests/qemucapabilitiesdata/caps_2.1.1-1.replies  |  8 ++++++++
 17 files changed, 77 insertions(+)

The patch to support the "max_outputs" in Qemu is still not merged but
I got agreement on the name of the argument.

Actually can be a compatiblity problem as heads in the XML configuration
was set by default to '1'.

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index ca7a7c2..cdc2575 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -285,6 +285,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
               "dea-key-wrap",
               "pci-serial",
               "aarch64-off",
+              "qxl-vga.max_outputs",
     );
 
 
@@ -1643,6 +1644,7 @@ static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsQxl[] = {
 
 static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsQxlVga[] = {
     { "vgamem_mb", QEMU_CAPS_QXL_VGA_VGAMEM },
+    { "max_outputs", QEMU_CAPS_QXL_VGA_MAX_OUTPUTS },
 };
 
 struct virQEMUCapsObjectTypeProps {
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index b5a7770..a2ea84b 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -229,6 +229,7 @@ typedef enum {
     QEMU_CAPS_DEA_KEY_WRAP       = 187, /* -machine dea_key_wrap */
     QEMU_CAPS_DEVICE_PCI_SERIAL  = 188, /* -device pci-serial */
     QEMU_CAPS_CPU_AARCH64_OFF    = 189, /* -cpu ...,aarch64=off */
+    QEMU_CAPS_QXL_VGA_MAX_OUTPUTS = 190, /* qxl-vga.max_outputs */
 
     QEMU_CAPS_LAST,                   /* this must always be the last item */
 } virQEMUCapsFlags;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 0a6d92f..2bd63e1 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -5610,6 +5610,11 @@ qemuBuildDeviceVideoStr(virDomainDefPtr def,
             /* QEMU accepts mebibytes for vgamem_mb. */
             virBufferAsprintf(&buf, ",vgamem_mb=%u", video->vgamem / 1024);
         }
+
+        if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_QXL_VGA_MAX_OUTPUTS) &&
+            video->heads > 0) {
+            virBufferAsprintf(&buf, ",max_outputs=%u", video->heads);
+        }
     } else if (video->vram &&
         ((video->type == VIR_DOMAIN_VIDEO_TYPE_VGA &&
           virQEMUCapsGet(qemuCaps, QEMU_CAPS_VGA_VGAMEM)) ||
@@ -10234,6 +10239,7 @@ qemuBuildCommandLine(virConnectPtr conn,
                     unsigned int ram = def->videos[0]->ram;
                     unsigned int vram = def->videos[0]->vram;
                     unsigned int vgamem = def->videos[0]->vgamem;
+                    unsigned int heads = def->videos[0]->heads;
 
                     if (vram > (UINT_MAX / 1024)) {
                         virReportError(VIR_ERR_OVERFLOW,
@@ -10264,6 +10270,11 @@ qemuBuildCommandLine(virConnectPtr conn,
                         virCommandAddArgFormat(cmd, "%s.vgamem_mb=%u",
                                                dev, vgamem / 1024);
                     }
+                    if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_QXL_VGA_MAX_OUTPUTS) && heads > 0) {
+                        virCommandAddArg(cmd, "-global");
+                        virCommandAddArgFormat(cmd, "%s.max_outputs=%u",
+                                               dev, heads);
+                    }
                 }
 
                 if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE) &&
diff --git a/tests/qemucapabilitiesdata/caps_1.2.2-1.caps b/tests/qemucapabilitiesdata/caps_1.2.2-1.caps
index 30239df..7791e42 100644
--- a/tests/qemucapabilitiesdata/caps_1.2.2-1.caps
+++ b/tests/qemucapabilitiesdata/caps_1.2.2-1.caps
@@ -120,4 +120,5 @@
     <flag name='vmware-svga.vgamem_mb'/>
     <flag name='qxl.vgamem_mb'/>
     <flag name='qxl-vga.vgamem_mb'/>
+    <flag name='qxl-vga.max_outputs'/>
   </qemuCaps>
diff --git a/tests/qemucapabilitiesdata/caps_1.2.2-1.replies b/tests/qemucapabilitiesdata/caps_1.2.2-1.replies
index f501218..aa1d3f9 100644
--- a/tests/qemucapabilitiesdata/caps_1.2.2-1.replies
+++ b/tests/qemucapabilitiesdata/caps_1.2.2-1.replies
@@ -1488,6 +1488,10 @@
             "type": "pci-devfn"
         },
         {
+            "name": "max_outputs",
+            "type": "uint16"
+        },
+        {
             "name": "vgamem_mb",
             "type": "uint32"
         },
@@ -1554,6 +1558,10 @@
             "type": "pci-devfn"
         },
         {
+            "name": "max_outputs",
+            "type": "uint16"
+        },
+        {
             "name": "vgamem_mb",
             "type": "uint32"
         },
diff --git a/tests/qemucapabilitiesdata/caps_1.3.1-1.caps b/tests/qemucapabilitiesdata/caps_1.3.1-1.caps
index ea3d850..bf4c731 100644
--- a/tests/qemucapabilitiesdata/caps_1.3.1-1.caps
+++ b/tests/qemucapabilitiesdata/caps_1.3.1-1.caps
@@ -135,4 +135,5 @@
     <flag name='qxl.vgamem_mb'/>
     <flag name='qxl-vga.vgamem_mb'/>
     <flag name='pci-serial'/>
+    <flag name='qxl-vga.max_outputs'/>
   </qemuCaps>
diff --git a/tests/qemucapabilitiesdata/caps_1.3.1-1.replies b/tests/qemucapabilitiesdata/caps_1.3.1-1.replies
index e1f9704..6e210fe 100644
--- a/tests/qemucapabilitiesdata/caps_1.3.1-1.replies
+++ b/tests/qemucapabilitiesdata/caps_1.3.1-1.replies
@@ -1659,6 +1659,10 @@
             "type": "pci-devfn"
         },
         {
+            "name": "max_outputs",
+            "type": "uint16"
+        },
+        {
             "name": "surfaces",
             "type": "int32"
         },
@@ -1729,6 +1733,10 @@
             "type": "pci-devfn"
         },
         {
+            "name": "max_outputs",
+            "type": "uint16"
+        },
+        {
             "name": "surfaces",
             "type": "int32"
         },
diff --git a/tests/qemucapabilitiesdata/caps_1.4.2-1.caps b/tests/qemucapabilitiesdata/caps_1.4.2-1.caps
index 2c19ddc..a371b57 100644
--- a/tests/qemucapabilitiesdata/caps_1.4.2-1.caps
+++ b/tests/qemucapabilitiesdata/caps_1.4.2-1.caps
@@ -136,4 +136,5 @@
     <flag name='qxl.vgamem_mb'/>
     <flag name='qxl-vga.vgamem_mb'/>
     <flag name='pci-serial'/>
+    <flag name='qxl-vga.max_outputs'/>
   </qemuCaps>
diff --git a/tests/qemucapabilitiesdata/caps_1.4.2-1.replies b/tests/qemucapabilitiesdata/caps_1.4.2-1.replies
index 3d797b2..2b97937 100644
--- a/tests/qemucapabilitiesdata/caps_1.4.2-1.replies
+++ b/tests/qemucapabilitiesdata/caps_1.4.2-1.replies
@@ -1706,6 +1706,10 @@
             "type": "pci-devfn"
         },
         {
+            "name": "max_outputs",
+            "type": "uint16"
+        },
+        {
             "name": "surfaces",
             "type": "int32"
         },
@@ -1776,6 +1780,10 @@
             "type": "pci-devfn"
         },
         {
+            "name": "max_outputs",
+            "type": "uint16"
+        },
+        {
             "name": "surfaces",
             "type": "int32"
         },
diff --git a/tests/qemucapabilitiesdata/caps_1.5.3-1.caps b/tests/qemucapabilitiesdata/caps_1.5.3-1.caps
index aadccd5..bb3d7aa 100644
--- a/tests/qemucapabilitiesdata/caps_1.5.3-1.caps
+++ b/tests/qemucapabilitiesdata/caps_1.5.3-1.caps
@@ -145,4 +145,5 @@
     <flag name='qxl.vgamem_mb'/>
     <flag name='qxl-vga.vgamem_mb'/>
     <flag name='pci-serial'/>
+    <flag name='qxl-vga.max_outputs'/>
   </qemuCaps>
diff --git a/tests/qemucapabilitiesdata/caps_1.5.3-1.replies b/tests/qemucapabilitiesdata/caps_1.5.3-1.replies
index 45571a3..1a67ab9 100644
--- a/tests/qemucapabilitiesdata/caps_1.5.3-1.replies
+++ b/tests/qemucapabilitiesdata/caps_1.5.3-1.replies
@@ -1780,6 +1780,10 @@
             "type": "pci-devfn"
         },
         {
+            "name": "max_outputs",
+            "type": "uint16"
+        },
+        {
             "name": "surfaces",
             "type": "int32"
         },
@@ -1850,6 +1854,10 @@
             "type": "pci-devfn"
         },
         {
+            "name": "max_outputs",
+            "type": "uint16"
+        },
+        {
             "name": "surfaces",
             "type": "int32"
         },
diff --git a/tests/qemucapabilitiesdata/caps_1.6.0-1.caps b/tests/qemucapabilitiesdata/caps_1.6.0-1.caps
index 3e81cbf..9d98f13 100644
--- a/tests/qemucapabilitiesdata/caps_1.6.0-1.caps
+++ b/tests/qemucapabilitiesdata/caps_1.6.0-1.caps
@@ -151,4 +151,5 @@
     <flag name='qxl.vgamem_mb'/>
     <flag name='qxl-vga.vgamem_mb'/>
     <flag name='pci-serial'/>
+    <flag name='qxl-vga.max_outputs'/>
   </qemuCaps>
diff --git a/tests/qemucapabilitiesdata/caps_1.6.0-1.replies b/tests/qemucapabilitiesdata/caps_1.6.0-1.replies
index ae4b3f4..3b187c5 100644
--- a/tests/qemucapabilitiesdata/caps_1.6.0-1.replies
+++ b/tests/qemucapabilitiesdata/caps_1.6.0-1.replies
@@ -1842,6 +1842,10 @@
             "type": "pci-devfn"
         },
         {
+            "name": "max_outputs",
+            "type": "uint16"
+        },
+        {
             "name": "surfaces",
             "type": "int32"
         },
@@ -1912,6 +1916,10 @@
             "type": "pci-devfn"
         },
         {
+            "name": "max_outputs",
+            "type": "uint16"
+        },
+        {
             "name": "surfaces",
             "type": "int32"
         },
diff --git a/tests/qemucapabilitiesdata/caps_1.6.50-1.caps b/tests/qemucapabilitiesdata/caps_1.6.50-1.caps
index 84c357f..ac1a3bd 100644
--- a/tests/qemucapabilitiesdata/caps_1.6.50-1.caps
+++ b/tests/qemucapabilitiesdata/caps_1.6.50-1.caps
@@ -151,4 +151,5 @@
     <flag name='qxl.vgamem_mb'/>
     <flag name='qxl-vga.vgamem_mb'/>
     <flag name='pci-serial'/>
+    <flag name='qxl-vga.max_outputs'/>
   </qemuCaps>
diff --git a/tests/qemucapabilitiesdata/caps_1.6.50-1.replies b/tests/qemucapabilitiesdata/caps_1.6.50-1.replies
index 90d31f0..52ddebb 100644
--- a/tests/qemucapabilitiesdata/caps_1.6.50-1.replies
+++ b/tests/qemucapabilitiesdata/caps_1.6.50-1.replies
@@ -1806,6 +1806,10 @@
             "type": "pci-devfn"
         },
         {
+            "name": "max_outputs",
+            "type": "uint16"
+        },
+        {
             "name": "surfaces",
             "type": "int32"
         },
@@ -1876,6 +1880,10 @@
             "type": "pci-devfn"
         },
         {
+            "name": "max_outputs",
+            "type": "uint16"
+        },
+        {
             "name": "surfaces",
             "type": "int32"
         },
diff --git a/tests/qemucapabilitiesdata/caps_2.1.1-1.caps b/tests/qemucapabilitiesdata/caps_2.1.1-1.caps
index b1ee8df..df23c28 100644
--- a/tests/qemucapabilitiesdata/caps_2.1.1-1.caps
+++ b/tests/qemucapabilitiesdata/caps_2.1.1-1.caps
@@ -167,4 +167,5 @@
     <flag name='qxl-vga.vgamem_mb'/>
     <flag name='pc-dimm'/>
     <flag name='pci-serial'/>
+    <flag name='qxl-vga.max_outputs'/>
   </qemuCaps>
diff --git a/tests/qemucapabilitiesdata/caps_2.1.1-1.replies b/tests/qemucapabilitiesdata/caps_2.1.1-1.replies
index 511461a..863003f 100644
--- a/tests/qemucapabilitiesdata/caps_2.1.1-1.replies
+++ b/tests/qemucapabilitiesdata/caps_2.1.1-1.replies
@@ -2252,6 +2252,10 @@
             "type": "pci-devfn"
         },
         {
+            "name": "max_outputs",
+            "type": "uint16"
+        },
+        {
             "name": "surfaces",
             "type": "int32"
         },
@@ -2322,6 +2326,10 @@
             "type": "pci-devfn"
         },
         {
+            "name": "max_outputs",
+            "type": "uint16"
+        },
+        {
             "name": "surfaces",
             "type": "int32"
         },
-- 
2.1.0



More information about the Spice-devel mailing list