[libvirt] [PATCH v2 0/2] qemu: add spice opengl support

Hi, The following patches allow to enable OpenGl support with spice/qemu server. Qemu should support this option starting from 2.6 (patches still under review). v1->v2: - move gl attribute as a sub-element - update documentation - comment TristateSwitch vs TristateBool usage - fix caps test location - fix syntax-check Marc-André Lureau (2): util: TristateBool and TristateSwitch are interchangeable qemu: add spice opengl support docs/formatdomain.html.in | 8 ++++ docs/schemas/domaincommon.rng | 8 ++++ src/conf/domain_conf.c | 26 ++++++++++++- src/conf/domain_conf.h | 1 + src/qemu/qemu_capabilities.c | 2 + src/qemu/qemu_capabilities.h | 1 + src/qemu/qemu_command.c | 13 +++++++ src/util/virutil.h | 7 +++- tests/qemucapabilitiesdata/caps_2.6.0-1.caps | 1 + tests/qemucapabilitiesdata/caps_2.6.0-1.replies | 4 ++ .../qemuxml2argv-video-virtio-gpu-spice-gl.args | 24 ++++++++++++ .../qemuxml2argv-video-virtio-gpu-spice-gl.xml | 38 ++++++++++++++++++ tests/qemuxml2argvtest.c | 6 +++ .../qemuxml2xmlout-video-virtio-gpu-spice-gl.xml | 45 ++++++++++++++++++++++ tests/qemuxml2xmltest.c | 1 + 15 files changed, 183 insertions(+), 2 deletions(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-virtio-gpu-spice-gl.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-virtio-gpu-spice-gl.xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-video-virtio-gpu-spice-gl.xml -- 2.5.0

It may be useful in some cases to call TristateSwitch helper with TristateBool. Document that enum values equivalency in the code. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> --- src/util/virutil.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/util/virutil.h b/src/util/virutil.h index 535807c..b121de0 100644 --- a/src/util/virutil.h +++ b/src/util/virutil.h @@ -236,10 +236,15 @@ typedef enum { VIR_TRISTATE_SWITCH_LAST } virTristateSwitch; - VIR_ENUM_DECL(virTristateBool) VIR_ENUM_DECL(virTristateSwitch) +/* the two enums must be in sync to be able to use helpers interchangeably in + * some special cases */ +verify((int)VIR_TRISTATE_BOOL_YES == (int)VIR_TRISTATE_SWITCH_ON); +verify((int)VIR_TRISTATE_BOOL_NO == (int)VIR_TRISTATE_SWITCH_OFF); +verify((int)VIR_TRISTATE_BOOL_ABSENT == (int)VIR_TRISTATE_SWITCH_ABSENT); + unsigned int virGetListenFDs(void); long virGetSystemPageSize(void); -- 2.5.0

On 19.02.2016 15:30, Marc-André Lureau wrote:
It may be useful in some cases to call TristateSwitch helper with TristateBool. Document that enum values equivalency in the code.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> --- src/util/virutil.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/util/virutil.h b/src/util/virutil.h index 535807c..b121de0 100644 --- a/src/util/virutil.h +++ b/src/util/virutil.h @@ -236,10 +236,15 @@ typedef enum { VIR_TRISTATE_SWITCH_LAST } virTristateSwitch;
- VIR_ENUM_DECL(virTristateBool) VIR_ENUM_DECL(virTristateSwitch)
+/* the two enums must be in sync to be able to use helpers interchangeably in + * some special cases */ +verify((int)VIR_TRISTATE_BOOL_YES == (int)VIR_TRISTATE_SWITCH_ON); +verify((int)VIR_TRISTATE_BOOL_NO == (int)VIR_TRISTATE_SWITCH_OFF); +verify((int)VIR_TRISTATE_BOOL_ABSENT == (int)VIR_TRISTATE_SWITCH_ABSENT); + unsigned int virGetListenFDs(void);
long virGetSystemPageSize(void);
ACK. I'm pushing this one as it makes perfect sense on its own. Michal

Hi ----- Original Message -----
VIR_ENUM_DECL(virTristateBool) VIR_ENUM_DECL(virTristateSwitch)
+/* the two enums must be in sync to be able to use helpers interchangeably in + * some special cases */ +verify((int)VIR_TRISTATE_BOOL_YES == (int)VIR_TRISTATE_SWITCH_ON); +verify((int)VIR_TRISTATE_BOOL_NO == (int)VIR_TRISTATE_SWITCH_OFF); +verify((int)VIR_TRISTATE_BOOL_ABSENT == (int)VIR_TRISTATE_SWITCH_ABSENT); + unsigned int virGetListenFDs(void);
long virGetSystemPageSize(void);
ACK.
I'm pushing this one as it makes perfect sense on its own.
thanks

Add Spice graphics gl attribute. qemu 2.6 should have -spice gl=on argument to enable opengl rendering context (patches on the ML). This is necessary to actually enable virgl rendering. Add a qemuxml2argv test for virtio-gpu + spice with virgl. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> --- docs/formatdomain.html.in | 8 ++++ docs/schemas/domaincommon.rng | 8 ++++ src/conf/domain_conf.c | 26 ++++++++++++- src/conf/domain_conf.h | 1 + src/qemu/qemu_capabilities.c | 2 + src/qemu/qemu_capabilities.h | 1 + src/qemu/qemu_command.c | 13 +++++++ tests/qemucapabilitiesdata/caps_2.6.0-1.caps | 1 + tests/qemucapabilitiesdata/caps_2.6.0-1.replies | 4 ++ .../qemuxml2argv-video-virtio-gpu-spice-gl.args | 24 ++++++++++++ .../qemuxml2argv-video-virtio-gpu-spice-gl.xml | 38 ++++++++++++++++++ tests/qemuxml2argvtest.c | 6 +++ .../qemuxml2xmlout-video-virtio-gpu-spice-gl.xml | 45 ++++++++++++++++++++++ tests/qemuxml2xmltest.c | 1 + 14 files changed, 177 insertions(+), 1 deletion(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-virtio-gpu-spice-gl.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-virtio-gpu-spice-gl.xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-video-virtio-gpu-spice-gl.xml diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index e96798f..256ad1b 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -5000,6 +5000,7 @@ qemu-kvm -net nic,model=? /dev/null <clipboard copypaste='no'/> <mouse mode='client'/> <filetransfer enable='no'/> + <gl enable='yes'/> </graphics></pre> <p> Spice supports variable compression settings for audio, @@ -5046,6 +5047,13 @@ qemu-kvm -net nic,model=? /dev/null <code>enable</code> property to <code>no</code> , since <span class="since">since 1.2.2</span>. </p> + <p> + Spice may provide accelerated server-side rendering with + OpenGL. You can enable or disable OpenGL support explicitly with + the <code>gl</code> element, by setting the + <code>enable</code> property. (QEMU + only, <span class="since">since 1.3.2</span>). + </p> </dd> <dt><code>"rdp"</code></dt> <dd> diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 67af93a..18ef510 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -2823,6 +2823,14 @@ <empty/> </element> </optional> + <optional> + <element name="gl"> + <attribute name="enable"> + <ref name="virYesNo"/> + </attribute> + <empty/> + </element> + </optional> </interleave> </group> <group> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index acd58a1..45d745f 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -11024,6 +11024,26 @@ virDomainGraphicsDefParseXML(xmlNodePtr node, VIR_FREE(enable); def->data.spice.filetransfer = enableVal; + } else if (xmlStrEqual(cur->name, BAD_CAST "gl")) { + char *enable = virXMLPropString(cur, "enable"); + int enableVal; + + if (!enable) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("spice gl element missing enable")); + goto error; + } + + if ((enableVal = + virTristateBoolTypeFromString(enable)) <= 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unknown enable value '%s'"), enable); + VIR_FREE(enable); + goto error; + } + VIR_FREE(enable); + + def->data.spice.gl = enableVal; } else if (xmlStrEqual(cur->name, BAD_CAST "mouse")) { char *mode = virXMLPropString(cur, "mode"); int modeVal; @@ -21093,7 +21113,8 @@ virDomainGraphicsDefFormat(virBufferPtr buf, if (!children && (def->data.spice.image || def->data.spice.jpeg || def->data.spice.zlib || def->data.spice.playback || def->data.spice.streaming || def->data.spice.copypaste || - def->data.spice.mousemode || def->data.spice.filetransfer)) { + def->data.spice.mousemode || def->data.spice.filetransfer || + def->data.spice.gl)) { virBufferAddLit(buf, ">\n"); virBufferAdjustIndent(buf, 2); children = true; @@ -21122,6 +21143,9 @@ virDomainGraphicsDefFormat(virBufferPtr buf, if (def->data.spice.filetransfer) virBufferAsprintf(buf, "<filetransfer enable='%s'/>\n", virTristateBoolTypeToString(def->data.spice.filetransfer)); + if (def->data.spice.gl) + virBufferAsprintf(buf, "<gl enable='%s'/>\n", + virTristateBoolTypeToString(def->data.spice.gl)); } if (children) { diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 1de3be3..d3b3ed2 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1586,6 +1586,7 @@ struct _virDomainGraphicsDef { int streaming; int copypaste; /* enum virTristateBool */ int filetransfer; /* enum virTristateBool */ + int gl; /* enum virTristateBool */ } spice; } data; /* nListens, listens, and *port are only useful if type is vnc, diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 3099e34..cab4d7d 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -314,6 +314,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST, "vserport-change-event", /* 210 */ "virtio-balloon-pci.deflate-on-oom", + "spice-gl", ); @@ -2625,6 +2626,7 @@ static struct virQEMUCapsCommandLineProps virQEMUCapsCommandLine[] = { { "machine", "aes-key-wrap", QEMU_CAPS_AES_KEY_WRAP }, { "machine", "dea-key-wrap", QEMU_CAPS_DEA_KEY_WRAP }, { "chardev", "append", QEMU_CAPS_CHARDEV_FILE_APPEND }, + { "spice", "gl", QEMU_CAPS_SPICE_GL }, }; static int diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index e5353de..0c857d2 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -343,6 +343,7 @@ typedef enum { QEMU_CAPS_VSERPORT_CHANGE, /* VSERPORT_CHANGE event */ QEMU_CAPS_VIRTIO_BALLOON_AUTODEFLATE, /* virtio-balloon-{device,pci,ccw}. * deflate-on-oom */ + QEMU_CAPS_SPICE_GL, /* -spice gl */ 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 b751f04..8e9c0c7 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -6047,6 +6047,19 @@ qemuBuildGraphicsSPICECommandLine(virQEMUDriverConfigPtr cfg, } } + if (graphics->data.spice.gl) { + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SPICE_GL)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("This QEMU doesn't support spice OpenGL")); + goto error; + } + + /* spice.gl is a TristateBool, but qemu expects on/off: use + * TristateSwitch helper */ + virBufferAsprintf(&opt, ",gl=%s", + virTristateSwitchTypeToString(graphics->data.spice.gl)); + } + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_SEAMLESS_MIGRATION)) { /* If qemu supports seamless migration turn it * unconditionally on. If migration destination diff --git a/tests/qemucapabilitiesdata/caps_2.6.0-1.caps b/tests/qemucapabilitiesdata/caps_2.6.0-1.caps index f32d5aa..0767b85 100644 --- a/tests/qemucapabilitiesdata/caps_2.6.0-1.caps +++ b/tests/qemucapabilitiesdata/caps_2.6.0-1.caps @@ -174,4 +174,5 @@ <flag name='ich9-disable-s4'/> <flag name='vserport-change-event'/> <flag name='virtio-balloon-pci.deflate-on-oom'/> + <flag name='spice-gl'/> </qemuCaps> diff --git a/tests/qemucapabilitiesdata/caps_2.6.0-1.replies b/tests/qemucapabilitiesdata/caps_2.6.0-1.replies index 8ee4bec..d2b58b5 100644 --- a/tests/qemucapabilitiesdata/caps_2.6.0-1.replies +++ b/tests/qemucapabilitiesdata/caps_2.6.0-1.replies @@ -3345,6 +3345,10 @@ { "parameters": [ { + "name": "gl", + "type": "boolean" + }, + { "name": "seamless-migration", "type": "boolean" }, diff --git a/tests/qemuxml2argvdata/qemuxml2argv-video-virtio-gpu-spice-gl.args b/tests/qemuxml2argvdata/qemuxml2argv-video-virtio-gpu-spice-gl.args new file mode 100644 index 0000000..16ac8ca --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-video-virtio-gpu-spice-gl.args @@ -0,0 +1,24 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/home/test \ +USER=test \ +LOGNAME=test \ +QEMU_AUDIO_DRV=spice \ +/usr/bin/qemu \ +-name QEMUGuest1 \ +-S \ +-M pc \ +-m 1024 \ +-smp 1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-nodefaults \ +-monitor unix:/tmp/test-monitor,server,nowait \ +-no-acpi \ +-boot c \ +-usb \ +-drive file=/var/lib/libvirt/images/QEMUGuest1,format=qcow2,if=none,\ +id=drive-ide0-0-0,cache=none \ +-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \ +-spice port=0,gl=on \ +-device virtio-vga,id=video0,virgl=on,bus=pci.0,addr=0x2 \ +-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-video-virtio-gpu-spice-gl.xml b/tests/qemuxml2argvdata/qemuxml2argv-video-virtio-gpu-spice-gl.xml new file mode 100644 index 0000000..b9c7c8a --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-video-virtio-gpu-spice-gl.xml @@ -0,0 +1,38 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>1048576</memory> + <currentMemory unit='KiB'>1048576</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='file' device='disk'> + <driver name='qemu' type='qcow2' cache='none'/> + <source file='/var/lib/libvirt/images/QEMUGuest1'/> + <target dev='hda' bus='ide'/> + <address type='drive' controller='0' bus='0' target='0' unit='0'/> + </disk> + <controller type='ide' index='0'/> + <controller type='usb' index='0'/> + <controller type='pci' index='0' model='pci-root'/> + <input type='mouse' bus='ps2'/> + <input type='keyboard' bus='ps2'/> + <graphics type='spice' autoport='no'> + <gl enable='yes'/> + </graphics> + <video> + <model type='virtio' heads='1'> + <acceleration accel3d='yes'/> + </model> + </video> + <memballoon model='virtio'/> + </devices> +</domain> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index bb80c22..5c14f5d 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1458,6 +1458,12 @@ mymain(void) QEMU_CAPS_DEVICE_VIRTIO_GPU, QEMU_CAPS_DEVICE_VIRTIO_GPU_VIRGL, QEMU_CAPS_DEVICE_VIDEO_PRIMARY); + DO_TEST("video-virtio-gpu-spice-gl", + QEMU_CAPS_DEVICE_VIRTIO_GPU, + QEMU_CAPS_DEVICE_VIRTIO_GPU_VIRGL, + QEMU_CAPS_SPICE, + QEMU_CAPS_SPICE_GL, + QEMU_CAPS_DEVICE_VIDEO_PRIMARY); DO_TEST_PARSE_ERROR("video-invalid", NONE); DO_TEST("virtio-rng-default", QEMU_CAPS_DEVICE_VIRTIO_RNG, diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-video-virtio-gpu-spice-gl.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-video-virtio-gpu-spice-gl.xml new file mode 100644 index 0000000..05e9cd5 --- /dev/null +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-video-virtio-gpu-spice-gl.xml @@ -0,0 +1,45 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>1048576</memory> + <currentMemory unit='KiB'>1048576</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='file' device='disk'> + <driver name='qemu' type='qcow2' cache='none'/> + <source file='/var/lib/libvirt/images/QEMUGuest1'/> + <target dev='hda' bus='ide'/> + <address type='drive' controller='0' bus='0' target='0' unit='0'/> + </disk> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> + <controller type='pci' index='0' model='pci-root'/> + <input type='mouse' bus='ps2'/> + <input type='keyboard' bus='ps2'/> + <graphics type='spice' autoport='no'> + <gl enable='yes'/> + </graphics> + <video> + <model type='virtio' heads='1'> + <acceleration accel3d='yes'/> + </model> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> + </video> + <memballoon model='virtio'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> + </memballoon> + </devices> +</domain> diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 56dc821..d24ad2b 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -751,6 +751,7 @@ mymain(void) DO_TEST("video-virtio-gpu-device"); DO_TEST("video-virtio-gpu-virgl"); + DO_TEST("video-virtio-gpu-spice-gl"); DO_TEST("virtio-input"); DO_TEST("virtio-input-passthrough"); -- 2.5.0

On 19.02.2016 15:30, Marc-André Lureau wrote:
Add Spice graphics gl attribute. qemu 2.6 should have -spice gl=on argument to enable opengl rendering context (patches on the ML). This is necessary to actually enable virgl rendering.
Add a qemuxml2argv test for virtio-gpu + spice with virgl.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> --- docs/formatdomain.html.in | 8 ++++ docs/schemas/domaincommon.rng | 8 ++++ src/conf/domain_conf.c | 26 ++++++++++++- src/conf/domain_conf.h | 1 + src/qemu/qemu_capabilities.c | 2 + src/qemu/qemu_capabilities.h | 1 + src/qemu/qemu_command.c | 13 +++++++ tests/qemucapabilitiesdata/caps_2.6.0-1.caps | 1 + tests/qemucapabilitiesdata/caps_2.6.0-1.replies | 4 ++ .../qemuxml2argv-video-virtio-gpu-spice-gl.args | 24 ++++++++++++ .../qemuxml2argv-video-virtio-gpu-spice-gl.xml | 38 ++++++++++++++++++ tests/qemuxml2argvtest.c | 6 +++ .../qemuxml2xmlout-video-virtio-gpu-spice-gl.xml | 45 ++++++++++++++++++++++ tests/qemuxml2xmltest.c | 1 + 14 files changed, 177 insertions(+), 1 deletion(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-virtio-gpu-spice-gl.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-virtio-gpu-spice-gl.xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-video-virtio-gpu-spice-gl.xml
Looking good. ACK to the design. But I'd rather postpone pushing until qemu has released the feature. Otherwise we may end up with different functionality we claim to be supported than qemu does. Yet again. Michal

Hi ----- Original Message -----
On 19.02.2016 15:30, Marc-André Lureau wrote:
Add Spice graphics gl attribute. qemu 2.6 should have -spice gl=on argument to enable opengl rendering context (patches on the ML). This is necessary to actually enable virgl rendering.
Add a qemuxml2argv test for virtio-gpu + spice with virgl.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> --- docs/formatdomain.html.in | 8 ++++ docs/schemas/domaincommon.rng | 8 ++++ src/conf/domain_conf.c | 26 ++++++++++++- src/conf/domain_conf.h | 1 + src/qemu/qemu_capabilities.c | 2 + src/qemu/qemu_capabilities.h | 1 + src/qemu/qemu_command.c | 13 +++++++ tests/qemucapabilitiesdata/caps_2.6.0-1.caps | 1 + tests/qemucapabilitiesdata/caps_2.6.0-1.replies | 4 ++ .../qemuxml2argv-video-virtio-gpu-spice-gl.args | 24 ++++++++++++ .../qemuxml2argv-video-virtio-gpu-spice-gl.xml | 38 ++++++++++++++++++ tests/qemuxml2argvtest.c | 6 +++ .../qemuxml2xmlout-video-virtio-gpu-spice-gl.xml | 45 ++++++++++++++++++++++ tests/qemuxml2xmltest.c | 1 + 14 files changed, 177 insertions(+), 1 deletion(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-virtio-gpu-spice-gl.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-virtio-gpu-spice-gl.xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-video-virtio-gpu-spice-gl.xml
Looking good. ACK to the design. But I'd rather postpone pushing until qemu has released the feature. Otherwise we may end up with different functionality we claim to be supported than qemu does. Yet again.
How much of a problem is this, since there are caps checks? (assuming the interface in qemu doesn't change - I don't think it will). We were aiming for fedora 24 if possible, but I see qemu 2.6 is planned for 04-26, which is a week after Fedora code complete deadline 04-19. It's a bit sad to delay by >2 months given that Spice support is now finally ready. Many people are eager to have accelerated VMs in virt-manager, I wonder what solution we can find to shorten the delay. thanks

On Mon, Feb 22, 2016 at 09:49:04AM -0500, Marc-André Lureau wrote:
Hi
----- Original Message -----
On 19.02.2016 15:30, Marc-André Lureau wrote:
Add Spice graphics gl attribute. qemu 2.6 should have -spice gl=on argument to enable opengl rendering context (patches on the ML). This is necessary to actually enable virgl rendering.
Add a qemuxml2argv test for virtio-gpu + spice with virgl.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> --- docs/formatdomain.html.in | 8 ++++ docs/schemas/domaincommon.rng | 8 ++++ src/conf/domain_conf.c | 26 ++++++++++++- src/conf/domain_conf.h | 1 + src/qemu/qemu_capabilities.c | 2 + src/qemu/qemu_capabilities.h | 1 + src/qemu/qemu_command.c | 13 +++++++ tests/qemucapabilitiesdata/caps_2.6.0-1.caps | 1 + tests/qemucapabilitiesdata/caps_2.6.0-1.replies | 4 ++ .../qemuxml2argv-video-virtio-gpu-spice-gl.args | 24 ++++++++++++ .../qemuxml2argv-video-virtio-gpu-spice-gl.xml | 38 ++++++++++++++++++ tests/qemuxml2argvtest.c | 6 +++ .../qemuxml2xmlout-video-virtio-gpu-spice-gl.xml | 45 ++++++++++++++++++++++ tests/qemuxml2xmltest.c | 1 + 14 files changed, 177 insertions(+), 1 deletion(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-virtio-gpu-spice-gl.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-virtio-gpu-spice-gl.xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-video-virtio-gpu-spice-gl.xml
Looking good. ACK to the design. But I'd rather postpone pushing until qemu has released the feature. Otherwise we may end up with different functionality we claim to be supported than qemu does. Yet again.
How much of a problem is this, since there are caps checks? (assuming the interface in qemu doesn't change - I don't think it will).
We were aiming for fedora 24 if possible, but I see qemu 2.6 is planned for 04-26, which is a week after Fedora code complete deadline 04-19. It's a bit sad to delay by >2 months given that Spice support is now finally ready. Many people are eager to have accelerated VMs in virt-manager, I wonder what solution we can find to shorten the delay.
We don't have to wait until QEMU 2.6 is released IMHO. QEMU hard feature freeze is March 29th http://wiki.qemu.org/Planning/2.6 If we wait until that point, we can be confident enough the QEMU interface won't be changing before 2.6 GA, and still haved time to get a libvirt release with this stuff included and into Fedora 24. Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|

On 22.02.2016 16:04, Daniel P. Berrange wrote:
On Mon, Feb 22, 2016 at 09:49:04AM -0500, Marc-André Lureau wrote:
Hi
----- Original Message -----
On 19.02.2016 15:30, Marc-André Lureau wrote:
Add Spice graphics gl attribute. qemu 2.6 should have -spice gl=on argument to enable opengl rendering context (patches on the ML). This is necessary to actually enable virgl rendering.
Add a qemuxml2argv test for virtio-gpu + spice with virgl.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> --- docs/formatdomain.html.in | 8 ++++ docs/schemas/domaincommon.rng | 8 ++++ src/conf/domain_conf.c | 26 ++++++++++++- src/conf/domain_conf.h | 1 + src/qemu/qemu_capabilities.c | 2 + src/qemu/qemu_capabilities.h | 1 + src/qemu/qemu_command.c | 13 +++++++ tests/qemucapabilitiesdata/caps_2.6.0-1.caps | 1 + tests/qemucapabilitiesdata/caps_2.6.0-1.replies | 4 ++ .../qemuxml2argv-video-virtio-gpu-spice-gl.args | 24 ++++++++++++ .../qemuxml2argv-video-virtio-gpu-spice-gl.xml | 38 ++++++++++++++++++ tests/qemuxml2argvtest.c | 6 +++ .../qemuxml2xmlout-video-virtio-gpu-spice-gl.xml | 45 ++++++++++++++++++++++ tests/qemuxml2xmltest.c | 1 + 14 files changed, 177 insertions(+), 1 deletion(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-virtio-gpu-spice-gl.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-virtio-gpu-spice-gl.xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-video-virtio-gpu-spice-gl.xml
Looking good. ACK to the design. But I'd rather postpone pushing until qemu has released the feature. Otherwise we may end up with different functionality we claim to be supported than qemu does. Yet again.
How much of a problem is this, since there are caps checks? (assuming the interface in qemu doesn't change - I don't think it will).
We were aiming for fedora 24 if possible, but I see qemu 2.6 is planned for 04-26, which is a week after Fedora code complete deadline 04-19. It's a bit sad to delay by >2 months given that Spice support is now finally ready. Many people are eager to have accelerated VMs in virt-manager, I wonder what solution we can find to shorten the delay.
We don't have to wait until QEMU 2.6 is released IMHO.
QEMU hard feature freeze is March 29th http://wiki.qemu.org/Planning/2.6 If we wait until that point, we can be confident enough the QEMU interface won't be changing before 2.6 GA, and still haved time to get a libvirt release with this stuff included and into Fedora 24.
Okay. I will keep this patch in my local branch and push it afterwards. Michal

On 22.02.2016 16:28, Michal Privoznik wrote:
On 22.02.2016 16:04, Daniel P. Berrange wrote:
On Mon, Feb 22, 2016 at 09:49:04AM -0500, Marc-André Lureau wrote:
Hi
----- Original Message -----
On 19.02.2016 15:30, Marc-André Lureau wrote:
Add Spice graphics gl attribute. qemu 2.6 should have -spice gl=on argument to enable opengl rendering context (patches on the ML). This is necessary to actually enable virgl rendering.
Add a qemuxml2argv test for virtio-gpu + spice with virgl.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> --- docs/formatdomain.html.in | 8 ++++ docs/schemas/domaincommon.rng | 8 ++++ src/conf/domain_conf.c | 26 ++++++++++++- src/conf/domain_conf.h | 1 + src/qemu/qemu_capabilities.c | 2 + src/qemu/qemu_capabilities.h | 1 + src/qemu/qemu_command.c | 13 +++++++ tests/qemucapabilitiesdata/caps_2.6.0-1.caps | 1 + tests/qemucapabilitiesdata/caps_2.6.0-1.replies | 4 ++ .../qemuxml2argv-video-virtio-gpu-spice-gl.args | 24 ++++++++++++ .../qemuxml2argv-video-virtio-gpu-spice-gl.xml | 38 ++++++++++++++++++ tests/qemuxml2argvtest.c | 6 +++ .../qemuxml2xmlout-video-virtio-gpu-spice-gl.xml | 45 ++++++++++++++++++++++ tests/qemuxml2xmltest.c | 1 + 14 files changed, 177 insertions(+), 1 deletion(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-virtio-gpu-spice-gl.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-virtio-gpu-spice-gl.xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-video-virtio-gpu-spice-gl.xml
Looking good. ACK to the design. But I'd rather postpone pushing until qemu has released the feature. Otherwise we may end up with different functionality we claim to be supported than qemu does. Yet again.
How much of a problem is this, since there are caps checks? (assuming the interface in qemu doesn't change - I don't think it will).
We were aiming for fedora 24 if possible, but I see qemu 2.6 is planned for 04-26, which is a week after Fedora code complete deadline 04-19. It's a bit sad to delay by >2 months given that Spice support is now finally ready. Many people are eager to have accelerated VMs in virt-manager, I wonder what solution we can find to shorten the delay.
We don't have to wait until QEMU 2.6 is released IMHO.
QEMU hard feature freeze is March 29th http://wiki.qemu.org/Planning/2.6 If we wait until that point, we can be confident enough the QEMU interface won't be changing before 2.6 GA, and still haved time to get a libvirt release with this stuff included and into Fedora 24.
Okay. I will keep this patch in my local branch and push it afterwards.
Pushed now. Michal

[dropping Andrea from the cc-list for the sake of his Inbox] On Mon, Feb 22, 2016 at 09:49:04AM -0500, Marc-André Lureau wrote:
Hi
----- Original Message -----
On 19.02.2016 15:30, Marc-André Lureau wrote:
Add Spice graphics gl attribute. qemu 2.6 should have -spice gl=on argument to enable opengl rendering context (patches on the ML). This is necessary to actually enable virgl rendering.
Add a qemuxml2argv test for virtio-gpu + spice with virgl.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> --- docs/formatdomain.html.in | 8 ++++ docs/schemas/domaincommon.rng | 8 ++++ src/conf/domain_conf.c | 26 ++++++++++++- src/conf/domain_conf.h | 1 + src/qemu/qemu_capabilities.c | 2 + src/qemu/qemu_capabilities.h | 1 + src/qemu/qemu_command.c | 13 +++++++ tests/qemucapabilitiesdata/caps_2.6.0-1.caps | 1 + tests/qemucapabilitiesdata/caps_2.6.0-1.replies | 4 ++ .../qemuxml2argv-video-virtio-gpu-spice-gl.args | 24 ++++++++++++ .../qemuxml2argv-video-virtio-gpu-spice-gl.xml | 38 ++++++++++++++++++ tests/qemuxml2argvtest.c | 6 +++ .../qemuxml2xmlout-video-virtio-gpu-spice-gl.xml | 45 ++++++++++++++++++++++ tests/qemuxml2xmltest.c | 1 + 14 files changed, 177 insertions(+), 1 deletion(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-virtio-gpu-spice-gl.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-virtio-gpu-spice-gl.xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-video-virtio-gpu-spice-gl.xml
Looking good. ACK to the design. But I'd rather postpone pushing until qemu has released the feature. Otherwise we may end up with different functionality we claim to be supported than qemu does. Yet again.
Generally, having it merged in qemu.git master has been enough for us.
How much of a problem is this, since there are caps checks? (assuming the interface in qemu doesn't change - I don't think it will).
That is the assumption we are trying not to make.
We were aiming for fedora 24 if possible, but I see qemu 2.6 is planned for 04-26, which is a week after Fedora code complete deadline 04-19. It's a bit sad to delay by >2 months given that Spice support is now finally ready. Many people are eager to have accelerated VMs in virt-manager, I wonder what solution we can find to shorten the delay.
I presume the option will hit qemu.git much sooner than that. Jan

Hi,
Looking good. ACK to the design. But I'd rather postpone pushing until qemu has released the feature. Otherwise we may end up with different functionality we claim to be supported than qemu does. Yet again.
Generally, having it merged in qemu.git master has been enough for us.
Pull request just sent. Also note the gl=on is already there for gtk (v2.5) and sdl2 (master) and there is zero reason to name the parameter differently for spice. cheers, Gerd

[reducing the cc-list] On Fri, Feb 19, 2016 at 03:30:15PM +0100, Marc-André Lureau wrote:
Add Spice graphics gl attribute. qemu 2.6 should have -spice gl=on argument to enable opengl rendering context (patches on the ML). This is necessary to actually enable virgl rendering.
Add a qemuxml2argv test for virtio-gpu + spice with virgl.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> --- docs/formatdomain.html.in | 8 ++++ docs/schemas/domaincommon.rng | 8 ++++ src/conf/domain_conf.c | 26 ++++++++++++- src/conf/domain_conf.h | 1 + src/qemu/qemu_capabilities.c | 2 + src/qemu/qemu_capabilities.h | 1 + src/qemu/qemu_command.c | 13 +++++++ tests/qemucapabilitiesdata/caps_2.6.0-1.caps | 1 + tests/qemucapabilitiesdata/caps_2.6.0-1.replies | 4 ++ .../qemuxml2argv-video-virtio-gpu-spice-gl.args | 24 ++++++++++++ .../qemuxml2argv-video-virtio-gpu-spice-gl.xml | 38 ++++++++++++++++++ tests/qemuxml2argvtest.c | 6 +++ .../qemuxml2xmlout-video-virtio-gpu-spice-gl.xml | 45 ++++++++++++++++++++++ tests/qemuxml2xmltest.c | 1 + 14 files changed, 177 insertions(+), 1 deletion(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-virtio-gpu-spice-gl.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-virtio-gpu-spice-gl.xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-video-virtio-gpu-spice-gl.xml
@@ -6047,6 +6047,19 @@ qemuBuildGraphicsSPICECommandLine(virQEMUDriverConfigPtr cfg, } }
+ if (graphics->data.spice.gl) { + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SPICE_GL)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("This QEMU doesn't support spice OpenGL")); + goto error; + }
QEMU support is not needed if the request was to turn it off. Jan
+ + /* spice.gl is a TristateBool, but qemu expects on/off: use + * TristateSwitch helper */ + virBufferAsprintf(&opt, ",gl=%s", + virTristateSwitchTypeToString(graphics->data.spice.gl)); + } + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_SEAMLESS_MIGRATION)) { /* If qemu supports seamless migration turn it * unconditionally on. If migration destination
participants (6)
-
Daniel P. Berrange
-
Gerd Hoffmann
-
Ján Tomko
-
Marc-André Lureau
-
Marc-André Lureau
-
Michal Privoznik