Backport some useful bits from master
This commit is contained in:
parent
a4cf6e99f7
commit
cc29d8f03c
94
0001-dispatch-Learn-about-glvnd.patch
Normal file
94
0001-dispatch-Learn-about-glvnd.patch
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
From 58ca477e14c05435f32e4393ff31e8281e8e8c9d Mon Sep 17 00:00:00 2001
|
||||||
|
From: Adam Jackson <ajax@redhat.com>
|
||||||
|
Date: Fri, 16 Jun 2017 14:37:06 -0400
|
||||||
|
Subject: [PATCH 1/5] dispatch: Learn about glvnd
|
||||||
|
|
||||||
|
glvnd has the rather nice property that GLX and (desktop) GL are
|
||||||
|
available in separate libraries. As an example this would allow an EGL
|
||||||
|
app to use desktop GL without any X11 libraries. Fix up our dlopens to
|
||||||
|
prefer the glvnd libraries if available and fall back to the old ABI if
|
||||||
|
not.
|
||||||
|
|
||||||
|
Signed-off-by: Adam Jackson <ajax@redhat.com>
|
||||||
|
(cherry picked from commit 759de647298aca23b5d77f7f11e530dc99c08ca9)
|
||||||
|
---
|
||||||
|
src/dispatch_common.c | 31 ++++++++++++++++++++++++++-----
|
||||||
|
1 file changed, 26 insertions(+), 5 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/dispatch_common.c b/src/dispatch_common.c
|
||||||
|
index a38c0fc..bbbf913 100644
|
||||||
|
--- a/src/dispatch_common.c
|
||||||
|
+++ b/src/dispatch_common.c
|
||||||
|
@@ -178,6 +178,7 @@
|
||||||
|
#elif defined(ANDROID)
|
||||||
|
#define GLX_LIB "libGLESv2.so"
|
||||||
|
#else
|
||||||
|
+#define GLVND_GLX_LIB "libGLX.so.1"
|
||||||
|
#define GLX_LIB "libGL.so.1"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
@@ -193,6 +194,7 @@
|
||||||
|
#define EGL_LIB "libEGL.so.1"
|
||||||
|
#define GLES1_LIB "libGLESv1_CM.so.1"
|
||||||
|
#define GLES2_LIB "libGLESv2.so.2"
|
||||||
|
+#define OPENGL_LIB "libOpenGL.so.1"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __GNUC__
|
||||||
|
@@ -223,13 +225,18 @@ struct api {
|
||||||
|
pthread_mutex_t mutex;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
- /* dlopen() return value for libGL.so.1. */
|
||||||
|
+ /*
|
||||||
|
+ * dlopen() return value for the GLX API. This is libGLX.so.1 if the
|
||||||
|
+ * runtime is glvnd-enabled, else libGL.so.1
|
||||||
|
+ */
|
||||||
|
void *glx_handle;
|
||||||
|
|
||||||
|
/*
|
||||||
|
- * dlopen() return value for OS X's GL library.
|
||||||
|
+ * dlopen() return value for the desktop GL library.
|
||||||
|
*
|
||||||
|
- * On linux, glx_handle is used instead.
|
||||||
|
+ * On Windows this is OPENGL32. On OSX this is classic libGL. On Linux
|
||||||
|
+ * this is either libOpenGL (if the runtime is glvnd-enabled) or
|
||||||
|
+ * classic libGL.so.1
|
||||||
|
*/
|
||||||
|
void *gl_handle;
|
||||||
|
|
||||||
|
@@ -590,6 +597,10 @@ epoxy_egl_dlsym(const char *name)
|
||||||
|
void *
|
||||||
|
epoxy_conservative_glx_dlsym(const char *name, bool exit_if_fails)
|
||||||
|
{
|
||||||
|
+ /* prefer the glvnd library if it exists */
|
||||||
|
+ if (!api.glx_handle)
|
||||||
|
+ get_dlopen_handle(&api.glx_handle, GLVND_GLX_LIB, false);
|
||||||
|
+
|
||||||
|
return do_dlsym(&api.glx_handle, GLX_LIB, name, exit_if_fails);
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -609,8 +620,18 @@ epoxy_gl_dlsym(const char *name)
|
||||||
|
"/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL",
|
||||||
|
name, true);
|
||||||
|
#else
|
||||||
|
- /* There's no library for desktop GL support independent of GLX. */
|
||||||
|
- return epoxy_glx_dlsym(name);
|
||||||
|
+ void *sym;
|
||||||
|
+
|
||||||
|
+ if (!api.gl_handle)
|
||||||
|
+ get_dlopen_handle(&api.gl_handle, OPENGL_LIB, false);
|
||||||
|
+
|
||||||
|
+ if (api.gl_handle)
|
||||||
|
+ return do_dlsym(&api.gl_handle, NULL, name, true);
|
||||||
|
+
|
||||||
|
+ sym = do_dlsym(&api.glx_handle, GLX_LIB, name, true);
|
||||||
|
+ api.gl_handle = api.glx_handle; /* skip the dlopen next time */
|
||||||
|
+
|
||||||
|
+ return sym;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
--
|
||||||
|
2.13.5
|
||||||
|
|
@ -0,0 +1,34 @@
|
|||||||
|
From 82d3b474a47994b5f939b81469dfcec933e5c364 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Adam Jackson <ajax@redhat.com>
|
||||||
|
Date: Wed, 12 Jul 2017 13:59:44 -0400
|
||||||
|
Subject: [PATCH 2/5] dispatch: Don't reference glvnd #defines on non-glvnd
|
||||||
|
systems
|
||||||
|
|
||||||
|
Broke the build on OSX, oops.
|
||||||
|
|
||||||
|
Resolves: https://github.com/anholt/libepoxy/issues/132
|
||||||
|
Signed-off-by: Adam Jackson <ajax@redhat.com>
|
||||||
|
(cherry picked from commit 91c9ecebd963c7af1f0ef3d1333ca0a723bdd6d4)
|
||||||
|
---
|
||||||
|
src/dispatch_common.c | 2 ++
|
||||||
|
1 file changed, 2 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/src/dispatch_common.c b/src/dispatch_common.c
|
||||||
|
index bbbf913..a7c2f74 100644
|
||||||
|
--- a/src/dispatch_common.c
|
||||||
|
+++ b/src/dispatch_common.c
|
||||||
|
@@ -597,9 +597,11 @@ epoxy_egl_dlsym(const char *name)
|
||||||
|
void *
|
||||||
|
epoxy_conservative_glx_dlsym(const char *name, bool exit_if_fails)
|
||||||
|
{
|
||||||
|
+#ifdef GLVND_GLX_LIB
|
||||||
|
/* prefer the glvnd library if it exists */
|
||||||
|
if (!api.glx_handle)
|
||||||
|
get_dlopen_handle(&api.glx_handle, GLVND_GLX_LIB, false);
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
return do_dlsym(&api.glx_handle, GLX_LIB, name, exit_if_fails);
|
||||||
|
}
|
||||||
|
--
|
||||||
|
2.13.5
|
||||||
|
|
@ -0,0 +1,68 @@
|
|||||||
|
From e571f25187ef53ce41aa46bec6d7d2903ee51170 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Adam Jackson <ajax@redhat.com>
|
||||||
|
Date: Wed, 12 Jul 2017 14:03:35 -0400
|
||||||
|
Subject: [PATCH 3/5] dispatch: Use epoxy_conservative_glx_dlsym when probing
|
||||||
|
GLX
|
||||||
|
|
||||||
|
This path should also only load libGLX.so if possible.
|
||||||
|
|
||||||
|
Signed-off-by: Adam Jackson <ajax@redhat.com>
|
||||||
|
(cherry picked from commit f81274b12470a0ce8678465112998708f63c3559)
|
||||||
|
---
|
||||||
|
src/dispatch_common.c | 26 +++++++++++++-------------
|
||||||
|
1 file changed, 13 insertions(+), 13 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/dispatch_common.c b/src/dispatch_common.c
|
||||||
|
index a7c2f74..48bd3f5 100644
|
||||||
|
--- a/src/dispatch_common.c
|
||||||
|
+++ b/src/dispatch_common.c
|
||||||
|
@@ -500,6 +500,18 @@ epoxy_internal_has_gl_extension(const char *ext, bool invalid_op_mode)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
+void *
|
||||||
|
+epoxy_conservative_glx_dlsym(const char *name, bool exit_if_fails)
|
||||||
|
+{
|
||||||
|
+#ifdef GLVND_GLX_LIB
|
||||||
|
+ /* prefer the glvnd library if it exists */
|
||||||
|
+ if (!api.glx_handle)
|
||||||
|
+ get_dlopen_handle(&api.glx_handle, GLVND_GLX_LIB, false);
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
+ return do_dlsym(&api.glx_handle, GLX_LIB, name, exit_if_fails);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
/**
|
||||||
|
* Tests whether the currently bound context is EGL or GLX, trying to
|
||||||
|
* avoid loading libraries unless necessary.
|
||||||
|
@@ -541,7 +553,7 @@ epoxy_current_context_is_glx(void)
|
||||||
|
* Presumably they dlopened with RTLD_LOCAL, which hides it
|
||||||
|
* from us. Just go dlopen()ing likely libraries and try them.
|
||||||
|
*/
|
||||||
|
- sym = do_dlsym(&api.glx_handle, GLX_LIB, "glXGetCurrentContext", false);
|
||||||
|
+ sym = epoxy_conservative_glx_dlsym("glXGetCurrentContext", false);
|
||||||
|
if (sym && glXGetCurrentContext())
|
||||||
|
return true;
|
||||||
|
|
||||||
|
@@ -595,18 +607,6 @@ epoxy_egl_dlsym(const char *name)
|
||||||
|
}
|
||||||
|
|
||||||
|
void *
|
||||||
|
-epoxy_conservative_glx_dlsym(const char *name, bool exit_if_fails)
|
||||||
|
-{
|
||||||
|
-#ifdef GLVND_GLX_LIB
|
||||||
|
- /* prefer the glvnd library if it exists */
|
||||||
|
- if (!api.glx_handle)
|
||||||
|
- get_dlopen_handle(&api.glx_handle, GLVND_GLX_LIB, false);
|
||||||
|
-#endif
|
||||||
|
-
|
||||||
|
- return do_dlsym(&api.glx_handle, GLX_LIB, name, exit_if_fails);
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
-void *
|
||||||
|
epoxy_glx_dlsym(const char *name)
|
||||||
|
{
|
||||||
|
return epoxy_conservative_glx_dlsym(name, true);
|
||||||
|
--
|
||||||
|
2.13.5
|
||||||
|
|
@ -0,0 +1,62 @@
|
|||||||
|
From f8b473bc44b01eeeca9ebada47ff1165c27f9deb Mon Sep 17 00:00:00 2001
|
||||||
|
From: Adam Jackson <ajax@redhat.com>
|
||||||
|
Date: Wed, 12 Jul 2017 13:26:05 -0400
|
||||||
|
Subject: [PATCH 4/5] dispatch: Be more paranoid about detecting GLX or not
|
||||||
|
|
||||||
|
This code attempts not to dlopen anything if it can find the appropriate
|
||||||
|
winsys symbols in the global namespace. That's nice. However we normally
|
||||||
|
do dlopen(RTLD_LOCAL) when we open lib{GLX,EGL} so those symbols will
|
||||||
|
_not_ in fact be in the global namespace. The code also prefers checking
|
||||||
|
GLX to EGL, which means even if we initialize EGL through epoxy, and
|
||||||
|
even if we're using glvnd, we'll still dlopen libGL the first time we
|
||||||
|
hit epoxy_is_desktop_gl().
|
||||||
|
|
||||||
|
There's a couple of ways to skin this cat, let's take the easy one. If
|
||||||
|
either-but-not-both of the glx or egl handles in the global API state
|
||||||
|
are initialized, then we know we're already in one or the other. If
|
||||||
|
neither or both are initialized, then the current heuristic should work
|
||||||
|
fine.
|
||||||
|
|
||||||
|
Note that epoxy_is_desktop_gl() is only bothering to check for GLX to
|
||||||
|
work around PowerVR's broken GLES. One suspects a better way to do that
|
||||||
|
would be to check GL_VENDOR or GL_RENDERER and avoid probing the window
|
||||||
|
system at all.
|
||||||
|
|
||||||
|
Signed-off-by: Adam Jackson <ajax@redhat.com>
|
||||||
|
(cherry picked from commit 7c4817f2eed2faf0353c1ceb5f38b500f6aff7cf)
|
||||||
|
---
|
||||||
|
src/dispatch_common.c | 11 ++++++++++-
|
||||||
|
1 file changed, 10 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/src/dispatch_common.c b/src/dispatch_common.c
|
||||||
|
index 48bd3f5..87bd98a 100644
|
||||||
|
--- a/src/dispatch_common.c
|
||||||
|
+++ b/src/dispatch_common.c
|
||||||
|
@@ -522,6 +522,16 @@ epoxy_current_context_is_glx(void)
|
||||||
|
#if !PLATFORM_HAS_GLX
|
||||||
|
return false;
|
||||||
|
#else
|
||||||
|
+ void *sym;
|
||||||
|
+
|
||||||
|
+ /* If we've been called already, don't load more */
|
||||||
|
+ if (!api.egl_handle != !api.glx_handle) {
|
||||||
|
+ if (api.glx_handle)
|
||||||
|
+ return true;
|
||||||
|
+ else if (api.egl_handle)
|
||||||
|
+ return false;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
/* If the application hasn't explicitly called some of our GLX
|
||||||
|
* or EGL code but has presumably set up a context on its own,
|
||||||
|
* then we need to figure out how to getprocaddress anyway.
|
||||||
|
@@ -529,7 +539,6 @@ epoxy_current_context_is_glx(void)
|
||||||
|
* If there's a public GetProcAddress loaded in the
|
||||||
|
* application's namespace, then use that.
|
||||||
|
*/
|
||||||
|
- void *sym;
|
||||||
|
|
||||||
|
sym = dlsym(NULL, "glXGetCurrentContext");
|
||||||
|
if (sym) {
|
||||||
|
--
|
||||||
|
2.13.5
|
||||||
|
|
27
0005-dispatch-Fix-the-libOpenGL-soname.patch
Normal file
27
0005-dispatch-Fix-the-libOpenGL-soname.patch
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
From 5f64275aa1ddcf37c87599d1fae6dab8d58bb976 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Adam Jackson <ajax@redhat.com>
|
||||||
|
Date: Thu, 7 Sep 2017 17:02:22 -0400
|
||||||
|
Subject: [PATCH 5/5] dispatch: Fix the libOpenGL soname
|
||||||
|
|
||||||
|
Brown-paper-bag-for: Adam Jackson <ajax@redhat.com>
|
||||||
|
(cherry picked from commit e5372a25baa9034b6223b32a0cab838c42779a39)
|
||||||
|
---
|
||||||
|
src/dispatch_common.c | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/src/dispatch_common.c b/src/dispatch_common.c
|
||||||
|
index 87bd98a..7ec91b6 100644
|
||||||
|
--- a/src/dispatch_common.c
|
||||||
|
+++ b/src/dispatch_common.c
|
||||||
|
@@ -194,7 +194,7 @@
|
||||||
|
#define EGL_LIB "libEGL.so.1"
|
||||||
|
#define GLES1_LIB "libGLESv1_CM.so.1"
|
||||||
|
#define GLES2_LIB "libGLESv2.so.2"
|
||||||
|
-#define OPENGL_LIB "libOpenGL.so.1"
|
||||||
|
+#define OPENGL_LIB "libOpenGL.so.0"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __GNUC__
|
||||||
|
--
|
||||||
|
2.13.5
|
||||||
|
|
@ -1,7 +1,7 @@
|
|||||||
Summary: epoxy runtime library
|
Summary: epoxy runtime library
|
||||||
Name: libepoxy
|
Name: libepoxy
|
||||||
Version: 1.4.3
|
Version: 1.4.3
|
||||||
Release: 3%{?dist}
|
Release: 4%{?dist}
|
||||||
License: MIT
|
License: MIT
|
||||||
URL: https://github.com/anholt/libepoxy
|
URL: https://github.com/anholt/libepoxy
|
||||||
Source0: %{url}/releases/download/%{version}/%{name}-%{version}.tar.xz
|
Source0: %{url}/releases/download/%{version}/%{name}-%{version}.tar.xz
|
||||||
@ -13,6 +13,12 @@ BuildRequires: pkgconfig(egl)
|
|||||||
BuildRequires: pkgconfig(glesv2)
|
BuildRequires: pkgconfig(glesv2)
|
||||||
BuildRequires: python3
|
BuildRequires: python3
|
||||||
|
|
||||||
|
Patch1: 0001-dispatch-Learn-about-glvnd.patch
|
||||||
|
Patch2: 0002-dispatch-Don-t-reference-glvnd-defines-on-non-glvnd-.patch
|
||||||
|
Patch3: 0003-dispatch-Use-epoxy_conservative_glx_dlsym-when-probi.patch
|
||||||
|
Patch4: 0004-dispatch-Be-more-paranoid-about-detecting-GLX-or-not.patch
|
||||||
|
Patch5: 0005-dispatch-Fix-the-libOpenGL-soname.patch
|
||||||
|
|
||||||
%description
|
%description
|
||||||
A library for handling OpenGL function pointer management.
|
A library for handling OpenGL function pointer management.
|
||||||
|
|
||||||
@ -58,6 +64,9 @@ developing applications that use %{name}.
|
|||||||
%{_libdir}/pkgconfig/epoxy.pc
|
%{_libdir}/pkgconfig/epoxy.pc
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Fri Sep 22 2017 Adam Jackson <ajax@redhat.com> - 1.4.3-4
|
||||||
|
- Backport some useful bits from master
|
||||||
|
|
||||||
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.4.3-3
|
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.4.3-3
|
||||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user