diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2017-02-20 16:31:38 +0000 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2017-02-20 16:31:38 +0000 |
commit | c8f21dbfc3dea943ca5edac2f00058477ecb5b6b (patch) | |
tree | bc1e072313852a03d487a20da639a93ba354211d | |
parent | 6753e4ed150ca1f94651aad06c031680a0be6cac (diff) | |
parent | 0ea1523fb6703aa0dcd65e66b59e96fec028e60a (diff) |
Merge remote-tracking branch 'remotes/kraxel/tags/pull-ui-20170220-1' into staging
ui: opengl fixes, for spice and egl-helpers.
# gpg: Signature made Mon 20 Feb 2017 13:12:46 GMT
# gpg: using RSA key 0x4CB6D8EED3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
# gpg: aka "Gerd Hoffmann <gerd@kraxel.org>"
# gpg: aka "Gerd Hoffmann (private) <kraxel@gmail.com>"
# Primary key fingerprint: A032 8CFF B93A 17A7 9901 FE7D 4CB6 D8EE D3E8 7138
* remotes/kraxel/tags/pull-ui-20170220-1:
egl-helpers: Support newer MESA versions
spice: allow to specify drm rendernode
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r-- | include/ui/egl-helpers.h | 3 | ||||
-rw-r--r-- | qemu-options.hx | 6 | ||||
-rw-r--r-- | ui/egl-helpers.c | 14 | ||||
-rw-r--r-- | ui/spice-core.c | 5 |
4 files changed, 21 insertions, 7 deletions
diff --git a/include/ui/egl-helpers.h b/include/ui/egl-helpers.h index 03fcf4bba2..88a13e827b 100644 --- a/include/ui/egl-helpers.h +++ b/include/ui/egl-helpers.h @@ -14,8 +14,7 @@ extern int qemu_egl_rn_fd; extern struct gbm_device *qemu_egl_rn_gbm_dev; extern EGLContext qemu_egl_rn_ctx; -int qemu_egl_rendernode_open(void); -int egl_rendernode_init(void); +int egl_rendernode_init(const char *rendernode); int egl_get_fd_for_texture(uint32_t tex_id, EGLint *stride, EGLint *fourcc); #endif diff --git a/qemu-options.hx b/qemu-options.hx index 5633d3914f..809b2b0d8c 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -1066,7 +1066,7 @@ DEF("spice", HAS_ARG, QEMU_OPTION_spice, " [,streaming-video=[off|all|filter]][,disable-copy-paste]\n" " [,disable-agent-file-xfer][,agent-mouse=[on|off]]\n" " [,playback-compression=[on|off]][,seamless-migration=[on|off]]\n" - " [,gl=[on|off]]\n" + " [,gl=[on|off]][,rendernode=<file>]\n" " enable spice\n" " at least one of {port, tls-port} is mandatory\n", QEMU_ARCH_ALL) @@ -1161,6 +1161,10 @@ Enable/disable spice seamless migration. Default is off. @item gl=[on|off] Enable/disable OpenGL context. Default is off. +@item rendernode=<file> +DRM render node for OpenGL rendering. If not specified, it will pick +the first available. (Since 2.9) + @end table ETEXI diff --git a/ui/egl-helpers.c b/ui/egl-helpers.c index cd24568a5e..584dd1b04d 100644 --- a/ui/egl-helpers.c +++ b/ui/egl-helpers.c @@ -44,13 +44,17 @@ int qemu_egl_rn_fd; struct gbm_device *qemu_egl_rn_gbm_dev; EGLContext qemu_egl_rn_ctx; -int qemu_egl_rendernode_open(void) +static int qemu_egl_rendernode_open(const char *rendernode) { DIR *dir; struct dirent *e; int r, fd; char *p; + if (rendernode) { + return open(rendernode, O_RDWR | O_CLOEXEC | O_NOCTTY | O_NONBLOCK); + } + dir = opendir("/dev/dri"); if (!dir) { return -1; @@ -85,11 +89,11 @@ int qemu_egl_rendernode_open(void) return fd; } -int egl_rendernode_init(void) +int egl_rendernode_init(const char *rendernode) { qemu_egl_rn_fd = -1; - qemu_egl_rn_fd = qemu_egl_rendernode_open(); + qemu_egl_rn_fd = qemu_egl_rendernode_open(rendernode); if (qemu_egl_rn_fd == -1) { error_report("egl: no drm render node available"); goto err; @@ -219,7 +223,11 @@ int qemu_egl_init_dpy(EGLNativeDisplayType dpy, bool gles, bool debug) } egl_dbg("eglGetDisplay (dpy %p) ...\n", dpy); +#ifdef EGL_MESA_platform_gbm + qemu_egl_display = eglGetPlatformDisplayEXT(EGL_PLATFORM_GBM_MESA, dpy, NULL); +#else qemu_egl_display = eglGetDisplay(dpy); +#endif if (qemu_egl_display == EGL_NO_DISPLAY) { error_report("egl: eglGetDisplay failed"); return -1; diff --git a/ui/spice-core.c b/ui/spice-core.c index 1452e77fd1..39ccab7561 100644 --- a/ui/spice-core.c +++ b/ui/spice-core.c @@ -501,6 +501,9 @@ static QemuOptsList qemu_spice_opts = { },{ .name = "gl", .type = QEMU_OPT_BOOL, + },{ + .name = "rendernode", + .type = QEMU_OPT_STRING, #endif }, { /* end of list */ } @@ -833,7 +836,7 @@ void qemu_spice_init(void) "incompatible with -spice port/tls-port"); exit(1); } - if (egl_rendernode_init() != 0) { + if (egl_rendernode_init(qemu_opt_get(opts, "rendernode")) != 0) { error_report("Failed to initialize EGL render node for SPICE GL"); exit(1); } |