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(a)redhat.com>
---
src/qemu/qemu_command.c | 8 ++++----
src/qemu/qemu_validate.c | 4 ++--
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 60b4f96e06..99ac44d7f1 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -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;
diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
index 24e0866f8c..7eaad3614e 100644
--- a/src/qemu/qemu_validate.c
+++ b/src/qemu/qemu_validate.c
@@ -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) ||
--
2.34.1