|
|
525926 |
From 988e021960eb372be50038fdf0b2874f063c02b6 Mon Sep 17 00:00:00 2001
|
|
|
525926 |
From: Adam Jackson <ajax@redhat.com>
|
|
|
525926 |
Date: Tue, 11 Oct 2016 16:16:38 -0400
|
|
|
525926 |
Subject: [PATCH] egl: Use eglGetPlatformDisplay not eglGetDisplay
|
|
|
525926 |
|
|
|
525926 |
The latter requires the implementation to guess which kind of display it
|
|
|
525926 |
is. Different implementations do different thing, in particular glvnd
|
|
|
525926 |
does something different from Mesa, and it's better to be explicit about
|
|
|
525926 |
what we need.
|
|
|
525926 |
|
|
|
525926 |
Signed-off-by: Adam Jackson <ajax@redhat.com>
|
|
|
525926 |
---
|
|
|
525926 |
cogl/cogl-egl.h | 1 -
|
|
|
525926 |
cogl/winsys/cogl-winsys-egl-kms.c | 3 ++-
|
|
|
525926 |
cogl/winsys/cogl-winsys-egl-private.h | 33 +++++++++++++++++++++++++++++++++
|
|
|
525926 |
cogl/winsys/cogl-winsys-egl-wayland.c | 3 ++-
|
|
|
525926 |
cogl/winsys/cogl-winsys-egl-x11.c | 2 +-
|
|
|
525926 |
5 files changed, 38 insertions(+), 4 deletions(-)
|
|
|
525926 |
|
|
|
525926 |
diff --git a/cogl/cogl-egl.h b/cogl/cogl-egl.h
|
|
|
525926 |
index cea7b10..5dac55f 100644
|
|
|
525926 |
--- a/cogl/cogl-egl.h
|
|
|
525926 |
+++ b/cogl/cogl-egl.h
|
|
|
525926 |
@@ -98,7 +98,6 @@ cogl_egl_context_get_egl_display (CoglContext *context);
|
|
|
525926 |
EGLContext
|
|
|
525926 |
cogl_egl_context_get_egl_context (CoglContext *context);
|
|
|
525926 |
|
|
|
525926 |
-
|
|
|
525926 |
COGL_END_DECLS
|
|
|
525926 |
|
|
|
525926 |
/* The gobject introspection scanner seems to parse public headers in
|
|
|
525926 |
diff --git a/cogl/winsys/cogl-winsys-egl-kms.c b/cogl/winsys/cogl-winsys-egl-kms.c
|
|
|
525926 |
index 4da1f14..ae9f6fc 100644
|
|
|
525926 |
--- a/cogl/winsys/cogl-winsys-egl-kms.c
|
|
|
525926 |
+++ b/cogl/winsys/cogl-winsys-egl-kms.c
|
|
|
525926 |
@@ -342,7 +342,8 @@ _cogl_winsys_renderer_connect (CoglRenderer *renderer,
|
|
|
525926 |
goto fail;
|
|
|
525926 |
}
|
|
|
525926 |
|
|
|
525926 |
- egl_renderer->edpy = eglGetDisplay ((EGLNativeDisplayType)kms_renderer->gbm);
|
|
|
525926 |
+ egl_renderer->edpy = cogl_winsys_egl_get_display(EGL_PLATFORM_GBM_KHR,
|
|
|
525926 |
+ kms_renderer->gbm);
|
|
|
525926 |
if (egl_renderer->edpy == EGL_NO_DISPLAY)
|
|
|
525926 |
{
|
|
|
525926 |
_cogl_set_error (error, COGL_WINSYS_ERROR,
|
|
|
525926 |
diff --git a/cogl/winsys/cogl-winsys-egl-private.h b/cogl/winsys/cogl-winsys-egl-private.h
|
|
|
525926 |
index 5d21b4f..27ac25c 100644
|
|
|
525926 |
--- a/cogl/winsys/cogl-winsys-egl-private.h
|
|
|
525926 |
+++ b/cogl/winsys/cogl-winsys-egl-private.h
|
|
|
525926 |
@@ -200,4 +200,37 @@ CoglBool
|
|
|
525926 |
_cogl_winsys_egl_renderer_connect_common (CoglRenderer *renderer,
|
|
|
525926 |
CoglError **error);
|
|
|
525926 |
|
|
|
525926 |
+static inline EGLDisplay
|
|
|
525926 |
+cogl_winsys_egl_get_display (EGLint type, void *native)
|
|
|
525926 |
+{
|
|
|
525926 |
+ EGLDisplay dpy = NULL;
|
|
|
525926 |
+ const char *client_exts = eglQueryString (NULL, EGL_EXTENSIONS);
|
|
|
525926 |
+
|
|
|
525926 |
+ if (g_strstr_len (client_exts, -1, "EGL_KHR_platform_base"))
|
|
|
525926 |
+ {
|
|
|
525926 |
+ PFNEGLGETPLATFORMDISPLAYEXTPROC get_platform_display =
|
|
|
525926 |
+ (void *) eglGetProcAddress ("eglGetPlatformDisplay");
|
|
|
525926 |
+
|
|
|
525926 |
+ if (get_platform_display)
|
|
|
525926 |
+ dpy = get_platform_display (type, native, NULL);
|
|
|
525926 |
+
|
|
|
525926 |
+ if (dpy)
|
|
|
525926 |
+ return dpy;
|
|
|
525926 |
+ }
|
|
|
525926 |
+
|
|
|
525926 |
+ if (g_strstr_len (client_exts, -1, "EGL_EXT_platform_base"))
|
|
|
525926 |
+ {
|
|
|
525926 |
+ PFNEGLGETPLATFORMDISPLAYEXTPROC get_platform_display =
|
|
|
525926 |
+ (void *) eglGetProcAddress ("eglGetPlatformDisplayEXT");
|
|
|
525926 |
+
|
|
|
525926 |
+ if (get_platform_display)
|
|
|
525926 |
+ dpy = get_platform_display (type, native, NULL);
|
|
|
525926 |
+
|
|
|
525926 |
+ if (dpy)
|
|
|
525926 |
+ return dpy;
|
|
|
525926 |
+ }
|
|
|
525926 |
+
|
|
|
525926 |
+ return eglGetDisplay ((EGLNativeDisplayType) native);
|
|
|
525926 |
+}
|
|
|
525926 |
+
|
|
|
525926 |
#endif /* __COGL_WINSYS_EGL_PRIVATE_H */
|
|
|
525926 |
diff --git a/cogl/winsys/cogl-winsys-egl-wayland.c b/cogl/winsys/cogl-winsys-egl-wayland.c
|
|
|
525926 |
index 2e22052..463041b 100644
|
|
|
525926 |
--- a/cogl/winsys/cogl-winsys-egl-wayland.c
|
|
|
525926 |
+++ b/cogl/winsys/cogl-winsys-egl-wayland.c
|
|
|
525926 |
@@ -289,7 +289,8 @@ _cogl_winsys_renderer_connect (CoglRenderer *renderer,
|
|
|
525926 |
}
|
|
|
525926 |
|
|
|
525926 |
egl_renderer->edpy =
|
|
|
525926 |
- eglGetDisplay ((EGLNativeDisplayType) wayland_renderer->wayland_display);
|
|
|
525926 |
+ cogl_winsys_egl_get_display (EGL_PLATFORM_WAYLAND_KHR,
|
|
|
525926 |
+ wayland_renderer->wayland_display);
|
|
|
525926 |
|
|
|
525926 |
if (!_cogl_winsys_egl_renderer_connect_common (renderer, error))
|
|
|
525926 |
goto error;
|
|
|
525926 |
diff --git a/cogl/winsys/cogl-winsys-egl-x11.c b/cogl/winsys/cogl-winsys-egl-x11.c
|
|
|
525926 |
index 724a4d0..a7e9c2f 100644
|
|
|
525926 |
--- a/cogl/winsys/cogl-winsys-egl-x11.c
|
|
|
525926 |
+++ b/cogl/winsys/cogl-winsys-egl-x11.c
|
|
|
525926 |
@@ -278,7 +278,7 @@ _cogl_winsys_renderer_connect (CoglRenderer *renderer,
|
|
|
525926 |
goto error;
|
|
|
525926 |
|
|
|
525926 |
egl_renderer->edpy =
|
|
|
525926 |
- eglGetDisplay ((EGLNativeDisplayType) xlib_renderer->xdpy);
|
|
|
525926 |
+ cogl_winsys_egl_get_display (EGL_PLATFORM_X11_KHR, xlib_renderer->xdpy);
|
|
|
525926 |
|
|
|
525926 |
if (!_cogl_winsys_egl_renderer_connect_common (renderer, error))
|
|
|
525926 |
goto error;
|
|
|
525926 |
--
|
|
|
525926 |
2.9.3
|
|
|
525926 |
|