<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, May 12, 2022 at 2:28 AM Jonathon Jongsma <<a href="mailto:jjongsma@redhat.com">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">On 5/11/22 9:56 AM, Han Han wrote:<br>
> <br>
> <br>
> On Wed, May 11, 2022 at 12:26 AM Jonathon Jongsma <<a href="mailto:jjongsma@redhat.com" target="_blank">jjongsma@redhat.com</a> <br>
> <mailto:<a href="mailto:jjongsma@redhat.com" target="_blank">jjongsma@redhat.com</a>>> wrote:<br>
> <br>
> 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://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>
> <<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>
> <<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>
> <mailto:<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<br>
> addressable as<br>
> 64bit memory.<br>
> <br>
> + :since:`Since 8.2.0`, devices with type "virtio" have an<br>
> optional ``blob``<br>
> <br>
> Since 8.4.0 for libvirt.<br>
<br>
Oops. Didn't catch that in the rebase.<br>
<br>
> And please mention the QEMU version 6.1.0<br>
<br>
There are a lot of libvirt features that require minimum versions of <br>
qemu, but it doesn't look like we generally specify these qemu version <br>
requirements in the libvirt documentation. Not sure if I should add it <br>
here...<br></blockquote><div>Generally, the minimal required QEMU version is 3.1.0(<a href="https://libvirt.org/drvqemu.html">https://libvirt.org/drvqemu.html</a>):</div><div>"The libvirt KVM/QEMU driver can manage any QEMU emulator from version 3.1.0 or
later"</div><div>That's to say, a user can use 3.1.0<=QEMU<6.2.0 with current libvirt. <br></div><div>So it's better to mention the required QEMU version for 'blob' to help users resolved the unsupported error.<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
> <br>
> + attribute that can be set to "on" or "off". Setting ``blob`` to<br>
> "on" will<br>
> + enable the use of blob resources in the device. This can<br>
> accelerate the<br>
> + display path by reducing or eliminating copying of pixel data<br>
> between the<br>
> + guest and host.<br>
> +<br>
> :since:`Since 5.9.0` , the ``model`` element may also have an<br>
> optional<br>
> ``resolution`` sub-element. The ``resolution`` element has<br>
> 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 @@<br>
> virDomainVideoModelDefParseXML(virDomainVideoDef *def,<br>
> else if (rc == 0)<br>
> def->heads = 1;<br>
> <br>
> + if (virXMLPropTristateSwitch(node, "blob", VIR_XML_PROP_NONE,<br>
> &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<br>
> 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<br>
> resources"),<br>
> + virDomainVideoTypeToString(video->type));<br>
> + return -1;<br>
> + }<br>
> + }<br>
> <br>
> return 0;<br>
> }<br>
> diff --git a/src/conf/schemas/domaincommon.rng<br>
> 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>
<br>
</blockquote></div></div>