Prefer eglGetPlatformDisplay to eglGetDisplay

This commit is contained in:
Adam Jackson 2016-10-11 14:46:47 -04:00
parent 168435add7
commit 5b5f0538b9
2 changed files with 82 additions and 1 deletions

View File

@ -0,0 +1,75 @@
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

View File

@ -9,7 +9,7 @@
Name: gnome-session
Version: 3.23.2
Release: 1%{?dist}
Release: 2%{?dist}
Summary: GNOME session manager
License: GPLv2+
@ -19,6 +19,8 @@ Source0: http://download.gnome.org/sources/gnome-session/3.22/%{name}-%{version}
# Blacklist NV30: https://bugzilla.redhat.com/show_bug.cgi?id=745202
Patch1: gnome-session-3.3.92-nv30.patch
Patch3: gnome-session-3.6.2-swrast.patch
# https://bugzilla.gnome.org/show_bug.cgi?id=772421
Patch4: 0001-check-accelerated-gles-Use-eglGetPlatformDisplay-EXT.patch
BuildRequires: pkgconfig(egl)
BuildRequires: pkgconfig(gl)
@ -82,6 +84,7 @@ Desktop file to add GNOME on wayland to display manager session menu.
%setup -q
%patch1 -p1 -b .nv30
%patch3 -p1 -b .swrast
%patch4 -p1 -b .platform
%build
%configure --enable-docbook-docs \
@ -135,6 +138,9 @@ glib-compile-schemas %{_datadir}/glib-2.0/schemas &>/dev/null || :
%{_datadir}/glib-2.0/schemas/org.gnome.SessionManager.gschema.xml
%changelog
* Tue Oct 11 2016 Adam Jackson <ajax@redhat.com> - 3.23.2-2
- Prefer eglGetPlatformDisplay to eglGetDisplay
* Tue Oct 11 2016 Bastien Nocera <bnocera@redhat.com> - 3.23.2-1
+ gnome-session-3.23.2-1
- Update to 3.23.2