From: Marc-André Lureau <marcandre.lureau(a)redhat.com>
vhost-user-gpu helper may accept --render-node option to specify on
which GPU should the renderning be done.
(by comparison <graphics> rendernode is the target/display rendering)
Signed-off-by: Marc-André Lureau <marcandre.lureau(a)redhat.com>
Signed-off-by: Cole Robinson <crobinso(a)redhat.com>
---
docs/formatdomain.html.in | 5 +++++
docs/schemas/domaincommon.rng | 5 +++++
src/conf/domain_conf.c | 18 +++++++++++++++++-
src/conf/domain_conf.h | 1 +
4 files changed, 28 insertions(+), 1 deletion(-)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index ec650fbe17..5a4807d937 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -7059,6 +7059,11 @@ 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 vhost-user driver only, <span
+ class="since">since 5.5.0</span>)</dd>
</dl>
</dd>
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index bac566855d..6e91fe6cef 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -3644,6 +3644,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 f51575d57d..2cc055491d 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -2832,6 +2832,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);
@@ -15270,6 +15272,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) {
@@ -15278,12 +15281,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)
@@ -15307,6 +15311,9 @@ virDomainVideoAccelDefParseXML(xmlNodePtr node)
def->accel2d = val;
}
+ if (VIR_STRDUP(def->rendernode, rendernode) < 0)
+ goto cleanup;
+
cleanup:
return def;
}
@@ -15474,6 +15481,11 @@ virDomainVideoDefParseXML(virDomainXMLOptionPtr xmlopt,
goto error;
}
}
+ if (!def->vhostuser && def->accel &&
def->accel->rendernode) {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("unsupported rendernode accel attribute without
'vhost-user'"));
+ goto error;
+ }
if (virDomainDeviceInfoParseXML(xmlopt, node, &def->info, flags) < 0)
goto error;
@@ -26452,6 +26464,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 bc2450f25e..707fbd1cd3 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1405,6 +1405,7 @@ VIR_ENUM_DECL(virDomainVideoVGAConf);
struct _virDomainVideoAccelDef {
int accel2d; /* enum virTristateBool */
int accel3d; /* enum virTristateBool */
+ char *rendernode;
};
--
2.21.0