diff -Nru libepoxy-1.4.3/debian/changelog libepoxy-1.4.3/debian/changelog --- libepoxy-1.4.3/debian/changelog 2017-11-13 11:44:13.000000000 +0000 +++ libepoxy-1.4.3/debian/changelog 2018-05-14 11:05:24.000000000 +0000 @@ -1,3 +1,11 @@ +libepoxy (1.4.3-1ubuntu18.04.1) bionic; urgency=medium + + * debian/patches/168.patch: + cherry-pick and rebase "even-more-gentle-glx-detection" branch fixes. + (See LP: #1698233) + + -- Gianfranco Costamagna Mon, 14 May 2018 13:05:24 +0200 + libepoxy (1.4.3-1) unstable; urgency=medium * New upstream version 1.4.3 (Closes: #881540). diff -Nru libepoxy-1.4.3/debian/patches/168.patch libepoxy-1.4.3/debian/patches/168.patch --- libepoxy-1.4.3/debian/patches/168.patch 1970-01-01 00:00:00.000000000 +0000 +++ libepoxy-1.4.3/debian/patches/168.patch 2018-05-14 11:05:24.000000000 +0000 @@ -0,0 +1,121 @@ +## Description: add some description +## Origin/Author: add some origin or author +## Bug: bug URL +From b5a4b16799a30cb74db1916d52f2756a7a5345ed Mon Sep 17 00:00:00 2001 +From: Adam Jackson +Date: Mon, 30 Apr 2018 15:26:17 -0400 +Subject: [PATCH 1/2] dispatch: Query the EGL context version when + bootstrapping on GLES + +We're about to change our dlopen paths to do RTLD_NOLOAD more +aggressively. The issue then is we can create an EGL GLES context +without libGLES* ever being loaded. test/egl_gles2_without_glx will fail +in such a world: the first gentle probe for libGLESv2 will fail, then +the less-gentle probe for libGLESv1_CM will be shot down by the test, +and we exit. + +Fortunately by the time we've gotten to this point the context exists, +so we can query its version via EGL instead. + +Signed-off-by: Adam Jackson +--- + src/dispatch_common.c | 20 ++++++++++---------- + 1 file changed, 10 insertions(+), 10 deletions(-) + +Index: libepoxy-1.4.3/src/dispatch_common.c +=================================================================== +--- libepoxy-1.4.3.orig/src/dispatch_common.c ++++ libepoxy-1.4.3/src/dispatch_common.c +@@ -299,7 +299,11 @@ + #else + pthread_mutex_lock(&api.mutex); + if (!*handle) { +- *handle = dlopen(lib_name, RTLD_LAZY | RTLD_LOCAL); ++ int flags = RTLD_LAZY | RTLD_LOCAL; ++ if (!exit_on_fail) ++ flags |= RTLD_NOLOAD; ++ ++ *handle = dlopen(lib_name, flags); + if (!*handle) { + if (exit_on_fail) { + fprintf(stderr, "Couldn't open %s: %s\n", lib_name, dlerror()); +@@ -503,16 +507,9 @@ + #if !PLATFORM_HAS_GLX + return false; + #else +- /* 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. +- * +- * If there's a public GetProcAddress loaded in the +- * application's namespace, then use that. +- */ + void *sym; + +- sym = dlsym(NULL, "glXGetCurrentContext"); ++ sym = epoxy_conservative_glx_dlsym("glXGetCurrentContext", false); + if (sym) { + if (glXGetCurrentContext()) + return true; +@@ -521,7 +518,7 @@ + } + + #if PLATFORM_HAS_EGL +- sym = dlsym(NULL, "eglGetCurrentContext"); ++ sym = epoxy_conservative_egl_dlsym("eglGetCurrentContext", false); + if (sym) { + if (epoxy_egl_get_current_gl_context_api() != EGL_NONE) + return false; +@@ -530,21 +527,6 @@ + } + #endif /* PLATFORM_HAS_EGL */ + +- /* OK, couldn't find anything in the app's address space. +- * 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); +- if (sym && glXGetCurrentContext()) +- return true; +- +-#if PLATFORM_HAS_EGL +- sym = do_dlsym(&api.egl_handle, EGL_LIB, "eglGetCurrentContext", +- false); +- if (sym && epoxy_egl_get_current_gl_context_api() != EGL_NONE) +- return false; +-#endif /* PLATFORM_HAS_EGL */ +- + return false; + #endif /* PLATFORM_HAS_GLX */ + } +@@ -730,20 +712,20 @@ + #if PLATFORM_HAS_EGL + get_dlopen_handle(&api.egl_handle, EGL_LIB, false); + if (api.egl_handle) { ++ int version = 0; + switch (epoxy_egl_get_current_gl_context_api()) { + case EGL_OPENGL_API: + return epoxy_gl_dlsym(name); + case EGL_OPENGL_ES_API: +- /* We can't resolve the GL version, because +- * epoxy_glGetString() is one of the two things calling +- * us. Try the GLES2 implementation first, and fall back +- * to GLES1 otherwise. +- */ +- get_dlopen_handle(&api.gles2_handle, GLES2_LIB, false); +- if (api.gles2_handle) +- return epoxy_gles2_dlsym(name); +- else +- return epoxy_gles1_dlsym(name); ++ if (eglQueryContext(eglGetCurrentDisplay(), ++ eglGetCurrentContext(), ++ EGL_CONTEXT_CLIENT_VERSION, ++ &version)) { ++ if (version >= 2) ++ return epoxy_gles2_dlsym(name); ++ else ++ return epoxy_gles1_dlsym(name); ++ } + } + } + #endif /* PLATFORM_HAS_EGL */ diff -Nru libepoxy-1.4.3/debian/patches/series libepoxy-1.4.3/debian/patches/series --- libepoxy-1.4.3/debian/patches/series 1970-01-01 00:00:00.000000000 +0000 +++ libepoxy-1.4.3/debian/patches/series 2018-05-14 11:05:24.000000000 +0000 @@ -0,0 +1 @@ +168.patch