]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: minor refactor of video device string handling
authorJonathon Jongsma <jjongsma@redhat.com>
Thu, 11 Jul 2019 21:05:32 +0000 (16:05 -0500)
committerJán Tomko <jtomko@redhat.com>
Fri, 12 Jul 2019 14:54:32 +0000 (16:54 +0200)
In preparation for adding the bochs display device, refactor the logic
so that each branch handles a single device type and checks its
parameters within that branch. In this case VGA and VMVGA are still
grouped into the same branch since they share device-specific parameter
names.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_command.c

index 688dc324c60b50e5f5d72d6109415a8103e39f80..2f98efd6bf6b51b80c1e76e736def99b6b78d5b7 100644 (file)
@@ -4748,13 +4748,12 @@ qemuBuildDeviceVideoStr(const virDomainDef *def,
             if (video->heads)
                 virBufferAsprintf(&buf, ",max_outputs=%u", video->heads);
         }
-    } else if (video->vram &&
-        ((video->type == VIR_DOMAIN_VIDEO_TYPE_VGA &&
-          virQEMUCapsGet(qemuCaps, QEMU_CAPS_VGA_VGAMEM)) ||
-         (video->type == VIR_DOMAIN_VIDEO_TYPE_VMVGA &&
-          virQEMUCapsGet(qemuCaps, QEMU_CAPS_VMWARE_SVGA_VGAMEM)))) {
-
-        virBufferAsprintf(&buf, ",vgamem_mb=%u", video->vram / 1024);
+    } else if ((video->type == VIR_DOMAIN_VIDEO_TYPE_VGA &&
+                virQEMUCapsGet(qemuCaps, QEMU_CAPS_VGA_VGAMEM)) ||
+               (video->type == VIR_DOMAIN_VIDEO_TYPE_VMVGA &&
+                virQEMUCapsGet(qemuCaps, QEMU_CAPS_VMWARE_SVGA_VGAMEM))) {
+        if (video->vram)
+            virBufferAsprintf(&buf, ",vgamem_mb=%u", video->vram / 1024);
     }
 
     if (qemuBuildDeviceAddressStr(&buf, def, &video->info, qemuCaps) < 0)