diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 500f114f41a5cc90dcc9b79236f59b0c37091212..962766b792d3acc7d984592cb782205d1b60bc76 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -7077,7 +7077,10 @@ qemu-kvm -net nic,model=? /dev/null
vgamem
(since 1.2.11 ) to set
the size of VGA framebuffer for fallback mode of QXL device.
Attribute vram64
(since 1.3.3 )
- extends secondary bar and makes it addressable as 64bit memory.
+ extends secondary bar and makes it addressable as 64bit memory. For
+ resolution settings, there are x
and y
+ (since 5.9.0 ) optional attributes to set
+ minimum resolution for model.
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index ead5a25068d4524dedbcc2cd30cd05586579a5ed..e06f892da3931375bd32f118382713bbe7541d37 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -3656,6 +3656,16 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 2e6a113de3276081c109db3da0bae153df697719..88e93f6fb84e6cc765d2de8a6ac08563125acdf5 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -15345,6 +15345,52 @@ virDomainVideoAccelDefParseXML(xmlNodePtr node)
return def;
}
+static virDomainVideoResolutionDefPtr
+virDomainVideoResolutionDefParseXML(xmlNodePtr node)
+{
+ xmlNodePtr cur;
+ virDomainVideoResolutionDefPtr def;
+ g_autofree char *x = NULL;
+ g_autofree char *y = NULL;
+
+ cur = node->children;
+ while (cur != NULL) {
+ if (cur->type == XML_ELEMENT_NODE) {
+ if (!x && !y &&
+ virXMLNodeNameEqual(cur, "resolution")) {
+ x = virXMLPropString(cur, "x");
+ y = virXMLPropString(cur, "y");
+ }
+ }
+ cur = cur->next;
+ }
+
+ if (!x || !y)
+ return NULL;
+
+ if (VIR_ALLOC(def) < 0)
+ goto cleanup;
+
+ if (x) {
+ if (virStrToLong_uip(x, NULL, 10, &def->x) < 0) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("cannot parse video x-resolution '%s'"), x);
+ goto cleanup;
+ }
+ }
+
+ if (y) {
+ if (virStrToLong_uip(y, NULL, 10, &def->y) < 0) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("cannot parse video y-resolution '%s'"), y);
+ goto cleanup;
+ }
+ }
+
+ cleanup:
+ return def;
+}
+
static virDomainVideoDriverDefPtr
virDomainVideoDriverDefParseXML(xmlNodePtr node)
{
@@ -15424,6 +15470,7 @@ virDomainVideoDefParseXML(virDomainXMLOptionPtr xmlopt,
}
def->accel = virDomainVideoAccelDefParseXML(cur);
+ def->res = virDomainVideoResolutionDefParseXML(cur);
}
if (virXMLNodeNameEqual(cur, "driver")) {
if (virDomainVirtioOptionsParseXML(cur, &def->virtio) < 0)
@@ -26515,6 +26562,18 @@ virDomainVideoAccelDefFormat(virBufferPtr buf,
virBufferAddLit(buf, "/>\n");
}
+static void
+virDomainVideoResolutionDefFormat(virBufferPtr buf,
+ virDomainVideoResolutionDefPtr def)
+{
+ virBufferAddLit(buf, "x && def->y) {
+ virBufferAsprintf(buf, " x='%u' y='%u'",
+ def->x, def->y);
+ }
+ virBufferAddLit(buf, "/>\n");
+}
+
static int
virDomainVideoDefFormat(virBufferPtr buf,
virDomainVideoDefPtr def,
@@ -26562,11 +26621,13 @@ virDomainVideoDefFormat(virBufferPtr buf,
virBufferAsprintf(buf, " heads='%u'", def->heads);
if (def->primary)
virBufferAddLit(buf, " primary='yes'");
- if (def->accel) {
+ if (def->accel || def->res) {
virBufferAddLit(buf, ">\n");
virBufferAdjustIndent(buf, 2);
if (def->accel)
virDomainVideoAccelDefFormat(buf, def->accel);
+ if (def->res)
+ virDomainVideoResolutionDefFormat(buf, def->res);
virBufferAdjustIndent(buf, -2);
virBufferAddLit(buf, "\n");
} else {
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index edac6250e4bbae2b15928b0bc33fafbd07437475..b33e5334f4c0bfa97fca32033b955a44af68dbcd 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1421,6 +1421,10 @@ struct _virDomainVideoAccelDef {
char *rendernode;
};
+struct _virDomainVideoResolutionDef {
+ unsigned int x;
+ unsigned int y;
+};
struct _virDomainVideoDriverDef {
virDomainVideoVGAConf vgaconf;
@@ -1438,6 +1442,7 @@ struct _virDomainVideoDef {
unsigned int heads;
bool primary;
virDomainVideoAccelDefPtr accel;
+ virDomainVideoResolutionDefPtr res;
virDomainVideoDriverDefPtr driver;
virDomainDeviceInfo info;
virDomainVirtioOptionsPtr virtio;
diff --git a/src/conf/virconftypes.h b/src/conf/virconftypes.h
index a15cfb5f9e1d716a601229aa5564196621c71263..462842f32415513396adbc6516ccc81bf7efa017 100644
--- a/src/conf/virconftypes.h
+++ b/src/conf/virconftypes.h
@@ -324,6 +324,9 @@ typedef virDomainVcpuDef *virDomainVcpuDefPtr;
typedef struct _virDomainVideoAccelDef virDomainVideoAccelDef;
typedef virDomainVideoAccelDef *virDomainVideoAccelDefPtr;
+typedef struct _virDomainVideoResolutionDef virDomainVideoResolutionDef;
+typedef virDomainVideoResolutionDef *virDomainVideoResolutionDefPtr;
+
typedef struct _virDomainVideoDef virDomainVideoDef;
typedef virDomainVideoDef *virDomainVideoDefPtr;
diff --git a/tests/qemuxml2argvdata/video-qxl-resolution.args b/tests/qemuxml2argvdata/video-qxl-resolution.args
new file mode 100644
index 0000000000000000000000000000000000000000..1dbcd660f11d15e2220625b3e99732370787cc93
--- /dev/null
+++ b/tests/qemuxml2argvdata/video-qxl-resolution.args
@@ -0,0 +1,32 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/tmp/lib/domain--1-QEMUGuest1 \
+USER=test \
+LOGNAME=test \
+XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \
+XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \
+XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
+QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-i686 \
+-name QEMUGuest1 \
+-S \
+-machine pc,accel=tcg,usb=off,dump-guest-core=off \
+-m 214 \
+-realtime mlock=off \
+-smp 1,sockets=1,cores=1,threads=1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-display none \
+-no-user-config \
+-nodefaults \
+-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\
+server,nowait \
+-mon chardev=charmonitor,id=monitor,mode=control \
+-rtc base=utc \
+-no-shutdown \
+-no-acpi \
+-usb \
+-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 \
+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
diff --git a/tests/qemuxml2argvdata/video-qxl-resolution.xml b/tests/qemuxml2argvdata/video-qxl-resolution.xml
new file mode 100644
index 0000000000000000000000000000000000000000..6ba2817002767ef4351cf9455f3cd04118e0e86e
--- /dev/null
+++ b/tests/qemuxml2argvdata/video-qxl-resolution.xml
@@ -0,0 +1,40 @@
+
+ QEMUGuest1
+ c7a5fdbd-edaf-9455-926a-d65c16db1809
+ 219136
+ 219136
+ 1
+
+ hvm
+
+
+
+ destroy
+ restart
+ destroy
+
+ /usr/bin/qemu-system-i686
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 5212ce50bded532ccb746e5f34afb3674cd0cc81..90edd7a8441de0bb31ac91c947fd278878f5607a 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -2056,6 +2056,10 @@ mymain(void)
QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
QEMU_CAPS_DEVICE_QXL,
QEMU_CAPS_QXL_MAX_OUTPUTS);
+ DO_TEST("video-qxl-resolution",
+ QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
+ QEMU_CAPS_DEVICE_QXL,
+ QEMU_CAPS_QXL_VGAMEM);
DO_TEST("video-virtio-gpu-device",
QEMU_CAPS_DEVICE_VIRTIO_GPU,
QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
diff --git a/tests/qemuxml2xmloutdata/video-qxl-resolution.xml b/tests/qemuxml2xmloutdata/video-qxl-resolution.xml
new file mode 100644
index 0000000000000000000000000000000000000000..6ba2817002767ef4351cf9455f3cd04118e0e86e
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/video-qxl-resolution.xml
@@ -0,0 +1,40 @@
+
+ QEMUGuest1
+ c7a5fdbd-edaf-9455-926a-d65c16db1809
+ 219136
+ 219136
+ 1
+
+ hvm
+
+
+
+ destroy
+ restart
+ destroy
+
+ /usr/bin/qemu-system-i686
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index b9364f942f2d2a2b13b1c743aa2d54e0aea49931..4c7ba98367f204eb5252994e152b3c892236971f 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -1210,6 +1210,7 @@ mymain(void)
QEMU_CAPS_DEVICE_QXL);
DO_TEST("video-qxl-heads", NONE);
DO_TEST("video-qxl-noheads", NONE);
+ DO_TEST("video-qxl-resolution", NONE);
DO_TEST("video-virtio-gpu-secondary", NONE);
DO_TEST("video-virtio-gpu-ccw",
QEMU_CAPS_CCW,