[mutter] Use eglGetPlatformDisplay
- From: Rui Matos <rtcm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] Use eglGetPlatformDisplay
- Date: Tue, 7 Feb 2017 13:43:20 +0000 (UTC)
commit 1f0659d5169d19298e045fb98eeb28928869371d
Author: Adam Jackson <ajax redhat com>
Date: Tue Oct 4 13:20:27 2016 -0400
Use eglGetPlatformDisplay
Different libEGL will do different things for eglGetDisplay since it has
to guess what kind of display it's been handed. Better to just use the
API that makes it explicit.
Signed-off-by: Adam Jackson <ajax redhat com>
https://bugzilla.gnome.org/show_bug.cgi?id=772422
cogl/cogl/winsys/cogl-winsys-egl-x11.c | 36 ++++++++++++++++++++++++++++++-
1 files changed, 34 insertions(+), 2 deletions(-)
---
diff --git a/cogl/cogl/winsys/cogl-winsys-egl-x11.c b/cogl/cogl/winsys/cogl-winsys-egl-x11.c
index c660f34..d72ba02 100644
--- a/cogl/cogl/winsys/cogl-winsys-egl-x11.c
+++ b/cogl/cogl/winsys/cogl-winsys-egl-x11.c
@@ -262,6 +262,39 @@ _cogl_winsys_renderer_disconnect (CoglRenderer *renderer)
g_slice_free (CoglRendererEGL, egl_renderer);
}
+static EGLDisplay
+_cogl_winsys_egl_get_display (void *native)
+{
+ EGLDisplay dpy = NULL;
+ const char *client_exts = eglQueryString (NULL, EGL_EXTENSIONS);
+
+ if (g_strstr_len (client_exts, -1, "EGL_KHR_platform_base"))
+ {
+ PFNEGLGETPLATFORMDISPLAYEXTPROC get_platform_display =
+ (void *) eglGetProcAddress ("eglGetPlatformDisplay");
+
+ if (get_platform_display)
+ dpy = get_platform_display (EGL_PLATFORM_X11_KHR, native, NULL);
+
+ if (dpy)
+ return dpy;
+ }
+
+ if (g_strstr_len (client_exts, -1, "EGL_EXT_platform_base"))
+ {
+ PFNEGLGETPLATFORMDISPLAYEXTPROC get_platform_display =
+ (void *) eglGetProcAddress ("eglGetPlatformDisplayEXT");
+
+ if (get_platform_display)
+ dpy = get_platform_display (EGL_PLATFORM_X11_KHR, native, NULL);
+
+ if (dpy)
+ return dpy;
+ }
+
+ return eglGetDisplay ((EGLNativeDisplayType) native);
+}
+
static CoglBool
_cogl_winsys_renderer_connect (CoglRenderer *renderer,
CoglError **error)
@@ -278,8 +311,7 @@ _cogl_winsys_renderer_connect (CoglRenderer *renderer,
if (!_cogl_xlib_renderer_connect (renderer, error))
goto error;
- egl_renderer->edpy =
- eglGetDisplay ((EGLNativeDisplayType) xlib_renderer->xdpy);
+ egl_renderer->edpy = _cogl_winsys_egl_get_display (xlib_renderer->xdpy);
if (!_cogl_winsys_egl_renderer_connect_common (renderer, error))
goto error;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]