3e5111
From 7f85f27f9f14683fb784ffd9aecb545d7d39194d Mon Sep 17 00:00:00 2001
3e5111
Message-Id: <7f85f27f9f14683fb784ffd9aecb545d7d39194d@dist-git>
3e5111
From: Martin Kletzander <mkletzan@redhat.com>
3e5111
Date: Mon, 19 Jun 2017 15:40:17 +0200
3e5111
Subject: [PATCH] qemu: Pass the number of heads even with -vga qxl
3e5111
3e5111
When added in multiple previous commits, it was used only with -device
3e5111
qxl(-vga), but for some QEMUs (< 1.6) we need to add this
3e5111
functionality when using -vga qxl as well.
3e5111
3e5111
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1283207
3e5111
3e5111
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
3e5111
(cherry picked from commit d23410449fc9f91ceeeacb19d915a6db2f17f3be)
3e5111
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
3e5111
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
3e5111
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
3e5111
---
3e5111
 src/qemu/qemu_command.c                            |  7 ++++
3e5111
 .../qemuxml2argv-video-vga-qxl-heads.args          | 30 ++++++++++++++
3e5111
 .../qemuxml2argv-video-vga-qxl-heads.xml           | 47 ++++++++++++++++++++++
3e5111
 tests/qemuxml2argvtest.c                           |  3 ++
3e5111
 4 files changed, 87 insertions(+)
