mirror of https://gitee.com/openkylin/libvirt.git
qemu: validate virtio-gpu with vhost-user
Check qemu capability, and accept 3d acceleration. 3d acceleration support is checked when looking for a suitable vhost-user helper. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
parent
6396a478f4
commit
c3d0831745
|
@ -5266,34 +5266,43 @@ qemuProcessStartValidateVideo(virDomainObjPtr vm,
|
||||||
for (i = 0; i < vm->def->nvideos; i++) {
|
for (i = 0; i < vm->def->nvideos; i++) {
|
||||||
video = vm->def->videos[i];
|
video = vm->def->videos[i];
|
||||||
|
|
||||||
if ((video->type == VIR_DOMAIN_VIDEO_TYPE_VGA &&
|
if (video->backend == VIR_DOMAIN_VIDEO_BACKEND_TYPE_VHOSTUSER) {
|
||||||
!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VGA)) ||
|
if (video->type == VIR_DOMAIN_VIDEO_TYPE_VIRTIO &&
|
||||||
(video->type == VIR_DOMAIN_VIDEO_TYPE_CIRRUS &&
|
!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VHOST_USER_GPU)) {
|
||||||
!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_CIRRUS_VGA)) ||
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
(video->type == VIR_DOMAIN_VIDEO_TYPE_VMVGA &&
|
_("this QEMU does not support 'vhost-user' video device"));
|
||||||
!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VMWARE_SVGA)) ||
|
return -1;
|
||||||
(video->type == VIR_DOMAIN_VIDEO_TYPE_QXL &&
|
}
|
||||||
!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_QXL)) ||
|
} else {
|
||||||
(video->type == VIR_DOMAIN_VIDEO_TYPE_VIRTIO &&
|
if ((video->type == VIR_DOMAIN_VIDEO_TYPE_VGA &&
|
||||||
!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_GPU)) ||
|
!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VGA)) ||
|
||||||
(video->type == VIR_DOMAIN_VIDEO_TYPE_VIRTIO &&
|
(video->type == VIR_DOMAIN_VIDEO_TYPE_CIRRUS &&
|
||||||
video->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW &&
|
!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_CIRRUS_VGA)) ||
|
||||||
!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_GPU_CCW))) {
|
(video->type == VIR_DOMAIN_VIDEO_TYPE_VMVGA &&
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VMWARE_SVGA)) ||
|
||||||
_("this QEMU does not support '%s' video device"),
|
(video->type == VIR_DOMAIN_VIDEO_TYPE_QXL &&
|
||||||
virDomainVideoTypeToString(video->type));
|
!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_QXL)) ||
|
||||||
return -1;
|
(video->type == VIR_DOMAIN_VIDEO_TYPE_VIRTIO &&
|
||||||
}
|
!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_GPU)) ||
|
||||||
|
(video->type == VIR_DOMAIN_VIDEO_TYPE_VIRTIO &&
|
||||||
if (video->accel) {
|
video->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW &&
|
||||||
if (video->accel->accel3d == VIR_TRISTATE_SWITCH_ON &&
|
!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_GPU_CCW))) {
|
||||||
(video->type != VIR_DOMAIN_VIDEO_TYPE_VIRTIO ||
|
|
||||||
!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_GPU_VIRGL))) {
|
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
_("%s 3d acceleration is not supported"),
|
_("this QEMU does not support '%s' video device"),
|
||||||
virDomainVideoTypeToString(video->type));
|
virDomainVideoTypeToString(video->type));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (video->accel) {
|
||||||
|
if (video->accel->accel3d == VIR_TRISTATE_SWITCH_ON &&
|
||||||
|
(video->type != VIR_DOMAIN_VIDEO_TYPE_VIRTIO ||
|
||||||
|
!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_GPU_VIRGL))) {
|
||||||
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
|
_("%s 3d acceleration is not supported"),
|
||||||
|
virDomainVideoTypeToString(video->type));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2892,8 +2892,7 @@ mymain(void)
|
||||||
DO_TEST("virtio-options", QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_VIRTIO_KEYBOARD,
|
DO_TEST("virtio-options", QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_VIRTIO_KEYBOARD,
|
||||||
QEMU_CAPS_VIRTIO_MOUSE, QEMU_CAPS_VIRTIO_TABLET,
|
QEMU_CAPS_VIRTIO_MOUSE, QEMU_CAPS_VIRTIO_TABLET,
|
||||||
QEMU_CAPS_VIRTIO_INPUT_HOST,
|
QEMU_CAPS_VIRTIO_INPUT_HOST,
|
||||||
QEMU_CAPS_DEVICE_VIRTIO_GPU,
|
QEMU_CAPS_DEVICE_VHOST_USER_GPU,
|
||||||
QEMU_CAPS_VIRTIO_GPU_VIRGL,
|
|
||||||
QEMU_CAPS_DEVICE_VIRTIO_RNG,
|
QEMU_CAPS_DEVICE_VIRTIO_RNG,
|
||||||
QEMU_CAPS_OBJECT_RNG_RANDOM,
|
QEMU_CAPS_OBJECT_RNG_RANDOM,
|
||||||
QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
|
QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
|
||||||
|
|
Loading…
Reference in New Issue