[PATCH v2 4/5] qemu: add virtio-gpu virgl support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Check if virtio-gpu provides virgl option, and add qemu command line
formatter.

It is enabled with the existing accel3d attribute:
<model type='virtio' heads='1'>
 <acceleration accel3d='yes'/>
</model>

Signed-off-by: Marc-André Lureau <marcandre.lureau@xxxxxxxxx>
---
 src/qemu/qemu_capabilities.c                       |   7 ++
 src/qemu/qemu_capabilities.h                       |   1 +
 src/qemu/qemu_command.c                            |  17 +++-
 tests/qemucapabilitiesdata/caps_1.2.2-1.replies    |  22 +++--
 tests/qemucapabilitiesdata/caps_1.3.1-1.replies    |  22 +++--
 tests/qemucapabilitiesdata/caps_1.4.2-1.replies    |  22 +++--
 tests/qemucapabilitiesdata/caps_1.5.3-1.replies    |  22 +++--
 tests/qemucapabilitiesdata/caps_1.6.0-1.replies    |  22 +++--
 tests/qemucapabilitiesdata/caps_1.6.50-1.replies   |  22 +++--
 tests/qemucapabilitiesdata/caps_2.1.1-1.replies    |  22 +++--
 tests/qemucapabilitiesdata/caps_2.4.0-1.replies    |  95 ++++++++++++++++++--
 tests/qemucapabilitiesdata/caps_2.5.0-1.caps       |   1 +
 tests/qemucapabilitiesdata/caps_2.5.0-1.replies    | 100 +++++++++++++++++++--
 .../qemuxml2argv-video-virtio-gpu-virgl.args       |  23 +++++
 .../qemuxml2argv-video-virtio-gpu-virgl.xml        |  33 +++++++
 tests/qemuxml2argvtest.c                           |   4 +
 tests/qemuxml2xmltest.c                            |   1 +
 17 files changed, 372 insertions(+), 64 deletions(-)
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-virtio-gpu-virgl.args
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-virtio-gpu-virgl.xml

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 12e2098..4d76c40 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -302,6 +302,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
 
               "incoming-defer", /* 200 */
               "virtio-gpu",
+              "virtio-gpu.virgl",
     );
 
 
@@ -1631,6 +1632,10 @@ static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsQxlVga[] = {
     { "vgamem_mb", QEMU_CAPS_QXL_VGA_VGAMEM },
 };
 
