Introduce 'rendernode' option for egl-headless display type
cover Introduce 'rendernode' option for egl-headless display type
Since QEMU always picks the default DRI device, libvirt doesn't know which one to put into the mount namespace and relabel it accordingly, hence hitting permission issues, unless admin tweaks the default permissions of the DRI devices.
https://bugzilla.redhat.com/show_bug.cgi?id=1648236
Erik Skultety (3):
qapi: Add "rendernode" display option for egl-headless
ui: Allow specifying 'rendernode' display option for egl-headless
help: Provide help for egl-headless
qapi/ui.json | 16 +++++++++++++++- qemu-options.hx | 6 +++++- ui/egl-headless.c | 2 +- 3 files changed, 21 insertions(+), 3 deletions(-)
--
2.19.1
PATCH 1/3 qapi: Add "rendernode" display option for egl-headless
Unlike SPICE, egl-headless doesn't offer a way of specifying the DRM node used for OpenGL, hence QEMU always selecting the first one that is available. Thus, add rendernode option to QAPI.
--- qapi/ui.json | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
qapi/ui.json +15 -1
@@ -1037,6 +1037,19 @@ 'data' : { '*grab-on-hover' : 'bool', '*zoom-to-fit' : 'bool' } } +## +# @DisplayEGLHeadless: +# +# EGL headless display options. +# +# @rendernode: Which DRM render node should be used. +# +# Since: 3.2 +# +## +{ 'struct' : 'DisplayEGLHeadless', + 'data' : { '*rendernode' : 'str' } } + ## # @DisplayGLMode: #
@@ -1086,4 +1099,5 @@ '*window-close' : 'bool', '*gl' : 'DisplayGLMode' }, 'discriminator' : 'type', - 'data' : { 'gtk' : 'DisplayGTK' } } + 'data' : { 'gtk' : 'DisplayGTK', + 'egl-headless' : 'DisplayEGLHeadless'} }
Signature · 1 line
2.19.1
Re: [Qemu-devel] [PATCH 1/3] qapi: Add "rendernode" display option for egl-headless
Quoted 15 lines · Erik Skultety
Unlike SPICE, egl-headless doesn't offer a way of specifying the DRM node used for OpenGL, hence QEMU always selecting the first one that is available. Thus, add rendernode option to QAPI.
Signed-off-by Erik Skultety <[email protected]>--- qapi/ui.json | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)qapi/ui.json +0
-0@@ -1037,6 +1037,19 @@ 'data' : { '*grab-on-hover' : 'bool',
qapi/ui.json line 1047
Quoted 10 lines
qapi/ui.json +8
-0'*zoom-to-fit' : 'bool' } } +## +# @DisplayEGLHeadless: +# +# EGL headless display options. +# +# @rendernode: Which DRM render node should be used. +# +# Since: 3.2
Either 3.1 or 4.0, depending on whether this is okay this late after soft freeze. Worth mentioning that rendernode defaults to the first available node?
Quoted 16 lines
qapi/ui.json +7
-1+# +## +{ 'struct' : 'DisplayEGLHeadless', + 'data' : { '*rendernode' : 'str' } } + ## # @DisplayGLMode: #@@ -1086,4 +1099,5 @@ '*window-close' : 'bool', '*gl' : 'DisplayGLMode' }, 'discriminator' : 'type', - 'data' : { 'gtk' : 'DisplayGTK' } } + 'data' : { 'gtk' : 'DisplayGTK', + 'egl-headless' : 'DisplayEGLHeadless'} }
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
PATCH 2/3 ui: Allow specifying 'rendernode' display option for egl-headless
In reply to Erik SkultetyAs libvirt can't predict which rendernode QEMU would pick, it won't adjust the permissions on the device, hence QEMU getting "Permission denied" when opening the DRI device. Therefore, enable 'rendernode' option for egl-headless display type.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1648236
--- ui/egl-headless.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
ui/egl-headless.c +1 -1
@@ -176,7 +176,7 @@ static void egl_headless_init(DisplayState *ds, DisplayOptions *opts)egl_dpy *edpy;int idx; -if (egl_rendernode_init (NULL , mode) <0 ) { +if (egl_rendernode_init (opts->u.egl_headless.rendernode, mode) <0 ) {error_report ("egl: render node init failed" );exit (1 ); }
Signature · 1 line
2.19.1
PATCH 3/3 help: Provide help for egl-headless
In reply to Erik SkultetyEGL headless has been missing from QEMU's help or man page, we should mention that such a thing exists, especially since projects like libvirt might rely on that. This patch also adds the newly introduced option for egl-headless 'rendernode'.
--- qemu-options.hx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
qemu-options.hx +5 -1
@@ -1216,7 +1216,8 @@ DEF("display", HAS_ARG, QEMU_OPTION_display, "-display gtk[,grab_on_hover=on|off][,gl=on|off]|\n" "-display vnc=<display>[,<optargs>]\n" "-display curses\n" - "-display none" + "-display none\n" + "-display egl-headless[,rendernode=<file>]" " select display type\n" "The default display is equivalent to\n" #if defined(CONFIG_GTK)
@@ -1258,6 +1259,9 @@ menus and other UI elements to configure and control the VM during runtime. @item vnc Start a VNC server on display <arg> +@item egl-headless +Offload all OpenGL operations to a local DRI device. For any graphical display, +this display needs to be paired with either VNC or SPICE displays. @end table ETEXI
Signature · 1 line
2.19.1
Quoted 6 lines · Erik Skultety
Since QEMU always picks the default DRI device, libvirt doesn't know which one to put into the mount namespace and relabel it accordingly, hence hitting permission issues, unless admin tweaks the default permissions of the DRI devices.
This is borderline between fixing a bug that gets in the way of libvirt (and thus useful for 3.1) and a feature (thus for 4.0, since we won't have a 3.2 release). I'll let Gerd decide.
Quoted 16 lines
Erik Skultety (3):
qapi: Add "rendernode" display option for egl-headless
ui: Allow specifying 'rendernode' display option for egl-headless
help: Provide help for egl-headlessqapi/ui.json | 16 +++++++++++++++- qemu-options.hx | 6 +++++- ui/egl-headless.c | 2 +- 3 files changed, 21 insertions(+), 3 deletions(-)--
2.19.1
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
Quoted 11 lines · Eric Blake
Quoted 6 lines · Erik Skultety
Since QEMU always picks the default DRI device, libvirt doesn't know which one to put into the mount namespace and relabel it accordingly, hence hitting permission issues, unless admin tweaks the default permissions of the DRI devices.
This is borderline between fixing a bug that gets in the way of libvirt (and thus useful for 3.1) and a feature (thus for 4.0, since we won't have a 3.2 release). I'll let Gerd decide.
It's simple enough and we are early in the -rc cycle still, I think it would be okay for 3.1.
cheers,
Gerd
Quoted 7 lines · Gerd Hoffmann
Quoted 6 lines · Eric Blake
Quoted 5 lines · Erik Skultety
Since QEMU always picks the default DRI device, libvirt doesn't know which one to put into the mount namespace and relabel it accordingly, hence hitting permission issues, unless admin tweaks the default permissions of the DRI devices.
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
This is borderline between fixing a bug that gets in the way of libvirt (and thus useful for 3.1) and a feature (thus for 4.0, since we won't have a 3.2 release). I'll let Gerd decide.
It's simple enough and we are early in the -rc cycle still, I think it would be okay for 3.1.
As far as upstream's concerned, I'm okay with both because libvirt has to add another version specific capability enum for this anyway. It's been broken since libvirt 4.6.0 where I added egl-headless graphics type. Luckily, even though it's far from optimal, a working solution exists, just change the permissions on the device.
Thanks,
Erik
Quoted 9 lines · Erik Skultety
Quoted 2 lines · Gerd Hoffmann
It's simple enough and we are early in the -rc cycle still, I think it would be okay for 3.1.
As far as upstream's concerned, I'm okay with both because libvirt has to add another version specific capability enum for this anyway. It's been broken since libvirt 4.6.0 where I added egl-headless graphics type. Luckily, even though it's far from optimal, a working solution exists, just change the permissions on the device.
I'm fine either way too. So just pick a version, update the doc comments and repost.
thanks,
Gerd