]> xenbits.xensource.com Git - libvirt.git/commitdiff
domaincaps: Report video modelType
authorCole Robinson <crobinso@redhat.com>
Sun, 8 May 2016 16:11:39 +0000 (12:11 -0400)
committerCole Robinson <crobinso@redhat.com>
Mon, 9 May 2016 20:05:31 +0000 (16:05 -0400)
Requires adding the plumbing for <device><video>
The value is <enum name='modelType'> to match the associated domain
XML of <video><model type='XXX'/>

Wire it up for qemu too

14 files changed:
docs/formatdomaincaps.html.in
docs/schemas/domaincaps.rng
src/conf/domain_capabilities.c
src/conf/domain_capabilities.h
src/qemu/qemu_capabilities.c
tests/domaincapsschemadata/domaincaps-basic.xml
tests/domaincapsschemadata/domaincaps-full.xml
tests/domaincapsschemadata/domaincaps-qemu_1.6.50-1.xml
tests/domaincapsschemadata/domaincaps-qemu_2.6.0-1.xml
tests/domaincapsschemadata/domaincaps-qemu_2.6.0-2.xml
tests/domaincapsschemadata/domaincaps-qemu_2.6.0-3.xml
tests/domaincapsschemadata/domaincaps-qemu_2.6.0-4.xml
tests/domaincapsschemadata/domaincaps-qemu_2.6.0-5.xml
tests/domaincapstest.c

index 52e44637f2e82b8ef65179beec5afcd75b318876..d5a8414aa4bc5a5e0624ab050396cb3ba46cffec 100644 (file)
     </dl>
 
 
+    <h4><a name="elementsVideo">Video device</a></h4>
+    <p>Video device capabilities are exposed under the
+    <code>video</code> element. For instance:</p>
+
+<pre>
+&lt;domainCapabilities&gt;
+  ...
+  &lt;devices&gt;
+    &lt;video supported='yes'&gt;
+      &lt;enum name='modelType'&gt;
+        &lt;value&gt;vga&lt;/value&gt;
+        &lt;value&gt;cirrus&lt;/value&gt;
+        &lt;value&gt;vmvga&lt;/value&gt;
+        &lt;value&gt;qxl&lt;/value&gt;
+        &lt;value&gt;virtio&lt;/value&gt;
+      &lt;/enum&gt;
+    &lt;/video&gt;
+    ...
+  &lt;/devices&gt;
+&lt;/domainCapabilities&gt;
+</pre>
+
+    <dl>
+      <dt><code>modelType</code></dt>
+      <dd>Options for the <code>type</code> attribute of the
+      &lt;video&gt;&lt;model&gt; element.</dd>
+    </dl>
+
+
     <h4><a name="elementsHostDev">Host device assignment</a></h4>
     <p>Some host devices can be passed through to a guest (e.g. USB, PCI and
     SCSI). Well, only if the following is enabled:</p>
index 3e82b5771a3331ea46a930fa0aef90b3027107ed..97da41f53350b93ec7b9172ab969b68fdf6ba687 100644 (file)
@@ -73,6 +73,7 @@
       <interleave>
         <ref name='disk'/>
         <ref name='graphics'/>
+        <ref name='video'/>
         <ref name='hostdev'/>
       </interleave>
     </element>
     </element>
   </define>
 
+  <define name='video'>
+    <element name='video'>
+      <ref name='supported'/>
+      <ref name='enum'/>
+    </element>
+  </define>
+
   <define name='hostdev'>
     <element name='hostdev'>
       <ref name='supported'/>
index 232acd5fe302d6683329bdfcb98be5839673d740..1676f0e10efc38bc946c8d5229c65ff924ac6f69 100644 (file)
@@ -258,6 +258,18 @@ virDomainCapsDeviceGraphicsFormat(virBufferPtr buf,
 }
 
 
+static void
+virDomainCapsDeviceVideoFormat(virBufferPtr buf,
+                               virDomainCapsDeviceVideoPtr const video)
+{
+    FORMAT_PROLOGUE(video);
+
+    ENUM_PROCESS(video, modelType, virDomainVideoTypeToString);
+
+    FORMAT_EPILOGUE(video);
+}
+
+
 static void
 virDomainCapsDeviceHostdevFormat(virBufferPtr buf,
                                  virDomainCapsDeviceHostdevPtr const hostdev)