+static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsVirtioGpu[] = {
+    { "virgl", QEMU_CAPS_DEVICE_VIRTIO_GPU_VIRGL },
+};
+
 struct virQEMUCapsObjectTypeProps {
     const char *type;
     struct virQEMUCapsStringFlags *props;
@@ -1684,6 +1689,8 @@ static struct virQEMUCapsObjectTypeProps virQEMUCapsObjectProps[] = {
       ARRAY_CARDINALITY(virQEMUCapsObjectPropsQxl) },
     { "qxl-vga", virQEMUCapsObjectPropsQxlVga,
       ARRAY_CARDINALITY(virQEMUCapsObjectPropsQxlVga) },
+    { "virtio-gpu-pci", virQEMUCapsObjectPropsVirtioGpu,
+      ARRAY_CARDINALITY(virQEMUCapsObjectPropsVirtioGpu) },
 };
 
 
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index 8a7c97e..ab711ff 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -328,6 +328,7 @@ typedef enum {
     /* 200 */
     QEMU_CAPS_INCOMING_DEFER, /* -incoming defer and migrate_incoming */
     QEMU_CAPS_DEVICE_VIRTIO_GPU, /* -device virtio-gpu-* & virtio-vga */
+    QEMU_CAPS_DEVICE_VIRTIO_GPU_VIRGL, /* -device virtio-gpu-*.virgl */
 
     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 887c87e..2808960 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -5896,7 +5896,22 @@ qemuBuildDeviceVideoStr(virDomainDefPtr def,
 
     virBufferAsprintf(&buf, "%s,id=%s", model, video->info.alias);
 
-    if (video->type == VIR_DOMAIN_VIDEO_TYPE_QXL) {
+    if (video->type == VIR_DOMAIN_VIDEO_TYPE_VIRTIO) {
+        if (video->accel) {
+            if (video->accel->accel3d &&
+                !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_GPU_VIRGL)) {
+                virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                               "%s", _("virtio-gpu 3d acceleration is not supported"));
+                goto error;
+            }
+
+            if (video->accel->accel3d) {
+                virBufferAsprintf(&buf, ",virgl=%s",
+                                  virTristateSwitchTypeToString(video->accel->accel3d));
+            }
+        }
+
+    } else if (video->type == VIR_DOMAIN_VIDEO_TYPE_QXL) {
         if (video->vram > (UINT_MAX / 1024)) {
             virReportError(VIR_ERR_OVERFLOW,
                            _("value for 'vram' must be less than '%u'"),
diff --git a/tests/qemucapabilitiesdata/caps_1.2.2-1.replies b/tests/qemucapabilitiesdata/caps_1.2.2-1.replies
index f501218..e7de77b 100644
--- a/tests/qemucapabilitiesdata/caps_1.2.2-1.replies
+++ b/tests/qemucapabilitiesdata/caps_1.2.2-1.replies
@@ -1598,6 +1598,14 @@
 }
 
 {
+    "id": "libvirt-31",
+    "error": {
+        "class": "DeviceNotFound",
+        "desc": "Device 'virtio-gpu-pci' not found"
+    }
+}
+
+{
     "return": [
         {
             "name": "xenpv"
@@ -1641,7 +1649,7 @@
             "name": "none"
         }
     ],
-    "id": "libvirt-31"
+    "id": "libvirt-32"
 }
 
 {
@@ -1713,7 +1721,7 @@
             "name": "Opteron_G4"
         }
     ],
-    "id": "libvirt-32"
+    "id": "libvirt-33"
 }
 
 {
@@ -1721,11 +1729,11 @@
         "enabled": false,
         "present": true
     },
-    "id": "libvirt-33"
+    "id": "libvirt-34"
 }
 
 {
-    "id": "libvirt-34",
+    "id": "libvirt-35",
     "error": {
         "class": "CommandNotFound",
         "desc": "The command query-tpm-models has not been found"
@@ -1733,7 +1741,7 @@
 }
 
 {
-    "id": "libvirt-35",
+    "id": "libvirt-36",
     "error": {
         "class": "CommandNotFound",
         "desc": "The command query-tpm-types has not been found"
@@ -1741,7 +1749,7 @@
 }
 
 {
-    "id": "libvirt-36",
+    "id": "libvirt-37",
     "error": {
         "class": "CommandNotFound",
         "desc": "The command query-command-line-options has not been found"
@@ -1755,5 +1763,5 @@
             "state": false
         }
     ],
-    "id": "libvirt-37"
+    "id": "libvirt-38"
 }
diff --git a/tests/qemucapabilitiesdata/caps_1.3.1-1.replies b/tests/qemucapabilitiesdata/caps_1.3.1-1.replies
index e1f9704..bf9cbad 100644
--- a/tests/qemucapabilitiesdata/caps_1.3.1-1.replies
+++ b/tests/qemucapabilitiesdata/caps_1.3.1-1.replies
@@ -1777,6 +1777,14 @@
 }
 
 {
+    "id": "libvirt-32",
+    "error": {
+        "class": "DeviceNotFound",
+        "desc": "Device 'virtio-gpu-pci' not found"
+    }
+}
+
+{
     "return": [
         {
             "name": "xenpv"
@@ -1827,7 +1835,7 @@
             "name": "none"
         }
     ],
-    "id": "libvirt-32"
+    "id": "libvirt-33"
 }
 
 {
@@ -1905,7 +1913,7 @@
             "name": "Opteron_G5"
         }
     ],
-    "id": "libvirt-33"
+    "id": "libvirt-34"
 }
 
 {
@@ -1913,11 +1921,11 @@
         "enabled": false,
         "present": true
     },
