mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-04-01 20:05:19 +00:00
qemu: Use virTristateBool instead of virTristateSwitch in a few places
Both @accel2d and @accel3d are parsed as virTristateBool, but in a few places (qemuDeviceVideoGetModel() and qemuValidateDomainDeviceDefVideo()) they are compared to virTristateSwitch enum either directly or via a variable of that type. Clear this confusion by using the correct enum. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
2ab0a346bf
commit
5a33dd25c1
@ -695,7 +695,7 @@ qemuDeviceVideoGetModel(virQEMUCaps *qemuCaps,
|
||||
{
|
||||
const char *model = NULL;
|
||||
bool primaryVga = false;
|
||||
virTristateSwitch accel3d = VIR_TRISTATE_SWITCH_ABSENT;
|
||||
virTristateBool accel3d = VIR_TRISTATE_BOOL_ABSENT;
|
||||
|
||||
*virtio = false;
|
||||
*virtioBusSuffix = false;
|
||||
@ -735,7 +735,7 @@ qemuDeviceVideoGetModel(virQEMUCaps *qemuCaps,
|
||||
break;
|
||||
case VIR_DOMAIN_VIDEO_TYPE_VIRTIO:
|
||||
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_VGA_GL) &&
|
||||
accel3d == VIR_TRISTATE_SWITCH_ON)
|
||||
accel3d == VIR_TRISTATE_BOOL_YES)
|
||||
model = "virtio-vga-gl";
|
||||
else
|
||||
model = "virtio-vga";
|
||||
@ -765,7 +765,7 @@ qemuDeviceVideoGetModel(virQEMUCaps *qemuCaps,
|
||||
break;
|
||||
case VIR_DOMAIN_VIDEO_TYPE_VIRTIO:
|
||||
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_GPU_GL_PCI) &&
|
||||
accel3d == VIR_TRISTATE_SWITCH_ON)
|
||||
accel3d == VIR_TRISTATE_BOOL_YES)
|
||||
model = "virtio-gpu-gl";
|
||||
else
|
||||
model = "virtio-gpu";
|
||||
@ -4816,7 +4816,7 @@ qemuBuildDeviceVideoCmd(virCommand *cmd,
|
||||
virQEMUCaps *qemuCaps)
|
||||
{
|
||||
const char *model = NULL;
|
||||
virTristateSwitch virgl = VIR_TRISTATE_SWITCH_ABSENT;
|
||||
virTristateBool virgl = VIR_TRISTATE_BOOL_ABSENT;
|
||||
bool virtio = false;
|
||||
bool virtioBusSuffix = false;
|
||||
g_autoptr(virJSONValue) props = NULL;
|
||||
|
@ -2489,7 +2489,7 @@ qemuValidateDomainDeviceDefVideo(const virDomainVideoDef *video,
|
||||
}
|
||||
}
|
||||
|
||||
if (video->accel && video->accel->accel2d == VIR_TRISTATE_SWITCH_ON) {
|
||||
if (video->accel && video->accel->accel2d == VIR_TRISTATE_BOOL_YES) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("qemu does not support the accel2d setting"));
|
||||
return -1;
|
||||
@ -2553,7 +2553,7 @@ qemuValidateDomainDeviceDefVideo(const virDomainVideoDef *video,
|
||||
return -1;
|
||||
}
|
||||
} else if (video->accel) {
|
||||
if (video->accel->accel3d == VIR_TRISTATE_SWITCH_ON &&
|
||||
if (video->accel->accel3d == VIR_TRISTATE_BOOL_YES &&
|
||||
(video->type != VIR_DOMAIN_VIDEO_TYPE_VIRTIO ||
|
||||
!(virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_GPU_VIRGL) ||
|
||||
virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_GPU_GL_PCI) ||
|
||||
|
Loading…
x
Reference in New Issue
Block a user