@@ -327,6 +339,7 @@ virDomainCapsFormatInternal(virBufferPtr buf,
 
     virDomainCapsDeviceDiskFormat(buf, &caps->disk);
     virDomainCapsDeviceGraphicsFormat(buf, &caps->graphics);
+    virDomainCapsDeviceVideoFormat(buf, &caps->video);
     virDomainCapsDeviceHostdevFormat(buf, &caps->hostdev);
 
     virBufferAdjustIndent(buf, -2);
index 545ada762c0006649e7177561aa1adf83e5dd4ce..d0ca0098b7648d351385b75c25c6f1f1f7e84ebe 100644 (file)
@@ -76,6 +76,15 @@ struct _virDomainCapsDeviceGraphics {
     virDomainCapsEnum type;   /* virDomainGraphicsType */
 };
 
+typedef struct _virDomainCapsDeviceVideo virDomainCapsDeviceVideo;
+typedef virDomainCapsDeviceVideo *virDomainCapsDeviceVideoPtr;
+struct _virDomainCapsDeviceVideo {
+    bool supported;
+    virDomainCapsEnum modelType;   /* virDomainVideoType */
+};
+
+typedef struct _virDomainCapsDeviceHostdev virDomainCapsDeviceHostdev;
+
 typedef struct _virDomainCapsDeviceHostdev virDomainCapsDeviceHostdev;
 typedef virDomainCapsDeviceHostdev *virDomainCapsDeviceHostdevPtr;
 struct _virDomainCapsDeviceHostdev {
@@ -109,6 +118,7 @@ struct _virDomainCaps {
     virDomainCapsOS os;
     virDomainCapsDeviceDisk disk;
     virDomainCapsDeviceGraphics graphics;
+    virDomainCapsDeviceVideo video;
     virDomainCapsDeviceHostdev hostdev;
     /* add new domain devices here */
 
index c675f9f4981d6a58f8c870fddd9ae76ffba5fafe..1bddf439cbb7b626ec5874c15f8a0c75b9409454 100644 (file)
@@ -4187,6 +4187,27 @@ virQEMUCapsFillDomainDeviceGraphicsCaps(virQEMUCapsPtr qemuCaps,
 }
 
 
+static int
+virQEMUCapsFillDomainDeviceVideoCaps(virQEMUCapsPtr qemuCaps,
+                                     virDomainCapsDeviceVideoPtr dev)
+{
+    dev->supported = true;
+
+    if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VGA))
+        VIR_DOMAIN_CAPS_ENUM_SET(dev->modelType, VIR_DOMAIN_VIDEO_TYPE_VGA);
+    if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_CIRRUS_VGA))
+        VIR_DOMAIN_CAPS_ENUM_SET(dev->modelType, VIR_DOMAIN_VIDEO_TYPE_CIRRUS);
+    if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VMWARE_SVGA))
+        VIR_DOMAIN_CAPS_ENUM_SET(dev->modelType, VIR_DOMAIN_VIDEO_TYPE_VMVGA);
+    if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_QXL_VGA))
+        VIR_DOMAIN_CAPS_ENUM_SET(dev->modelType, VIR_DOMAIN_VIDEO_TYPE_QXL);
+    if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_GPU))
+        VIR_DOMAIN_CAPS_ENUM_SET(dev->modelType, VIR_DOMAIN_VIDEO_TYPE_VIRTIO);
+
+    return 0;
+}
+
+
 static int
 virQEMUCapsFillDomainDeviceHostdevCaps(virQEMUCapsPtr qemuCaps,
                                        virDomainCapsDeviceHostdevPtr hostdev)