-    "id": "libvirt-34"
+    "id": "libvirt-35"
 }
 
 {
-    "id": "libvirt-35",
+    "id": "libvirt-36",
     "error": {
         "class": "CommandNotFound",
         "desc": "The command query-tpm-models has not been found"
@@ -1925,7 +1933,7 @@
 }
 
 {
-    "id": "libvirt-36",
+    "id": "libvirt-37",
     "error": {
         "class": "CommandNotFound",
         "desc": "The command query-tpm-types has not been found"
@@ -1933,7 +1941,7 @@
 }
 
 {
-    "id": "libvirt-37",
+    "id": "libvirt-38",
     "error": {
         "class": "CommandNotFound",
         "desc": "The command query-command-line-options has not been found"
@@ -1947,5 +1955,5 @@
             "state": false
         }
     ],
-    "id": "libvirt-38"
+    "id": "libvirt-39"
 }
diff --git a/tests/qemucapabilitiesdata/caps_1.4.2-1.replies b/tests/qemucapabilitiesdata/caps_1.4.2-1.replies
index 3d797b2..bd7980f 100644
--- a/tests/qemucapabilitiesdata/caps_1.4.2-1.replies
+++ b/tests/qemucapabilitiesdata/caps_1.4.2-1.replies
@@ -1824,6 +1824,14 @@
 }
 
 {
+    "id": "libvirt-32",
+    "error": {
+        "class": "DeviceNotFound",
+        "desc": "Device 'virtio-gpu-pci' not found"
+    }
+}
+
+{
     "return": [
         {
             "name": "xenpv"
@@ -1877,7 +1885,7 @@
             "name": "none"
         }
     ],
-    "id": "libvirt-32"
+    "id": "libvirt-33"
 }
 
 {
@@ -1955,7 +1963,7 @@
             "name": "qemu64"
         }
     ],
-    "id": "libvirt-33"
+    "id": "libvirt-34"
 }
 
 {
@@ -1963,11 +1971,11 @@
         "enabled": false,
         "present": true
     },
-    "id": "libvirt-34"
+    "id": "libvirt-35"
 }
 
 {
-    "id": "libvirt-35",
+    "id": "libvirt-36",
     "error": {
         "class": "CommandNotFound",
         "desc": "The command query-tpm-models has not been found"
@@ -1975,7 +1983,7 @@
 }
 
 {
-    "id": "libvirt-36",
+    "id": "libvirt-37",
     "error": {
         "class": "CommandNotFound",
         "desc": "The command query-tpm-types has not been found"
@@ -1983,7 +1991,7 @@
 }
 
 {
-    "id": "libvirt-37",
+    "id": "libvirt-38",
     "error": {
         "class": "CommandNotFound",
         "desc": "The command query-command-line-options has not been found"
@@ -1997,5 +2005,5 @@
             "state": false
         }
     ],
-    "id": "libvirt-38"
+    "id": "libvirt-39"
 }
diff --git a/tests/qemucapabilitiesdata/caps_1.5.3-1.replies b/tests/qemucapabilitiesdata/caps_1.5.3-1.replies
index 45571a3..abdba6c 100644
--- a/tests/qemucapabilitiesdata/caps_1.5.3-1.replies
+++ b/tests/qemucapabilitiesdata/caps_1.5.3-1.replies
@@ -1898,6 +1898,14 @@
 }
 
 {
+    "id": "libvirt-32",
+    "error": {
+        "class": "DeviceNotFound",
+        "desc": "Device 'virtio-gpu-pci' not found"
+    }
+}
+
+{
     "return": [
         {
             "name": "pc-q35-1.4",
@@ -1967,7 +1975,7 @@
             "cpu-max": 1
         }
     ],
-    "id": "libvirt-32"
+    "id": "libvirt-33"
 }
 
 {
@@ -2045,7 +2053,7 @@
             "name": "qemu64"
         }
     ],
-    "id": "libvirt-33"
+    "id": "libvirt-34"
 }
 
 {
@@ -2053,19 +2061,19 @@
         "enabled": false,
         "present": true
     },
