[libvirt] [PATCH V3 0/3] Some improvements for video model

From: Zeng Junliang <zengjunliang@huawei.com> http://www.redhat.com/archives/libvir-list/2014-July/msg00644.html diff to v2: - hide vram attribute silently instead of reporting an error. - introduce three new capabilities for vga.vgamem_mb, vmvga.vgamem_mb and qxl.vgamem_mb. - fix some error reported by building libvirt. Zeng Junliang (3): qemu: Hide vram attribute for some useless cases. qemu: Introduce vgamem attribute for video model qemu: Add secondary-vga support docs/formatdomain.html.in | 46 +++--- docs/schemas/domaincommon.rng | 6 + src/conf/domain_conf.c | 57 +++++++- src/conf/domain_conf.h | 3 + src/libvirt_private.syms | 1 + src/qemu/qemu_capabilities.c | 17 +++ src/qemu/qemu_capabilities.h | 4 + src/qemu/qemu_command.c | 162 +++++++++++++++------ src/qemu/qemu_domain.c | 12 ++ tests/qemucapabilitiesdata/caps_1.2.2-1.caps | 3 + tests/qemucapabilitiesdata/caps_1.3.1-1.caps | 3 + tests/qemucapabilitiesdata/caps_1.4.2-1.caps | 3 + tests/qemucapabilitiesdata/caps_1.5.3-1.caps | 3 + tests/qemucapabilitiesdata/caps_1.6.0-1.caps | 3 + tests/qemucapabilitiesdata/caps_1.6.50-1.caps | 3 + tests/qemuhelptest.c | 10 +- ...qemuhotplug-console-compat-2+console-virtio.xml | 2 +- .../qemuxml2argv-console-compat-2.xml | 2 +- .../qemuxml2argv-controller-order.xml | 2 +- .../qemuxml2argv-graphics-listen-network.xml | 2 +- .../qemuxml2argv-graphics-listen-network2.xml | 2 +- .../qemuxml2argv-graphics-sdl-fullscreen.xml | 2 +- .../qemuxml2argvdata/qemuxml2argv-graphics-sdl.xml | 2 +- ...emuxml2argv-graphics-spice-agent-file-xfer.args | 5 +- ...qemuxml2argv-graphics-spice-agent-file-xfer.xml | 4 +- .../qemuxml2argv-graphics-spice-agentmouse.xml | 2 +- .../qemuxml2argv-graphics-spice-compression.args | 4 +- .../qemuxml2argv-graphics-spice-compression.xml | 4 +- .../qemuxml2argv-graphics-spice-listen-network.xml | 4 +- .../qemuxml2argv-graphics-spice-qxl-vga.args | 4 +- .../qemuxml2argv-graphics-spice-qxl-vga.xml | 4 +- .../qemuxml2argv-graphics-spice-sasl.args | 3 +- .../qemuxml2argv-graphics-spice-sasl.xml | 2 +- .../qemuxml2argv-graphics-spice-timeout.xml | 2 +- .../qemuxml2argv-graphics-spice.args | 5 +- .../qemuxml2argv-graphics-spice.xml | 4 +- .../qemuxml2argv-graphics-vnc-policy.xml | 2 +- .../qemuxml2argv-graphics-vnc-sasl.xml | 2 +- .../qemuxml2argv-graphics-vnc-secondary-vga.args | 7 + .../qemuxml2argv-graphics-vnc-secondary-vga.xml | 39 +++++ .../qemuxml2argv-graphics-vnc-socket.xml | 2 +- .../qemuxml2argv-graphics-vnc-std-vga.args | 4 + .../qemuxml2argv-graphics-vnc-std-vga.xml | 36 +++++ .../qemuxml2argv-graphics-vnc-tls.xml | 2 +- .../qemuxml2argv-graphics-vnc-vmware-svga.args | 4 + .../qemuxml2argv-graphics-vnc-vmware-svga.xml | 36 +++++ .../qemuxml2argv-graphics-vnc-websocket.xml | 2 +- .../qemuxml2argvdata/qemuxml2argv-graphics-vnc.xml | 2 +- .../qemuxml2argv-net-bandwidth.xml | 2 +- .../qemuxml2argv-pci-autoadd-addr.xml | 2 +- .../qemuxml2argv-pci-autoadd-idx.xml | 2 +- tests/qemuxml2argvdata/qemuxml2argv-pci-bridge.xml | 2 +- .../qemuxml2argv-pcihole64-q35.args | 3 +- .../qemuxml2argv-pcihole64-q35.xml | 2 +- .../qemuxml2argvdata/qemuxml2argv-pseries-disk.xml | 2 +- tests/qemuxml2argvdata/qemuxml2argv-q35.args | 3 +- tests/qemuxml2argvdata/qemuxml2argv-q35.xml | 2 +- .../qemuxml2argv-serial-spiceport.args | 4 +- .../qemuxml2argv-serial-spiceport.xml | 2 +- .../qemuxml2argv-video-device-pciaddr-default.args | 9 +- .../qemuxml2argv-video-device-pciaddr-default.xml | 6 +- tests/qemuxml2argvtest.c | 26 +++- .../qemuxml2xmlout-graphics-listen-network2.xml | 2 +- .../qemuxml2xmlout-graphics-spice-timeout.xml | 2 +- .../qemuxml2xmlout-pci-autoadd-addr.xml | 2 +- .../qemuxml2xmlout-pci-autoadd-idx.xml | 2 +- tests/qemuxml2xmloutdata/qemuxml2xmlout-q35.xml | 2 +- tests/qemuxml2xmltest.c | 3 + 68 files changed, 494 insertions(+), 121 deletions(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-secondary-vga.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-secondary-vga.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-std-vga.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-std-vga.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-vmware-svga.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-vmware-svga.xml -- 1.7.12.4

From: Zeng Junliang <zengjunliang@huawei.com> The vram attribute is never used for VGA, CIRRUS and VMVGA as QEMU has no vram attribute for these models. Hide it for qemu in qemuDomainDevicePostParse function. And update the corresponding test cases and descriptions. Signed-off-by: Zeng Junliang <zengjunliang@huawei.com> Signed-off-by: Wang Rui <moon.wangrui@huawei.com> --- docs/formatdomain.html.in | 24 +++++++++++----------- src/qemu/qemu_command.c | 3 ++- src/qemu/qemu_domain.c | 12 +++++++++++ ...qemuhotplug-console-compat-2+console-virtio.xml | 2 +- .../qemuxml2argv-console-compat-2.xml | 2 +- .../qemuxml2argv-controller-order.xml | 2 +- .../qemuxml2argv-graphics-listen-network.xml | 2 +- .../qemuxml2argv-graphics-listen-network2.xml | 2 +- .../qemuxml2argv-graphics-sdl-fullscreen.xml | 2 +- .../qemuxml2argvdata/qemuxml2argv-graphics-sdl.xml | 2 +- .../qemuxml2argv-graphics-spice-agentmouse.xml | 2 +- .../qemuxml2argv-graphics-spice-timeout.xml | 2 +- .../qemuxml2argv-graphics-vnc-policy.xml | 2 +- .../qemuxml2argv-graphics-vnc-sasl.xml | 2 +- .../qemuxml2argv-graphics-vnc-socket.xml | 2 +- .../qemuxml2argv-graphics-vnc-tls.xml | 2 +- .../qemuxml2argv-graphics-vnc-websocket.xml | 2 +- .../qemuxml2argvdata/qemuxml2argv-graphics-vnc.xml | 2 +- .../qemuxml2argv-net-bandwidth.xml | 2 +- .../qemuxml2argv-pci-autoadd-addr.xml | 2 +- .../qemuxml2argv-pci-autoadd-idx.xml | 2 +- tests/qemuxml2argvdata/qemuxml2argv-pci-bridge.xml | 2 +- .../qemuxml2argvdata/qemuxml2argv-pseries-disk.xml | 2 +- .../qemuxml2xmlout-graphics-listen-network2.xml | 2 +- .../qemuxml2xmlout-graphics-spice-timeout.xml | 2 +- .../qemuxml2xmlout-pci-autoadd-addr.xml | 2 +- .../qemuxml2xmlout-pci-autoadd-idx.xml | 2 +- 27 files changed, 50 insertions(+), 37 deletions(-) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index bd99ae0..3012e3c 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -4419,7 +4419,7 @@ qemu-kvm -net nic,model=? /dev/null ... <devices> <video> - <model type='vga' vram='8192' heads='1'> + <model type='vga' heads='1'> <acceleration accel3d='yes' accel2d='yes'/> </model> </video> @@ -4434,17 +4434,16 @@ qemu-kvm -net nic,model=? /dev/null is set but there is a <code>graphics</code> in domain xml, then libvirt will add a default <code>video</code> according to the guest type. For a guest of type "kvm", the default <code>video</code> for it is: - <code>type</code> with value "cirrus", <code>vram</code> with value - "9216", and <code>heads</code> with value "1". By default, the first - video device in domain xml is the primary one, but the optional - attribute <code>primary</code> (<span class="since">since 1.0.2</span>) - with value 'yes' can be used to mark the primary in cases of multiple - video device. The non-primary must be type of "qxl". The optional - attribute <code>ram</code> (<span class="since">since - 1.0.2</span>) is allowed for "qxl" type only and specifies - the size of the primary bar, while <code>vram</code> specifies the - secondary bar size. If "ram" or "vram" are not supplied a default - value is used. + <code>type</code> with value "cirrus", and <code>heads</code> with + value "1". By default, the first video device in domain xml is the + primary one, but the optional attribute <code>primary</code> + (<span class="since">since 1.0.2</span>) with value 'yes' can be + used to mark the primary in cases of multiple video device. + The non-primary must be type of "qxl". The optional attribute + <code>ram</code> (<span class="since">since 1.0.2</span>) is allowed + for "qxl" type only and specifies the size of the primary bar, + while <code>vram</code> specifies the secondary bar size. + If "ram" or "vram" are not supplied a default value is used. </dd> <dt><code>model</code></dt> @@ -4456,6 +4455,7 @@ qemu-kvm -net nic,model=? /dev/null You can also provide the amount of video memory in kibibytes (blocks of 1024 bytes) using <code>vram</code> and the number of screen with <code>heads</code>. + For type of kvm <code>vram</code> attribute is only valid for "qxl". </dd> <dt><code>acceleration</code></dt> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 8a69976..c3f860e 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -11766,7 +11766,8 @@ qemuParseCommandLine(virCapsPtr qemuCaps, vid->type = VIR_DOMAIN_VIDEO_TYPE_XEN; else vid->type = video; - vid->vram = virDomainVideoDefaultRAM(def, vid->type); + vid->vram = vid->type == VIR_DOMAIN_VIDEO_TYPE_QXL ? + virDomainVideoDefaultRAM(def, vid->type) : 0; vid->ram = vid->type == VIR_DOMAIN_VIDEO_TYPE_QXL ? virDomainVideoDefaultRAM(def, vid->type) : 0; vid->heads = 1; diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index e9506e0..9b02f39 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -950,6 +950,18 @@ qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr dev, goto cleanup; } + /* hide the confusing vram attribute which is never used + * for VGA, CIRRUS and VMVGA devices */ + if (dev->type == VIR_DOMAIN_DEVICE_VIDEO && + (dev->data.video->type == VIR_DOMAIN_VIDEO_TYPE_VGA || + dev->data.video->type == VIR_DOMAIN_VIDEO_TYPE_CIRRUS || + dev->data.video->type == VIR_DOMAIN_VIDEO_TYPE_VMVGA)) { + VIR_DEBUG("Hide the confusing vram attribute here, " + "which is never used for VGA, CIRRUS and " + "VMVGA devices"); + dev->data.video->vram = 0; + } + ret = 0; cleanup: diff --git a/tests/qemuhotplugtestdata/qemuhotplug-console-compat-2+console-virtio.xml b/tests/qemuhotplugtestdata/qemuhotplug-console-compat-2+console-virtio.xml index ec1c6e8..6ee2b58 100644 --- a/tests/qemuhotplugtestdata/qemuhotplug-console-compat-2+console-virtio.xml +++ b/tests/qemuhotplugtestdata/qemuhotplug-console-compat-2+console-virtio.xml @@ -91,7 +91,7 @@ <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> </sound> <video> - <model type='cirrus' vram='9216' heads='1'/> + <model type='cirrus' heads='1'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> <memballoon model='virtio'> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-console-compat-2.xml b/tests/qemuxml2argvdata/qemuxml2argv-console-compat-2.xml index 4d4ac47..bae4ff2a 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-console-compat-2.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-console-compat-2.xml @@ -88,7 +88,7 @@ <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> </sound> <video> - <model type='cirrus' vram='9216' heads='1'/> + <model type='cirrus' heads='1'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> <memballoon model='virtio'> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-controller-order.xml b/tests/qemuxml2argvdata/qemuxml2argv-controller-order.xml index 6a98eaa..519109f 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-controller-order.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-controller-order.xml @@ -73,7 +73,7 @@ <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> </sound> <video> - <model type='cirrus' vram='9216' heads='1'/> + <model type='cirrus' heads='1'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> <hostdev mode='subsystem' type='usb' managed='yes'> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-listen-network.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-listen-network.xml index 98b7d6a..d1ca28c 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-listen-network.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-listen-network.xml @@ -28,7 +28,7 @@ <listen type='network' network='Bobsnetwork'/> </graphics> <video> - <model type='cirrus' vram='9216' heads='1'/> + <model type='cirrus' heads='1'/> </video> <memballoon model='virtio'/> </devices> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-listen-network2.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-listen-network2.xml index aa458d7..e3e2b46 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-listen-network2.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-listen-network2.xml @@ -28,7 +28,7 @@ <listen type='network' network='Bobsnetwork'/> </graphics> <video> - <model type='cirrus' vram='9216' heads='1'/> + <model type='cirrus' heads='1'/> </video> <memballoon model='virtio'/> </devices> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl-fullscreen.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl-fullscreen.xml index 0177654..895c76e 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl-fullscreen.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl-fullscreen.xml @@ -27,7 +27,7 @@ <input type='keyboard' bus='ps2'/> <graphics type='sdl' display=':0.1' xauth='/root/.Xauthority' fullscreen='yes'/> <video> - <model type='cirrus' vram='9216' heads='1'/> + <model type='cirrus' heads='1'/> </video> <memballoon model='none'/> </devices> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl.xml index 6bebd10..cb6c774 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl.xml @@ -27,7 +27,7 @@ <input type='keyboard' bus='ps2'/> <graphics type='sdl' display=':0.1' xauth='/root/.Xauthority'/> <video> - <model type='vga' vram='9216' heads='1'/> + <model type='vga' heads='1'/> </video> <memballoon model='none'/> </devices> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-agentmouse.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-agentmouse.xml index 113a236..bad60e8 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-agentmouse.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-agentmouse.xml @@ -32,7 +32,7 @@ <address type='virtio-serial' controller='1' bus='0' port='3'/> </channel> <video> - <model type='cirrus' vram='9216' heads='1'/> + <model type='cirrus' heads='1'/> </video> <memballoon model='virtio'/> </devices> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-timeout.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-timeout.xml index e6ecbed..b5940f4 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-timeout.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-timeout.xml @@ -77,7 +77,7 @@ <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </sound> <video> - <model type='vga' vram='9216' heads='1'/> + <model type='vga' heads='1'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> <memballoon model='virtio'> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-policy.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-policy.xml index 694343f..8e5b17b 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-policy.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-policy.xml @@ -29,7 +29,7 @@ <listen type='address' address='127.0.0.1'/> </graphics> <video> - <model type='cirrus' vram='9216' heads='1'/> + <model type='cirrus' heads='1'/> </video> <memballoon model='none'/> </devices> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-sasl.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-sasl.xml index b35c2bd..30437d3 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-sasl.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-sasl.xml @@ -29,7 +29,7 @@ <listen type='address' address='127.0.0.1'/> </graphics> <video> - <model type='cirrus' vram='9216' heads='1'/> + <model type='cirrus' heads='1'/> </video> <memballoon model='none'/> </devices> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-socket.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-socket.xml index 44df226..f58c237 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-socket.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-socket.xml @@ -27,7 +27,7 @@ <input type='keyboard' bus='ps2'/> <graphics type='vnc' socket='/tmp/foo.socket'/> <video> - <model type='cirrus' vram='9216' heads='1'/> + <model type='cirrus' heads='1'/> </video> <memballoon model='none'/> </devices> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-tls.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-tls.xml index b35c2bd..30437d3 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-tls.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-tls.xml @@ -29,7 +29,7 @@ <listen type='address' address='127.0.0.1'/> </graphics> <video> - <model type='cirrus' vram='9216' heads='1'/> + <model type='cirrus' heads='1'/> </video> <memballoon model='none'/> </devices> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-websocket.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-websocket.xml index cfa61be..0c27493 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-websocket.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-websocket.xml @@ -22,7 +22,7 @@ <listen type='address' address='127.0.0.1'/> </graphics> <video> - <model type='cirrus' vram='9216' heads='1'/> + <model type='cirrus' heads='1'/> </video> <memballoon model='none'/> </devices> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc.xml index 356ac36..b6f49e8 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc.xml @@ -29,7 +29,7 @@ <listen type='address' address='2001:1:2:3:4:5:1234:1234'/> </graphics> <video> - <model type='cirrus' vram='9216' heads='1'/> + <model type='cirrus' heads='1'/> </video> <memballoon model='none'/> </devices> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-net-bandwidth.xml b/tests/qemuxml2argvdata/qemuxml2argv-net-bandwidth.xml index f70e20a..19155ac 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-net-bandwidth.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-net-bandwidth.xml @@ -66,7 +66,7 @@ <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </sound> <video> - <model type='vga' vram='9216' heads='1'/> + <model type='vga' heads='1'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> <memballoon model='virtio'> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pci-autoadd-addr.xml b/tests/qemuxml2argvdata/qemuxml2argv-pci-autoadd-addr.xml index 92db5e6..a1cef80 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-pci-autoadd-addr.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-pci-autoadd-addr.xml @@ -34,7 +34,7 @@ </controller> <input type='mouse' bus='ps2'/> <video> - <model type='cirrus' vram='9216' heads='1'/> + <model type='cirrus' heads='1'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> <memballoon model='virtio'> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pci-autoadd-idx.xml b/tests/qemuxml2argvdata/qemuxml2argv-pci-autoadd-idx.xml index f6a3ddf..881f3e0 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-pci-autoadd-idx.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-pci-autoadd-idx.xml @@ -35,7 +35,7 @@ <controller type='pci' index='8' model='pci-bridge'/> <input type='mouse' bus='ps2'/> <video> - <model type='cirrus' vram='9216' heads='1'/> + <model type='cirrus' heads='1'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> <memballoon model='virtio'> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pci-bridge.xml b/tests/qemuxml2argvdata/qemuxml2argv-pci-bridge.xml index a1cb38c..d2771e5 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-pci-bridge.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-pci-bridge.xml @@ -201,7 +201,7 @@ <listen type='address' address='127.0.0.1'/> </graphics> <video> - <model type='cirrus' vram='9216' heads='1'/> + <model type='cirrus' heads='1'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> <memballoon model='virtio'> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-disk.xml b/tests/qemuxml2argvdata/qemuxml2argv-pseries-disk.xml index 1f896f8..71c844e 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-pseries-disk.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-disk.xml @@ -34,7 +34,7 @@ <input type='mouse' bus='usb'/> <graphics type='sdl'/> <video> - <model type='cirrus' vram='9216' heads='1'/> + <model type='cirrus' heads='1'/> </video> <memballoon model='none'/> </devices> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-listen-network2.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-listen-network2.xml index ae40805..f4103c2 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-listen-network2.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-listen-network2.xml @@ -29,7 +29,7 @@ <listen type='network' network='Bobsnetwork'/> </graphics> <video> - <model type='cirrus' vram='9216' heads='1'/> + <model type='cirrus' heads='1'/> </video> <memballoon model='virtio'/> </devices> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-timeout.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-timeout.xml index 44c4cf7..8a319a2 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-timeout.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-timeout.xml @@ -80,7 +80,7 @@ <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </sound> <video> - <model type='vga' vram='9216' heads='1'/> + <model type='vga' heads='1'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> <memballoon model='virtio'> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-autoadd-addr.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-autoadd-addr.xml index 13f0f5d..d8abb9d 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-autoadd-addr.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-autoadd-addr.xml @@ -34,7 +34,7 @@ </controller> <controller type='pci' index='0' model='pci-root'/> <video> - <model type='cirrus' vram='9216' heads='1'/> + <model type='cirrus' heads='1'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> <memballoon model='virtio'> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-autoadd-idx.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-autoadd-idx.xml index 8748437..a4c22e3 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-autoadd-idx.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-autoadd-idx.xml @@ -35,7 +35,7 @@ <controller type='pci' index='8' model='pci-bridge'/> <controller type='pci' index='0' model='pci-root'/> <video> - <model type='cirrus' vram='9216' heads='1'/> + <model type='cirrus' heads='1'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> <memballoon model='virtio'> -- 1.7.12.4

