| From a6312fac4de6253c80a85b306262c4764e08c12d Mon Sep 17 00:00:00 2001 |
| From: Lepton Wu <lepton@chromium.org> |
| Date: Thu, 25 Jun 2020 13:52:24 -0700 |
| Subject: [PATCH] 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. |
| --- |
| src/mapi/mapi_glapi.c | 13 ++++++++++++- |
| 1 file changed, 12 insertions(+), 1 deletion(-) |
| |
| diff --git a/src/mapi/mapi_glapi.c b/src/mapi/mapi_glapi.c |
| index 1cee148c891..25b17c06a61 100644 |
| --- a/src/mapi/mapi_glapi.c |
| +++ b/src/mapi/mapi_glapi.c |
| @@ -169,6 +169,13 @@ _glapi_add_dispatch( const char * const * function_names, |
| return (alias) ? stub_get_slot(alias) : -1; |
| } |
| |
| +static int is_debug_marker_func(const char *name) |
| +{ |
| + return (!strcmp(name, "InsertEventMarkerEXT") || |
| + !strcmp(name, "PushGroupMarkerEXT") || |
| + !strcmp(name, "PopGroupMarkerEXT")); |
| +} |
| + |
| static const struct mapi_stub * |
| _glapi_get_stub(const char *name, int generate) |
| { |
| @@ -179,7 +186,11 @@ _glapi_get_stub(const char *name, int generate) |
| name += 2; |
| |
| stub = stub_find_public(name); |
| - if (!stub) |
| + /* 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)) |
| stub = stub_find_dynamic(name, generate); |
| |
| return stub; |
| -- |
| 2.26.2 |
| |