mirror of https://gitee.com/openkylin/libvirt.git
domain: add rendernode attribute on <accel>
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@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
bc1e924cf0
commit
1394bf1091
|
@ -7082,6 +7082,12 @@ qemu-kvm -net nic,model=? /dev/null
|
||||||
<dd>Enable 3D acceleration (for vbox driver
|
<dd>Enable 3D acceleration (for vbox driver
|
||||||
<span class="since">since 0.7.1</span>, qemu driver
|
<span class="since">since 0.7.1</span>, qemu driver
|
||||||
<span class="since">since 1.3.0</span>)</dd>
|
<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>
|
</dl>
|
||||||
</dd>
|
</dd>
|
||||||
|
|
||||||
|
|
|
@ -3648,6 +3648,11 @@
|
||||||
<ref name="virYesNo"/>
|
<ref name="virYesNo"/>
|
||||||
</attribute>
|
</attribute>
|
||||||
</optional>
|
</optional>
|
||||||
|
<optional>
|
||||||
|
<attribute name="rendernode">
|
||||||
|
<ref name="absFilePath"/>
|
||||||
|
</attribute>
|
||||||
|
</optional>
|
||||||
</element>
|
</element>
|
||||||
</optional>
|
</optional>
|
||||||
</element>
|
</element>
|
||||||
|
|
|
@ -2840,6 +2840,8 @@ virDomainVideoDefClear(virDomainVideoDefPtr def)
|
||||||
|
|
||||||
virDomainDeviceInfoClear(&def->info);
|
virDomainDeviceInfoClear(&def->info);
|
||||||
|
|
||||||
|
if (def->accel)
|
||||||
|
VIR_FREE(def->accel->rendernode);
|
||||||
VIR_FREE(def->accel);
|
VIR_FREE(def->accel);
|
||||||
VIR_FREE(def->virtio);
|
VIR_FREE(def->virtio);
|
||||||
VIR_FREE(def->driver);
|
VIR_FREE(def->driver);
|
||||||
|
@ -6279,6 +6281,11 @@ virDomainVideoDefValidate(const virDomainVideoDef *video,
|
||||||
break;
|
break;
|
||||||
case VIR_DOMAIN_VIDEO_BACKEND_TYPE_DEFAULT:
|
case VIR_DOMAIN_VIDEO_BACKEND_TYPE_DEFAULT:
|
||||||
case VIR_DOMAIN_VIDEO_BACKEND_TYPE_QEMU:
|
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;
|
break;
|
||||||
case VIR_DOMAIN_VIDEO_BACKEND_TYPE_LAST:
|
case VIR_DOMAIN_VIDEO_BACKEND_TYPE_LAST:
|
||||||
default:
|
default:
|
||||||
|
@ -15341,6 +15348,7 @@ virDomainVideoAccelDefParseXML(xmlNodePtr node)
|
||||||
int val;
|
int val;
|
||||||
VIR_AUTOFREE(char *) accel2d = NULL;
|
VIR_AUTOFREE(char *) accel2d = NULL;
|
||||||
VIR_AUTOFREE(char *) accel3d = NULL;
|
VIR_AUTOFREE(char *) accel3d = NULL;
|
||||||
|
VIR_AUTOFREE(char *) rendernode = NULL;
|
||||||
|
|
||||||
cur = node->children;
|
cur = node->children;
|
||||||
while (cur != NULL) {
|
while (cur != NULL) {
|
||||||
|
@ -15349,12 +15357,13 @@ virDomainVideoAccelDefParseXML(xmlNodePtr node)
|
||||||
virXMLNodeNameEqual(cur, "acceleration")) {
|
virXMLNodeNameEqual(cur, "acceleration")) {
|
||||||
accel3d = virXMLPropString(cur, "accel3d");
|
accel3d = virXMLPropString(cur, "accel3d");
|
||||||
accel2d = virXMLPropString(cur, "accel2d");
|
accel2d = virXMLPropString(cur, "accel2d");
|
||||||
|
rendernode = virXMLPropString(cur, "rendernode");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cur = cur->next;
|
cur = cur->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!accel3d && !accel2d)
|
if (!accel3d && !accel2d && !rendernode)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (VIR_ALLOC(def) < 0)
|
if (VIR_ALLOC(def) < 0)
|
||||||
|
@ -15378,6 +15387,9 @@ virDomainVideoAccelDefParseXML(xmlNodePtr node)
|
||||||
def->accel2d = val;
|
def->accel2d = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (rendernode)
|
||||||
|
def->rendernode = virFileSanitizePath(rendernode);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
return def;
|
return def;
|
||||||
}
|
}
|
||||||
|
@ -26506,6 +26518,7 @@ virDomainVideoAccelDefFormat(virBufferPtr buf,
|
||||||
virBufferAsprintf(buf, " accel2d='%s'",
|
virBufferAsprintf(buf, " accel2d='%s'",
|
||||||
virTristateBoolTypeToString(def->accel2d));
|
virTristateBoolTypeToString(def->accel2d));
|
||||||
}
|
}
|
||||||
|
virBufferEscapeString(buf, " rendernode='%s'", def->rendernode);
|
||||||
virBufferAddLit(buf, "/>\n");
|
virBufferAddLit(buf, "/>\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1417,6 +1417,7 @@ VIR_ENUM_DECL(virDomainVideoVGAConf);
|
||||||
struct _virDomainVideoAccelDef {
|
struct _virDomainVideoAccelDef {
|
||||||
int accel2d; /* enum virTristateBool */
|
int accel2d; /* enum virTristateBool */
|
||||||
int accel3d; /* enum virTristateBool */
|
int accel3d; /* enum virTristateBool */
|
||||||
|
char *rendernode;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -75,7 +75,7 @@
|
||||||
<video>
|
<video>
|
||||||
<driver iommu='on' ats='on' name='vhostuser'/>
|
<driver iommu='on' ats='on' name='vhostuser'/>
|
||||||
<model type='virtio' heads='1' primary='yes'>
|
<model type='virtio' heads='1' primary='yes'>
|
||||||
<acceleration accel3d='yes'/>
|
<acceleration accel3d='yes' rendernode='/dev/dri/test'/>
|
||||||
</model>
|
</model>
|
||||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
|
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
|
||||||
</video>
|
</video>
|
||||||
|
|
Loading…
Reference in New Issue