]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
conf: add support for 'blob' in virtio video device
authorJonathon Jongsma <jjongsma@redhat.com>
Wed, 9 Feb 2022 21:13:09 +0000 (15:13 -0600)
committerJonathon Jongsma <jjongsma@redhat.com>
Wed, 8 Mar 2023 19:05:05 +0000 (13:05 -0600)
Add the ability to enable blob resources for the virtio video device.
This will accelerate the display path due to less or no copying of pixel
data.

Blob resource support can be enabled with e.g.:

    <video>
      <model type='virtio' blob='on'/>
    </video>

Some additional background information about blob resources:
https://lists.freedesktop.org/archives/dri-devel/2020-August/275972.html
https://www.kraxel.org/blog/2021/05/virtio-gpu-qemu-graphics-update/

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2032406

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
docs/formatdomain.rst
src/conf/domain_conf.c
src/conf/domain_conf.h
src/conf/domain_validate.c
src/conf/schemas/domaincommon.rng

index c4077c6868009e505dc0568f9ce676d77cfa42fd..da059f9aac1be5a6ab96311d96395a8826975322 100644 (file)
@@ -6437,6 +6437,13 @@ A video device.
    :since:`since 1.3.3` ) extends secondary bar and makes it addressable as
    64bit memory.
 
+   :since:`Since 9.2.0` (QEMU driver only), devices with type "virtio" have an
+   optional ``blob`` attribute that can be set to "on" or "off". Setting
+   ``blob`` to "on" will enable the use of blob resources in the device. This
+   can accelerate the display path by reducing or eliminating copying of pixel
+   data between the guest and host. Note that blob resource support requires
+   QEMU version 6.1 or newer.
+
    :since:`Since 5.9.0` , the ``model`` element may also have an optional
    ``resolution`` sub-element. The ``resolution`` element has attributes ``x``
    and ``y`` to set the minimum resolution for the video device. This
index 8dbab41db85138822f5d0c81efd7d8b07d7919d9..be1ce1cc53d716c9598c39b38b473a2946cbd330 100644 (file)
@@ -12904,6 +12904,9 @@ virDomainVideoModelDefParseXML(virDomainVideoDef *def,
     if (virXMLPropUIntDefault(node, "heads", 10, VIR_XML_PROP_NONE, &def->heads, 1) < 0)
         return -1;
 
+    if (virXMLPropTristateSwitch(node, "blob", VIR_XML_PROP_NONE, &def->blob) < 0)
+        return -1;
+
     return 0;
 }
 
@@ -25280,6 +25283,8 @@ virDomainVideoDefFormat(virBuffer *buf,
         virBufferAsprintf(buf, " heads='%u'", def->heads);
     if (def->primary)
         virBufferAddLit(buf, " primary='yes'");
+    if (def->blob != VIR_TRISTATE_SWITCH_ABSENT)
+        virBufferAsprintf(buf, " blob='%s'", virTristateSwitchTypeToString(def->blob));
     if (def->accel || def->res) {
         virBufferAddLit(buf, ">\n");
         virBufferAdjustIndent(buf, 2);
index f5624a0162a58ba320b28d3c515826fdfe296376..5a2c70f012f8434ca44972093bbc49d8ecc21a75 100644 (file)
@@ -1824,6 +1824,7 @@ struct _virDomainVideoDef {
     bool primary;
     virDomainVideoAccelDef *accel;
     virDomainVideoResolutionDef *res;
+    virTristateSwitch blob;
     virDomainVideoDriverDef *driver;
     virDomainDeviceInfo info;
     virDomainVirtioOptions *virtio;
index db13e561071d62d647617412b66746d8d601b47b..5fb2d4971c07eaaa7edd50ff91ae2b1094adf850 100644 (file)
@@ -225,9 +225,16 @@ virDomainVideoDefValidate(const virDomainVideoDef *video,
         }
     }
 
-    if (video->type != VIR_DOMAIN_VIDEO_TYPE_VIRTIO &&
-        (virDomainCheckVirtioOptionsAreAbsent(video->virtio) < 0))
-        return -1;
+    if (video->type != VIR_DOMAIN_VIDEO_TYPE_VIRTIO) {
+        if (virDomainCheckVirtioOptionsAreAbsent(video->virtio) < 0)
+            return -1;
+        if (video->blob != VIR_TRISTATE_SWITCH_ABSENT) {
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                           _("video type '%s' does not support blob resources"),
+                           virDomainVideoTypeToString(video->type));
+            return -1;
+        }
+    }
 
     return 0;
 }
index 790bba0f7f431a33f1e476ebf13a8f8845ce2fe3..d9373977a8b1dbd8e42d69ecd7ece92da8530675 100644 (file)
                 <ref name="virYesNo"/>
               </attribute>
             </optional>
+            <optional>
+              <attribute name="blob">
+                <ref name="virOnOff"/>
+              </attribute>
+            </optional>
             <optional>
               <element name="acceleration">
                 <optional>