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>
---
docs/formatdomain.html.in | 5 +++++
docs/schemas/domaincommon.rng | 5 +++++
src/conf/domain_conf.c | 19 ++++++++++++++++++-
src/conf/domain_conf.h | 1 +
4 files changed, 29 insertions(+), 1 deletion(-)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index d2cc8c00b5..d7f21d0329 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -7038,6 +7038,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 e249d5f8f0..e614ff6f56 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -3635,6 +3635,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 916440256a..7a590bd86a 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -2826,6 +2826,9 @@ 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);
@@ -15223,6 +15226,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) {
@@ -15231,12 +15235,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)
@@ -15260,6 +15265,9 @@ virDomainVideoAccelDefParseXML(xmlNodePtr node)
def->accel2d = val;
}
+ if (VIR_STRDUP(def->rendernode, rendernode) < 0)
+ goto cleanup;
+
cleanup:
return def;
}
@@ -15427,6 +15435,11 @@ virDomainVideoDefParseXML(virDomainXMLOptionPtr xmlopt,
goto error;
}
}
+ if (!def->vhostuser && def->accel &&
def->accel->rendernode) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("unsupported rendernode accel attribute without
vhost-user'"));
+ goto error;
+ }
if (virDomainDeviceInfoParseXML(xmlopt, node, &def->info, flags) < 0)
goto error;
@@ -26330,6 +26343,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 a62b35b092..9f533aa314 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1400,6 +1400,7 @@ VIR_ENUM_DECL(virDomainVideoVGAConf);
struct _virDomainVideoAccelDef {
int accel2d; /* enum virTristateBool */
int accel3d; /* enum virTristateBool */
+ char *rendernode;
};
--
2.22.0.rc2.384.g1a9a72ea1d