@@ -4299,6 +4320,7 @@ virQEMUCapsFillDomainCaps(virDomainCapsPtr domCaps,
     virDomainCapsDeviceDiskPtr disk = &domCaps->disk;
     virDomainCapsDeviceHostdevPtr hostdev = &domCaps->hostdev;
     virDomainCapsDeviceGraphicsPtr graphics = &domCaps->graphics;
+    virDomainCapsDeviceVideoPtr video = &domCaps->video;
     int maxvcpus = virQEMUCapsGetMachineMaxCpus(qemuCaps, domCaps->machine);
 
     domCaps->maxvcpus = maxvcpus;
@@ -4308,6 +4330,7 @@ virQEMUCapsFillDomainCaps(virDomainCapsPtr domCaps,
         virQEMUCapsFillDomainDeviceDiskCaps(qemuCaps,
                                             domCaps->machine, disk) < 0 ||
         virQEMUCapsFillDomainDeviceGraphicsCaps(qemuCaps, graphics) < 0 ||
+        virQEMUCapsFillDomainDeviceVideoCaps(qemuCaps, video) < 0 ||
         virQEMUCapsFillDomainDeviceHostdevCaps(qemuCaps, hostdev) < 0 ||
         virQEMUCapsFillDomainFeatureGICCaps(qemuCaps, domCaps) < 0)
         return -1;
index f0f08642cdca3dae5bb4f2331492c84a61ece23a..5513f99357fd1f156cdf706f651f8667555b4519 100644 (file)
@@ -7,6 +7,7 @@
   <devices>
     <disk supported='no'/>
     <graphics supported='no'/>
+    <video supported='no'/>
     <hostdev supported='no'/>
   </devices>
   <features>
index b3b8855a7f318da54e82bd16b61201cd01ccd1c6..2f529ff40ce6f56b762719265270a04cb808f738 100644 (file)
         <value>spice</value>
       </enum>
     </graphics>
+    <video supported='yes'>
+      <enum name='modelType'>
+        <value>vga</value>
+        <value>cirrus</value>
+        <value>vmvga</value>
+        <value>xen</value>
+        <value>vbox</value>
+        <value>qxl</value>
+        <value>parallels</value>
+        <value>virtio</value>
+      </enum>
+    </video>
     <hostdev supported='yes'>
       <enum name='mode'>
         <value>subsystem</value>
index 147424d6747e6e7c8dfce891a01f0e7b9c4fcfb3..161d0ab8214b765e8e408d838015367719923a20 100644 (file)
         <value>spice</value>
       </enum>
     </graphics>
+    <video supported='yes'>
+      <enum name='modelType'>
+        <value>vga</value>
+        <value>cirrus</value>
+        <value>vmvga</value>
+        <value>qxl</value>
+      </enum>
+    </video>
     <hostdev supported='yes'>
       <enum name='mode'>
         <value>subsystem</value>
index f8f7465f531f1a75c2163df6a2e0cbeae56e4695..f42d239584496d001c660be0eac5a9e8f43add22 100644 (file)
         <value>spice</value>
       </enum>
     </graphics>
+    <video supported='yes'>
+      <enum name='modelType'>
+        <value>vga</value>
+        <value>cirrus</value>
+        <value>vmvga</value>
+        <value>qxl</value>
+        <value>virtio</value>
+      </enum>
+    </video>
     <hostdev supported='yes'>
       <enum name='mode'>
         <value>subsystem</value>
index 79137032880a27f2d95e536aac2c735cdbfd4a0f..4e87cd281b1bd039f95e624808f89e5a4f19a7db 100644 (file)
         <value>vnc</value>
       </enum>
     </graphics>
+    <video supported='yes'>
+      <enum name='modelType'>
+        <value>vga</value>
+        <value>qxl</value>
+        <value>virtio</value>
+      </enum>
+    </video>
     <hostdev supported='yes'>
       <enum name='mode'>
         <value>subsystem</value>
index 6f30819dfeb8b6d4a6ee6c21c1470b65ca641c5f..f5f0f1cd07f48011dbe4e266e7f9c26796226b7e 100644 (file)
         <value>vnc</value>
       </enum>
     </graphics>
+    <video supported='yes'>
+      <enum name='modelType'>
+        <value>vga</value>
+        <value>qxl</value>
+        <value>virtio</value>
+      </enum>
+    </video>
     <hostdev supported='yes'>
       <enum name='mode'>
         <value>subsystem</value>
index 6845e92e3a7b2f4977313d01c8fc4421396e73ca..1ae8172db28f1102e9e0ad9f8f15ade76dea7ff6 100644 (file)
         <value>vnc</value>
       </enum>
     </graphics>
+    <video supported='yes'>
+      <enum name='modelType'>
+        <value>vga</value>
+        <value>qxl</value>
+        <value>virtio</value>
+      </enum>
+    </video>
     <hostdev supported='yes'>
       <enum name='mode'>
         <value>subsystem</value>
index 68d88d1fc9e7bbba2510cf0c08f424fa62c26c3c..583fdf002462dacb3cf171cf8fc6f5877b4fd619 100644 (file)
         <value>vnc</value>
       </enum>
     </graphics>
+    <video supported='yes'>
+      <enum name='modelType'>
+        <value>vga</value>
+        <value>qxl</value>
+        <value>virtio</value>
+      </enum>
+    </video>
     <hostdev supported='yes'>
       <enum name='mode'>
         <value>subsystem</value>
index 6bef6823cd5cd698f42206991652758e6aa77c26..6ae3f358316860d2338c204afd0f57ece9df54f8 100644 (file)
@@ -62,6 +62,7 @@ fillAllCaps(virDomainCapsPtr domCaps)
     virDomainCapsLoaderPtr loader = &os->loader;
     virDomainCapsDeviceDiskPtr disk = &domCaps->disk;
     virDomainCapsDeviceGraphicsPtr graphics = &domCaps->graphics;
+    virDomainCapsDeviceVideoPtr video = &domCaps->video;
     virDomainCapsDeviceHostdevPtr hostdev = &domCaps->hostdev;
     domCaps->maxvcpus = 255;
 
@@ -83,6 +84,9 @@ fillAllCaps(virDomainCapsPtr domCaps)
     graphics->supported = true;
     SET_ALL_BITS(graphics->type);
 
+    video->supported = true;
+    SET_ALL_BITS(video->modelType);
+
     hostdev->supported = true;
     SET_ALL_BITS(hostdev->mode);
     SET_ALL_BITS(hostdev->startupPolicy);