<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, May 11, 2022 at 12:26 AM Jonathon Jongsma <<a href="mailto:jjongsma@redhat.com" target="_blank">jjongsma@redhat.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Add the ability to enable blob resources for the virtio video device.<br>
This will accelerate the display path due to less or no copying of pixel<br>
data.<br>
<br>
Blob resource support can be enabled with e.g.:<br>
<br>
    <video><br>
      <model type='virtio' blob='on'/><br>
    </video><br>
<br>
Some additional background information about blob resources:<br>
<a href="https://lists.freedesktop.org/archives/dri-devel/2020-August/275972.html" rel="noreferrer" target="_blank">https://lists.freedesktop.org/archives/dri-devel/2020-August/275972.html</a><br>
<a href="https://www.kraxel.org/blog/2021/05/virtio-gpu-qemu-graphics-update/" rel="noreferrer" target="_blank">https://www.kraxel.org/blog/2021/05/virtio-gpu-qemu-graphics-update/</a><br>
<br>
Resolves: <a href="https://bugzilla.redhat.com/show_bug.cgi?id=2032406" rel="noreferrer" target="_blank">https://bugzilla.redhat.com/show_bug.cgi?id=2032406</a><br>
<br>
Signed-off-by: Jonathon Jongsma <<a href="mailto:jjongsma@redhat.com" target="_blank">jjongsma@redhat.com</a>><br>
---<br>
 docs/formatdomain.rst             |  6 ++++++<br>
 src/conf/domain_conf.c            |  6 ++++++<br>
 src/conf/domain_conf.h            |  1 +<br>
 src/conf/domain_validate.c        | 13 ++++++++++---<br>
 src/conf/schemas/domaincommon.rng |  5 +++++<br>
 5 files changed, 28 insertions(+), 3 deletions(-)<br>
<br>
diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst<br>
index 993c65e50b..2161cc7e30 100644<br>
--- a/docs/formatdomain.rst<br>
+++ b/docs/formatdomain.rst<br>
@@ -6198,6 +6198,12 @@ A video device.<br>
    :since:`since 1.3.3` ) extends secondary bar and makes it addressable as<br>
    64bit memory.<br>
<br>
+   :since:`Since 8.2.0`, devices with type "virtio" have an optional ``blob``<br></blockquote><div>Since 8.4.0 for libvirt.</div><div>And please mention the QEMU version 6.1.0<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
+   attribute that can be set to "on" or "off". Setting ``blob`` to "on" will<br>
+   enable the use of blob resources in the device. This can accelerate the<br>
+   display path by reducing or eliminating copying of pixel data between the<br>
+   guest and host.<br>
+<br>
    :since:`Since 5.9.0` , the ``model`` element may also have an optional<br>
    ``resolution`` sub-element. The ``resolution`` element has attributes ``x``<br>
    and ``y`` to set the minimum resolution for the video device. This<br>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c<br>
index 60c27ddd34..ae86f455bd 100644<br>
--- a/src/conf/domain_conf.c<br>
+++ b/src/conf/domain_conf.c<br>
@@ -14154,6 +14154,9 @@ virDomainVideoModelDefParseXML(virDomainVideoDef *def,<br>
     else if (rc == 0)<br>
         def->heads = 1;<br>
<br>
+    if (virXMLPropTristateSwitch(node, "blob", VIR_XML_PROP_NONE, &def->blob) < 0)<br>
+        return -1;<br>
+<br>
     return 0;<br>
 }<br>
<br>
@@ -26075,6 +26078,9 @@ virDomainVideoDefFormat(virBuffer *buf,<br>
         virBufferAsprintf(buf, " heads='%u'", def->heads);<br>
     if (def->primary)<br>
         virBufferAddLit(buf, " primary='yes'");<br>
+    if (def->blob != VIR_TRISTATE_SWITCH_ABSENT)<br>
+        virBufferAsprintf(buf, " blob='%s'",<br>
+                          virTristateSwitchTypeToString(def->blob));<br>
     if (def->accel || def->res) {<br>
         virBufferAddLit(buf, ">\n");<br>
         virBufferAdjustIndent(buf, 2);<br>
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h<br>
index acd0588e9b..afa6db2403 100644<br>
--- a/src/conf/domain_conf.h<br>
+++ b/src/conf/domain_conf.h<br>
@@ -1763,6 +1763,7 @@ struct _virDomainVideoDef {<br>
     bool primary;<br>
     virDomainVideoAccelDef *accel;<br>
     virDomainVideoResolutionDef *res;<br>
+    virTristateSwitch blob;<br>
     virDomainVideoDriverDef *driver;<br>
     virDomainDeviceInfo info;<br>
     virDomainVirtioOptions *virtio;<br>
diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c<br>
index 18eb8d697d..da0ff06570 100644<br>
--- a/src/conf/domain_validate.c<br>
+++ b/src/conf/domain_validate.c<br>
@@ -226,9 +226,16 @@ virDomainVideoDefValidate(const virDomainVideoDef *video,<br>
         }<br>
     }<br>
<br>
-    if (video->type != VIR_DOMAIN_VIDEO_TYPE_VIRTIO &&<br>
-        (virDomainCheckVirtioOptionsAreAbsent(video->virtio) < 0))<br>
-        return -1;<br>
+    if (video->type != VIR_DOMAIN_VIDEO_TYPE_VIRTIO) {<br>
+        if (virDomainCheckVirtioOptionsAreAbsent(video->virtio) < 0)<br>
+            return -1;<br>
+        if (video->blob != VIR_TRISTATE_SWITCH_ABSENT) {<br>
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,<br>
+                           _("video type '%s' does not support blob resources"),<br>
+                           virDomainVideoTypeToString(video->type));<br>
+            return -1;<br>
+        }<br>
+    }<br>
<br>
     return 0;<br>
 }<br>
diff --git a/src/conf/schemas/domaincommon.rng b/src/conf/schemas/domaincommon.rng<br>
index 2544864eb4..16b3fd9c53 100644<br>
--- a/src/conf/schemas/domaincommon.rng<br>
+++ b/src/conf/schemas/domaincommon.rng<br>
@@ -4251,6 +4251,11 @@<br>
                 <ref name="virYesNo"/><br>
               </attribute><br>
             </optional><br>
+            <optional><br>
+              <attribute name="blob"><br>
+                <ref name="virOnOff"/><br>
+              </attribute><br>
+            </optional><br>
             <optional><br>
               <element name="acceleration"><br>
                 <optional><br>
-- <br>
2.35.1<br>
<br>
</blockquote></div></div>