-    "id": "libvirt-34"
+    "id": "libvirt-35"
 }
 
 {
     "return": [
     ],
-    "id": "libvirt-35"
+    "id": "libvirt-36"
 }
 
 {
     "return": [
     ],
-    "id": "libvirt-36"
+    "id": "libvirt-37"
 }
 
 {
@@ -2741,7 +2749,7 @@
             "option": "drive"
         }
     ],
-    "id": "libvirt-37"
+    "id": "libvirt-38"
 }
 
 {
@@ -2751,5 +2759,5 @@
             "state": false
         }
     ],
-    "id": "libvirt-38"
+    "id": "libvirt-39"
 }
diff --git a/tests/qemucapabilitiesdata/caps_1.6.0-1.replies b/tests/qemucapabilitiesdata/caps_1.6.0-1.replies
index ae4b3f4..26a0e9d 100644
--- a/tests/qemucapabilitiesdata/caps_1.6.0-1.replies
+++ b/tests/qemucapabilitiesdata/caps_1.6.0-1.replies
@@ -1960,6 +1960,14 @@
 }
 
 {
+    "id": "libvirt-32",
+    "error": {
+        "class": "DeviceNotFound",
+        "desc": "Device 'virtio-gpu-pci' not found"
+    }
+}
+
+{
     "return": [
         {
             "name": "xenpv",
@@ -2045,7 +2053,7 @@
             "cpu-max": 1
         }
     ],
-    "id": "libvirt-32"
+    "id": "libvirt-33"
 }
 
 {
@@ -2123,7 +2131,7 @@
             "name": "qemu64"
         }
     ],
-    "id": "libvirt-33"
+    "id": "libvirt-34"
 }
 
 {
@@ -2131,19 +2139,19 @@
         "enabled": false,
         "present": true
     },
-    "id": "libvirt-34"
+    "id": "libvirt-35"
 }
 
 {
     "return": [
     ],
-    "id": "libvirt-35"
+    "id": "libvirt-36"
 }
 
 {
     "return": [
     ],
-    "id": "libvirt-36"
+    "id": "libvirt-37"
 }
 
 {
@@ -2721,7 +2729,7 @@
             "option": "drive"
         }
     ],
-    "id": "libvirt-37"
+    "id": "libvirt-38"
 }
 
 {
@@ -2743,5 +2751,5 @@
             "state": false
         }
     ],
-    "id": "libvirt-38"
+    "id": "libvirt-39"
 }
diff --git a/tests/qemucapabilitiesdata/caps_1.6.50-1.replies b/tests/qemucapabilitiesdata/caps_1.6.50-1.replies
index 90d31f0..5c493b7 100644
--- a/tests/qemucapabilitiesdata/caps_1.6.50-1.replies
+++ b/tests/qemucapabilitiesdata/caps_1.6.50-1.replies
@@ -1924,6 +1924,14 @@
 }
 
 {
+    "id": "libvirt-32",
+    "error": {
+        "class": "DeviceNotFound",
+        "desc": "Device 'virtio-gpu-pci' not found"
+    }
+}
+
+{
     "return": [
         {
             "name": "xenpv",
@@ -2017,7 +2025,7 @@
             "cpu-max": 1
         }
     ],
-    "id": "libvirt-32"
+    "id": "libvirt-33"
 }
 
 {
@@ -2095,7 +2103,7 @@
             "name": "qemu64"
         }
     ],
-    "id": "libvirt-33"
+    "id": "libvirt-34"
 }
 
 {
@@ -2103,19 +2111,19 @@
         "enabled": false,
         "present": true
     },
-    "id": "libvirt-34"
+    "id": "libvirt-35"
 }
 
 {
     "return": [
     ],
-    "id": "libvirt-35"
+    "id": "libvirt-36"
 }
 
 {
     "return": [
     ],
-    "id": "libvirt-36"
+    "id": "libvirt-37"
 }
 
 {
@@ -2703,7 +2711,7 @@
             "option": "drive"
         }
     ],
-    "id": "libvirt-37"
+    "id": "libvirt-38"
 }
 
 {
@@ -2725,5 +2733,5 @@
             "state": false
         }
     ],
