]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: Use virTristateBool instead of virTristateSwitch in a few places
authorMichal Privoznik <mprivozn@redhat.com>
Thu, 20 Jan 2022 13:14:31 +0000 (14:14 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Fri, 21 Jan 2022 15:42:13 +0000 (16:42 +0100)
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>
src/qemu/qemu_command.c
src/qemu/qemu_validate.c

index 733cd470460d0f2b878a757904f8568dcf9b313e..c3007bd76182bf3eb93ed3e605f041235b26a452 100644 (file)
@@ -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;
index 24e0866f8c6bc8a6ab11da197cab22822133093d..7eaad3614e6954e9eeb2ba44d33f928614576fd3 100644 (file)
@@ -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) ||