On 14.08.2014 14:43, Wang Rui wrote:
From: Zeng Junliang <zengjunliang@huawei.com>
The vram attribute is never used for VGA, CIRRUS and VMVGA as QEMU has no vram attribute for these models. Hide it for qemu in qemuDomainDevicePostParse function. And update the corresponding test cases and descriptions.
Signed-off-by: Zeng Junliang <zengjunliang@huawei.com> Signed-off-by: Wang Rui <moon.wangrui@huawei.com> --- docs/formatdomain.html.in | 24 +++++++++++----------- src/qemu/qemu_command.c | 3 ++- src/qemu/qemu_domain.c | 12 +++++++++++ ...qemuhotplug-console-compat-2+console-virtio.xml | 2 +- .../qemuxml2argv-console-compat-2.xml | 2 +- .../qemuxml2argv-controller-order.xml | 2 +- .../qemuxml2argv-graphics-listen-network.xml | 2 +- .../qemuxml2argv-graphics-listen-network2.xml | 2 +- .../qemuxml2argv-graphics-sdl-fullscreen.xml | 2 +- .../qemuxml2argvdata/qemuxml2argv-graphics-sdl.xml | 2 +- .../qemuxml2argv-graphics-spice-agentmouse.xml | 2 +- .../qemuxml2argv-graphics-spice-timeout.xml | 2 +- .../qemuxml2argv-graphics-vnc-policy.xml | 2 +- .../qemuxml2argv-graphics-vnc-sasl.xml | 2 +- .../qemuxml2argv-graphics-vnc-socket.xml | 2 +- .../qemuxml2argv-graphics-vnc-tls.xml | 2 +- .../qemuxml2argv-graphics-vnc-websocket.xml | 2 +- .../qemuxml2argvdata/qemuxml2argv-graphics-vnc.xml | 2 +- .../qemuxml2argv-net-bandwidth.xml | 2 +- .../qemuxml2argv-pci-autoadd-addr.xml | 2 +- .../qemuxml2argv-pci-autoadd-idx.xml | 2 +- tests/qemuxml2argvdata/qemuxml2argv-pci-bridge.xml | 2 +- .../qemuxml2argvdata/qemuxml2argv-pseries-disk.xml | 2 +- .../qemuxml2xmlout-graphics-listen-network2.xml | 2 +- .../qemuxml2xmlout-graphics-spice-timeout.xml | 2 +- .../qemuxml2xmlout-pci-autoadd-addr.xml | 2 +- .../qemuxml2xmlout-pci-autoadd-idx.xml | 2 +- 27 files changed, 50 insertions(+), 37 deletions(-)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index bd99ae0..3012e3c 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -4419,7 +4419,7 @@ qemu-kvm -net nic,model=? /dev/null ... <devices> <video> - <model type='vga' vram='8192' heads='1'> + <model type='vga' heads='1'> <acceleration accel3d='yes' accel2d='yes'/> </model> </video> @@ -4434,17 +4434,16 @@ qemu-kvm -net nic,model=? /dev/null is set but there is a <code>graphics</code> in domain xml, then libvirt will add a default <code>video</code> according to the guest type. For a guest of type "kvm", the default <code>video</code> for it is: - <code>type</code> with value "cirrus", <code>vram</code> with value - "9216", and <code>heads</code> with value "1". By default, the first - video device in domain xml is the primary one, but the optional - attribute <code>primary</code> (<span class="since">since 1.0.2</span>) - with value 'yes' can be used to mark the primary in cases of multiple - video device. The non-primary must be type of "qxl". The optional - attribute <code>ram</code> (<span class="since">since - 1.0.2</span>) is allowed for "qxl" type only and specifies - the size of the primary bar, while <code>vram</code> specifies the - secondary bar size. If "ram" or "vram" are not supplied a default - value is used. + <code>type</code> with value "cirrus", and <code>heads</code> with + value "1". By default, the first video device in domain xml is the + primary one, but the optional attribute <code>primary</code> + (<span class="since">since 1.0.2</span>) with value 'yes' can be + used to mark the primary in cases of multiple video device. + The non-primary must be type of "qxl". The optional attribute + <code>ram</code> (<span class="since">since 1.0.2</span>) is allowed + for "qxl" type only and specifies the size of the primary bar, + while <code>vram</code> specifies the secondary bar size. + If "ram" or "vram" are not supplied a default value is used. </dd>
NACK to these two chunks! The fact that qemu doesn't support setting vram (or maybe it does meanwhile, but we're missing implementation) doesn't mean it should be removed from the XML - moreover, some other drivers support this setting (e.g. vmx and virtualbox). We must keep it there otherwise vmx users won't like us anymore.
<dt><code>model</code></dt> @@ -4456,6 +4455,7 @@ qemu-kvm -net nic,model=? /dev/null You can also provide the amount of video memory in kibibytes (blocks of 1024 bytes) using <code>vram</code> and the number of screen with <code>heads</code>. + For type of kvm <code>vram</code> attribute is only valid for "qxl".
True. This is a good note to have in docs. Okay.
</dd>
<dt><code>acceleration</code></dt> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 8a69976..c3f860e 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -11766,7 +11766,8 @@ qemuParseCommandLine(virCapsPtr qemuCaps, vid->type = VIR_DOMAIN_VIDEO_TYPE_XEN; else vid->type = video; - vid->vram = virDomainVideoDefaultRAM(def, vid->type); + vid->vram = vid->type == VIR_DOMAIN_VIDEO_TYPE_QXL ? + virDomainVideoDefaultRAM(def, vid->type) : 0; vid->ram = vid->type == VIR_DOMAIN_VIDEO_TYPE_QXL ? virDomainVideoDefaultRAM(def, vid->type) : 0; vid->heads = 1; diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index e9506e0..9b02f39 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -950,6 +950,18 @@ qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr dev, goto cleanup; }
+ /* hide the confusing vram attribute which is never used + * for VGA, CIRRUS and VMVGA devices */ + if (dev->type == VIR_DOMAIN_DEVICE_VIDEO && + (dev->data.video->type == VIR_DOMAIN_VIDEO_TYPE_VGA || + dev->data.video->type == VIR_DOMAIN_VIDEO_TYPE_CIRRUS || + dev->data.video->type == VIR_DOMAIN_VIDEO_TYPE_VMVGA)) { + VIR_DEBUG("Hide the confusing vram attribute here, " + "which is never used for VGA, CIRRUS and " + "VMVGA devices"); + dev->data.video->vram = 0; + } +
Well, the field can be looked as reporting field back to user. But I can live with this too. Michal

