From: Marc-André Lureau <marcandre.lureau(a)redhat.com>
vhost-user-gpu helper takes --render-node option to specify on which
GPU should the renderning be done.
Signed-off-by: Marc-André Lureau <marcandre.lureau(a)redhat.com>
---
docs/formatdomain.html.in | 6 ++++++
docs/schemas/domaincommon.rng | 5 +++++
src/conf/domain_conf.c | 17 ++++++++++++++++-
src/conf/domain_conf.h | 1 +
tests/qemuxml2argvdata/virtio-options.xml | 2 +-
5 files changed, 29 insertions(+), 2 deletions(-)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index f56d04eac3..5b2b1a71b1 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -7054,6 +7054,12 @@ qemu-kvm -net nic,model=? /dev/null
<dd>Enable 3D acceleration (for vbox driver
<span class="since">since 0.7.1</span>, qemu driver
<span class="since">since 1.3.0</span>)</dd>
+
+ <dt><code>rendernode</code></dt>
+ <dd>Absolute path to a host's DRI device to be used for
+ rendering (for 'vhostuser' driver only, <span
+ class="since">since 5.8.0</span>). If none is specified,
+ libvirt will pick one available.</dd>
</dl>
</dd>
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 7e0b63f0a6..f4a1074080 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -3643,6 +3643,11 @@
<ref name="virYesNo"/>
</attribute>
</optional>
+ <optional>
+ <attribute name="rendernode">
+ <ref name="absFilePath"/>
+ </attribute>
+ </optional>
</element>
</optional>
</element>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index dc5b7eac5c..129651085f 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -2839,6 +2839,8 @@ virDomainVideoDefClear(virDomainVideoDefPtr def)
virDomainDeviceInfoClear(&def->info);
+ if (def->accel)
+ VIR_FREE(def->accel->rendernode);
VIR_FREE(def->accel);
VIR_FREE(def->virtio);
VIR_FREE(def->driver);
@@ -6266,6 +6268,11 @@ virDomainVideoDefValidate(const virDomainVideoDef *video,
break;
case VIR_DOMAIN_VIDEO_BACKEND_TYPE_DEFAULT:
case VIR_DOMAIN_VIDEO_BACKEND_TYPE_QEMU:
+ if (video->accel && video->accel->rendernode) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("unsupported rendernode accel attribute without
'vhostuser'"));
+ return -1;
+ }
break;
case VIR_DOMAIN_VIDEO_BACKEND_TYPE_LAST:
default:
@@ -15294,6 +15301,7 @@ virDomainVideoAccelDefParseXML(xmlNodePtr node)
int val;
VIR_AUTOFREE(char *) accel2d = NULL;
VIR_AUTOFREE(char *) accel3d = NULL;
+ VIR_AUTOFREE(char *) rendernode = NULL;
cur = node->children;
while (cur != NULL) {
@@ -15302,12 +15310,13 @@ virDomainVideoAccelDefParseXML(xmlNodePtr node)
virXMLNodeNameEqual(cur, "acceleration")) {
accel3d = virXMLPropString(cur, "accel3d");
accel2d = virXMLPropString(cur, "accel2d");
+ rendernode = virXMLPropString(cur, "rendernode");
}
}
cur = cur->next;
}
- if (!accel3d && !accel2d)
+ if (!accel3d && !accel2d && !rendernode)
return NULL;
if (VIR_ALLOC(def) < 0)
@@ -15331,6 +15340,8 @@ virDomainVideoAccelDefParseXML(xmlNodePtr node)
def->accel2d = val;
}
+ VIR_STEAL_PTR(def->rendernode, rendernode);
+
cleanup:
return def;
}
@@ -26476,6 +26487,10 @@ virDomainVideoAccelDefFormat(virBufferPtr buf,
virBufferAsprintf(buf, " accel2d='%s'",
virTristateBoolTypeToString(def->accel2d));
}
+ if (def->rendernode) {
+ virBufferAsprintf(buf, " rendernode='%s'",
+ def->rendernode);
+ }
virBufferAddLit(buf, "/>\n");
}
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index af7fec6e22..0d7cb0b6fa 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1415,6 +1415,7 @@ VIR_ENUM_DECL(virDomainVideoVGAConf);
struct _virDomainVideoAccelDef {
int accel2d; /* enum virTristateBool */
int accel3d; /* enum virTristateBool */
+ char *rendernode;
};
diff --git a/tests/qemuxml2argvdata/virtio-options.xml
b/tests/qemuxml2argvdata/virtio-options.xml
index bdfadca22d..dd9a4f4a01 100644
--- a/tests/qemuxml2argvdata/virtio-options.xml
+++ b/tests/qemuxml2argvdata/virtio-options.xml
@@ -75,7 +75,7 @@
<video>
<driver iommu='on' ats='on' name='vhostuser'/>
<model type='virtio' heads='1' primary='yes'>
- <acceleration accel3d='yes'/>
+ <acceleration accel3d='yes' rendernode='/dev/dri/test'/>
</model>
<address type='pci' domain='0x0000' bus='0x00'
slot='0x02' function='0x0'/>
</video>
--
2.23.0