gnome-session/0001-check-accelerated-gles-Use-eglGetPlatformDisplay-EXT.patch

76 lines
2.2 KiB
Diff
Raw Normal View History

From 687ec347d2fa0bca227e3a583a3a47f9bbc10bb0 Mon Sep 17 00:00:00 2001
From: Adam Jackson <ajax@redhat.com>
Date: Tue, 4 Oct 2016 13:15:39 -0400
Subject: [PATCH] check-accelerated-gles: Use eglGetPlatformDisplay{,EXT}
eglGetDisplay forces the implementation to guess, and in general it
can't guess correctly. Be explicit.
Signed-off-by: Adam Jackson <ajax@redhat.com>
---
.../gnome-session-check-accelerated-gles-helper.c | 36 +++++++++++++++++++++-
1 file changed, 35 insertions(+), 1 deletion(-)
diff --git a/tools/gnome-session-check-accelerated-gles-helper.c b/tools/gnome-session-check-accelerated-gles-helper.c
index 2a38d9e..472d1ad 100644
--- a/tools/gnome-session-check-accelerated-gles-helper.c
+++ b/tools/gnome-session-check-accelerated-gles-helper.c
@@ -34,11 +34,43 @@
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#include <EGL/egl.h>
+#include <EGL/eglext.h>
#endif
#include "gnome-session-check-accelerated-common.h"
#ifdef GDK_WINDOWING_X11
+static EGLDisplay
+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 char *
get_gles_renderer (void)
{
@@ -67,7 +99,9 @@ get_gles_renderer (void)
gdk_error_trap_push ();
display = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
- egl_dpy = eglGetDisplay (display);
+
+ egl_dpy = get_display (display);
+
if (!egl_dpy) {
g_warning ("eglGetDisplay() failed");
goto out;
--
2.9.3