Mesa (master): mapi: Return NULL function pointers for GL_EXT_debug_marker

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Jul 31 00:07:02 UTC 2020


Module: Mesa
Branch: master
Commit: a2065917cc8f95f76c2926d8d7cb4bf3c9ff7de1
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=a2065917cc8f95f76c2926d8d7cb4bf3c9ff7de1

Author: Lepton Wu <lepton at chromium.org>
Date:   Thu Jun 25 13:52:24 2020 -0700

mapi: Return NULL function pointers for GL_EXT_debug_marker

Mesa returns a stub function pointer to glAnything for years.
Android framework till API level 30 just uses function pointers
returned from eglGetProcAddress without checking if the underlying
extension is supported. If we return stub pointers for functions
in GL_EXT_debug_marker, Android just uses our stub functions instead
of its own stubs and then fail the dEQP. In the past, the issue
didn't show up because mesa only has limited slots and run out of slots
before Android calls eglGetProcAddress on functions inside
GL_EXT_debug_marker.

Signed-off-by: Lepton Wu <lepton at chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5652>

---

 src/mapi/mapi_glapi.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/src/mapi/mapi_glapi.c b/src/mapi/mapi_glapi.c
index 1cee148c891..21ca0a0902d 100644
--- a/src/mapi/mapi_glapi.c
+++ b/src/mapi/mapi_glapi.c
@@ -169,6 +169,15 @@ _glapi_add_dispatch( const char * const * function_names,
    return (alias) ? stub_get_slot(alias) : -1;
 }
 
+#if defined(ANDROID) && ANDROID_API_LEVEL <= 30
+static int is_debug_marker_func(const char *name)
+{
+   return (!strcmp(name, "InsertEventMarkerEXT") ||
+           !strcmp(name, "PushGroupMarkerEXT") ||
+           !strcmp(name, "PopGroupMarkerEXT"));
+}
+#endif
+
 static const struct mapi_stub *
 _glapi_get_stub(const char *name, int generate)
 {
@@ -179,7 +188,15 @@ _glapi_get_stub(const char *name, int generate)
    name += 2;
 
    stub = stub_find_public(name);
+#if defined(ANDROID) && ANDROID_API_LEVEL <= 30
+   /* Android framework till API Level 30 uses function pointers from
+    * eglGetProcAddress without checking GL_EXT_debug_marker.
+    * Make sure we don't return stub function pointers if we don't
+    * support GL_EXT_debug_marker */
+   if (!stub && !is_debug_marker_func(name))
+#else
    if (!stub)
+#endif
       stub = stub_find_dynamic(name, generate);
 
    return stub;



More information about the mesa-commit mailing list