diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 5016772543b5c31eee7cbfdb35376249c6d5d0af..c54b3080d5fa8990b5d5a41811cee5e38a9c2c79 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -5002,6 +5002,7 @@ qemu-kvm -net nic,model=? /dev/null <clipboard copypaste='no'/> <mouse mode='client'/> <filetransfer enable='no'/> + <gl enable='yes'/> </graphics>

Spice supports variable compression settings for audio, @@ -5048,6 +5049,13 @@ qemu-kvm -net nic,model=? /dev/null enable property to no , since since 1.2.2.

+

+ Spice may provide accelerated server-side rendering with + OpenGL. You can enable or disable OpenGL support explicitly with + the gl element, by setting the + enable property. (QEMU + only, since 1.3.2). +

"rdp"
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 67af93a004f082d0f1f42a89cdc8d8cc76191216..18ef51092ec82b93dc1546eac51c87e48938de17 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -2823,6 +2823,14 @@ + + + + + + + + diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 79758d42d8f70ba4489cf9ad32fdd8697757ee17..049a7a775d3955e953640db3c9dc9e6bead93248 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -11034,6 +11034,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, "\n", virTristateBoolTypeToString(def->data.spice.filetransfer)); + if (def->data.spice.gl) + virBufferAsprintf(buf, "\n", + virTristateBoolTypeToString(def->data.spice.gl)); } if (children) { diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 1de3be33e128966841c1d10a64d0806d0f4f375a..d3b3ed289e8fcc99c1ca24f170bb2ecb3d92c2aa 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 1018d6c3cf3c86ea7313f627ae7c1bd271f1cad5..6762e4c6b4f7e421b9a3b060f53a87b1d9f391fa 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -315,6 +315,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST, "vserport-change-event", /* 210 */ "virtio-balloon-pci.deflate-on-oom", "mptsas1068", + "spice-gl", ); @@ -2627,6 +2628,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 b73c529e768a57116625ed33353bc7e6f9b14ec2..f51b8e9b5462c42c4ca13ae80941b901cf37e8d4 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -344,6 +344,7 @@ typedef enum { QEMU_CAPS_VIRTIO_BALLOON_AUTODEFLATE, /* virtio-balloon-{device,pci,ccw}. * deflate-on-oom */ QEMU_CAPS_SCSI_MPTSAS1068, /* -device mptsas1068 */ + 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 d08e78fea04f31aa964c5e4b389c8520dc40ac42..a60e8727cb5345025f91a8df52ab32724a234abd 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -6049,6 +6049,19 @@ qemuBuildGraphicsSPICECommandLine(virQEMUDriverConfigPtr cfg, } } + if (graphics->data.spice.gl == VIR_TRISTATE_SWITCH_ON) { + 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 f32d5aaa474205763560a4c80709b2430d56573e..0767b85ab8306ac1f24d3ec3be20b6cef7053944 100644 --- a/tests/qemucapabilitiesdata/caps_2.6.0-1.caps +++ b/tests/qemucapabilitiesdata/caps_2.6.0-1.caps @@ -174,4 +174,5 @@ + diff --git a/tests/qemucapabilitiesdata/caps_2.6.0-1.replies b/tests/qemucapabilitiesdata/caps_2.6.0-1.replies index 8ee4bec76de51345a4319abf4c947534c4217862..d2b58b56ca05d75a196173f5b0b200d887783dcd 100644 --- a/tests/qemucapabilitiesdata/caps_2.6.0-1.replies +++ b/tests/qemucapabilitiesdata/caps_2.6.0-1.replies @@ -3344,6 +3344,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 0000000000000000000000000000000000000000..edecca15ce86785407c8a7351c8d4740eabe68b6 --- /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/lib/domain--1-QEMUGuest1/monitor.sock,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 0000000000000000000000000000000000000000..b9c7c8af008297a7b099c3d7a5a0be10945e1fe0 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-video-virtio-gpu-spice-gl.xml @@ -0,0 +1,38 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 1048576 + 1048576 + 1 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu + + + + +
+ + + + + + + + + + + + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index f843b16ce5f398e4eff42277d3193ed9821ed71d..d29073dda5e637d3e108c6d0cf85fe4c6ab36784 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1480,6 +1480,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 0000000000000000000000000000000000000000..05e9cd5e8a4e24a1759200230c03fdd029de0539 --- /dev/null +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-video-virtio-gpu-spice-gl.xml @@ -0,0 +1,45 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 1048576 + 1048576 + 1 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu + + + + +
+ + +
+ + +
+ + + + + + + +