Prefer eglGetPlatformDisplay to eglGetDisplay
This commit is contained in:
parent
ee1bc92e1f
commit
a93c5b0559
52
0001-Fix-some-EGLDisplay-abuse.patch
Normal file
52
0001-Fix-some-EGLDisplay-abuse.patch
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
From dc0e3f9d949723856dde43b7ee3a8aa87b320c88 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Adam Jackson <ajax@redhat.com>
|
||||||
|
Date: Mon, 10 Oct 2016 14:10:38 -0400
|
||||||
|
Subject: [PATCH 1/2] Fix some EGLDisplay * abuse
|
||||||
|
|
||||||
|
EGLDisplays are already opaque pointers, and eglGetDisplay returns an
|
||||||
|
EGLDisplay not a pointer to one.
|
||||||
|
|
||||||
|
Signed-off-by: Adam Jackson <ajax@redhat.com>
|
||||||
|
---
|
||||||
|
gdk/wayland/gdkglcontext-wayland.c | 2 +-
|
||||||
|
gtk/inspector/general.c | 4 ++--
|
||||||
|
2 files changed, 3 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/gdk/wayland/gdkglcontext-wayland.c b/gdk/wayland/gdkglcontext-wayland.c
|
||||||
|
index 7733188..ae1354e 100644
|
||||||
|
--- a/gdk/wayland/gdkglcontext-wayland.c
|
||||||
|
+++ b/gdk/wayland/gdkglcontext-wayland.c
|
||||||
|
@@ -279,7 +279,7 @@ gdk_wayland_display_init_gl (GdkDisplay *display)
|
||||||
|
{
|
||||||
|
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (display);
|
||||||
|
EGLint major, minor;
|
||||||
|
- EGLDisplay *dpy;
|
||||||
|
+ EGLDisplay dpy;
|
||||||
|
|
||||||
|
if (display_wayland->have_egl)
|
||||||
|
return TRUE;
|
||||||
|
diff --git a/gtk/inspector/general.c b/gtk/inspector/general.c
|
||||||
|
index 31dd6aa..77d0a76 100644
|
||||||
|
--- a/gtk/inspector/general.c
|
||||||
|
+++ b/gtk/inspector/general.c
|
||||||
|
@@ -209,7 +209,7 @@ append_glx_extension_row (GtkInspectorGeneral *gen,
|
||||||
|
#ifdef GDK_WINDOWING_WAYLAND
|
||||||
|
static void
|
||||||
|
append_egl_extension_row (GtkInspectorGeneral *gen,
|
||||||
|
- EGLDisplay *dpy,
|
||||||
|
+ EGLDisplay dpy,
|
||||||
|
const gchar *ext)
|
||||||
|
{
|
||||||
|
add_check_row (gen, GTK_LIST_BOX (gen->priv->gl_box), ext, epoxy_has_egl_extension (dpy, ext), 0);
|
||||||
|
@@ -250,7 +250,7 @@ init_gl (GtkInspectorGeneral *gen)
|
||||||
|
if (GDK_IS_WAYLAND_DISPLAY (gdk_display_get_default ()))
|
||||||
|
{
|
||||||
|
GdkDisplay *display = gdk_display_get_default ();
|
||||||
|
- EGLDisplay *dpy;
|
||||||
|
+ EGLDisplay dpy;
|
||||||
|
EGLint major, minor;
|
||||||
|
gchar *version;
|
||||||
|
|
||||||
|
--
|
||||||
|
2.9.3
|
||||||
|
|
130
0002-Use-eglGetPlatformDisplay-EXT-if-available.patch
Normal file
130
0002-Use-eglGetPlatformDisplay-EXT-if-available.patch
Normal file
@ -0,0 +1,130 @@
|
|||||||
|
From 1a9c35461dc93979dbc45a201a6670eb049bb285 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Adam Jackson <ajax@redhat.com>
|
||||||
|
Date: Mon, 10 Oct 2016 14:12:40 -0400
|
||||||
|
Subject: [PATCH 2/2] Use eglGetPlatformDisplay{,EXT} if available
|
||||||
|
|
||||||
|
Calling eglGetDisplay forces libEGL to guess what kind of pointer you
|
||||||
|
passed it. Different EGL libraries will do different things here, and in
|
||||||
|
particular glvnd will do something different than Mesa. Since we do have
|
||||||
|
an API that allows us to explicitly type the display, use it.
|
||||||
|
|
||||||
|
The explicit call to eglGetProcAddress is working around a bug in
|
||||||
|
libepoxy 1.3, which does not understand the EGL concept of client
|
||||||
|
extensions. Since it does not, the normal epoxy resolver for
|
||||||
|
eglGetPlatformDisplayEXT would not find any provider for that entry
|
||||||
|
point, and crash when you attempted to call it.
|
||||||
|
|
||||||
|
Signed-off-by: Adam Jackson <ajax@redhat.com>
|
||||||
|
---
|
||||||
|
gdk/wayland/gdkglcontext-wayland.c | 37 ++++++++++++++++++++++++++++++++++++-
|
||||||
|
gtk/inspector/general.c | 32 +++++++++++++++++++++++++++++++-
|
||||||
|
2 files changed, 67 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/gdk/wayland/gdkglcontext-wayland.c b/gdk/wayland/gdkglcontext-wayland.c
|
||||||
|
index ae1354e..6573688 100644
|
||||||
|
--- a/gdk/wayland/gdkglcontext-wayland.c
|
||||||
|
+++ b/gdk/wayland/gdkglcontext-wayland.c
|
||||||
|
@@ -274,6 +274,40 @@ gdk_wayland_gl_context_init (GdkWaylandGLContext *self)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
+static EGLDisplay
|
||||||
|
+gdk_wayland_get_display (GdkWaylandDisplay *display_wayland)
|
||||||
|
+{
|
||||||
|
+ EGLDisplay dpy = NULL;
|
||||||
|
+
|
||||||
|
+ if (epoxy_has_egl_extension (NULL, "EGL_KHR_platform_base"))
|
||||||
|
+ {
|
||||||
|
+ PFNEGLGETPLATFORMDISPLAYPROC getPlatformDisplay =
|
||||||
|
+ (void *) eglGetProcAddress ("eglGetPlatformDisplay");
|
||||||
|
+
|
||||||
|
+ if (getPlatformDisplay)
|
||||||
|
+ dpy = getPlatformDisplay (EGL_PLATFORM_WAYLAND_EXT,
|
||||||
|
+ display_wayland->wl_display,
|
||||||
|
+ NULL);
|
||||||
|
+ if (dpy)
|
||||||
|
+ return dpy;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (epoxy_has_egl_extension (NULL, "EGL_EXT_platform_base"))
|
||||||
|
+ {
|
||||||
|
+ PFNEGLGETPLATFORMDISPLAYEXTPROC getPlatformDisplay =
|
||||||
|
+ (void *) eglGetProcAddress ("eglGetPlatformDisplayEXT");
|
||||||
|
+
|
||||||
|
+ if (getPlatformDisplay)
|
||||||
|
+ dpy = getPlatformDisplay (EGL_PLATFORM_WAYLAND_EXT,
|
||||||
|
+ display_wayland->wl_display,
|
||||||
|
+ NULL);
|
||||||
|
+ if (dpy)
|
||||||
|
+ return dpy;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return eglGetDisplay ((EGLNativeDisplayType) display_wayland->wl_display);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
gboolean
|
||||||
|
gdk_wayland_display_init_gl (GdkDisplay *display)
|
||||||
|
{
|
||||||
|
@@ -284,7 +318,8 @@ gdk_wayland_display_init_gl (GdkDisplay *display)
|
||||||
|
if (display_wayland->have_egl)
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
- dpy = eglGetDisplay ((EGLNativeDisplayType)display_wayland->wl_display);
|
||||||
|
+ dpy = gdk_wayland_get_display (display_wayland);
|
||||||
|
+
|
||||||
|
if (dpy == NULL)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
diff --git a/gtk/inspector/general.c b/gtk/inspector/general.c
|
||||||
|
index 77d0a76..f32f7fe 100644
|
||||||
|
--- a/gtk/inspector/general.c
|
||||||
|
+++ b/gtk/inspector/general.c
|
||||||
|
@@ -214,6 +214,36 @@ append_egl_extension_row (GtkInspectorGeneral *gen,
|
||||||
|
{
|
||||||
|
add_check_row (gen, GTK_LIST_BOX (gen->priv->gl_box), ext, epoxy_has_egl_extension (dpy, ext), 0);
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+static EGLDisplay
|
||||||
|
+wayland_get_display (struct wl_display *wl_dpy)
|
||||||
|
+{
|
||||||
|
+ EGLDisplay dpy = NULL;
|
||||||
|
+
|
||||||
|
+ if (epoxy_has_egl_extension (NULL, "EGL_KHR_platform_base"))
|
||||||
|
+ {
|
||||||
|
+ PFNEGLGETPLATFORMDISPLAYPROC getPlatformDisplay =
|
||||||
|
+ (void *) eglGetProcAddress ("eglGetPlatformDisplay");
|
||||||
|
+
|
||||||
|
+ if (getPlatformDisplay)
|
||||||
|
+ dpy = getPlatformDisplay (EGL_PLATFORM_WAYLAND_EXT, wl_dpy, NULL);
|
||||||
|
+ if (dpy)
|
||||||
|
+ return dpy;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (epoxy_has_egl_extension (NULL, "EGL_EXT_platform_base"))
|
||||||
|
+ {
|
||||||
|
+ PFNEGLGETPLATFORMDISPLAYEXTPROC getPlatformDisplay =
|
||||||
|
+ (void *) eglGetProcAddress ("eglGetPlatformDisplayEXT");
|
||||||
|
+
|
||||||
|
+ if (getPlatformDisplay)
|
||||||
|
+ dpy = getPlatformDisplay (EGL_PLATFORM_WAYLAND_EXT, wl_dpy, NULL);
|
||||||
|
+ if (dpy)
|
||||||
|
+ return dpy;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return eglGetDisplay ((EGLNativeDisplayType) wl_dpy);
|
||||||
|
+}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@@ -254,7 +284,7 @@ init_gl (GtkInspectorGeneral *gen)
|
||||||
|
EGLint major, minor;
|
||||||
|
gchar *version;
|
||||||
|
|
||||||
|
- dpy = eglGetDisplay ((EGLNativeDisplayType)gdk_wayland_display_get_wl_display (display));
|
||||||
|
+ dpy = wayland_get_display (gdk_wayland_display_get_wl_display (display));
|
||||||
|
|
||||||
|
if (!eglInitialize (dpy, &major, &minor))
|
||||||
|
return;
|
||||||
|
--
|
||||||
|
2.9.3
|
||||||
|
|
11
gtk3.spec
11
gtk3.spec
@ -18,13 +18,17 @@
|
|||||||
|
|
||||||
Name: gtk3
|
Name: gtk3
|
||||||
Version: 3.22.1
|
Version: 3.22.1
|
||||||
Release: 1%{?dist}
|
Release: 2%{?dist}
|
||||||
Summary: The GIMP ToolKit (GTK+), a library for creating GUIs for X
|
Summary: The GIMP ToolKit (GTK+), a library for creating GUIs for X
|
||||||
|
|
||||||
License: LGPLv2+
|
License: LGPLv2+
|
||||||
URL: http://www.gtk.org
|
URL: http://www.gtk.org
|
||||||
Source0: http://download.gnome.org/sources/gtk+/3.22/gtk+-%{version}.tar.xz
|
Source0: http://download.gnome.org/sources/gtk+/3.22/gtk+-%{version}.tar.xz
|
||||||
|
|
||||||
|
# backport, will be in 3.22.2
|
||||||
|
Patch1: 0001-Fix-some-EGLDisplay-abuse.patch
|
||||||
|
Patch2: 0002-Use-eglGetPlatformDisplay-EXT-if-available.patch
|
||||||
|
|
||||||
BuildRequires: pkgconfig(atk) >= %{atk_version}
|
BuildRequires: pkgconfig(atk) >= %{atk_version}
|
||||||
BuildRequires: pkgconfig(atk-bridge-2.0)
|
BuildRequires: pkgconfig(atk-bridge-2.0)
|
||||||
BuildRequires: pkgconfig(glib-2.0) >= %{glib2_version}
|
BuildRequires: pkgconfig(glib-2.0) >= %{glib2_version}
|
||||||
@ -157,6 +161,8 @@ the functionality of the installed %{name} package.
|
|||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q -n gtk+-%{version}
|
%setup -q -n gtk+-%{version}
|
||||||
|
%patch1 -p1
|
||||||
|
%patch2 -p1
|
||||||
|
|
||||||
%build
|
%build
|
||||||
|
|
||||||
@ -330,6 +336,9 @@ gtk-query-immodules-3.0-%{__isa_bits} --update-cache
|
|||||||
%{_datadir}/installed-tests
|
%{_datadir}/installed-tests
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Oct 11 2016 Adam Jackson <ajax@redhat.com> - 3.22.1-2
|
||||||
|
- Prefer eglGetPlatformDisplay to eglGetDisplay
|
||||||
|
|
||||||
* Sat Oct 01 2016 David King <amigadave@amigadave.com> - 3.22.1-1
|
* Sat Oct 01 2016 David King <amigadave@amigadave.com> - 3.22.1-1
|
||||||
- Update to 3.22.1
|
- Update to 3.22.1
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user