3e5111
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-vga-qxl-heads.args
3e5111
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-vga-qxl-heads.xml
3e5111
3e5111
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
3e5111
index 88223babeb..a4184b7378 100644
3e5111
--- a/src/qemu/qemu_command.c
3e5111
+++ b/src/qemu/qemu_command.c
3e5111
@@ -4585,6 +4585,7 @@ qemuBuildVgaVideoCommand(virCommandPtr cmd,
3e5111
         unsigned int vram = video->vram;
3e5111
         unsigned int vram64 = video->vram64;
3e5111
         unsigned int vgamem = video->vgamem;
3e5111
+        unsigned int heads = video->heads;
3e5111
 
3e5111
         if (ram) {
3e5111
             virCommandAddArg(cmd, "-global");
3e5111
@@ -4608,6 +4609,12 @@ qemuBuildVgaVideoCommand(virCommandPtr cmd,
3e5111
             virCommandAddArgFormat(cmd, "%s.vgamem_mb=%u",
3e5111
                                    dev, vgamem / 1024);
3e5111
         }
3e5111
+        if (heads &&
3e5111
+            virQEMUCapsGet(qemuCaps, QEMU_CAPS_QXL_MAX_OUTPUTS)) {
3e5111
+            virCommandAddArg(cmd, "-global");
3e5111
+            virCommandAddArgFormat(cmd, "%s.max_outputs=%u",
3e5111
+                                   dev, heads);
3e5111
+        }
3e5111
     }
3e5111
 
3e5111
     if (video->vram &&
3e5111
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-video-vga-qxl-heads.args b/tests/qemuxml2argvdata/qemuxml2argv-video-vga-qxl-heads.args
3e5111
new file mode 100644
3e5111
index 0000000000..411a2eedbc
3e5111
--- /dev/null
3e5111
+++ b/tests/qemuxml2argvdata/qemuxml2argv-video-vga-qxl-heads.args
3e5111
@@ -0,0 +1,30 @@
3e5111
+LC_ALL=C \
3e5111
+PATH=/bin \
3e5111
+HOME=/home/test \
3e5111
+USER=test \
3e5111
+LOGNAME=test \
3e5111
+QEMU_AUDIO_DRV=none \
3e5111
+/usr/bin/qemu-system-i686 \
3e5111
+-name QEMUGuest1 \
3e5111
+-S \
3e5111
+-M pc \
3e5111
+-m 214 \
3e5111
+-smp 1,sockets=1,cores=1,threads=1 \
3e5111
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
3e5111
+-nographic \
3e5111
+-nodefaults \
3e5111
+-monitor unix:/tmp/lib/domain--1-QEMUGuest1/monitor.sock,server,nowait \
3e5111
+-no-acpi \
3e5111
+-boot c \
3e5111
+-usb \
3e5111
+-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \
3e5111
+-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
3e5111
+-vga qxl \
3e5111
+-global qxl-vga.ram_size=67108864 \
3e5111
+-global qxl-vga.vram_size=67108864 \
3e5111
+-global qxl-vga.max_outputs=1 \
3e5111
+-device qxl,id=video1,ram_size=67108864,vram_size=33554432,max_outputs=3,\
3e5111
+bus=pci.0,addr=0x4 \
3e5111
+-device qxl,id=video2,ram_size=67108864,vram_size=67108864,max_outputs=7,\
3e5111
+bus=pci.0,addr=0x5 \
3e5111
+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
3e5111
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-video-vga-qxl-heads.xml b/tests/qemuxml2argvdata/qemuxml2argv-video-vga-qxl-heads.xml
3e5111
new file mode 100644
3e5111
index 0000000000..d878ddcd6d
3e5111
--- /dev/null
3e5111
+++ b/tests/qemuxml2argvdata/qemuxml2argv-video-vga-qxl-heads.xml
3e5111
@@ -0,0 +1,47 @@
3e5111
+<domain type='qemu'>
3e5111
+  <name>QEMUGuest1</name>
3e5111
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
3e5111
+  <memory unit='KiB'>219136</memory>
3e5111
+  <currentMemory unit='KiB'>219136</currentMemory>
3e5111
+  <vcpu placement='static'>1</vcpu>
3e5111
+  <os>
3e5111
+    <type arch='i686' machine='pc'>hvm</type>
3e5111
+    <boot dev='hd'/>
3e5111
+  </os>
3e5111
+  <clock offset='utc'/>
3e5111
+  <on_poweroff>destroy</on_poweroff>
3e5111
+  <on_reboot>restart</on_reboot>
3e5111
+  <on_crash>destroy</on_crash>
3e5111
+  <devices>
3e5111
+    <emulator>/usr/bin/qemu-system-i686</emulator>
3e5111
+    <disk type='block' device='disk'>
3e5111
+      <source dev='/dev/HostVG/QEMUGuest1'/>
3e5111
+      <target dev='hda' bus='ide'/>
3e5111
+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
3e5111
+    </disk>
3e5111
+    <controller type='usb' index='0'>
3e5111
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
3e5111
+    </controller>
3e5111
+    <controller type='ide' index='0'>
3e5111
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
3e5111
+    </controller>
3e5111
+    <controller type='pci' index='0' model='pci-root'/>
3e5111
+    <input type='mouse' bus='ps2'/>
3e5111
+    <input type='keyboard' bus='ps2'/>
3e5111
+    <video>
3e5111
+      <model type='qxl' ram='65536' vram='32768' vgamem='8192' heads='3'/>
3e5111
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
3e5111
+    </video>
3e5111
+    <video>
3e5111
+      <model type='qxl' ram='65536' vram='65536' vgamem='8192' heads='7'/>
3e5111
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
3e5111
+    </video>
3e5111
+    <video>
3e5111
+      <model type='qxl' ram='65536' vram='65536' vgamem='8192' heads='1' primary='yes'/>
3e5111
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
3e5111
+    </video>
3e5111
+    <memballoon model='virtio'>
3e5111
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
3e5111
+    </memballoon>
3e5111
+  </devices>
3e5111
+</domain>
3e5111
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
3e5111
index 0745d3807a..5ca27f105d 100644
3e5111
--- a/tests/qemuxml2argvtest.c
3e5111
+++ b/tests/qemuxml2argvtest.c
3e5111
@@ -1736,6 +1736,9 @@ mymain(void)
3e5111
             QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
3e5111
             QEMU_CAPS_DEVICE_QXL,
3e5111
             QEMU_CAPS_QXL_MAX_OUTPUTS);
3e5111
+    DO_TEST("video-vga-qxl-heads",
3e5111
+            QEMU_CAPS_DEVICE_QXL,
3e5111
+            QEMU_CAPS_QXL_MAX_OUTPUTS);
3e5111
     DO_TEST("video-qxl-noheads",
3e5111
             QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
3e5111
             QEMU_CAPS_DEVICE_QXL,
3e5111
-- 
3e5111
2.13.1
3e5111