[libvirt] [PATCH v2 04/10] qemu: Include {xres, yres} for QEMU command line

jcfaracco@gmail.com posted 10 patches 5 years, 2 months ago
[libvirt] [PATCH v2 04/10] qemu: Include {xres, yres} for QEMU command line
Posted by jcfaracco@gmail.com 5 years, 2 months ago
From: Julio Faracco <jcfaracco@gmail.com>

Display devices can use now properties 'xres' and 'yres' by QEMU
command line. Only models specified by their QEMU capabilities. This
commit includes VGA, QXL, Virtio and Bochs.

Signed-off-by: Julio Faracco <jcfaracco@gmail.com>
---
 src/qemu/qemu_command.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 1ca1ecd2f0..566e34a2c7 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -4564,6 +4564,11 @@ qemuBuildDeviceVideoStr(const virDomainDef *def,
             virBufferAsprintf(&buf, ",vram_size=%u", video->vram * 1024);
         }
 
+        if (video->res && video->res->x && video->res->y) {
+            /* QEMU accepts resolution xres and yres. */
+            virBufferAsprintf(&buf, ",xres=%u,yres=%u", video->res->x, video->res->y);
+        }
+
         if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_QXL_VRAM64)) {
             /* QEMU accepts mebibytes for vram64_size_mb. */
             virBufferAsprintf(&buf, ",vram64_size_mb=%u", video->vram64 / 1024);
@@ -4583,15 +4588,30 @@ qemuBuildDeviceVideoStr(const virDomainDef *def,
             if (video->heads)
                 virBufferAsprintf(&buf, ",max_outputs=%u", video->heads);
         }
+
+        if (video->res && video->res->x && video->res->y) {
+            /* QEMU accepts resolution xres and yres. */
+            virBufferAsprintf(&buf, ",xres=%u,yres=%u", video->res->x, video->res->y);
+        }
     } 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 (video->res && video->res->x && video->res->y) {
+            /* QEMU accepts resolution xres and yres. */
+            virBufferAsprintf(&buf, ",xres=%u,yres=%u", video->res->x, video->res->y);
+        }
     } else if (video->type == VIR_DOMAIN_VIDEO_TYPE_BOCHS) {
         if (video->vram)
             virBufferAsprintf(&buf, ",vgamem=%uk", video->vram);
+
+        if (video->res && video->res->x && video->res->y) {
+            /* QEMU accepts resolution xres and yres. */
+            virBufferAsprintf(&buf, ",xres=%u,yres=%u", video->res->x, video->res->y);
+        }
     }
 
     if (qemuBuildDeviceAddressStr(&buf, def, &video->info, qemuCaps) < 0)
-- 
2.20.1

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