[PATCH 2/2] qemu: format vgamem_mb on QEMU command line for cirrus video

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

 



Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1447831

Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx>
---
 src/qemu/qemu_command.c                            |  3 +++
 .../qemuxml2argv-video-cirrus-vgamem.args          | 22 ++++++++++++++++++++++
 .../qemuxml2argv-video-cirrus-vgamem.xml           | 22 ++++++++++++++++++++++
 tests/qemuxml2argvtest.c                           |  4 ++++
 4 files changed, 51 insertions(+)
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-cirrus-vgamem.args
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-cirrus-vgamem.xml

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 9c8bde49a8..96381e8751 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -4610,6 +4610,9 @@ qemuBuildDeviceVideoStr(const virDomainDef *def,
           virQEMUCapsGet(qemuCaps, QEMU_CAPS_VMWARE_SVGA_VGAMEM)))) {
 
         virBufferAsprintf(&buf, ",vgamem_mb=%u", video->vram / 1024);
+    } else if (video->type == VIR_DOMAIN_VIDEO_TYPE_CIRRUS) {
+        if (video->vram && virQEMUCapsGet(qemuCaps, QEMU_CAPS_CIRRUS_VGAMEM))
+            virBufferAsprintf(&buf, ",vgamem_mb=%u", video->vram / 1024);
     }
 
     if (qemuBuildDeviceAddressStr(&buf, def, &video->info, qemuCaps) < 0)
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-video-cirrus-vgamem.args b/tests/qemuxml2argvdata/qemuxml2argv-video-cirrus-vgamem.args
new file mode 100644
index 0000000000..883165b7c1
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-video-cirrus-vgamem.args
@@ -0,0 +1,22 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/home/test \
+USER=test \
+LOGNAME=test \
+QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-i686 \
+-name QEMUGuest1 \
+-S \
+-M pc \
+-m 1024 \
+-smp 1,sockets=1,cores=1,threads=1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-nographic \
+-nodefaults \
+-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\
+server,nowait \
+-mon chardev=charmonitor,id=monitor,mode=readline \
+-no-acpi \
+-boot c \
+-usb \
+-device cirrus-vga,id=video0,vgamem_mb=16,bus=pci.0,addr=0x2
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-video-cirrus-vgamem.xml b/tests/qemuxml2argvdata/qemuxml2argv-video-cirrus-vgamem.xml
new file mode 100644
index 0000000000..9f6f97d3eb
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-video-cirrus-vgamem.xml
@@ -0,0 +1,22 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>1048576</memory>
+  <currentMemory unit='KiB'>1048576</currentMemory>
+  <vcpu>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu-system-i686</emulator>
+    <video>
+      <model type='cirrus' vram='16384' heads='1'/>
+    </video>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index a505864b87..19f662ece9 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1861,6 +1861,10 @@ mymain(void)
             QEMU_CAPS_VNC,
             QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
             QEMU_CAPS_DEVICE_QXL);
+    DO_TEST("video-cirrus-vgamem",
+            QEMU_CAPS_DEVICE_CIRRUS_VGA,
+            QEMU_CAPS_CIRRUS_VGAMEM,
+            QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
     DO_TEST("video-vga-nodevice", QEMU_CAPS_DEVICE_VGA);
     DO_TEST("video-vga-device", QEMU_CAPS_DEVICE_VGA,
             QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
-- 
2.13.6

--
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]
  Powered by Linux