render / rpms / libvirt

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