From: Zeng Junliang <zengjunliang@huawei.com> QEMU suopports to specifie the size of the framebuffer portion of the "ram" region for vga, vmvga and qxl through the qemu command line parameter "vgamem_mb". This patch introduces vgamem attribute for video model, makes the "vgamem_mb" value configured in libvirt xml. Also, add test cases and descriptions for it. Libvirt xml configuration sample(based on VGA): <video> <model type='vga' vgamem='16384' heads='1'/> </video> The resulting qemu command line change is the addition of: -vga std -global VGA.vgamem_mb=16 or -device VGA,id=video0,vgamem_mb=16,bus=pci.0,addr=0x2 If 'vgamem' is not configured by user, a default value will be assigned by libvirt. Assume that user wants to start a VM without 'vgamem' configuration in xml, if QEMU lacks the ability of vgamem, libvirt will only report a warning rather than make starting failed even though libvirt has assigned a default value to vgamem. It could avoid a regression. It's less confusing to introduce the new vgamem attribute. Prior to the change: model libvirt-attribute(xml) qemu-attribute qxl vram vram_size qxl none vgamem_mb vga vram QEMU has no attribute named vram* vga none vgamem_mb vmvga vram QEMU has no attribute named vram* vmvga none vgamem_mb After the change: model libvirt attribute(xml) QEMU attribute qxl vram vram_size qxl vgamem vgamem_mb vga vram QEMU has no attribute named vram* vga vgamem vgamem_mb vmvga vram QEMU has no attribute named vram* vmvga vgamem vgamem_mb Signed-off-by: Zeng Junliang <zengjunliang@huawei.com> Signed-off-by: Wang Rui <moon.wangrui@huawei.com> --- docs/formatdomain.html.in | 35 ++++--- docs/schemas/domaincommon.rng | 5 + src/conf/domain_conf.c | 52 +++++++++- src/conf/domain_conf.h | 2 + src/libvirt_private.syms | 1 + src/qemu/qemu_capabilities.c | 15 +++ src/qemu/qemu_capabilities.h | 3 + src/qemu/qemu_command.c | 105 ++++++++++++++++----- tests/qemucapabilitiesdata/caps_1.2.2-1.caps | 3 + tests/qemucapabilitiesdata/caps_1.3.1-1.caps | 3 + tests/qemucapabilitiesdata/caps_1.4.2-1.caps | 3 + tests/qemucapabilitiesdata/caps_1.5.3-1.caps | 3 + tests/qemucapabilitiesdata/caps_1.6.0-1.caps | 3 + tests/qemucapabilitiesdata/caps_1.6.50-1.caps | 3 + tests/qemuhelptest.c | 10 +- .../qemuxml2argvdata/qemuxml2argv-graphics-sdl.xml | 2 +- ...emuxml2argv-graphics-spice-agent-file-xfer.args | 5 +- ...qemuxml2argv-graphics-spice-agent-file-xfer.xml | 4 +- .../qemuxml2argv-graphics-spice-compression.args | 4 +- .../qemuxml2argv-graphics-spice-compression.xml | 4 +- .../qemuxml2argv-graphics-spice-listen-network.xml | 4 +- .../qemuxml2argv-graphics-spice-qxl-vga.args | 4 +- .../qemuxml2argv-graphics-spice-qxl-vga.xml | 4 +- .../qemuxml2argv-graphics-spice-sasl.args | 3 +- .../qemuxml2argv-graphics-spice-sasl.xml | 2 +- .../qemuxml2argv-graphics-spice-timeout.xml | 2 +- .../qemuxml2argv-graphics-spice.args | 5 +- .../qemuxml2argv-graphics-spice.xml | 4 +- .../qemuxml2argv-graphics-vnc-std-vga.args | 4 + .../qemuxml2argv-graphics-vnc-std-vga.xml | 36 +++++++ .../qemuxml2argv-graphics-vnc-vmware-svga.args | 4 + .../qemuxml2argv-graphics-vnc-vmware-svga.xml | 36 +++++++ .../qemuxml2argv-net-bandwidth.xml | 2 +- .../qemuxml2argv-pcihole64-q35.args | 3 +- .../qemuxml2argv-pcihole64-q35.xml | 2 +- tests/qemuxml2argvdata/qemuxml2argv-q35.args | 3 +- tests/qemuxml2argvdata/qemuxml2argv-q35.xml | 2 +- .../qemuxml2argv-serial-spiceport.args | 4 +- .../qemuxml2argv-serial-spiceport.xml | 2 +- .../qemuxml2argv-video-device-pciaddr-default.args | 9 +- .../qemuxml2argv-video-device-pciaddr-default.xml | 6 +- tests/qemuxml2argvtest.c | 22 ++++- .../qemuxml2xmlout-graphics-spice-timeout.xml | 2 +- tests/qemuxml2xmloutdata/qemuxml2xmlout-q35.xml | 2 +- tests/qemuxml2xmltest.c | 2 + 45 files changed, 357 insertions(+), 77 deletions(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-std-vga.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-std-vga.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-vmware-svga.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-vmware-svga.xml diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 3012e3c..a0d15c4 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -4419,7 +4419,7 @@ qemu-kvm -net nic,model=? /dev/null ... <devices> <video> - <model type='vga' heads='1'> + <model type='vga' vgamem='16384' heads='1'> <acceleration accel3d='yes' accel2d='yes'/> </model> </video> @@ -4434,16 +4434,17 @@ qemu-kvm -net nic,model=? /dev/null is set but there is a <code>graphics</code> in domain xml, then libvirt will add a default <code>video</code> according to the guest type. For a guest of type "kvm", the default <code>video</code> for it is: - <code>type</code> with value "cirrus", and <code>heads</code> with - value "1". By default, the first video device in domain xml is the - primary one, but the optional attribute <code>primary</code> - (<span class="since">since 1.0.2</span>) with value 'yes' can be - used to mark the primary in cases of multiple video device. - The non-primary must be type of "qxl". The optional attribute + <code>type</code> with value "cirrus", <code>vgamem</code> + (<span class="since">since 1.2.8</span>) with value "16384" + and <code>heads</code> with value "1". By default, the first video + device in domain xml is the primary one, but the optional attribute + <code>primary</code> (<span class="since">since 1.0.2</span>) with + value 'yes' can be used to mark the primary in cases of multiple video + device. The non-primary must be type of "qxl". The optional attribute <code>ram</code> (<span class="since">since 1.0.2</span>) is allowed for "qxl" type only and specifies the size of the primary bar, while <code>vram</code> specifies the secondary bar size. - If "ram" or "vram" are not supplied a default value is used. + If "ram", "vram" or "vgamem" are not supplied a default value is used. </dd> <dt><code>model</code></dt> @@ -4452,10 +4453,20 @@ qemu-kvm -net nic,model=? /dev/null attribute which takes the value "vga", "cirrus", "vmvga", "xen", "vbox", or "qxl" (<span class="since">since 0.8.6</span>) depending on the hypervisor features available. - You can also provide the amount of video memory in kibibytes - (blocks of 1024 bytes) using - <code>vram</code> and the number of screen with <code>heads</code>. - For type of kvm <code>vram</code> attribute is only valid for "qxl". + <p> + <code>vram</code> attribute specifies the amount of video memory + in kibibytes (blocks of 1024 bytes). For type of kvm, it is only + valid for type of "qxl". + </p> + <p> + <code>vgamem</code> attribute <span class="since">since 1.2.8, + QEMU and KVM only</span> specifies the size of the framebuffer + portion of the "ram" region. And it is only valid for type of + "vga", "vmvga" and "qxl". + </p> + <p> + <code>heads</code> attribute specifies the number of screen. + </p> </dd> <dt><code>acceleration</code></dt> diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 033f2f6..b2cc218 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -2786,6 +2786,11 @@ <ref name="unsignedInt"/> </attribute> </optional> + <optional> + <attribute name="vgamem"> + <ref name="unsignedInt"/> + </attribute> + </optional> <optional> <attribute name="heads"> <ref name="unsignedInt"/> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 5c762fa..7097570 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -9639,6 +9639,21 @@ virDomainVideoDefaultType(const virDomainDef *def) } } +int +virDomainVideoDefaultVgamem(int type) +{ + switch (type) { + case VIR_DOMAIN_VIDEO_TYPE_VGA: + case VIR_DOMAIN_VIDEO_TYPE_VMVGA: + case VIR_DOMAIN_VIDEO_TYPE_QXL: + /* QEMU use 16M as default value for vga/vmvga/qxl device*/ + return 16 * 1024; + + default: + return 0; + } +} + static virDomainVideoAccelDefPtr virDomainVideoAccelDefParseXML(xmlNodePtr node) { @@ -9694,6 +9709,7 @@ virDomainVideoDefParseXML(xmlNodePtr node, char *type = NULL; char *heads = NULL; char *vram = NULL; + char *vgamem = NULL; char *ram = NULL; char *primary = NULL; @@ -9703,11 +9719,12 @@ virDomainVideoDefParseXML(xmlNodePtr node, cur = node->children; while (cur != NULL) { if (cur->type == XML_ELEMENT_NODE) { - if (!type && !vram && !ram && !heads && + if (!type && !vram && !ram && !heads && !vgamem && xmlStrEqual(cur->name, BAD_CAST "model")) { type = virXMLPropString(cur, "type"); ram = virXMLPropString(cur, "ram"); vram = virXMLPropString(cur, "vram"); + vgamem = virXMLPropString(cur, "vgamem"); heads = virXMLPropString(cur, "heads"); if ((primary = virXMLPropString(cur, "primary")) != NULL) { @@ -9754,13 +9771,31 @@ virDomainVideoDefParseXML(xmlNodePtr node, if (vram) { if (virStrToLong_ui(vram, NULL, 10, &def->vram) < 0) { virReportError(VIR_ERR_XML_ERROR, - _("cannot parse video ram '%s'"), vram); + _("cannot parse video vram '%s'"), vram); goto error; } } else { def->vram = virDomainVideoDefaultRAM(dom, def->type); } + if (vgamem) { + if (def->type != VIR_DOMAIN_VIDEO_TYPE_VGA && + def->type != VIR_DOMAIN_VIDEO_TYPE_VMVGA && + def->type != VIR_DOMAIN_VIDEO_TYPE_QXL) { + virReportError(VIR_ERR_XML_ERROR, + _("Unsupported vgamem attribute for %s device"), + virDomainVideoTypeToString(def->type)); + goto error; + } + if (virStrToLong_ui(vgamem, NULL, 10, &def->vgamem) < 0) { + virReportError(VIR_ERR_XML_ERROR, + _("cannot parse video vgamem '%s'"), vgamem); + goto error; + } + } else { + def->vgamem = virDomainVideoDefaultVgamem(def->type); + } + if (heads) { if (virStrToLong_ui(heads, NULL, 10, &def->heads) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, @@ -9777,6 +9812,7 @@ virDomainVideoDefParseXML(xmlNodePtr node, VIR_FREE(type); VIR_FREE(ram); VIR_FREE(vram); + VIR_FREE(vgamem); VIR_FREE(heads); return def; @@ -9786,6 +9822,7 @@ virDomainVideoDefParseXML(xmlNodePtr node, VIR_FREE(type); VIR_FREE(ram); VIR_FREE(vram); + VIR_FREE(vgamem); VIR_FREE(heads); return NULL; } @@ -12996,6 +13033,7 @@ virDomainDefParseXML(xmlDocPtr xml, VIR_FREE(video); goto error; } + video->vgamem = virDomainVideoDefaultVgamem(video->type); video->vram = virDomainVideoDefaultRAM(def, video->type); video->heads = 1; if (VIR_ALLOC_N(def->videos, 1) < 0) { @@ -13891,6 +13929,14 @@ virDomainVideoDefCheckABIStability(virDomainVideoDefPtr src, return false; } + if (src->vgamem != dst->vgamem) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target video card vgamem %u does not match source %u"), + dst->vgamem, src->vgamem); + return false; + } + + if (src->heads != dst->heads) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("Target video card heads %u does not match source %u"), @@ -16937,6 +16983,8 @@ virDomainVideoDefFormat(virBufferPtr buf, virBufferAsprintf(buf, " ram='%u'", def->ram); if (def->vram) virBufferAsprintf(buf, " vram='%u'", def->vram); + if (def->vgamem) + virBufferAsprintf(buf, " vgamem='%u'", def->vgamem); if (def->heads) virBufferAsprintf(buf, " heads='%u'", def->heads); if (def->primary) diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index ff7d640..d1ef6ec 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1244,6 +1244,7 @@ struct _virDomainVideoDef { int type; unsigned int ram; /* kibibytes (multiples of 1024) */ unsigned int vram; /* kibibytes (multiples of 1024) */ + unsigned int vgamem; /* kibibytes (multiples of 1024) */ unsigned int heads; bool primary; virDomainVideoAccelDefPtr accel; @@ -2492,6 +2493,7 @@ virDomainFSDefPtr virDomainFSRemove(virDomainDefPtr def, size_t i); int virDomainVideoDefaultType(const virDomainDef *def); int virDomainVideoDefaultRAM(const virDomainDef *def, int type); +int virDomainVideoDefaultVgamem(int type); int virDomainObjListNumOfDomains(virDomainObjListPtr doms, bool active, diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 08111d4..e481d92 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -416,6 +416,7 @@ virDomainVcpuPinFindByVcpu; virDomainVcpuPinIsDuplicate; virDomainVideoDefaultRAM; virDomainVideoDefaultType; +virDomainVideoDefaultVgamem; virDomainVideoDefFree; virDomainVideoTypeFromString; virDomainVideoTypeToString; diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 360cc67..146d67c 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -265,6 +265,10 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST, "numa", "memory-backend-file", "usb-audio", + "vga-vgamem", + + "qxl-vgamem", /* 175 */ + "vmware-vgamem", ); @@ -1073,6 +1077,14 @@ virQEMUCapsComputeCmdFlags(const char *help, virQEMUCapsSet(qemuCaps, QEMU_CAPS_VGA_QXL); if ((p = strstr(p, "|none")) && p < nl) virQEMUCapsSet(qemuCaps, QEMU_CAPS_VGA_NONE); + /* It seems that QEMU supports to be communicated with + * qmp command since 1.2.0. When qemuCaps->usedQMP is + * true, these logical code will be invalid. Does it need here? */ + if (version >= 1002000) { + virQEMUCapsSet(qemuCaps, QEMU_CAPS_VGA_VGAMEM_MB); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_QXL_VGAMEM_MB); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_VMWARE_VGAMEM_MB); + } } if (strstr(help, "-spice")) virQEMUCapsSet(qemuCaps, QEMU_CAPS_SPICE); @@ -3034,6 +3046,9 @@ virQEMUCapsInitQMPBasic(virQEMUCapsPtr qemuCaps) virQEMUCapsSet(qemuCaps, QEMU_CAPS_DUMP_GUEST_CORE); virQEMUCapsSet(qemuCaps, QEMU_CAPS_VNC_SHARE_POLICY); virQEMUCapsSet(qemuCaps, QEMU_CAPS_HOST_PCI_MULTIDOMAIN); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_VGA_VGAMEM_MB); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_QXL_VGAMEM_MB); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_VMWARE_VGAMEM_MB); } /* Capabilities that are architecture depending diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 2911759..cdf6920 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -213,6 +213,9 @@ typedef enum { QEMU_CAPS_NUMA = 171, /* newer -numa handling with disjoint cpu ranges */ QEMU_CAPS_OBJECT_MEMORY_FILE = 172, /* -object memory-backend-file */ QEMU_CAPS_OBJECT_USB_AUDIO = 173, /* usb-audio device support */ + QEMU_CAPS_VGA_VGAMEM_MB = 174, /* -global VGA.vgamem_mb */ + QEMU_CAPS_QXL_VGAMEM_MB = 175, /* -global qxl-vga.vgamem_mb */ + QEMU_CAPS_VMWARE_VGAMEM_MB = 176, /* -global vmware-svga.vgamem_mb */ QEMU_CAPS_LAST, /* this must always be the last item */ } virQEMUCapsFlags; diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index c3f860e..c15099a 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -4827,6 +4827,14 @@ qemuBuildDeviceVideoStr(virDomainDefPtr def, virBufferAsprintf(&buf, ",vram_size=%u", video->vram * 1024); } + /* 1. Ignore cirrus-vga as guests would not use it anyway. + * 2. QEMU accepts MByte for vgamem_mb and ensure its value + * a power of two and range: 1 MB -> 256 MB */ + if (video->type != VIR_DOMAIN_VIDEO_TYPE_CIRRUS && + video->vgamem > 1024) { + virBufferAsprintf(&buf, ",vgamem_mb=%u", video->vgamem / 1024); + } + if (qemuBuildDeviceAddressStr(&buf, def, &video->info, qemuCaps) < 0) goto error; @@ -8766,36 +8774,86 @@ qemuBuildCommandLine(virConnectPtr conn, virCommandAddArgList(cmd, "-vga", vgastr, NULL); - if (def->videos[0]->type == VIR_DOMAIN_VIDEO_TYPE_QXL && - (def->videos[0]->vram || def->videos[0]->ram) && - virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) { - const char *dev = (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_QXL_VGA) - ? "qxl-vga" : "qxl"); + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) { + const char *dev = NULL; + bool vgamemSupport = true; int ram = def->videos[0]->ram; int vram = def->videos[0]->vram; + int vgamem = def->videos[0]->vgamem; + switch (primaryVideoType) { + case VIR_DOMAIN_VIDEO_TYPE_VGA: + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VGA)) + dev = "VGA"; + if (dev && vgamem && + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_VGA_VGAMEM_MB)) { + vgamemSupport = false; + VIR_WARN("This QEMU does not support vgamem " + "attribute, ignore it"); + } + break; + case VIR_DOMAIN_VIDEO_TYPE_VMVGA: + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VMWARE_SVGA)) + dev = "vmware-svga"; + if (dev && vgamem && + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_VMWARE_VGAMEM_MB)) { + vgamemSupport = false; + VIR_WARN("This QEMU does not support vgamem " + "attribute, ignore it"); + } + break; + case VIR_DOMAIN_VIDEO_TYPE_QXL: + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_QXL_VGA)) + dev = "qxl-vga"; + else + dev = "qxl"; + if (dev && vgamem && + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_QXL_VGAMEM_MB)) { + vgamemSupport = false; + VIR_WARN("This QEMU does not support vgamem " + "attribute, ignore it"); + } - if (vram > (UINT_MAX / 1024)) { - virReportError(VIR_ERR_OVERFLOW, - _("value for 'vram' must be less than '%u'"), - UINT_MAX / 1024); - goto error; - } - if (ram > (UINT_MAX / 1024)) { - virReportError(VIR_ERR_OVERFLOW, - _("value for 'ram' must be less than '%u'"), - UINT_MAX / 1024); - goto error; + if (vram > (UINT_MAX / 1024)) { + virReportError(VIR_ERR_OVERFLOW, + _("value for 'vram' must be less than '%u'"), + UINT_MAX / 1024); + goto error; + } + if (ram > (UINT_MAX / 1024)) { + virReportError(VIR_ERR_OVERFLOW, + _("value for 'ram' must be less than '%u'"), + UINT_MAX / 1024); + goto error; + } + + if (ram) { + virCommandAddArg(cmd, "-global"); + virCommandAddArgFormat(cmd, "%s.ram_size=%u", + dev, ram * 1024); + } + if (vram) { + virCommandAddArg(cmd, "-global"); + virCommandAddArgFormat(cmd, "%s.vram_size=%u", + dev, vram * 1024); + } + + break; } - if (ram) { - virCommandAddArg(cmd, "-global"); - virCommandAddArgFormat(cmd, "%s.ram_size=%u", - dev, ram * 1024); + /* When vgamem less than 1024 kibibytes, we ignore it here + * and use qemu default value.*/ + if (vgamem < 1024) { + vgamemSupport = false; + VIR_WARN("The configuration value for vgamem is invalid, " + "ignore it and use qemu default value"); } - if (vram) { + + if (dev && vgamemSupport) { + /* QEMU accepts MByte for vgamem_mb and ensure its value + * a power of two and range: 1 MB -> 256 MB */ virCommandAddArg(cmd, "-global"); - virCommandAddArgFormat(cmd, "%s.vram_size=%u", - dev, vram * 1024); + virCommandAddArgFormat(cmd, "%s.vgamem_mb=%u", + dev, vgamem / 1024); } } } @@ -11766,6 +11824,7 @@ qemuParseCommandLine(virCapsPtr qemuCaps, vid->type = VIR_DOMAIN_VIDEO_TYPE_XEN; else vid->type = video; + vid->vgamem = virDomainVideoDefaultVgamem(vid->type); vid->vram = vid->type == VIR_DOMAIN_VIDEO_TYPE_QXL ? virDomainVideoDefaultRAM(def, vid->type) : 0; vid->ram = vid->type == VIR_DOMAIN_VIDEO_TYPE_QXL ? diff --git a/tests/qemucapabilitiesdata/caps_1.2.2-1.caps b/tests/qemucapabilitiesdata/caps_1.2.2-1.caps index c8a379a..1a61667 100644 --- a/tests/qemucapabilitiesdata/caps_1.2.2-1.caps +++ b/tests/qemucapabilitiesdata/caps_1.2.2-1.caps @@ -116,4 +116,7 @@ <flag name='usb-kbd'/> <flag name='host-pci-multidomain'/> <flag name='usb-audio'/> + <flag name='vga-vgamem'/> + <flag name='qxl-vgamem'/> + <flag name='vmware-vgamem'/> </qemuCaps> diff --git a/tests/qemucapabilitiesdata/caps_1.3.1-1.caps b/tests/qemucapabilitiesdata/caps_1.3.1-1.caps index 4b7651e..9f67949 100644 --- a/tests/qemucapabilitiesdata/caps_1.3.1-1.caps +++ b/tests/qemucapabilitiesdata/caps_1.3.1-1.caps @@ -129,4 +129,7 @@ <flag name='usb-kbd'/> <flag name='host-pci-multidomain'/> <flag name='usb-audio'/> + <flag name='vga-vgamem'/> + <flag name='qxl-vgamem'/> + <flag name='vmware-vgamem'/> </qemuCaps> diff --git a/tests/qemucapabilitiesdata/caps_1.4.2-1.caps b/tests/qemucapabilitiesdata/caps_1.4.2-1.caps index d146bf9..a813b56 100644 --- a/tests/qemucapabilitiesdata/caps_1.4.2-1.caps +++ b/tests/qemucapabilitiesdata/caps_1.4.2-1.caps @@ -130,4 +130,7 @@ <flag name='usb-kbd'/> <flag name='host-pci-multidomain'/> <flag name='usb-audio'/> + <flag name='vga-vgamem'/> + <flag name='qxl-vgamem'/> + <flag name='vmware-vgamem'/> </qemuCaps> diff --git a/tests/qemucapabilitiesdata/caps_1.5.3-1.caps b/tests/qemucapabilitiesdata/caps_1.5.3-1.caps index 5fa30aa..7ec2d49 100644 --- a/tests/qemucapabilitiesdata/caps_1.5.3-1.caps +++ b/tests/qemucapabilitiesdata/caps_1.5.3-1.caps @@ -138,4 +138,7 @@ <flag name='usb-kbd'/> <flag name='host-pci-multidomain'/> <flag name='usb-audio'/> + <flag name='vga-vgamem'/> + <flag name='qxl-vgamem'/> + <flag name='vmware-vgamem'/> </qemuCaps> diff --git a/tests/qemucapabilitiesdata/caps_1.6.0-1.caps b/tests/qemucapabilitiesdata/caps_1.6.0-1.caps index f364bbf..7b2628d 100644 --- a/tests/qemucapabilitiesdata/caps_1.6.0-1.caps +++ b/tests/qemucapabilitiesdata/caps_1.6.0-1.caps @@ -145,4 +145,7 @@ <flag name='host-pci-multidomain'/> <flag name='msg-timestamp'/> <flag name='usb-audio'/> + <flag name='vga-vgamem'/> + <flag name='qxl-vgamem'/> + <flag name='vmware-vgamem'/> </qemuCaps> diff --git a/tests/qemucapabilitiesdata/caps_1.6.50-1.caps b/tests/qemucapabilitiesdata/caps_1.6.50-1.caps index 10ce1b5..b661a93 100644 --- a/tests/qemucapabilitiesdata/caps_1.6.50-1.caps +++ b/tests/qemucapabilitiesdata/caps_1.6.50-1.caps @@ -144,4 +144,7 @@ <flag name='msg-timestamp'/> <flag name='numa'/> <flag name='usb-audio'/> + <flag name='vga-vgamem'/> + <flag name='qxl-vgamem'/> + <flag name='vmware-vgamem'/> </qemuCaps> diff --git a/tests/qemuhelptest.c b/tests/qemuhelptest.c index 366e36d..523f47e 100644 --- a/tests/qemuhelptest.c +++ b/tests/qemuhelptest.c @@ -953,7 +953,10 @@ mymain(void) QEMU_CAPS_DEVICE_USB_STORAGE, QEMU_CAPS_DEVICE_USB_KBD, QEMU_CAPS_USB_STORAGE_REMOVABLE, - QEMU_CAPS_OBJECT_USB_AUDIO); + QEMU_CAPS_OBJECT_USB_AUDIO, + QEMU_CAPS_VGA_VGAMEM_MB, + QEMU_CAPS_QXL_VGAMEM_MB, + QEMU_CAPS_VMWARE_VGAMEM_MB); DO_TEST("qemu-kvm-1.2.0", 1002000, 1, 0, QEMU_CAPS_VNC_COLON, QEMU_CAPS_NO_REBOOT, @@ -1068,7 +1071,10 @@ mymain(void) QEMU_CAPS_DEVICE_USB_STORAGE, QEMU_CAPS_DEVICE_USB_KBD, QEMU_CAPS_USB_STORAGE_REMOVABLE, - QEMU_CAPS_OBJECT_USB_AUDIO); + QEMU_CAPS_OBJECT_USB_AUDIO, + QEMU_CAPS_VGA_VGAMEM_MB, + QEMU_CAPS_QXL_VGAMEM_MB, + QEMU_CAPS_VMWARE_VGAMEM_MB); return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE; } diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl.xml index cb6c774..85dde76 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl.xml @@ -27,7 +27,7 @@ <input type='keyboard' bus='ps2'/> <graphics type='sdl' display=':0.1' xauth='/root/.Xauthority'/> <video> - <model type='vga' heads='1'/> + <model type='vga' vgamem='16384' heads='1'/> </video> <memballoon model='none'/> </devices> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-agent-file-xfer.args b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-agent-file-xfer.args index 66f22bc..c4089ce 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-agent-file-xfer.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-agent-file-xfer.args @@ -4,6 +4,7 @@ unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -usb -hda \ /dev/HostVG/QEMUGuest1 -spice port=5903,tls-port=5904,addr=127.0.0.1,\ x509-dir=/etc/pki/libvirt-spice,tls-channel=main,plaintext-channel=inputs,\ disable-agent-file-xfer -vga qxl -global qxl-vga.ram_size=67108864 \ --global qxl-vga.vram_size=33554432 \ --device qxl,id=video1,ram_size=67108864,vram_size=67108864,bus=pci.0,addr=0x4 \ +-global qxl-vga.vram_size=33554432 -global qxl-vga.vgamem_mb=16 \ +-device qxl,id=video1,ram_size=67108864,\ +vram_size=67108864,vgamem_mb=16,bus=pci.0,addr=0x4 \ -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-agent-file-xfer.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-agent-file-xfer.xml index 3a3e366..2574feb 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-agent-file-xfer.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-agent-file-xfer.xml @@ -30,10 +30,10 @@ <filetransfer enable='no'/> </graphics> <video> - <model type='qxl' ram='65536' vram='32768' heads='1'/> + <model type='qxl' ram='65536' vram='32768' vgamem='16384' heads='1'/> </video> <video> - <model type='qxl' ram='65536' vram='65536' heads='1'/> + <model type='qxl' ram='65536' vram='65536' vgamem='16384' heads='1'/> </video> <memballoon model='virtio'/> </devices> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-compression.args b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-compression.args index 59f064b..9c87509 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-compression.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-compression.args @@ -7,5 +7,7 @@ image-compression=auto_glz,jpeg-wan-compression=auto,\ zlib-glz-wan-compression=auto,\ playback-compression=on,streaming-video=filter -vga \ qxl -global qxl.ram_size=67108864 -global qxl.vram_size=18874368 \ --device qxl,id=video1,ram_size=67108864,vram_size=33554432,bus=pci.0,addr=0x4 \ +-global qxl.vgamem_mb=16 \ +-device qxl,id=video1,ram_size=67108864,\ +vram_size=33554432,vgamem_mb=16,bus=pci.0,addr=0x4 \ -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-compression.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-compression.xml index 6c913b4..8163020 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-compression.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-compression.xml @@ -33,10 +33,10 @@ <streaming mode='filter'/> </graphics> <video> - <model type='qxl' ram='65536' vram='18432' heads='1'/> + <model type='qxl' ram='65536' vram='18432' vgamem='16384' heads='1'/> </video> <video> - <model type='qxl' ram='65536' vram='32768' heads='1'/> + <model type='qxl' ram='65536' vram='32768' vgamem='16384' heads='1'/> </video> <memballoon model='virtio'/> </devices> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-listen-network.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-listen-network.xml index 34971fe..c0ad87c 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-listen-network.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-listen-network.xml @@ -35,10 +35,10 @@ <channel mode='secure' name='usbredir'/> </graphics> <video> - <model type='qxl' ram='65536' vram='18432' heads='1'/> + <model type='qxl' ram='65536' vram='18432' vgamem='16384' heads='1'/> </video> <video> - <model type='qxl' ram='65536' vram='32768' heads='1'/> + <model type='qxl' ram='65536' vram='32768' vgamem='16384' heads='1'/> </video> <memballoon model='virtio'/> </devices> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-qxl-vga.args b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-qxl-vga.args index ef499e6..8a294ed 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-qxl-vga.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-qxl-vga.args @@ -4,5 +4,7 @@ unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -usb -hda \ /dev/HostVG/QEMUGuest1 -spice port=5903,tls-port=5904,addr=127.0.0.1,\ x509-dir=/etc/pki/libvirt-spice,tls-channel=main,plaintext-channel=inputs -vga \ qxl -global qxl-vga.ram_size=67108864 -global qxl-vga.vram_size=33554432 \ --device qxl,id=video1,ram_size=67108864,vram_size=67108864,bus=pci.0,addr=0x4 \ +-global qxl-vga.vgamem_mb=16 \ +-device qxl,id=video1,ram_size=67108864,\ +vram_size=67108864,vgamem_mb=16,bus=pci.0,addr=0x4 \ -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-qxl-vga.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-qxl-vga.xml index acf3019..a12206b 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-qxl-vga.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-qxl-vga.xml @@ -30,10 +30,10 @@ <channel name='inputs' mode='insecure'/> </graphics> <video> - <model type='qxl' ram='65536' vram='32768' heads='1'/> + <model type='qxl' ram='65536' vram='32768' vgamem='16384' heads='1'/> </video> <video> - <model type='qxl' ram='65536' vram='65536' heads='1'/> + <model type='qxl' ram='65536' vram='65536' vgamem='16384' heads='1'/> </video> <memballoon model='virtio'/> </devices> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-sasl.args b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-sasl.args index 8847bce..614fada 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-sasl.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-sasl.args @@ -6,4 +6,5 @@ SASL_CONF_PATH=/root/.sasl2 QEMU_AUDIO_DRV=spice \ -spice port=5903,tls-port=5904,sasl,addr=127.0.0.1,\ x509-dir=/etc/pki/libvirt-spice,tls-channel=default \ -vga qxl -global qxl.ram_size=67108864 -global \ -qxl.vram_size=18874368 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 +qxl.vram_size=18874368 -global qxl.vgamem_mb=16 \ +-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-sasl.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-sasl.xml index eb630fa..2181f8e 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-sasl.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-sasl.xml @@ -28,7 +28,7 @@ <listen type='address' address='127.0.0.1'/> </graphics> <video> - <model type='qxl' ram='65536' vram='18432' heads='1'/> + <model type='qxl' ram='65536' vram='18432' vgamem='16384' heads='1'/> </video> <memballoon model='virtio'/> </devices> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-timeout.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-timeout.xml index b5940f4..deab263 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-timeout.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-timeout.xml @@ -77,7 +77,7 @@ <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </sound> <video> - <model type='vga' heads='1'/> + <model type='vga' vgamem='16384' heads='1'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> <memballoon model='virtio'> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.args b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.args index 8430d9c..93bb0dc 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.args @@ -8,6 +8,7 @@ image-compression=auto_glz,jpeg-wan-compression=auto,\ zlib-glz-wan-compression=auto,\ playback-compression=on,streaming-video=filter,disable-copy-paste,\ disable-agent-file-xfer -vga qxl -global qxl.ram_size=67108864 \ --global qxl.vram_size=18874368 \ --device qxl,id=video1,ram_size=67108864,vram_size=33554432,bus=pci.0,addr=0x4 \ +-global qxl.vram_size=18874368 -global qxl.vgamem_mb=16 \ +-device qxl,id=video1,ram_size=67108864,\ +vram_size=33554432,vgamem_mb=16,bus=pci.0,addr=0x4 \ -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.xml index 8f58149..9396056 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.xml @@ -37,10 +37,10 @@ <filetransfer enable='no'/> </graphics> <video> - <model type='qxl' ram='65536' vram='18432' heads='1'/> + <model type='qxl' ram='65536' vram='18432' vgamem='16384' heads='1'/> </video> <video> - <model type='qxl' ram='65536' vram='32768' heads='1'/> + <model type='qxl' ram='65536' vram='32768' vgamem='16384' heads='1'/> </video> <memballoon model='virtio'/> </devices> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-std-vga.args b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-std-vga.args new file mode 100644 index 0000000..540e3b1 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-std-vga.args @@ -0,0 +1,4 @@ +LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \ +/usr/bin/qemu -S -M pc -m 214 -smp 1 -nodefaults -monitor unix:/tmp/test-monitor,\ +server,nowait -no-acpi -boot c -usb -hda /dev/HostVG/QEMUGuest1 -vnc 127.0.0.1:3 \ +-vga std -global VGA.vgamem_mb=16 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-std-vga.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-std-vga.xml new file mode 100644 index 0000000..660a440 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-std-vga.xml @@ -0,0 +1,36 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>219100</memory> + <currentMemory unit='KiB'>219100</currentMemory> + <vcpu placement='static'>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</emulator> + <disk type='block' device='disk'> + <driver name='qemu' type='raw'/> + <source dev='/dev/HostVG/QEMUGuest1'/> + <target dev='hda' bus='ide'/> + <address type='drive' controller='0' bus='0' target='0' unit='0'/> + </disk> + <controller type='usb' index='0'/> + <controller type='ide' index='0'/> + <controller type='pci' index='0' model='pci-root'/> + <input type='mouse' bus='ps2'/> + <input type='keyboard' bus='ps2'/> + <graphics type='vnc' port='5903' autoport='no' listen='127.0.0.1'> + <listen type='address' address='127.0.0.1'/> + </graphics> + <video> + <model type='vga' vgamem='16384' heads='1'/> + </video> + <memballoon model='none'/> + </devices> +</domain> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-vmware-svga.args b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-vmware-svga.args new file mode 100644 index 0000000..4a7e70f --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-vmware-svga.args @@ -0,0 +1,4 @@ +LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \ +/usr/bin/qemu -S -M pc -m 214 -smp 1 -nodefaults -monitor unix:/tmp/test-monitor,\ +server,nowait -no-acpi -boot c -usb -hda /dev/HostVG/QEMUGuest1 -vnc 127.0.0.1:3 \ +-vga vmware -global vmware-svga.vgamem_mb=16 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-vmware-svga.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-vmware-svga.xml new file mode 100644 index 0000000..6efdb2d --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-vmware-svga.xml @@ -0,0 +1,36 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>219100</memory> + <currentMemory unit='KiB'>219100</currentMemory> + <vcpu placement='static'>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</emulator> + <disk type='block' device='disk'> + <driver name='qemu' type='raw'/> + <source dev='/dev/HostVG/QEMUGuest1'/> + <target dev='hda' bus='ide'/> + <address type='drive' controller='0' bus='0' target='0' unit='0'/> + </disk> + <controller type='usb' index='0'/> + <controller type='ide' index='0'/> + <controller type='pci' index='0' model='pci-root'/> + <input type='mouse' bus='ps2'/> + <input type='keyboard' bus='ps2'/> + <graphics type='vnc' port='5903' autoport='no' listen='127.0.0.1'> + <listen type='address' address='127.0.0.1'/> + </graphics> + <video> + <model type='vmvga' vgamem='16384' heads='1'/> + </video> + <memballoon model='none'/> + </devices> +</domain> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-net-bandwidth.xml b/tests/qemuxml2argvdata/qemuxml2argv-net-bandwidth.xml index 19155ac..9f82580 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-net-bandwidth.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-net-bandwidth.xml @@ -66,7 +66,7 @@ <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </sound> <video> - <model type='vga' heads='1'/> + <model type='vga' vgamem='16384' heads='1'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> <memballoon model='virtio'> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pcihole64-q35.args b/tests/qemuxml2argvdata/qemuxml2argv-pcihole64-q35.args index 6855cd2..8c5f01a 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-pcihole64-q35.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-pcihole64-q35.args @@ -6,4 +6,5 @@ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \ -device pci-bridge,chassis_nr=2,id=pci.2,bus=pci.1,addr=0x1 \ -drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-sata0-0-0 \ -device ide-drive,bus=ide.0,drive=drive-sata0-0-0,id=sata0-0-0 \ --vga qxl -global qxl.ram_size=67108864 -global qxl.vram_size=18874368 +-vga qxl -global qxl.ram_size=67108864 -global qxl.vram_size=18874368 \ +-global qxl.vgamem_mb=16 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pcihole64-q35.xml b/tests/qemuxml2argvdata/qemuxml2argv-pcihole64-q35.xml index ee151be..68f78a4 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-pcihole64-q35.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-pcihole64-q35.xml @@ -26,7 +26,7 @@ <controller type='pci' index='2' model='pci-bridge'/> <controller type='sata' index='0'/> <video> - <model type='qxl' ram='65536' vram='18432' heads='1'/> + <model type='qxl' ram='65536' vram='18432' vgamem='16384' heads='1'/> </video> <memballoon model='none'/> </devices> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-q35.args b/tests/qemuxml2argvdata/qemuxml2argv-q35.args index 8cc5874..f74bc01 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-q35.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-q35.args @@ -5,4 +5,5 @@ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \ -device pci-bridge,chassis_nr=2,id=pci.2,bus=pci.1,addr=0x1 \ -drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-sata0-0-0 \ -device ide-drive,bus=ide.0,drive=drive-sata0-0-0,id=sata0-0-0 \ --vga qxl -global qxl.ram_size=67108864 -global qxl.vram_size=18874368 +-vga qxl -global qxl.ram_size=67108864 -global qxl.vram_size=18874368 \ +-global qxl.vgamem_mb=16 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-q35.xml b/tests/qemuxml2argvdata/qemuxml2argv-q35.xml index edaf6cb..478d23f 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-q35.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-q35.xml @@ -23,7 +23,7 @@ <controller type='pci' index='1' model='dmi-to-pci-bridge'/> <controller type='pci' index='2' model='pci-bridge'/> <video> - <model type='qxl' ram='65536' vram='18432' heads='1'/> + <model type='qxl' ram='65536' vram='18432' vgamem='16384' heads='1'/> </video> <memballoon model='none'/> </devices> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-serial-spiceport.args b/tests/qemuxml2argvdata/qemuxml2argv-serial-spiceport.args index 8c631b1..3632421 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-serial-spiceport.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-serial-spiceport.args @@ -8,6 +8,6 @@ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=spice \ -device isa-serial,chardev=charserial0,id=serial0 \ -device usb-tablet,id=input0 \ -spice port=5903,tls-port=5904,addr=127.0.0.1,x509-dir=/etc/pki/libvirt-spice \ --device \ -qxl-vga,id=video0,ram_size=67107840,vram_size=67107840,bus=pci.0,addr=0x2 \ +-device qxl-vga,id=video0,ram_size=67107840,\ +vram_size=67107840,vgamem_mb=16,bus=pci.0,addr=0x2 \ -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-serial-spiceport.xml b/tests/qemuxml2argvdata/qemuxml2argv-serial-spiceport.xml index 36af468..47fabe9 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-serial-spiceport.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-serial-spiceport.xml @@ -37,7 +37,7 @@ <listen type='address' address='127.0.0.1'/> </graphics> <video> - <model type='qxl' ram='65535' vram='65535' heads='1'/> + <model type='qxl' ram='65535' vram='65535' vgamem='16384' heads='1'/> </video> <memballoon model='virtio'/> </devices> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-video-device-pciaddr-default.args b/tests/qemuxml2argvdata/qemuxml2argv-video-device-pciaddr-default.args index 4abd7c2..4dbbbfd 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-video-device-pciaddr-default.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-video-device-pciaddr-default.args @@ -3,7 +3,10 @@ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \ -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \ -usb \ -hda /var/lib/libvirt/images/QEMUGuest1 -vnc 127.0.0.1:-5900 \ --device qxl-vga,id=video0,ram_size=67108864,vram_size=67108864,bus=pci.0,addr=0x3 \ --device qxl,id=video1,ram_size=67108864,vram_size=67108864,bus=pci.0,addr=0x4 \ --device qxl,id=video2,ram_size=67108864,vram_size=67108864,bus=pci.0,addr=0x5 \ +-device qxl-vga,id=video0,ram_size=67108864,\ +vram_size=67108864,vgamem_mb=16,bus=pci.0,addr=0x3 \ +-device qxl,id=video1,ram_size=67108864,\ +vram_size=67108864,vgamem_mb=16,bus=pci.0,addr=0x4 \ +-device qxl,id=video2,ram_size=67108864,\ +vram_size=67108864,vgamem_mb=16,bus=pci.0,addr=0x5 \ -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x2 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-video-device-pciaddr-default.xml b/tests/qemuxml2argvdata/qemuxml2argv-video-device-pciaddr-default.xml index 120e7f4..c3f5bcc 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-video-device-pciaddr-default.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-video-device-pciaddr-default.xml @@ -29,13 +29,13 @@ <listen type='address' address='127.0.0.1'/> </graphics> <video> - <model type='qxl' vram='65536' heads='1'/> + <model type='qxl' vram='65536' vgamem='16384' heads='1'/> </video> <video> - <model type='qxl' vram='65536' heads='1' primary='yes'/> + <model type='qxl' vram='65536' vgamem='16384' heads='1' primary='yes'/> </video> <video> - <model type='qxl' vram='65536' heads='1'/> + <model type='qxl' vram='65536' vgamem='16384' heads='1'/> </video> <memballoon model='virtio'> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 62b969c..a7cbb02 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -871,6 +871,14 @@ mymain(void) DO_TEST("graphics-vnc-socket", QEMU_CAPS_VNC); DO_TEST("graphics-vnc-websocket", QEMU_CAPS_VNC, QEMU_CAPS_VNC_WEBSOCKET); DO_TEST("graphics-vnc-policy", QEMU_CAPS_VNC, QEMU_CAPS_VNC_SHARE_POLICY); + DO_TEST("graphics-vnc-std-vga", + QEMU_CAPS_VNC, QEMU_CAPS_DEVICE, + QEMU_CAPS_VGA, QEMU_CAPS_DEVICE_VGA, + QEMU_CAPS_VGA_VGAMEM_MB); + DO_TEST("graphics-vnc-vmware-svga", + QEMU_CAPS_VNC, QEMU_CAPS_DEVICE, + QEMU_CAPS_VGA, QEMU_CAPS_DEVICE_VMWARE_SVGA, + QEMU_CAPS_VMWARE_VGAMEM_MB); driver.config->vncSASL = 1; VIR_FREE(driver.config->vncSASLdir); @@ -890,6 +898,7 @@ mymain(void) QEMU_CAPS_VGA, QEMU_CAPS_VGA_NONE); DO_TEST("graphics-spice", QEMU_CAPS_VGA, QEMU_CAPS_VGA_QXL, + QEMU_CAPS_QXL_VGAMEM_MB, QEMU_CAPS_DEVICE, QEMU_CAPS_SPICE, QEMU_CAPS_DEVICE_QXL, QEMU_CAPS_SPICE_FILE_XFER_DISABLE); @@ -897,26 +906,32 @@ mymain(void) ignore_value(VIR_STRDUP(driver.config->spiceSASLdir, "/root/.sasl2")); DO_TEST("graphics-spice-sasl", QEMU_CAPS_VGA, QEMU_CAPS_VGA_QXL, + QEMU_CAPS_QXL_VGAMEM_MB, QEMU_CAPS_DEVICE, QEMU_CAPS_SPICE, QEMU_CAPS_DEVICE_QXL); VIR_FREE(driver.config->spiceSASLdir); driver.config->spiceSASL = 0; DO_TEST("graphics-spice-agentmouse", QEMU_CAPS_VGA, QEMU_CAPS_VGA_QXL, + QEMU_CAPS_QXL_VGAMEM_MB, QEMU_CAPS_DEVICE, QEMU_CAPS_SPICE, QEMU_CAPS_CHARDEV_SPICEVMC, QEMU_CAPS_NODEFCONFIG); DO_TEST("graphics-spice-compression", QEMU_CAPS_VGA, QEMU_CAPS_VGA_QXL, + QEMU_CAPS_QXL_VGAMEM_MB, QEMU_CAPS_DEVICE, QEMU_CAPS_SPICE, - QEMU_CAPS_DEVICE_QXL); + QEMU_CAPS_DEVICE_QXL, + QEMU_CAPS_QXL_VGAMEM_MB); DO_TEST("graphics-spice-timeout", QEMU_CAPS_DRIVE, QEMU_CAPS_VGA, QEMU_CAPS_VGA_QXL, + QEMU_CAPS_QXL_VGAMEM_MB, QEMU_CAPS_DEVICE, QEMU_CAPS_SPICE, QEMU_CAPS_DEVICE_QXL_VGA); DO_TEST("graphics-spice-qxl-vga", QEMU_CAPS_VGA, QEMU_CAPS_VGA_QXL, + QEMU_CAPS_QXL_VGAMEM_MB, QEMU_CAPS_DEVICE, QEMU_CAPS_SPICE, QEMU_CAPS_DEVICE_QXL_VGA, QEMU_CAPS_DEVICE_QXL); @@ -928,6 +943,7 @@ mymain(void) QEMU_CAPS_CHARDEV_SPICEVMC); DO_TEST("graphics-spice-agent-file-xfer", QEMU_CAPS_VGA, QEMU_CAPS_VGA_QXL, + QEMU_CAPS_QXL_VGAMEM_MB, QEMU_CAPS_DEVICE, QEMU_CAPS_SPICE, QEMU_CAPS_DEVICE_QXL_VGA, QEMU_CAPS_DEVICE_QXL, @@ -1336,7 +1352,8 @@ mymain(void) QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, QEMU_CAPS_DRIVE, QEMU_CAPS_ICH9_AHCI, QEMU_CAPS_VGA, QEMU_CAPS_DEVICE_VIDEO_PRIMARY, - QEMU_CAPS_VGA, QEMU_CAPS_VGA_QXL, QEMU_CAPS_DEVICE_QXL); + QEMU_CAPS_VGA, QEMU_CAPS_VGA_QXL, QEMU_CAPS_DEVICE_QXL, + QEMU_CAPS_QXL_VGAMEM_MB); DO_TEST("hostdev-scsi-lsi", QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE, QEMU_CAPS_DRIVE, @@ -1398,6 +1415,7 @@ mymain(void) QEMU_CAPS_DRIVE, QEMU_CAPS_ICH9_AHCI, QEMU_CAPS_VGA, QEMU_CAPS_DEVICE_VIDEO_PRIMARY, QEMU_CAPS_VGA_QXL, QEMU_CAPS_DEVICE_QXL, + QEMU_CAPS_QXL_VGAMEM_MB, QEMU_CAPS_Q35_PCI_HOLE64_SIZE); DO_TEST("arm-vexpressa9-nodevs", diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-timeout.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-timeout.xml index 8a319a2..0a18e74 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-timeout.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-timeout.xml @@ -80,7 +80,7 @@ <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </sound> <video> - <model type='vga' heads='1'/> + <model type='vga' vgamem='16384' heads='1'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> <memballoon model='virtio'> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-q35.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-q35.xml index 96f8eaf..aa24cc8 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-q35.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-q35.xml @@ -24,7 +24,7 @@ <controller type='pci' index='2' model='pci-bridge'/> <controller type='sata' index='0'/> <video> - <model type='qxl' ram='65536' vram='18432' heads='1'/> + <model type='qxl' ram='65536' vram='18432' vgamem='16384' heads='1'/> </video> <memballoon model='none'/> </devices> diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 5941323..720b058 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -238,6 +238,8 @@ mymain(void) DO_TEST("graphics-vnc-websocket"); DO_TEST("graphics-vnc-sasl"); DO_TEST("graphics-vnc-tls"); + DO_TEST("graphics-vnc-std-vga"); + DO_TEST("graphics-vnc-vmware-svga"); DO_TEST("graphics-sdl"); DO_TEST("graphics-sdl-fullscreen"); DO_TEST("graphics-spice"); -- 1.7.12.4

