From d4dc4ab133b5d7b066aa14036f297ed20398dd32 Mon Sep 17 00:00:00 2001 From: Erik Skultety Date: Fri, 16 Nov 2018 11:14:42 +0100 Subject: [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 the 'rendernode' option for egl-headless to QAPI. Signed-off-by: Erik Skultety Message-id: 7658e15eca72d520e7a5fb1c2e724702d83d4f7f.1542362949.git.eskultet@redhat.com Signed-off-by: Gerd Hoffmann --- qapi/ui.json | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/qapi/ui.json b/qapi/ui.json index bf9e157d5a..e0000248d3 100644 --- a/qapi/ui.json +++ b/qapi/ui.json @@ -1037,6 +1037,20 @@ 'data' : { '*grab-on-hover' : 'bool', '*zoom-to-fit' : 'bool' } } +## +# @DisplayEGLHeadless: +# +# EGL headless display options. +# +# @rendernode: Which DRM render node should be used. Default is the first +# available node on the host. +# +# Since: 3.1 +# +## +{ 'struct' : 'DisplayEGLHeadless', + 'data' : { '*rendernode' : 'str' } } + ## # @DisplayGLMode: # @@ -1086,4 +1100,5 @@ '*window-close' : 'bool', '*gl' : 'DisplayGLMode' }, 'discriminator' : 'type', - 'data' : { 'gtk' : 'DisplayGTK' } } + 'data' : { 'gtk' : 'DisplayGTK', + 'egl-headless' : 'DisplayEGLHeadless'} } From 91e61947eb2be21b00091d34f5692f89cef41376 Mon Sep 17 00:00:00 2001 From: Erik Skultety Date: Fri, 16 Nov 2018 11:14:43 +0100 Subject: [PATCH 2/3] ui: Allow specifying 'rendernode' display option for egl-headless As 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 Signed-off-by: Erik Skultety Message-id: 27f4617f19aa1072114f10f1aa9dd199735ef982.1542362949.git.eskultet@redhat.com Signed-off-by: Gerd Hoffmann --- ui/egl-headless.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/egl-headless.c b/ui/egl-headless.c index 42a41310b0..4cf3bbc0e4 100644 --- a/ui/egl-headless.c +++ b/ui/egl-headless.c @@ -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); } From 144aaa990e0d54d08865c4d98ba2138a89689530 Mon Sep 17 00:00:00 2001 From: Erik Skultety Date: Fri, 16 Nov 2018 11:14:44 +0100 Subject: [PATCH 3/3] help: Provide help for egl-headless EGL 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'. Signed-off-by: Erik Skultety Message-id: 87ef678b0934d3abba66c46c9e65b57119d29295.1542362949.git.eskultet@redhat.com Signed-off-by: Gerd Hoffmann --- qemu-options.hx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/qemu-options.hx b/qemu-options.hx index ee379b32e3..f7df472f43 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -1216,7 +1216,8 @@ DEF("display", HAS_ARG, QEMU_OPTION_display, "-display gtk[,grab_on_hover=on|off][,gl=on|off]|\n" "-display vnc=[,]\n" "-display curses\n" - "-display none" + "-display none\n" + "-display egl-headless[,rendernode=]" " 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 +@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