-    "id": "libvirt-38"
+    "id": "libvirt-39"
 }
diff --git a/tests/qemucapabilitiesdata/caps_2.1.1-1.replies b/tests/qemucapabilitiesdata/caps_2.1.1-1.replies
index 511461a..ba85b28 100644
--- a/tests/qemucapabilitiesdata/caps_2.1.1-1.replies
+++ b/tests/qemucapabilitiesdata/caps_2.1.1-1.replies
@@ -2370,6 +2370,14 @@
 }
 
 {
+    "id": "libvirt-32",
+    "error": {
+        "class": "DeviceNotFound",
+        "desc": "Device 'virtio-gpu-pci' not found"
+    }
+}
+
+{
   "return": [
     {
       "name": "pc-1.3",
@@ -2479,7 +2487,7 @@
       "cpu-max": 255
     }
   ],
-  "id": "libvirt-32"
+  "id": "libvirt-33"
 }
 
 {
@@ -2560,7 +2568,7 @@
       "name": "qemu64"
     }
   ],
-  "id": "libvirt-33"
+  "id": "libvirt-34"
 }
 
 {
@@ -2568,21 +2576,21 @@
     "enabled": false,
     "present": true
   },
-  "id": "libvirt-34"
+  "id": "libvirt-35"
 }
 
 {
   "return": [
     "tpm-tis"
   ],
-  "id": "libvirt-35"
+  "id": "libvirt-36"
 }
 
 {
   "return": [
     "passthrough"
   ],
-  "id": "libvirt-36"
+  "id": "libvirt-37"
 }
 
 {
@@ -3442,7 +3450,7 @@
       "option": "drive"
     }
   ],
-  "id": "libvirt-37"
+  "id": "libvirt-38"
 }
 
 {
@@ -3464,5 +3472,5 @@
       "capability": "zero-blocks"
     }
   ],
-  "id": "libvirt-38"
+  "id": "libvirt-39"
 }
diff --git a/tests/qemucapabilitiesdata/caps_2.4.0-1.replies b/tests/qemucapabilitiesdata/caps_2.4.0-1.replies
index e8a1047..8f50128 100644
--- a/tests/qemucapabilitiesdata/caps_2.4.0-1.replies
+++ b/tests/qemucapabilitiesdata/caps_2.4.0-1.replies
@@ -2680,6 +2680,87 @@
 {
   "return": [
     {
+      "name": "any_layout",
+      "description": "on/off",
+      "type": "bool"
+    },
+    {
+      "name": "notify_on_empty",
+      "description": "on/off",
+      "type": "bool"
+    },
+    {
+      "name": "event_idx",
+      "description": "on/off",
+      "type": "bool"
+    },
+    {
+      "name": "indirect_desc",
+      "description": "on/off",
+      "type": "bool"
+    },
+    {
+      "name": "max_outputs",
+      "type": "uint32"
+    },
+    {
+      "name": "virtio-backend",
+      "type": "child<virtio-gpu-device>"
+    },
+    {
+      "name": "command_serr_enable",
+      "description": "on/off",
+      "type": "bool"
+    },
+    {
+      "name": "multifunction",
+      "description": "on/off",
+      "type": "bool"
+    },
+    {
+      "name": "rombar",
+      "type": "uint32"
+    },
+    {
+      "name": "romfile",
+      "type": "str"
+    },
+    {
+      "name": "addr",
+      "description": "Slot and optional function number, example: 06.0 or 06",
+      "type": "int32"
+    },
+    {
+      "name": "disable-modern",
+      "description": "on/off",
+      "type": "bool"
+    },
+    {
+      "name": "disable-legacy",
+      "description": "on/off",
+      "type": "bool"
+    },
+    {
+      "name": "virtio-pci-bus-master-bug-migration",
+      "description": "on/off",
+      "type": "bool"
+    },
+    {
+      "name": "vectors",
+      "type": "uint32"
+    },
+    {
+      "name": "ioeventfd",
+      "description": "on/off",
+      "type": "bool"
+    }
+  ],
+  "id": "libvirt-32"
+}
+
+{
+  "return": [
+    {
       "name": "pc-i440fx-2.4",
       "is-default": true,
       "cpu-max": 255,
@@ -2803,7 +2884,7 @@
       "cpu-max": 255
     }
   ],
-  "id": "libvirt-32"
+  "id": "libvirt-33"
 }
 
 {
@@ -2893,7 +2974,7 @@
       "name": "qemu64"
     }
   ],
