[libvirt PATCH v5 4/6] conf: add support for 'blob' in virtio video device

Ján Tomko jtomko at redhat.com
Mon Nov 7 07:52:10 UTC 2022


On a Friday in 2022, Jonathon Jongsma wrote:
>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 at redhat.com>
>---
> docs/formatdomain.rst             |  7 +++++++
> src/conf/domain_conf.c            |  6 ++++++
> src/conf/domain_conf.h            |  1 +
> src/conf/domain_validate.c        | 13 ++++++++++---
> src/conf/schemas/domaincommon.rng |  5 +++++
> 5 files changed, 29 insertions(+), 3 deletions(-)
>
>diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst
>index e28b805009..b057fc4703 100644
>--- a/docs/formatdomain.rst
>+++ b/docs/formatdomain.rst
>@@ -6346,6 +6346,13 @@ A video device.
>    :since:`since 1.3.3` ) extends secondary bar and makes it addressable as
>    64bit memory.
>
>+   :since:`Since 8.10.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
>diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
>index 7484059e47..adbb41d19e 100644
>--- a/src/conf/domain_conf.c
>+++ b/src/conf/domain_conf.c
>@@ -12583,6 +12583,9 @@ virDomainVideoModelDefParseXML(virDomainVideoDef *def,
>     else if (rc == 0)
>         def->heads = 1;
>
>+    if (virXMLPropTristateSwitch(node, "blob", VIR_XML_PROP_NONE, &def->blob) < 0)
>+        return -1;
>+
>     return 0;
> }
>
>@@ -24623,6 +24626,9 @@ 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));

Thankfully we abolished the strict 80 column rule, so this can fit on
one line.
https://libvirt.org/coding-style.html#code-formatting-especially-for-new-code

>     if (def->accel || def->res) {
>         virBufferAddLit(buf, ">\n");
>         virBufferAdjustIndent(buf, 2);

Reviewed-by: Ján Tomko <jtomko at redhat.com>

Jano


More information about the libvir-list mailing list