On 14.08.2014 14:43, Wang Rui wrote:
From: Zeng Junliang <zengjunliang@huawei.com>
QEMU suopports to specifie the size of the framebuffer portion of the "ram" region for vga, vmvga and qxl through the qemu command line parameter "vgamem_mb". This patch introduces vgamem attribute for video model, makes the "vgamem_mb" value configured in libvirt xml. Also, add test cases and descriptions for it.
Libvirt xml configuration sample(based on VGA): <video> <model type='vga' vgamem='16384' heads='1'/> </video>
The resulting qemu command line change is the addition of: -vga std -global VGA.vgamem_mb=16 or -device VGA,id=video0,vgamem_mb=16,bus=pci.0,addr=0x2
If 'vgamem' is not configured by user, a default value will be assigned by libvirt. Assume that user wants to start a VM without 'vgamem' configuration in xml, if QEMU lacks the ability of vgamem, libvirt will only report a warning rather than make starting failed even though libvirt has assigned a default value to vgamem. It could avoid a regression.
It's less confusing to introduce the new vgamem attribute. Prior to the change: model libvirt-attribute(xml) qemu-attribute
qxl vram vram_size qxl none vgamem_mb vga vram QEMU has no attribute named vram* vga none vgamem_mb vmvga vram QEMU has no attribute named vram* vmvga none vgamem_mb
After the change: model libvirt attribute(xml) QEMU attribute
qxl vram vram_size qxl vgamem vgamem_mb vga vram QEMU has no attribute named vram* vga vgamem vgamem_mb vmvga vram QEMU has no attribute named vram* vmvga vgamem vgamem_mb
Signed-off-by: Zeng Junliang <zengjunliang@huawei.com> Signed-off-by: Wang Rui <moon.wangrui@huawei.com> --- docs/formatdomain.html.in | 35 ++++--- docs/schemas/domaincommon.rng | 5 + src/conf/domain_conf.c | 52 +++++++++- src/conf/domain_conf.h | 2 + src/libvirt_private.syms | 1 + src/qemu/qemu_capabilities.c | 15 +++ src/qemu/qemu_capabilities.h | 3 + src/qemu/qemu_command.c | 105 ++++++++++++++++----- tests/qemucapabilitiesdata/caps_1.2.2-1.caps | 3 + tests/qemucapabilitiesdata/caps_1.3.1-1.caps | 3 + tests/qemucapabilitiesdata/caps_1.4.2-1.caps | 3 + tests/qemucapabilitiesdata/caps_1.5.3-1.caps | 3 + tests/qemucapabilitiesdata/caps_1.6.0-1.caps | 3 + tests/qemucapabilitiesdata/caps_1.6.50-1.caps | 3 + tests/qemuhelptest.c | 10 +- .../qemuxml2argvdata/qemuxml2argv-graphics-sdl.xml | 2 +- ...emuxml2argv-graphics-spice-agent-file-xfer.args | 5 +- ...qemuxml2argv-graphics-spice-agent-file-xfer.xml | 4 +- .../qemuxml2argv-graphics-spice-compression.args | 4 +- .../qemuxml2argv-graphics-spice-compression.xml | 4 +- .../qemuxml2argv-graphics-spice-listen-network.xml | 4 +- .../qemuxml2argv-graphics-spice-qxl-vga.args | 4 +- .../qemuxml2argv-graphics-spice-qxl-vga.xml | 4 +- .../qemuxml2argv-graphics-spice-sasl.args | 3 +- .../qemuxml2argv-graphics-spice-sasl.xml | 2 +- .../qemuxml2argv-graphics-spice-timeout.xml | 2 +- .../qemuxml2argv-graphics-spice.args | 5 +- .../qemuxml2argv-graphics-spice.xml | 4 +- .../qemuxml2argv-graphics-vnc-std-vga.args | 4 + .../qemuxml2argv-graphics-vnc-std-vga.xml | 36 +++++++ .../qemuxml2argv-graphics-vnc-vmware-svga.args | 4 + .../qemuxml2argv-graphics-vnc-vmware-svga.xml | 36 +++++++ .../qemuxml2argv-net-bandwidth.xml | 2 +- .../qemuxml2argv-pcihole64-q35.args | 3 +- .../qemuxml2argv-pcihole64-q35.xml | 2 +- tests/qemuxml2argvdata/qemuxml2argv-q35.args | 3 +- tests/qemuxml2argvdata/qemuxml2argv-q35.xml | 2 +- .../qemuxml2argv-serial-spiceport.args | 4 +- .../qemuxml2argv-serial-spiceport.xml | 2 +- .../qemuxml2argv-video-device-pciaddr-default.args | 9 +- .../qemuxml2argv-video-device-pciaddr-default.xml | 6 +- tests/qemuxml2argvtest.c | 22 ++++- .../qemuxml2xmlout-graphics-spice-timeout.xml | 2 +- tests/qemuxml2xmloutdata/qemuxml2xmlout-q35.xml | 2 +- tests/qemuxml2xmltest.c | 2 + 45 files changed, 357 insertions(+), 77 deletions(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-std-vga.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-std-vga.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-vmware-svga.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-vmware-svga.xml
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 3012e3c..a0d15c4 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -4419,7 +4419,7 @@ qemu-kvm -net nic,model=? /dev/null ... <devices> <video> - <model type='vga' heads='1'> + <model type='vga' vgamem='16384' heads='1'> <acceleration accel3d='yes' accel2d='yes'/> </model> </video> @@ -4434,16 +4434,17 @@ qemu-kvm -net nic,model=? /dev/null is set but there is a <code>graphics</code> in domain xml, then libvirt will add a default <code>video</code> according to the guest type. For a guest of type "kvm", the default <code>video</code> for it is: - <code>type</code> with value "cirrus", and <code>heads</code> with - value "1". By default, the first video device in domain xml is the - primary one, but the optional attribute <code>primary</code> - (<span class="since">since 1.0.2</span>) with value 'yes' can be - used to mark the primary in cases of multiple video device. - The non-primary must be type of "qxl". The optional attribute + <code>type</code> with value "cirrus", <code>vgamem</code> + (<span class="since">since 1.2.8</span>) with value "16384" + and <code>heads</code> with value "1". By default, the first video + device in domain xml is the primary one, but the optional attribute + <code>primary</code> (<span class="since">since 1.0.2</span>) with + value 'yes' can be used to mark the primary in cases of multiple video + device. The non-primary must be type of "qxl". The optional attribute <code>ram</code> (<span class="since">since 1.0.2</span>) is allowed for "qxl" type only and specifies the size of the primary bar, while <code>vram</code> specifies the secondary bar size. - If "ram" or "vram" are not supplied a default value is used. + If "ram", "vram" or "vgamem" are not supplied a default value is used. </dd>
<dt><code>model</code></dt> @@ -4452,10 +4453,20 @@ qemu-kvm -net nic,model=? /dev/null attribute which takes the value "vga", "cirrus", "vmvga", "xen", "vbox", or "qxl" (<span class="since">since 0.8.6</span>) depending on the hypervisor features available. - You can also provide the amount of video memory in kibibytes - (blocks of 1024 bytes) using - <code>vram</code> and the number of screen with <code>heads</code>. - For type of kvm <code>vram</code> attribute is only valid for "qxl". + <p> + <code>vram</code> attribute specifies the amount of video memory + in kibibytes (blocks of 1024 bytes). For type of kvm, it is only + valid for type of "qxl". + </p> + <p> + <code>vgamem</code> attribute <span class="since">since 1.2.8, + QEMU and KVM only</span> specifies the size of the framebuffer + portion of the "ram" region. And it is only valid for type of + "vga", "vmvga" and "qxl". + </p> + <p> + <code>heads</code> attribute specifies the number of screen. + </p> </dd>
<dt><code>acceleration</code></dt> diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 033f2f6..b2cc218 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -2786,6 +2786,11 @@ <ref name="unsignedInt"/> </attribute> </optional> + <optional> + <attribute name="vgamem"> + <ref name="unsignedInt"/> + </attribute> + </optional> <optional> <attribute name="heads"> <ref name="unsignedInt"/> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 5c762fa..7097570 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -9639,6 +9639,21 @@ virDomainVideoDefaultType(const virDomainDef *def) } }
+int +virDomainVideoDefaultVgamem(int type) +{ + switch (type) { + case VIR_DOMAIN_VIDEO_TYPE_VGA: + case VIR_DOMAIN_VIDEO_TYPE_VMVGA: + case VIR_DOMAIN_VIDEO_TYPE_QXL: + /* QEMU use 16M as default value for vga/vmvga/qxl device*/ + return 16 * 1024; + + default: + return 0; + } +} + static virDomainVideoAccelDefPtr virDomainVideoAccelDefParseXML(xmlNodePtr node) { @@ -9694,6 +9709,7 @@ virDomainVideoDefParseXML(xmlNodePtr node, char *type = NULL; char *heads = NULL; char *vram = NULL; + char *vgamem = NULL; char *ram = NULL; char *primary = NULL;
@@ -9703,11 +9719,12 @@ virDomainVideoDefParseXML(xmlNodePtr node, cur = node->children; while (cur != NULL) { if (cur->type == XML_ELEMENT_NODE) { - if (!type && !vram && !ram && !heads && + if (!type && !vram && !ram && !heads && !vgamem && xmlStrEqual(cur->name, BAD_CAST "model")) { type = virXMLPropString(cur, "type"); ram = virXMLPropString(cur, "ram"); vram = virXMLPropString(cur, "vram"); + vgamem = virXMLPropString(cur, "vgamem"); heads = virXMLPropString(cur, "heads");
if ((primary = virXMLPropString(cur, "primary")) != NULL) { @@ -9754,13 +9771,31 @@ virDomainVideoDefParseXML(xmlNodePtr node, if (vram) { if (virStrToLong_ui(vram, NULL, 10, &def->vram) < 0) { virReportError(VIR_ERR_XML_ERROR, - _("cannot parse video ram '%s'"), vram); + _("cannot parse video vram '%s'"), vram); goto error; } } else { def->vram = virDomainVideoDefaultRAM(dom, def->type); }
+ if (vgamem) { + if (def->type != VIR_DOMAIN_VIDEO_TYPE_VGA && + def->type != VIR_DOMAIN_VIDEO_TYPE_VMVGA && + def->type != VIR_DOMAIN_VIDEO_TYPE_QXL) { + virReportError(VIR_ERR_XML_ERROR, + _("Unsupported vgamem attribute for %s device"), + virDomainVideoTypeToString(def->type)); + goto error; + } + if (virStrToLong_ui(vgamem, NULL, 10, &def->vgamem) < 0) { + virReportError(VIR_ERR_XML_ERROR, + _("cannot parse video vgamem '%s'"), vgamem); + goto error; + } + } else { + def->vgamem = virDomainVideoDefaultVgamem(def->type); + } + if (heads) { if (virStrToLong_ui(heads, NULL, 10, &def->heads) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, @@ -9777,6 +9812,7 @@ virDomainVideoDefParseXML(xmlNodePtr node, VIR_FREE(type); VIR_FREE(ram); VIR_FREE(vram); + VIR_FREE(vgamem); VIR_FREE(heads);
return def; @@ -9786,6 +9822,7 @@ virDomainVideoDefParseXML(xmlNodePtr node, VIR_FREE(type); VIR_FREE(ram); VIR_FREE(vram); + VIR_FREE(vgamem); VIR_FREE(heads); return NULL; } @@ -12996,6 +13033,7 @@ virDomainDefParseXML(xmlDocPtr xml, VIR_FREE(video); goto error; } + video->vgamem = virDomainVideoDefaultVgamem(video->type); video->vram = virDomainVideoDefaultRAM(def, video->type); video->heads = 1; if (VIR_ALLOC_N(def->videos, 1) < 0) { @@ -13891,6 +13929,14 @@ virDomainVideoDefCheckABIStability(virDomainVideoDefPtr src, return false; }
+ if (src->vgamem != dst->vgamem) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target video card vgamem %u does not match source %u"), + dst->vgamem, src->vgamem); + return false; + } + + if (src->heads != dst->heads) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("Target video card heads %u does not match source %u"), @@ -16937,6 +16983,8 @@ virDomainVideoDefFormat(virBufferPtr buf, virBufferAsprintf(buf, " ram='%u'", def->ram); if (def->vram) virBufferAsprintf(buf, " vram='%u'", def->vram); + if (def->vgamem) + virBufferAsprintf(buf, " vgamem='%u'", def->vgamem); if (def->heads) virBufferAsprintf(buf, " heads='%u'", def->heads); if (def->primary) diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index ff7d640..d1ef6ec 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1244,6 +1244,7 @@ struct _virDomainVideoDef { int type; unsigned int ram; /* kibibytes (multiples of 1024) */ unsigned int vram; /* kibibytes (multiples of 1024) */ + unsigned int vgamem; /* kibibytes (multiples of 1024) */ unsigned int heads; bool primary; virDomainVideoAccelDefPtr accel; @@ -2492,6 +2493,7 @@ virDomainFSDefPtr virDomainFSRemove(virDomainDefPtr def, size_t i);
int virDomainVideoDefaultType(const virDomainDef *def); int virDomainVideoDefaultRAM(const virDomainDef *def, int type); +int virDomainVideoDefaultVgamem(int type);
int virDomainObjListNumOfDomains(virDomainObjListPtr doms, bool active, diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 08111d4..e481d92 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -416,6 +416,7 @@ virDomainVcpuPinFindByVcpu; virDomainVcpuPinIsDuplicate; virDomainVideoDefaultRAM; virDomainVideoDefaultType; +virDomainVideoDefaultVgamem; virDomainVideoDefFree; virDomainVideoTypeFromString; virDomainVideoTypeToString; diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 360cc67..146d67c 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -265,6 +265,10 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST, "numa", "memory-backend-file", "usb-audio", + "vga-vgamem", + + "qxl-vgamem", /* 175 */ + "vmware-vgamem", );
@@ -1073,6 +1077,14 @@ virQEMUCapsComputeCmdFlags(const char *help, virQEMUCapsSet(qemuCaps, QEMU_CAPS_VGA_QXL); if ((p = strstr(p, "|none")) && p < nl) virQEMUCapsSet(qemuCaps, QEMU_CAPS_VGA_NONE); + /* It seems that QEMU supports to be communicated with + * qmp command since 1.2.0. When qemuCaps->usedQMP is + * true, these logical code will be invalid. Does it need here? */ + if (version >= 1002000) { + virQEMUCapsSet(qemuCaps, QEMU_CAPS_VGA_VGAMEM_MB); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_QXL_VGAMEM_MB); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_VMWARE_VGAMEM_MB);
At least for cirrus vga this is not true. The vgamem_mb property of cirrus vga was introduced in 19403a68 (v1.3.0). However, I'd expect these to be set by something else than version based test. For instance, aren't the properties listen in device prop query command?
+ } } if (strstr(help, "-spice")) virQEMUCapsSet(qemuCaps, QEMU_CAPS_SPICE); @@ -3034,6 +3046,9 @@ virQEMUCapsInitQMPBasic(virQEMUCapsPtr qemuCaps) virQEMUCapsSet(qemuCaps, QEMU_CAPS_DUMP_GUEST_CORE); virQEMUCapsSet(qemuCaps, QEMU_CAPS_VNC_SHARE_POLICY); virQEMUCapsSet(qemuCaps, QEMU_CAPS_HOST_PCI_MULTIDOMAIN); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_VGA_VGAMEM_MB); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_QXL_VGAMEM_MB); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_VMWARE_VGAMEM_MB);
No.
}
/* Capabilities that are architecture depending diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 2911759..cdf6920 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -213,6 +213,9 @@ typedef enum { QEMU_CAPS_NUMA = 171, /* newer -numa handling with disjoint cpu ranges */ QEMU_CAPS_OBJECT_MEMORY_FILE = 172, /* -object memory-backend-file */ QEMU_CAPS_OBJECT_USB_AUDIO = 173, /* usb-audio device support */ + QEMU_CAPS_VGA_VGAMEM_MB = 174, /* -global VGA.vgamem_mb */ + QEMU_CAPS_QXL_VGAMEM_MB = 175, /* -global qxl-vga.vgamem_mb */ + QEMU_CAPS_VMWARE_VGAMEM_MB = 176, /* -global vmware-svga.vgamem_mb */
QEMU_CAPS_LAST, /* this must always be the last item */ } virQEMUCapsFlags; diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index c3f860e..c15099a 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -4827,6 +4827,14 @@ qemuBuildDeviceVideoStr(virDomainDefPtr def, virBufferAsprintf(&buf, ",vram_size=%u", video->vram * 1024); }
+ /* 1. Ignore cirrus-vga as guests would not use it anyway. + * 2. QEMU accepts MByte for vgamem_mb and ensure its value + * a power of two and range: 1 MB -> 256 MB */ + if (video->type != VIR_DOMAIN_VIDEO_TYPE_CIRRUS && + video->vgamem > 1024) { + virBufferAsprintf(&buf, ",vgamem_mb=%u", video->vgamem / 1024); + } + if (qemuBuildDeviceAddressStr(&buf, def, &video->info, qemuCaps) < 0) goto error;
@@ -8766,36 +8774,86 @@ qemuBuildCommandLine(virConnectPtr conn,
virCommandAddArgList(cmd, "-vga", vgastr, NULL);
- if (def->videos[0]->type == VIR_DOMAIN_VIDEO_TYPE_QXL && - (def->videos[0]->vram || def->videos[0]->ram) && - virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) { - const char *dev = (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_QXL_VGA) - ? "qxl-vga" : "qxl"); + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) { + const char *dev = NULL; + bool vgamemSupport = true; int ram = def->videos[0]->ram; int vram = def->videos[0]->vram; + int vgamem = def->videos[0]->vgamem; + switch (primaryVideoType) { + case VIR_DOMAIN_VIDEO_TYPE_VGA: + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VGA)) + dev = "VGA"; + if (dev && vgamem && + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_VGA_VGAMEM_MB)) { + vgamemSupport = false; + VIR_WARN("This QEMU does not support vgamem " + "attribute, ignore it");
Why? If I deliberately set vgamem the domain startup process must fail if qemu doesn't support it. Michal

On 2014/9/19 20:02, Michal Privoznik wrote:
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 360cc67..146d67c 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -265,6 +265,10 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST, "numa", "memory-backend-file", "usb-audio", + "vga-vgamem", + + "qxl-vgamem", /* 175 */ + "vmware-vgamem", );
@@ -1073,6 +1077,14 @@ virQEMUCapsComputeCmdFlags(const char *help, virQEMUCapsSet(qemuCaps, QEMU_CAPS_VGA_QXL); if ((p = strstr(p, "|none")) && p < nl) virQEMUCapsSet(qemuCaps, QEMU_CAPS_VGA_NONE); + /* It seems that QEMU supports to be communicated with + * qmp command since 1.2.0. When qemuCaps->usedQMP is + * true, these logical code will be invalid. Does it need here? */ + if (version >= 1002000) { + virQEMUCapsSet(qemuCaps, QEMU_CAPS_VGA_VGAMEM_MB); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_QXL_VGAMEM_MB); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_VMWARE_VGAMEM_MB);
At least for cirrus vga this is not true. The vgamem_mb property of cirrus vga was introduced in 19403a68 (v1.3.0). However, I'd expect these to be set by something else than version based test. For instance, aren't the properties listen in device prop query command?
Thanks for your review. I use "-global VGA.vgamem_mb=16" to support vgamem_mb in the case that QEMU supports "-global". From the result of "qemu-kvm --help", I can't get enough information about valid args for "-global". So I don't know how to set this capability according to a query command. I search other "-global" command line arguments in qemu_command.c. They are used without checking their capabilities. So should I use "-global VGA.vgamem_mb" without checking the capability like other "-global" command arguments? Or find a query command to set the capability and check it? What's your opinion.
+ } } if (strstr(help, "-spice")) virQEMUCapsSet(qemuCaps, QEMU_CAPS_SPICE); @@ -3034,6 +3046,9 @@ virQEMUCapsInitQMPBasic(virQEMUCapsPtr qemuCaps) virQEMUCapsSet(qemuCaps, QEMU_CAPS_DUMP_GUEST_CORE); virQEMUCapsSet(qemuCaps, QEMU_CAPS_VNC_SHARE_POLICY); virQEMUCapsSet(qemuCaps, QEMU_CAPS_HOST_PCI_MULTIDOMAIN); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_VGA_VGAMEM_MB); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_QXL_VGAMEM_MB); + virQEMUCapsSet(qemuCaps, QEMU_CAPS_VMWARE_VGAMEM_MB);
No.
}
/* Capabilities that are architecture depending diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 2911759..cdf6920 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -213,6 +213,9 @@ typedef enum { QEMU_CAPS_NUMA = 171, /* newer -numa handling with disjoint cpu ranges */ QEMU_CAPS_OBJECT_MEMORY_FILE = 172, /* -object memory-backend-file */ QEMU_CAPS_OBJECT_USB_AUDIO = 173, /* usb-audio device support */ + QEMU_CAPS_VGA_VGAMEM_MB = 174, /* -global VGA.vgamem_mb */ + QEMU_CAPS_QXL_VGAMEM_MB = 175, /* -global qxl-vga.vgamem_mb */ + QEMU_CAPS_VMWARE_VGAMEM_MB = 176, /* -global vmware-svga.vgamem_mb */
QEMU_CAPS_LAST, /* this must always be the last item */ } virQEMUCapsFlags; diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index c3f860e..c15099a 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -4827,6 +4827,14 @@ qemuBuildDeviceVideoStr(virDomainDefPtr def, virBufferAsprintf(&buf, ",vram_size=%u", video->vram * 1024); }
+ /* 1. Ignore cirrus-vga as guests would not use it anyway. + * 2. QEMU accepts MByte for vgamem_mb and ensure its value + * a power of two and range: 1 MB -> 256 MB */ + if (video->type != VIR_DOMAIN_VIDEO_TYPE_CIRRUS && + video->vgamem > 1024) { + virBufferAsprintf(&buf, ",vgamem_mb=%u", video->vgamem / 1024); + } + if (qemuBuildDeviceAddressStr(&buf, def, &video->info, qemuCaps) < 0) goto error;
@@ -8766,36 +8774,86 @@ qemuBuildCommandLine(virConnectPtr conn,
virCommandAddArgList(cmd, "-vga", vgastr, NULL);
- if (def->videos[0]->type == VIR_DOMAIN_VIDEO_TYPE_QXL && - (def->videos[0]->vram || def->videos[0]->ram) && - virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) { - const char *dev = (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_QXL_VGA) - ? "qxl-vga" : "qxl"); + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) { + const char *dev = NULL; + bool vgamemSupport = true; int ram = def->videos[0]->ram; int vram = def->videos[0]->vram; + int vgamem = def->videos[0]->vgamem; + switch (primaryVideoType) { + case VIR_DOMAIN_VIDEO_TYPE_VGA: + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VGA)) + dev = "VGA"; + if (dev && vgamem && + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_VGA_VGAMEM_MB)) { + vgamemSupport = false; + VIR_WARN("This QEMU does not support vgamem " + "attribute, ignore it");
Why? If I deliberately set vgamem the domain startup process must fail if qemu doesn't support it.
Yes, domain startup should fail if user configure vgamem in xml but qemu doesn't support it. My intention is for avoiding regression because I set vgamem to a default value if it is not configured in xml. Referring to your idea, I'll remove setting the default value and make startup failed if qemu doesn't support vgamem. Qemu can give a default value if libvirt does not. Is this better?

From: Zeng Junliang <zengjunliang@huawei.com> Secondary-vga is supported by QEMU in currently master. Add it supported in libvirt as qemu commandline show: '-device secondary-vga'. And it can be used as secondary display device, like qxl. Also, add test cases and descriptions for it. Libvirt xml configuration sample: <video> <model type='secondary' vgamem='16384' heads='1'/> </video> The resulting qemu command line change is the addition of: -device secondary-vga,id=video0,vgamem_mb=16,bus=pci.0,addr=0x5 Signed-off-by: Zeng Junliang <zengjunliang@huawei.com> Signed-off-by: Wang Rui <moon.wangrui@huawei.com> --- docs/formatdomain.html.in | 13 +++--- docs/schemas/domaincommon.rng | 1 + src/conf/domain_conf.c | 9 ++-- src/conf/domain_conf.h | 1 + src/qemu/qemu_capabilities.c | 2 + src/qemu/qemu_capabilities.h | 1 + src/qemu/qemu_command.c | 54 +++++++++++++++------- .../qemuxml2argv-graphics-vnc-secondary-vga.args | 7 +++ .../qemuxml2argv-graphics-vnc-secondary-vga.xml | 39 ++++++++++++++++ tests/qemuxml2argvtest.c | 4 ++ tests/qemuxml2xmltest.c | 1 + 11 files changed, 106 insertions(+), 26 deletions(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-secondary-vga.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-secondary-vga.xml diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index a0d15c4..b1d8ad4 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -4440,9 +4440,9 @@ qemu-kvm -net nic,model=? /dev/null device in domain xml is the primary one, but the optional attribute <code>primary</code> (<span class="since">since 1.0.2</span>) with value 'yes' can be used to mark the primary in cases of multiple video - device. The non-primary must be type of "qxl". The optional attribute - <code>ram</code> (<span class="since">since 1.0.2</span>) is allowed - for "qxl" type only and specifies the size of the primary bar, + device. The non-primary must be type of "qxl" or "secondary". The + optional attribute <code>ram</code> (<span class="since">since 1.0.2</span>) + is allowed for "qxl" type only and specifies the size of the primary bar, while <code>vram</code> specifies the secondary bar size. If "ram", "vram" or "vgamem" are not supplied a default value is used. </dd> @@ -4451,8 +4451,9 @@ qemu-kvm -net nic,model=? /dev/null <dd> The <code>model</code> element has a mandatory <code>type</code> attribute which takes the value "vga", "cirrus", "vmvga", "xen", - "vbox", or "qxl" (<span class="since">since 0.8.6</span>) - depending on the hypervisor features available. + "vbox", "qxl" (<span class="since">since 0.8.6</span>) or + "secondary" (<span class="since">since 1.2.8</span>) depending + on the hypervisor features available. <p> <code>vram</code> attribute specifies the amount of video memory in kibibytes (blocks of 1024 bytes). For type of kvm, it is only @@ -4462,7 +4463,7 @@ qemu-kvm -net nic,model=? /dev/null <code>vgamem</code> attribute <span class="since">since 1.2.8, QEMU and KVM only</span> specifies the size of the framebuffer portion of the "ram" region. And it is only valid for type of - "vga", "vmvga" and "qxl". + "vga", "vmvga", "qxl" and "secondary". </p> <p> <code>heads</code> attribute specifies the number of screen. diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index b2cc218..db8dbde 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -2768,6 +2768,7 @@ <value>vmvga</value> <value>xen</value> <value>vbox</value> + <value>secondary</value> </choice> </attribute> <group> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 7097570..c7b9a5d 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -490,7 +490,8 @@ VIR_ENUM_IMPL(virDomainVideo, VIR_DOMAIN_VIDEO_TYPE_LAST, "vmvga", "xen", "vbox", - "qxl") + "qxl", + "secondary") VIR_ENUM_IMPL(virDomainInput, VIR_DOMAIN_INPUT_TYPE_LAST, "mouse", @@ -9646,7 +9647,8 @@ virDomainVideoDefaultVgamem(int type) case VIR_DOMAIN_VIDEO_TYPE_VGA: case VIR_DOMAIN_VIDEO_TYPE_VMVGA: case VIR_DOMAIN_VIDEO_TYPE_QXL: - /* QEMU use 16M as default value for vga/vmvga/qxl device*/ + case VIR_DOMAIN_VIDEO_TYPE_SECONDARY: + /* QEMU use 16M as default value for vga/vmvga/qxl/secondary device */ return 16 * 1024; default: @@ -9781,7 +9783,8 @@ virDomainVideoDefParseXML(xmlNodePtr node, if (vgamem) { if (def->type != VIR_DOMAIN_VIDEO_TYPE_VGA && def->type != VIR_DOMAIN_VIDEO_TYPE_VMVGA && - def->type != VIR_DOMAIN_VIDEO_TYPE_QXL) { + def->type != VIR_DOMAIN_VIDEO_TYPE_QXL && + def->type != VIR_DOMAIN_VIDEO_TYPE_SECONDARY) { virReportError(VIR_ERR_XML_ERROR, _("Unsupported vgamem attribute for %s device"), virDomainVideoTypeToString(def->type)); diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index d1ef6ec..9ead8a7 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1227,6 +1227,7 @@ typedef enum { VIR_DOMAIN_VIDEO_TYPE_XEN, VIR_DOMAIN_VIDEO_TYPE_VBOX, VIR_DOMAIN_VIDEO_TYPE_QXL, + VIR_DOMAIN_VIDEO_TYPE_SECONDARY, VIR_DOMAIN_VIDEO_TYPE_LAST } virDomainVideoType; diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 146d67c..fed3244 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -269,6 +269,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST, "qxl-vgamem", /* 175 */ "vmware-vgamem", + "secondary-vga", ); @@ -1470,6 +1471,7 @@ struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[] = { { "spicevmc", QEMU_CAPS_DEVICE_SPICEVMC }, { "qxl-vga", QEMU_CAPS_DEVICE_QXL_VGA }, { "qxl", QEMU_CAPS_DEVICE_QXL }, + { "secondary-vga", QEMU_CAPS_DEVICE_SECONDARY_VGA }, { "sga", QEMU_CAPS_SGA }, { "scsi-block", QEMU_CAPS_SCSI_BLOCK }, { "scsi-cd", QEMU_CAPS_SCSI_CD }, diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index cdf6920..f6d158d 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -216,6 +216,7 @@ typedef enum { QEMU_CAPS_VGA_VGAMEM_MB = 174, /* -global VGA.vgamem_mb */ QEMU_CAPS_QXL_VGAMEM_MB = 175, /* -global qxl-vga.vgamem_mb */ QEMU_CAPS_VMWARE_VGAMEM_MB = 176, /* -global vmware-svga.vgamem_mb */ + QEMU_CAPS_DEVICE_SECONDARY_VGA = 177, /* -device secondary-vga */ QEMU_CAPS_LAST, /* this must always be the last item */ } virQEMUCapsFlags; diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index c15099a..35ab29a 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -109,7 +109,9 @@ VIR_ENUM_IMPL(qemuVideo, VIR_DOMAIN_VIDEO_TYPE_LAST, "vmware", "", /* no arg needed for xen */ "", /* don't support vbox */ - "qxl"); + "qxl", + ""); /* '-vga XXX' for secondary-vga device + * is currently not supported with QEMU */ VIR_ENUM_DECL(qemuDeviceVideo) @@ -119,7 +121,8 @@ VIR_ENUM_IMPL(qemuDeviceVideo, VIR_DOMAIN_VIDEO_TYPE_LAST, "vmware-svga", "", /* no device for xen */ "", /* don't support vbox */ - "qxl-vga"); + "qxl-vga", + "secondary-vga"); VIR_ENUM_DECL(qemuSoundCodec) @@ -2257,11 +2260,13 @@ qemuAssignDevicePCISlots(virDomainDefPtr def, flags) < 0) goto error; } - /* Further non-primary video cards which have to be qxl type */ + /* Further non-primary video cards which have to be qxl or secondary */ for (i = 1; i < def->nvideos; i++) { - if (def->videos[i]->type != VIR_DOMAIN_VIDEO_TYPE_QXL) { + if (def->videos[i]->type != VIR_DOMAIN_VIDEO_TYPE_QXL && + def->videos[i]->type != VIR_DOMAIN_VIDEO_TYPE_SECONDARY) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("non-primary video device must be type of 'qxl'")); + _("non-primary video device must be " + "type of 'qxl' or 'secondary'")); goto error; } if (def->videos[i]->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) @@ -4789,19 +4794,31 @@ qemuBuildDeviceVideoStr(virDomainDefPtr def, goto error; } } else { - if (video->type != VIR_DOMAIN_VIDEO_TYPE_QXL) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - "%s", _("non-primary video device must be type of 'qxl'")); - goto error; - } - - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_QXL)) { + switch (video->type) { + case VIR_DOMAIN_VIDEO_TYPE_QXL: + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_QXL)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("video type %s is not supported with QEMU"), + virDomainVideoTypeToString(video->type)); + goto error; + } + model = "qxl"; + break; + case VIR_DOMAIN_VIDEO_TYPE_SECONDARY: + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_SECONDARY_VGA)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("video type %s is not supported with QEMU"), + virDomainVideoTypeToString(video->type)); + goto error; + } + model = "secondary-vga"; + break; + default: virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - "%s", _("only one video card is currently supported")); + "%s", _("non-primary video device must be " + "type of 'qxl' or 'secondary'")); goto error; } - - model = "qxl"; } virBufferAsprintf(&buf, "%s,id=%s", model, video->info.alias); @@ -8742,7 +8759,9 @@ qemuBuildCommandLine(virConnectPtr conn, (primaryVideoType == VIR_DOMAIN_VIDEO_TYPE_VMVGA && virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VMWARE_SVGA)) || (primaryVideoType == VIR_DOMAIN_VIDEO_TYPE_QXL && - virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_QXL_VGA))) + virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_QXL_VGA)) || + (primaryVideoType == VIR_DOMAIN_VIDEO_TYPE_SECONDARY && + virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_SECONDARY_VGA))) ) { for (i = 0; i < def->nvideos; i++) { char *str; @@ -8862,7 +8881,8 @@ qemuBuildCommandLine(virConnectPtr conn, if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) { for (i = 1; i < def->nvideos; i++) { char *str; - if (def->videos[i]->type != VIR_DOMAIN_VIDEO_TYPE_QXL) { + if (def->videos[i]->type != VIR_DOMAIN_VIDEO_TYPE_QXL && + def->videos[i]->type != VIR_DOMAIN_VIDEO_TYPE_SECONDARY) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("video type %s is only valid as primary video card"), virDomainVideoTypeToString(def->videos[0]->type)); diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-secondary-vga.args b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-secondary-vga.args new file mode 100644 index 0000000..b5e075a --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-secondary-vga.args @@ -0,0 +1,7 @@ +LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \ +/usr/bin/qemu -S -M pc -m 214 -smp 1 -nodefaults -monitor unix:/tmp/test-monitor,\ +server,nowait -no-acpi -boot c -usb -hda /dev/HostVG/QEMUGuest1 \ +-vnc 127.0.0.1:3 \ +-device secondary-vga,id=video0,vgamem_mb=16,bus=pci.0,addr=0x2 \ +-device secondary-vga,id=video1,vgamem_mb=16,bus=pci.0,addr=0x4 \ +-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-secondary-vga.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-secondary-vga.xml new file mode 100644 index 0000000..03b9154 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-secondary-vga.xml @@ -0,0 +1,39 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>219100</memory> + <currentMemory unit='KiB'>219100</currentMemory> + <vcpu placement='static'>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</emulator> + <disk type='block' device='disk'> + <driver name='qemu' type='raw'/> + <source dev='/dev/HostVG/QEMUGuest1'/> + <target dev='hda' bus='ide'/> + <address type='drive' controller='0' bus='0' target='0' unit='0'/> + </disk> + <controller type='usb' index='0'/> + <controller type='ide' index='0'/> + <controller type='pci' index='0' model='pci-root'/> + <input type='mouse' bus='ps2'/> + <input type='keyboard' bus='ps2'/> + <graphics type='vnc' port='5903' autoport='no' listen='127.0.0.1'> + <listen type='address' address='127.0.0.1'/> + </graphics> + <video> + <model type='secondary' vgamem='16384' heads='1'/> + </video> + <video> + <model type='secondary' vgamem='16384' heads='1'/> + </video> + <memballoon model='virtio'/> + </devices> +</domain> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index a7cbb02..5eb5776 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -879,6 +879,10 @@ mymain(void) QEMU_CAPS_VNC, QEMU_CAPS_DEVICE, QEMU_CAPS_VGA, QEMU_CAPS_DEVICE_VMWARE_SVGA, QEMU_CAPS_VMWARE_VGAMEM_MB); + DO_TEST("graphics-vnc-secondary-vga", + QEMU_CAPS_VNC, QEMU_CAPS_DEVICE, + QEMU_CAPS_DEVICE_SECONDARY_VGA, + QEMU_CAPS_DEVICE_VIDEO_PRIMARY); driver.config->vncSASL = 1; VIR_FREE(driver.config->vncSASLdir); diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 720b058..1ab5f1d 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -240,6 +240,7 @@ mymain(void) DO_TEST("graphics-vnc-tls"); DO_TEST("graphics-vnc-std-vga"); DO_TEST("graphics-vnc-vmware-svga"); + DO_TEST("graphics-vnc-secondary-vga"); DO_TEST("graphics-sdl"); DO_TEST("graphics-sdl-fullscreen"); DO_TEST("graphics-spice"); -- 1.7.12.4

On 14.08.2014 14:43, Wang Rui wrote:
From: Zeng Junliang <zengjunliang@huawei.com>
Secondary-vga is supported by QEMU in currently master. Add it supported in libvirt as qemu commandline show: '-device secondary-vga'. And it can be used as secondary display device, like qxl. Also, add test cases and descriptions for it.
Libvirt xml configuration sample: <video> <model type='secondary' vgamem='16384' heads='1'/> </video>
The resulting qemu command line change is the addition of: -device secondary-vga,id=video0,vgamem_mb=16,bus=pci.0,addr=0x5
Signed-off-by: Zeng Junliang <zengjunliang@huawei.com> Signed-off-by: Wang Rui <moon.wangrui@huawei.com> --- docs/formatdomain.html.in | 13 +++--- docs/schemas/domaincommon.rng | 1 + src/conf/domain_conf.c | 9 ++-- src/conf/domain_conf.h | 1 + src/qemu/qemu_capabilities.c | 2 + src/qemu/qemu_capabilities.h | 1 + src/qemu/qemu_command.c | 54 +++++++++++++++------- .../qemuxml2argv-graphics-vnc-secondary-vga.args | 7 +++ .../qemuxml2argv-graphics-vnc-secondary-vga.xml | 39 ++++++++++++++++ tests/qemuxml2argvtest.c | 4 ++ tests/qemuxml2xmltest.c | 1 + 11 files changed, 106 insertions(+), 26 deletions(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-secondary-vga.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-secondary-vga.xml
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index a0d15c4..b1d8ad4 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -4440,9 +4440,9 @@ qemu-kvm -net nic,model=? /dev/null device in domain xml is the primary one, but the optional attribute <code>primary</code> (<span class="since">since 1.0.2</span>) with value 'yes' can be used to mark the primary in cases of multiple video - device. The non-primary must be type of "qxl". The optional attribute - <code>ram</code> (<span class="since">since 1.0.2</span>) is allowed - for "qxl" type only and specifies the size of the primary bar, + device. The non-primary must be type of "qxl" or "secondary". The + optional attribute <code>ram</code> (<span class="since">since 1.0.2</span>) + is allowed for "qxl" type only and specifies the size of the primary bar, while <code>vram</code> specifies the secondary bar size. If "ram", "vram" or "vgamem" are not supplied a default value is used. </dd> @@ -4451,8 +4451,9 @@ qemu-kvm -net nic,model=? /dev/null <dd> The <code>model</code> element has a mandatory <code>type</code> attribute which takes the value "vga", "cirrus", "vmvga", "xen", - "vbox", or "qxl" (<span class="since">since 0.8.6</span>) - depending on the hypervisor features available. + "vbox", "qxl" (<span class="since">since 0.8.6</span>) or + "secondary" (<span class="since">since 1.2.8</span>) depending + on the hypervisor features available. <p> <code>vram</code> attribute specifies the amount of video memory in kibibytes (blocks of 1024 bytes). For type of kvm, it is only @@ -4462,7 +4463,7 @@ qemu-kvm -net nic,model=? /dev/null <code>vgamem</code> attribute <span class="since">since 1.2.8, QEMU and KVM only</span> specifies the size of the framebuffer portion of the "ram" region. And it is only valid for type of - "vga", "vmvga" and "qxl". + "vga", "vmvga", "qxl" and "secondary". </p> <p> <code>heads</code> attribute specifies the number of screen. diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index b2cc218..db8dbde 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -2768,6 +2768,7 @@ <value>vmvga</value> <value>xen</value> <value>vbox</value> + <value>secondary</value> </choice> </attribute> <group> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 7097570..c7b9a5d 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -490,7 +490,8 @@ VIR_ENUM_IMPL(virDomainVideo, VIR_DOMAIN_VIDEO_TYPE_LAST, "vmvga", "xen", "vbox", - "qxl") + "qxl", + "secondary")
VIR_ENUM_IMPL(virDomainInput, VIR_DOMAIN_INPUT_TYPE_LAST, "mouse", @@ -9646,7 +9647,8 @@ virDomainVideoDefaultVgamem(int type) case VIR_DOMAIN_VIDEO_TYPE_VGA: case VIR_DOMAIN_VIDEO_TYPE_VMVGA: case VIR_DOMAIN_VIDEO_TYPE_QXL: - /* QEMU use 16M as default value for vga/vmvga/qxl device*/ + case VIR_DOMAIN_VIDEO_TYPE_SECONDARY: + /* QEMU use 16M as default value for vga/vmvga/qxl/secondary device */ return 16 * 1024;
default: @@ -9781,7 +9783,8 @@ virDomainVideoDefParseXML(xmlNodePtr node, if (vgamem) { if (def->type != VIR_DOMAIN_VIDEO_TYPE_VGA && def->type != VIR_DOMAIN_VIDEO_TYPE_VMVGA && - def->type != VIR_DOMAIN_VIDEO_TYPE_QXL) { + def->type != VIR_DOMAIN_VIDEO_TYPE_QXL && + def->type != VIR_DOMAIN_VIDEO_TYPE_SECONDARY) { virReportError(VIR_ERR_XML_ERROR, _("Unsupported vgamem attribute for %s device"), virDomainVideoTypeToString(def->type)); diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index d1ef6ec..9ead8a7 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1227,6 +1227,7 @@ typedef enum { VIR_DOMAIN_VIDEO_TYPE_XEN, VIR_DOMAIN_VIDEO_TYPE_VBOX, VIR_DOMAIN_VIDEO_TYPE_QXL, + VIR_DOMAIN_VIDEO_TYPE_SECONDARY,
VIR_DOMAIN_VIDEO_TYPE_LAST } virDomainVideoType; diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 146d67c..fed3244 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -269,6 +269,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
"qxl-vgamem", /* 175 */ "vmware-vgamem", + "secondary-vga", );
@@ -1470,6 +1471,7 @@ struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[] = { { "spicevmc", QEMU_CAPS_DEVICE_SPICEVMC }, { "qxl-vga", QEMU_CAPS_DEVICE_QXL_VGA }, { "qxl", QEMU_CAPS_DEVICE_QXL }, + { "secondary-vga", QEMU_CAPS_DEVICE_SECONDARY_VGA }, { "sga", QEMU_CAPS_SGA }, { "scsi-block", QEMU_CAPS_SCSI_BLOCK }, { "scsi-cd", QEMU_CAPS_SCSI_CD }, diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index cdf6920..f6d158d 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -216,6 +216,7 @@ typedef enum { QEMU_CAPS_VGA_VGAMEM_MB = 174, /* -global VGA.vgamem_mb */ QEMU_CAPS_QXL_VGAMEM_MB = 175, /* -global qxl-vga.vgamem_mb */ QEMU_CAPS_VMWARE_VGAMEM_MB = 176, /* -global vmware-svga.vgamem_mb */ + QEMU_CAPS_DEVICE_SECONDARY_VGA = 177, /* -device secondary-vga */
QEMU_CAPS_LAST, /* this must always be the last item */ } virQEMUCapsFlags; diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index c15099a..35ab29a 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -109,7 +109,9 @@ VIR_ENUM_IMPL(qemuVideo, VIR_DOMAIN_VIDEO_TYPE_LAST, "vmware", "", /* no arg needed for xen */ "", /* don't support vbox */ - "qxl"); + "qxl", + ""); /* '-vga XXX' for secondary-vga device + * is currently not supported with QEMU */
VIR_ENUM_DECL(qemuDeviceVideo)
@@ -119,7 +121,8 @@ VIR_ENUM_IMPL(qemuDeviceVideo, VIR_DOMAIN_VIDEO_TYPE_LAST, "vmware-svga", "", /* no device for xen */ "", /* don't support vbox */ - "qxl-vga"); + "qxl-vga", + "secondary-vga");
VIR_ENUM_DECL(qemuSoundCodec)
@@ -2257,11 +2260,13 @@ qemuAssignDevicePCISlots(virDomainDefPtr def, flags) < 0) goto error; } - /* Further non-primary video cards which have to be qxl type */ + /* Further non-primary video cards which have to be qxl or secondary */ for (i = 1; i < def->nvideos; i++) { - if (def->videos[i]->type != VIR_DOMAIN_VIDEO_TYPE_QXL) { + if (def->videos[i]->type != VIR_DOMAIN_VIDEO_TYPE_QXL && + def->videos[i]->type != VIR_DOMAIN_VIDEO_TYPE_SECONDARY) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("non-primary video device must be type of 'qxl'")); + _("non-primary video device must be " + "type of 'qxl' or 'secondary'")); goto error; } if (def->videos[i]->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) @@ -4789,19 +4794,31 @@ qemuBuildDeviceVideoStr(virDomainDefPtr def, goto error; } } else { - if (video->type != VIR_DOMAIN_VIDEO_TYPE_QXL) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - "%s", _("non-primary video device must be type of 'qxl'")); - goto error; - } - - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_QXL)) { + switch (video->type) {
Just a small nitpick, I prefer switch() over libvirt enums to be typecasted(). That is: switch((enum virDomainVideo) video->type) even though you'll need to enumerate all the enum items, but that's the point. Otherwise I like this patch. Michal

Ping. On 2014/8/14 20:43, Wang Rui wrote:
From: Zeng Junliang <zengjunliang@huawei.com>
http://www.redhat.com/archives/libvir-list/2014-July/msg00644.html
diff to v2: - hide vram attribute silently instead of reporting an error. - introduce three new capabilities for vga.vgamem_mb, vmvga.vgamem_mb and qxl.vgamem_mb. - fix some error reported by building libvirt.
Zeng Junliang (3): qemu: Hide vram attribute for some useless cases. qemu: Introduce vgamem attribute for video model qemu: Add secondary-vga support
docs/formatdomain.html.in | 46 +++--- docs/schemas/domaincommon.rng | 6 + src/conf/domain_conf.c | 57 +++++++- src/conf/domain_conf.h | 3 + src/libvirt_private.syms | 1 + src/qemu/qemu_capabilities.c | 17 +++ src/qemu/qemu_capabilities.h | 4 + src/qemu/qemu_command.c | 162 +++++++++++++++------ src/qemu/qemu_domain.c | 12 ++ tests/qemucapabilitiesdata/caps_1.2.2-1.caps | 3 + tests/qemucapabilitiesdata/caps_1.3.1-1.caps | 3 + tests/qemucapabilitiesdata/caps_1.4.2-1.caps | 3 + tests/qemucapabilitiesdata/caps_1.5.3-1.caps | 3 + tests/qemucapabilitiesdata/caps_1.6.0-1.caps | 3 + tests/qemucapabilitiesdata/caps_1.6.50-1.caps | 3 + tests/qemuhelptest.c | 10 +- ...qemuhotplug-console-compat-2+console-virtio.xml | 2 +- .../qemuxml2argv-console-compat-2.xml | 2 +- .../qemuxml2argv-controller-order.xml | 2 +- .../qemuxml2argv-graphics-listen-network.xml | 2 +- .../qemuxml2argv-graphics-listen-network2.xml | 2 +- .../qemuxml2argv-graphics-sdl-fullscreen.xml | 2 +- .../qemuxml2argvdata/qemuxml2argv-graphics-sdl.xml | 2 +- ...emuxml2argv-graphics-spice-agent-file-xfer.args | 5 +- ...qemuxml2argv-graphics-spice-agent-file-xfer.xml | 4 +- .../qemuxml2argv-graphics-spice-agentmouse.xml | 2 +- .../qemuxml2argv-graphics-spice-compression.args | 4 +- .../qemuxml2argv-graphics-spice-compression.xml | 4 +- .../qemuxml2argv-graphics-spice-listen-network.xml | 4 +- .../qemuxml2argv-graphics-spice-qxl-vga.args | 4 +- .../qemuxml2argv-graphics-spice-qxl-vga.xml | 4 +- .../qemuxml2argv-graphics-spice-sasl.args | 3 +- .../qemuxml2argv-graphics-spice-sasl.xml | 2 +- .../qemuxml2argv-graphics-spice-timeout.xml | 2 +- .../qemuxml2argv-graphics-spice.args | 5 +- .../qemuxml2argv-graphics-spice.xml | 4 +- .../qemuxml2argv-graphics-vnc-policy.xml | 2 +- .../qemuxml2argv-graphics-vnc-sasl.xml | 2 +- .../qemuxml2argv-graphics-vnc-secondary-vga.args | 7 + .../qemuxml2argv-graphics-vnc-secondary-vga.xml | 39 +++++ .../qemuxml2argv-graphics-vnc-socket.xml | 2 +- .../qemuxml2argv-graphics-vnc-std-vga.args | 4 + .../qemuxml2argv-graphics-vnc-std-vga.xml | 36 +++++ .../qemuxml2argv-graphics-vnc-tls.xml | 2 +- .../qemuxml2argv-graphics-vnc-vmware-svga.args | 4 + .../qemuxml2argv-graphics-vnc-vmware-svga.xml | 36 +++++ .../qemuxml2argv-graphics-vnc-websocket.xml | 2 +- .../qemuxml2argvdata/qemuxml2argv-graphics-vnc.xml | 2 +- .../qemuxml2argv-net-bandwidth.xml | 2 +- .../qemuxml2argv-pci-autoadd-addr.xml | 2 +- .../qemuxml2argv-pci-autoadd-idx.xml | 2 +- tests/qemuxml2argvdata/qemuxml2argv-pci-bridge.xml | 2 +- .../qemuxml2argv-pcihole64-q35.args | 3 +- .../qemuxml2argv-pcihole64-q35.xml | 2 +- .../qemuxml2argvdata/qemuxml2argv-pseries-disk.xml | 2 +- tests/qemuxml2argvdata/qemuxml2argv-q35.args | 3 +- tests/qemuxml2argvdata/qemuxml2argv-q35.xml | 2 +- .../qemuxml2argv-serial-spiceport.args | 4 +- .../qemuxml2argv-serial-spiceport.xml | 2 +- .../qemuxml2argv-video-device-pciaddr-default.args | 9 +- .../qemuxml2argv-video-device-pciaddr-default.xml | 6 +- tests/qemuxml2argvtest.c | 26 +++- .../qemuxml2xmlout-graphics-listen-network2.xml | 2 +- .../qemuxml2xmlout-graphics-spice-timeout.xml | 2 +- .../qemuxml2xmlout-pci-autoadd-addr.xml | 2 +- .../qemuxml2xmlout-pci-autoadd-idx.xml | 2 +- tests/qemuxml2xmloutdata/qemuxml2xmlout-q35.xml | 2 +- tests/qemuxml2xmltest.c | 3 + 68 files changed, 494 insertions(+), 121 deletions(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-secondary-vga.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-secondary-vga.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-std-vga.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-std-vga.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-vmware-svga.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-vmware-svga.xml

On Do, 2014-08-14 at 20:43 +0800, Wang Rui wrote:
From: Zeng Junliang <zengjunliang@huawei.com>
http://www.redhat.com/archives/libvir-list/2014-July/msg00644.html
diff to v2: - hide vram attribute silently instead of reporting an error. - introduce three new capabilities for vga.vgamem_mb, vmvga.vgamem_mb and qxl.vgamem_mb. - fix some error reported by building libvirt.
Series looks good to me from qemu developers point of view. Can't review the libvirt internals though. cheers, Gerd

On 2014/8/28 16:05, Gerd Hoffmann wrote:
On Do, 2014-08-14 at 20:43 +0800, Wang Rui wrote:
From: Zeng Junliang <zengjunliang@huawei.com>
http://www.redhat.com/archives/libvir-list/2014-July/msg00644.html
diff to v2: - hide vram attribute silently instead of reporting an error. - introduce three new capabilities for vga.vgamem_mb, vmvga.vgamem_mb and qxl.vgamem_mb. - fix some error reported by building libvirt.
Series looks good to me from qemu developers point of view. Can't review the libvirt internals though.
cheers, Gerd
Thanks. :-)

Sorry for pinging again so soon. Defer reviewing is OK. Keep your schedule first. Could someone please spend some time to review these patches or recommend me a *right* maintainer in libvirt? I will be on holiday from this weekend to Oct 8th. If anyone has comments on these patches, just reply as usual. My colleague will go on sending the next version. Of course, it's grateful to receive your comments in this week. On 2014/8/28 16:05, Gerd Hoffmann wrote:
On Do, 2014-08-14 at 20:43 +0800, Wang Rui wrote:
From: Zeng Junliang <zengjunliang@huawei.com>
http://www.redhat.com/archives/libvir-list/2014-July/msg00644.html
diff to v2: - hide vram attribute silently instead of reporting an error. - introduce three new capabilities for vga.vgamem_mb, vmvga.vgamem_mb and qxl.vgamem_mb. - fix some error reported by building libvirt.
Series looks good to me from qemu developers point of view. Can't review the libvirt internals though.
cheers, Gerd
participants (3)
-
Gerd Hoffmann
-
Michal Privoznik
-
Wang Rui