-  "id": "libvirt-33"
+  "id": "libvirt-34"
 }
 
 {
@@ -2901,21 +2982,21 @@
     "enabled": false,
     "present": true
   },
-  "id": "libvirt-34"
+  "id": "libvirt-35"
 }
 
 {
   "return": [
     "tpm-tis"
   ],
-  "id": "libvirt-35"
+  "id": "libvirt-36"
 }
 
 {
   "return": [
     "passthrough"
   ],
-  "id": "libvirt-36"
+  "id": "libvirt-37"
 }
 
 {
@@ -3919,7 +4000,7 @@
       "option": "drive"
     }
   ],
-  "id": "libvirt-37"
+  "id": "libvirt-38"
 }
 
 {
@@ -3949,5 +4030,5 @@
       "capability": "events"
     }
   ],
-  "id": "libvirt-38"
+  "id": "libvirt-39"
 }
diff --git a/tests/qemucapabilitiesdata/caps_2.5.0-1.caps b/tests/qemucapabilitiesdata/caps_2.5.0-1.caps
index 82b1df1..975ed0c 100644
--- a/tests/qemucapabilitiesdata/caps_2.5.0-1.caps
+++ b/tests/qemucapabilitiesdata/caps_2.5.0-1.caps
@@ -163,4 +163,5 @@
     <flag name='virtio-net'/>
     <flag name='incoming-defer'/>
     <flag name='virtio-gpu'/>
+    <flag name='virtio-gpu.virgl'/>
   </qemuCaps>
diff --git a/tests/qemucapabilitiesdata/caps_2.5.0-1.replies b/tests/qemucapabilitiesdata/caps_2.5.0-1.replies
index e8a1047..d90a74b 100644
--- a/tests/qemucapabilitiesdata/caps_2.5.0-1.replies
+++ b/tests/qemucapabilitiesdata/caps_2.5.0-1.replies
@@ -2680,6 +2680,92 @@
 {
   "return": [
     {
+      "name": "any_layout",
+      "description": "on/off",
+      "type": "bool"
+    },
+    {
+      "name": "notify_on_empty",
+      "description": "on/off",
+      "type": "bool"
+    },
+    {
+      "name": "event_idx",
+      "description": "on/off",
+      "type": "bool"
+    },
+    {
+      "name": "indirect_desc",
+      "description": "on/off",
+      "type": "bool"
+    },
+    {
+      "name": "virgl",
+      "description": "on/off",
+      "type": "bool"
+    },
+    {
+      "name": "max_outputs",
+      "type": "uint32"
+    },
+    {
+      "name": "virtio-backend",
+      "type": "child<virtio-gpu-device>"
+    },
+    {
+      "name": "command_serr_enable",
+      "description": "on/off",
+      "type": "bool"
+    },
+    {
+      "name": "multifunction",
+      "description": "on/off",
+      "type": "bool"
+    },
+    {
+      "name": "rombar",
+      "type": "uint32"
+    },
+    {
+      "name": "romfile",
+      "type": "str"
+    },
+    {
+      "name": "addr",
+      "description": "Slot and optional function number, example: 06.0 or 06",
+      "type": "int32"
+    },
+    {
+      "name": "disable-modern",
+      "description": "on/off",
+      "type": "bool"
+    },
+    {
+      "name": "disable-legacy",
+      "description": "on/off",
+      "type": "bool"
+    },
+    {
+      "name": "virtio-pci-bus-master-bug-migration",
+      "description": "on/off",
+      "type": "bool"
+    },
+    {
+      "name": "vectors",
+      "type": "uint32"
+    },
+    {
+      "name": "ioeventfd",
+      "description": "on/off",
+      "type": "bool"
+    }
+  ],
+  "id": "libvirt-32"
+}
+
+{
+  "return": [
+    {
       "name": "pc-i440fx-2.4",
       "is-default": true,
       "cpu-max": 255,
@@ -2803,7 +2889,7 @@
       "cpu-max": 255
     }
   ],
-  "id": "libvirt-32"
+  "id": "libvirt-33"
 }
 
 {
@@ -2893,7 +2979,7 @@
       "name": "qemu64"
     }
   ],
