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 60a47c812b..93991aa3d1 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -7082,6 +7082,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 7006d9f508..40eb4a2d75 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -3648,6 +3648,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 6f81af2d4c..15fb8dea17 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -2840,6 +2840,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);
@@ -6279,6 +6281,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:
@@ -15341,6 +15348,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) {
@@ -15349,12 +15357,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)
@@ -15378,6 +15387,8 @@ virDomainVideoAccelDefParseXML(xmlNodePtr node)
def->accel2d = val;
}
+ VIR_STEAL_PTR(def->rendernode, rendernode);
+
cleanup:
return def;
}
@@ -26535,6 +26546,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 7d60f3054c..16dacd4b43 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1417,6 +1417,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