[PATCH v2 15/17] qemu_command: cleanup qemuBuildVideoCommandLine

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx>
---

Changes in v2:
    - removed switch that checked whether video type is supported, it is handled
    by previous patch

 src/qemu/qemu_command.c | 35 ++++++++++++++++-------------------
 1 file changed, 16 insertions(+), 19 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 823760a..e0c442a 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -4409,31 +4409,28 @@ qemuBuildVideoCommandLine(virCommandPtr cmd,
 {
     size_t i;
 
-    if (!def->videos)
-        return 0;
+    for (i = 0; i < def->nvideos; i++) {
+        char *str = NULL;
+        virDomainVideoDefPtr video = def->videos[i];
 
-    if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIDEO_PRIMARY)) {
-        for (i = 0; i < def->nvideos; i++) {
-            char *str;
-            virCommandAddArg(cmd, "-device");
-            if (!(str = qemuBuildDeviceVideoStr(def, def->videos[i],
-                                                qemuCaps)))
-                return -1;
+        if (video->primary) {
+            if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIDEO_PRIMARY)) {
 
-            virCommandAddArg(cmd, str);
-            VIR_FREE(str);
-        }
-    } else {
-        if (qemuBuildVgaVideoCommand(cmd, def->videos[0], qemuCaps) < 0)
-            return -1;
+                virCommandAddArg(cmd, "-device");
 
-        for (i = 1; i < def->nvideos; i++) {
-            char *str;
+                if (!(str = qemuBuildDeviceVideoStr(def, video, qemuCaps)))
+                    return -1;
 
+                virCommandAddArg(cmd, str);
+                VIR_FREE(str);
+            } else {
+                if (qemuBuildVgaVideoCommand(cmd, video, qemuCaps) < 0)
+                    return -1;
+            }
+        } else {
             virCommandAddArg(cmd, "-device");
 
-            if (!(str = qemuBuildDeviceVideoStr(def, def->videos[i],
-                                                qemuCaps)))
+            if (!(str = qemuBuildDeviceVideoStr(def, video, qemuCaps)))
                 return -1;
 
             virCommandAddArg(cmd, str);
-- 
2.10.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]