-  "id": "libvirt-33"
+  "id": "libvirt-34"
 }
 
 {
@@ -2901,21 +2987,21 @@
     "enabled": false,
     "present": true
   },
-  "id": "libvirt-34"
+  "id": "libvirt-35"
 }
 
 {
   "return": [
     "tpm-tis"
   ],
-  "id": "libvirt-35"
+  "id": "libvirt-36"
 }
 
 {
   "return": [
     "passthrough"
   ],
-  "id": "libvirt-36"
+  "id": "libvirt-37"
 }
 
 {
@@ -3919,7 +4005,7 @@
       "option": "drive"
     }
   ],
-  "id": "libvirt-37"
+  "id": "libvirt-38"
 }
 
 {
@@ -3949,5 +4035,5 @@
       "capability": "events"
     }
   ],
-  "id": "libvirt-38"
+  "id": "libvirt-39"
 }
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-video-virtio-gpu-virgl.args b/tests/qemuxml2argvdata/qemuxml2argv-video-virtio-gpu-virgl.args
new file mode 100644
index 0000000..35051ea
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-video-virtio-gpu-virgl.args
@@ -0,0 +1,23 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/home/test \
+USER=test \
+LOGNAME=test \
+QEMU_AUDIO_DRV=none \
+/usr/bin/qemu \
+-name QEMUGuest1 \
+-S \
+-M pc \
+-m 1024 \
+-smp 1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-nographic \
+-nodefaults \
+-monitor unix:/tmp/test-monitor,server,nowait \
+-no-acpi \
+-boot c \
+-usb \
+-drive file=/var/lib/libvirt/images/QEMUGuest1,if=none,id=drive-ide0-0-0,format=qcow2,cache=none \
+-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
+-device virtio-vga,id=video0,virgl=on,bus=pci.0,addr=0x2 \
+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-video-virtio-gpu-virgl.xml b/tests/qemuxml2argvdata/qemuxml2argv-video-virtio-gpu-virgl.xml
new file mode 100644
index 0000000..0227424
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-video-virtio-gpu-virgl.xml
@@ -0,0 +1,33 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>1048576</memory>
+  <currentMemory unit='KiB'>1048576</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <disk type='file' device='disk'>
+      <driver name='qemu' type='qcow2' cache='none'/>
+      <source file='/var/lib/libvirt/images/QEMUGuest1'/>
+      <target dev='hda' bus='ide'/>
+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+    </disk>
+    <controller type='ide' index='0'/>
+    <controller type='usb' index='0'/>
+    <controller type='pci' index='0' model='pci-root'/>
+    <video>
+      <model type='virtio' heads='1'>
+        <acceleration accel3d='yes'/>
+      </model>
+    </video>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 1bb0bde..4baadb7 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1751,6 +1751,10 @@ mymain(void)
     DO_TEST("video-virtio-gpu-device",
             QEMU_CAPS_DEVICE, QEMU_CAPS_DEVICE_VIRTIO_GPU,
             QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
+    DO_TEST("video-virtio-gpu-virgl",
+            QEMU_CAPS_DEVICE, QEMU_CAPS_DEVICE_VIRTIO_GPU,
+            QEMU_CAPS_DEVICE_VIRTIO_GPU_VIRGL,
+            QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
 
     qemuTestDriverFree(&driver);
 
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 73e5104..a4fefef 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -627,6 +627,7 @@ mymain(void)
     DO_TEST("net-udp");
 
     DO_TEST("video-virtio-gpu-device");
+    DO_TEST("video-virtio-gpu-virgl");
 
     qemuTestDriverFree(&driver);
 
-- 
2.5.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]