spice: Disallow use of gl + TCP port
PATCH 1/1 spice: Disallow use of gl + TCP port
Currently, virgl support has to go through a local unix socket, trying to connect to a VM using -spice gl through spice://localhost:5900 will only result in a black screen.
This commit errors out when the user tries to start a VM with both GL support and a port/tls-port set.
This would fit better in spice-server, but currently QEMU does not call into spice-server when parsing 'gl' on its command line, so we have to do this check in QEMU instead.
--- ui/spice-core.c | 4 ++++ 1 file changed, 4 insertions(+)
ui/spice-core.c +4 -0
@@ -844,6 +844,10 @@ void qemu_spice_init(void)#ifdef HAVE_SPICE_GL if (qemu_opt_get_bool (opts,"gl" ,0 )) { +if ((port !=0 ) || (tls_port !=0 )) { +error_report ("SPICE GL support is local-only for now and incompatible with -spice port/tls-port" ); +exit (1 ); + }if (egl_rendernode_init () ==0 ) { display_opengl =1 ; }
Signature · 1 line
2.5.0
Quoted 10 lines · Christophe Fergeau
Currently, virgl support has to go through a local unix socket, trying to connect to a VM using -spice gl through spice://localhost:5900 will only result in a black screen.
This commit errors out when the user tries to start a VM with both GL support and a port/tls-port set.
This would fit better in spice-server, but currently QEMU does not call into spice-server when parsing 'gl' on its command line, so we have to do this check in QEMU instead.Signed-off-by Christophe Fergeau <[email protected]>
Quoted 22 lines
--- ui/spice-core.c | 4 ++++ 1 file changed, 4 insertions(+)ui/spice-core.c +4
-1@@ -844,6 +844,10 @@ void qemu_spice_init(void)#ifdef HAVE_SPICE_GL if (qemu_opt_get_bool (opts,"gl" ,0 )) { +if ((port !=0 ) || (tls_port !=0 )) { +error_report ("SPICE GL support is local-only for now and incompatible with -spice port/tls-port" ); +exit (1 ); + }if (egl_rendernode_init () ==0 ) { display_opengl =1 ; } --2.5.0
Signature · 1 line
Marc-André Lureau
Quoted 8 lines · Christophe Fergeau
Currently, virgl support has to go through a local unix socket, trying to connect to a VM using -spice gl through spice://localhost:5900 will only result in a black screen.
This commit errors out when the user tries to start a VM with both GL support and a port/tls-port set.
This would fit better in spice-server, but currently QEMU does not call into spice-server when parsing 'gl' on its command line, so we have to do this check in QEMU instead.
Hmm. It's something which we want support long-term though, by encoding those dma-bufs as video stream and send them off over tcp.
I don't think this is a good idea long-term.
And even as temporary stopgap: Can libvirt + virt-manager handle this?
cheers,
Gerd
Hi,
Quoted 10 lines · Gerd Hoffmann
Quoted 8 lines · Christophe Fergeau
Currently, virgl support has to go through a local unix socket, trying to connect to a VM using -spice gl through spice://localhost:5900 will only result in a black screen.
This commit errors out when the user tries to start a VM with both GL support and a port/tls-port set.
This would fit better in spice-server, but currently QEMU does not call into spice-server when parsing 'gl' on its command line, so we have to do this check in QEMU instead.
Quoted 4 lines
Hmm. It's something which we want support long-term though, by encoding those dma-bufs as video stream and send them off over tcp.
I don't think this is a good idea long-term.
Yes, long-term we will want to remove this once spice gets support for this. Currently however, this imo makes it a bit easier to understand how everything is setup.
Otherwise I expect people are going to just take their existing SPICE libvirt configuration listening on the network, add <gl enable="yes"/> to it, try remote-viewer spice://localhost:5900 and wonder why they get a black screen, and not know whether this is because their guest does not support virgl, or their host, or because of some other issue, ...
Having this as a stopgap ensures that they at least be informed this is not a valid usecase.
Quoted 1 line
And even as temporary stopgap: Can libvirt + virt-manager handle this?
libvirt can, I haven't tried virt-manager (I believe all the patches from Marc-André haven't been pushed yet)
<spice autoport="no"/> starts QEMU with -spice port=0
Christophe
Quoted 19 lines · Christophe Fergeau
Currently, virgl support has to go through a local unix socket, trying to connect to a VM using -spice gl through spice://localhost:5900 will only result in a black screen.
This commit errors out when the user tries to start a VM with both GL support and a port/tls-port set.
This would fit better in spice-server, but currently QEMU does not call into spice-server when parsing 'gl' on its command line, so we have to do this check in QEMU instead.Signed-off-by Christophe Fergeau <[email protected]>--- ui/spice-core.c | 4 ++++ 1 file changed, 4 insertions(+)ui/spice-core.c +0
-0
ui/spice-core.c void qemu_spice_init(void) · line 847
Quoted 4 lines
ui/spice-core.c +1
-0@@ -844,6 +844,10 @@ void qemu_spice_init(void)#ifdef HAVE_SPICE_GL if (qemu_opt_get_bool (opts,"gl" ,0 )) { +if ((port !=0 ) || (tls_port !=0 )) {
Overparenthesized; you could write:
if (port || tls_port) {
for the same effect with less typing.
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Quoted 27 lines · Eric Blake
Quoted 19 lines · Christophe Fergeau
Currently, virgl support has to go through a local unix socket, trying to connect to a VM using -spice gl through spice://localhost:5900 will only result in a black screen.
This commit errors out when the user tries to start a VM with both GL support and a port/tls-port set.
This would fit better in spice-server, but currently QEMU does not call into spice-server when parsing 'gl' on its command line, so we have to do this check in QEMU instead.Signed-off-by Christophe Fergeau <[email protected]>--- ui/spice-core.c | 4 ++++ 1 file changed, 4 insertions(+)ui/spice-core.c +0
-0ui/spice-core.c void qemu_spice_init(void) · line 847
Quoted 4 lines
ui/spice-core.c +1
-0@@ -844,6 +844,10 @@ void qemu_spice_init(void)#ifdef HAVE_SPICE_GL if (qemu_opt_get_bool (opts,"gl" ,0 )) { +if ((port !=0 ) || (tls_port !=0 )) {Overparenthesized; you could write:
Quoted 3 lines
if (port ||
tls_port) {for the same effect with less typing.
Yeah I know I'm overly verbose with these tests, the parentheses make it explicit that there are no operator priority issues, the != 0 emphasize it's an integer type which is being handled.
I'll change it to your recommendation before sending a v2.
Christophe
Hi,
Quoted 2 lines
Yes, long-term we will want to remove this once spice gets support for this.
How can qemu figure whenever spice supports gl+tcp or not?
cheers,
Gerd
Quoted 6 lines · Gerd Hoffmann
Hi,
Quoted 2 lines
Yes, long-term we will want to remove this once spice gets support for this.
How can qemu figure whenever spice supports gl+tcp or not?
gl support is already enabled through a spice-server version check
#if defined(CONFIG_OPENGL_DMABUF)
# if SPICE_SERVER_VERSION >= 0x000d01 /* release 0.13.1 */ # define HAVE_SPICE_GL 1 # include "ui/egl-helpers.h" # include "ui/egl-context.h" # endif #endif
We can do something similar once gl+tcp is available.
Christophe
Quoted 10 lines · Christophe Fergeau
Quoted 6 lines · Gerd Hoffmann
Hi,
Quoted 2 lines
Yes, long-term we will want to remove this once spice gets support for this.
How can qemu figure whenever spice supports gl+tcp or not?
gl support is already enabled through a spice-server version check
Quoted 7 lines
#if
defined(CONFIG_OPENGL_DMABUF)# if SPICE_SERVER_VERSION >= 0x000d01 /* release 0.13.1 */ # define HAVE_SPICE_GL 1 # include "ui/egl-helpers.h" # include "ui/egl-context.h" # endif #endif
Sure, qemu needed to figure whenever spice-server provides the gl API.
Quoted 1 line
We can do something similar once gl+tcp is available.
I don't expect adding gl+tcp support to spice needs changes in the spice-server API and qemu. So ifdef'ing on the spice-server version is bogous, especially as the version you compiled qemu against can be newer or older as the version used to run qemu.
cheers,
Gerd
Quoted 5 lines · Gerd Hoffmann
Quoted 1 line
We can do something similar once gl+tcp is available.
I don't expect adding gl+tcp support to spice needs changes in the spice-server API and qemu. So ifdef'ing on the spice-server version is bogous,
Hmm, I expected some changes, at least wrt options if the user needs to tweak the format of the video stream, hence the suggestion :) Things get trickier then. Adding a runtime spice_get_version() would not be that great either as the check would have to be updated with each spice-server release.
I'd still like to have some failure when people try such configurations, gathering all the pieces is complicated enough, better to let people know when they try doing something that won't work.
Christophe
Quoted 10 lines · Christophe Fergeau
Currently, virgl support has to go through a local unix socket, trying to connect to a VM using -spice gl through spice://localhost:5900 will only result in a black screen.
This commit errors out when the user tries to start a VM with both GL support and a port/tls-port set.
This would fit better in spice-server, but currently QEMU does not call into spice-server when parsing 'gl' on its command line, so we have to do this check in QEMU instead.Signed-off-by Christophe Fergeau <[email protected]>
Picked up for ui patch queue.
thanks,
Gerd
Quoted 10 lines · Gerd Hoffmann
Quoted 9 lines · Christophe Fergeau
Currently, virgl support has to go through a local unix socket, trying to connect to a VM using -spice gl through spice://localhost:5900 will only result in a black screen.
This commit errors out when the user tries to start a VM with both GL support and a port/tls-port set.
This would fit better in spice-server, but currently QEMU does not call into spice-server when parsing 'gl' on its command line, so we have to do this check in QEMU instead.
Quoted 3 lines
Quoted 1 line
Signed-off-by Christophe Fergeau <[email protected]>Picked up for ui patch queue.
Great thanks!
Fwiw, I've changed it locally to address Eric's comments, but did not send it as v2 since a discussion was ongoing, here is what it looks in my local clone now (but I'm fine with either version):
commit c0e10fb17a45a9da14d068a58af3a00e78f82403
Author: Christophe Fergeau <[email protected]> Date: Mon Mar 14 12:37:50 2016 +0100
spice: Disallow use of gl + TCP port
Currently, virgl support has to go through a local unix socket, trying to connect to a VM using -spice gl through spice://localhost:5900 will only result in a black screen.
This commit errors out when the user tries to start a VM with both GL support and a port/tls-port set.
This would fit better in spice-server, but currently QEMU does not call into spice-server when parsing 'gl' on its command line, so we have to do this check in QEMU instead.
ui/spice-core.c +4 -0
@@ -844,6 +844,10 @@ void qemu_spice_init(void)#ifdef HAVE_SPICE_GL if (qemu_opt_get_bool (opts,"gl" ,0 )) { +if (port || tls_port) { +error_report ("SPICE GL support is local-only for now and incompatible with -spice port/tls-port" ); +exit (1 ); + }if (egl_rendernode_init () ==0 ) { display_opengl =1 ; }
Christophe