]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: Generate 'xres' and 'yres' for QEMU video devices
authorJulio Faracco <jcfaracco@gmail.com>
Thu, 17 Oct 2019 04:30:32 +0000 (01:30 -0300)
committerCole Robinson <crobinso@redhat.com>
Thu, 17 Oct 2019 20:18:34 +0000 (16:18 -0400)
This commit let QEMU command line define 'xres' and 'yres' properties
if XML contains both properties from video model: based on resolution
fields 'x' and 'y'. There is a conditional structure inside
qemuDomainDeviceDefValidateVideo() that validates if video model
supports this feature. This commit includes the necessary changes to
cover resolution for 'video-qxl-resolution' test cases too.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Julio Faracco <jcfaracco@gmail.com>
src/qemu/qemu_command.c
src/qemu/qemu_domain.c
tests/qemuxml2argvdata/video-qxl-resolution.args
tests/qemuxml2argvdata/video-qxl-resolution.xml
tests/qemuxml2xmloutdata/video-qxl-resolution.xml

index e98195b1d7586b893108a4e3167fc6471f472f88..b579b994f3c3f21165ce2782924c91774f417ad1 100644 (file)
@@ -4598,6 +4598,11 @@ qemuBuildDeviceVideoStr(const virDomainDef *def,
             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)
         return NULL;
 
index 09b6c9a570aaf62ea4208372b9ccd6c92e1f962a..a97bf65e7f9b7d759a1f739e97acf19538c8596f 100644 (file)
@@ -5774,6 +5774,17 @@ qemuDomainDeviceDefValidateVideo(const virDomainVideoDef *video)
         }
     }
 
+    if (video->type != VIR_DOMAIN_VIDEO_TYPE_VGA &&
+        video->type != VIR_DOMAIN_VIDEO_TYPE_QXL &&
+        video->type != VIR_DOMAIN_VIDEO_TYPE_VIRTIO &&
+        video->type != VIR_DOMAIN_VIDEO_TYPE_BOCHS) {
+        if (video->res) {
+            virReportError(VIR_ERR_XML_ERROR, "%s",
+                           _("model resolution is not supported"));
+            return -1;
+        }
+    }
+
     if (video->type == VIR_DOMAIN_VIDEO_TYPE_VGA ||
         video->type == VIR_DOMAIN_VIDEO_TYPE_VMVGA) {
         if (video->vram && video->vram < 1024) {
index 1dbcd660f11d15e2220625b3e99732370787cc93..ed2e4422dabd20768db4a82942b71c2434b7b8b0 100644 (file)
@@ -28,5 +28,5 @@ server,nowait \
 -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \
 -device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 \
 -device qxl-vga,id=video0,ram_size=67108864,vram_size=67108864,vgamem_mb=8,\
-bus=pci.0,addr=0x2 \
+xres=1280,yres=720,bus=pci.0,addr=0x2 \
 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
index 6ba2817002767ef4351cf9455f3cd04118e0e86e..1bc415f3f864f2e6fc7f9f604aad47af7a001471 100644 (file)
@@ -30,7 +30,9 @@
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
     <video>
-      <model type='qxl' ram='65536' vram='65536' vgamem='8192' heads='1' primary='yes'/>
+      <model type='qxl' ram='65536' vram='65536' vgamem='8192' heads='1' primary='yes'>
+        <resolution x='1280' y='720'/>
+      </model>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
     </video>
     <memballoon model='virtio'>
index 6ba2817002767ef4351cf9455f3cd04118e0e86e..1bc415f3f864f2e6fc7f9f604aad47af7a001471 100644 (file)
@@ -30,7 +30,9 @@
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
     <video>
-      <model type='qxl' ram='65536' vram='65536' vgamem='8192' heads='1' primary='yes'/>
+      <model type='qxl' ram='65536' vram='65536' vgamem='8192' heads='1' primary='yes'>
+        <resolution x='1280' y='720'/>
+      </model>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
     </video>
     <memballoon model='virtio'>