| Jesse Hall | 4774338 | 2013-02-08 11:13:46 -0800 | [diff] [blame] | 1 | /* | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2 | ** Copyright 2007, The Android Open Source Project | 
|  | 3 | ** | 
| Jesse Hall | 4774338 | 2013-02-08 11:13:46 -0800 | [diff] [blame] | 4 | ** Licensed under the Apache License, Version 2.0 (the "License"); | 
|  | 5 | ** you may not use this file except in compliance with the License. | 
|  | 6 | ** You may obtain a copy of the License at | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 7 | ** | 
| Jesse Hall | 4774338 | 2013-02-08 11:13:46 -0800 | [diff] [blame] | 8 | **     http://www.apache.org/licenses/LICENSE-2.0 | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 9 | ** | 
| Jesse Hall | 4774338 | 2013-02-08 11:13:46 -0800 | [diff] [blame] | 10 | ** Unless required by applicable law or agreed to in writing, software | 
|  | 11 | ** distributed under the License is distributed on an "AS IS" BASIS, | 
|  | 12 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 
|  | 13 | ** See the License for the specific language governing permissions and | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 14 | ** limitations under the License. | 
|  | 15 | */ | 
|  | 16 |  | 
| Mathias Agopian | d8fb7b5 | 2009-05-17 18:50:16 -0700 | [diff] [blame] | 17 | #include <stdlib.h> | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 18 |  | 
| Mathias Agopian | 518ec11 | 2011-05-13 16:21:08 -0700 | [diff] [blame] | 19 | #include <hardware/gralloc.h> | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 20 |  | 
|  | 21 | #include <EGL/egl.h> | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 22 |  | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 23 | #include <cutils/properties.h> | 
| Mathias Agopian | 311b479 | 2017-02-28 15:00:49 -0800 | [diff] [blame] | 24 |  | 
| Mark Salyzyn | 7823e12 | 2016-09-29 08:08:05 -0700 | [diff] [blame] | 25 | #include <log/log.h> | 
| Mathias Agopian | 311b479 | 2017-02-28 15:00:49 -0800 | [diff] [blame] | 26 |  | 
| Mathias Agopian | 39c24a2 | 2013-04-04 23:17:56 -0700 | [diff] [blame] | 27 | #include "../egl_impl.h" | 
| Mathias Agopian | 39c24a2 | 2013-04-04 23:17:56 -0700 | [diff] [blame] | 28 |  | 
| Mathias Agopian | 39c24a2 | 2013-04-04 23:17:56 -0700 | [diff] [blame] | 29 | #include "egldefs.h" | 
| Mathias Agopian | 311b479 | 2017-02-28 15:00:49 -0800 | [diff] [blame] | 30 | #include "egl_tls.h" | 
| Mathias Agopian | 518ec11 | 2011-05-13 16:21:08 -0700 | [diff] [blame] | 31 | #include "egl_display.h" | 
|  | 32 | #include "egl_object.h" | 
| Cody Northrop | 629ce4e | 2018-10-15 07:22:09 -0600 | [diff] [blame] | 33 | #include "egl_layers.h" | 
| Mathias Agopian | 5f1af04 | 2017-03-09 18:50:05 -0800 | [diff] [blame] | 34 | #include "CallStack.h" | 
| Mathias Agopian | 311b479 | 2017-02-28 15:00:49 -0800 | [diff] [blame] | 35 | #include "Loader.h" | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 36 |  | 
|  | 37 | // ---------------------------------------------------------------------------- | 
|  | 38 | namespace android { | 
|  | 39 | // ---------------------------------------------------------------------------- | 
|  | 40 |  | 
| Mathias Agopian | ada798b | 2012-02-13 17:09:30 -0800 | [diff] [blame] | 41 | egl_connection_t gEGLImpl; | 
|  | 42 | gl_hooks_t gHooks[2]; | 
| Mathias Agopian | 518ec11 | 2011-05-13 16:21:08 -0700 | [diff] [blame] | 43 | gl_hooks_t gHooksNoContext; | 
|  | 44 | pthread_key_t gGLWrapperKey = -1; | 
| Mathias Agopian | 076b1cc | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 45 |  | 
|  | 46 | // ---------------------------------------------------------------------------- | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 47 |  | 
| Mathias Agopian | 518ec11 | 2011-05-13 16:21:08 -0700 | [diff] [blame] | 48 | void setGLHooksThreadSpecific(gl_hooks_t const *value) { | 
| Jack Palevich | a2dd6cf | 2010-10-26 15:21:24 -0700 | [diff] [blame] | 49 | setGlThreadSpecific(value); | 
|  | 50 | } | 
|  | 51 |  | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 52 | /*****************************************************************************/ | 
|  | 53 |  | 
| Mathias Agopian | 6f08712 | 2010-09-23 16:38:38 -0700 | [diff] [blame] | 54 | static int gl_no_context() { | 
| Mathias Agopian | 518ec11 | 2011-05-13 16:21:08 -0700 | [diff] [blame] | 55 | if (egl_tls_t::logNoContextCall()) { | 
| Mathias Agopian | 455e360 | 2012-09-26 17:19:48 -0700 | [diff] [blame] | 56 | char const* const error = "call to OpenGL ES API with " | 
|  | 57 | "no current context (logged once per thread)"; | 
|  | 58 | if (LOG_NDEBUG) { | 
|  | 59 | ALOGE(error); | 
|  | 60 | } else { | 
|  | 61 | LOG_ALWAYS_FATAL(error); | 
|  | 62 | } | 
| Mathias Agopian | ecfe091 | 2011-09-06 17:24:05 -0700 | [diff] [blame] | 63 | char value[PROPERTY_VALUE_MAX]; | 
|  | 64 | property_get("debug.egl.callstack", value, "0"); | 
| John Reck | 1f246d7 | 2014-04-24 23:34:32 +0000 | [diff] [blame] | 65 | if (atoi(value)) { | 
| Mathias Agopian | 5f1af04 | 2017-03-09 18:50:05 -0800 | [diff] [blame] | 66 | CallStack::log(LOG_TAG); | 
| Mathias Agopian | ecfe091 | 2011-09-06 17:24:05 -0700 | [diff] [blame] | 67 | } | 
| Mathias Agopian | d274eae | 2009-07-31 16:21:17 -0700 | [diff] [blame] | 68 | } | 
| Mathias Agopian | 6f08712 | 2010-09-23 16:38:38 -0700 | [diff] [blame] | 69 | return 0; | 
| Mathias Agopian | 05c5311 | 2010-09-23 11:32:52 -0700 | [diff] [blame] | 70 | } | 
|  | 71 |  | 
| Jesse Hall | 4774338 | 2013-02-08 11:13:46 -0800 | [diff] [blame] | 72 | static void early_egl_init(void) | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 73 | { | 
| Dan Stoza | c3289c4 | 2014-01-17 11:38:34 -0800 | [diff] [blame] | 74 | int numHooks = sizeof(gHooksNoContext) / sizeof(EGLFuncPointer); | 
|  | 75 | EGLFuncPointer *iter = reinterpret_cast<EGLFuncPointer*>(&gHooksNoContext); | 
|  | 76 | for (int hook = 0; hook < numHooks; ++hook) { | 
|  | 77 | *(iter++) = reinterpret_cast<EGLFuncPointer>(gl_no_context); | 
|  | 78 | } | 
| Mathias Agopian | 05c5311 | 2010-09-23 11:32:52 -0700 | [diff] [blame] | 79 |  | 
| Jack Palevich | a2dd6cf | 2010-10-26 15:21:24 -0700 | [diff] [blame] | 80 | setGLHooksThreadSpecific(&gHooksNoContext); | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 81 | } | 
|  | 82 |  | 
|  | 83 | static pthread_once_t once_control = PTHREAD_ONCE_INIT; | 
|  | 84 | static int sEarlyInitState = pthread_once(&once_control, &early_egl_init); | 
|  | 85 |  | 
| Mathias Agopian | 518ec11 | 2011-05-13 16:21:08 -0700 | [diff] [blame] | 86 | // ---------------------------------------------------------------------------- | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 87 |  | 
| Jesse Hall | b29e5e8 | 2012-04-04 16:53:42 -0700 | [diff] [blame] | 88 | egl_display_ptr validate_display(EGLDisplay dpy) { | 
|  | 89 | egl_display_ptr dp = get_display(dpy); | 
| Mathias Agopian | 5b287a6 | 2011-05-16 18:58:55 -0700 | [diff] [blame] | 90 | if (!dp) | 
| Yi Kong | 48a6cd2 | 2018-07-18 10:07:09 -0700 | [diff] [blame] | 91 | return setError(EGL_BAD_DISPLAY, egl_display_ptr(nullptr)); | 
| Mathias Agopian | 5b287a6 | 2011-05-16 18:58:55 -0700 | [diff] [blame] | 92 | if (!dp->isReady()) | 
| Yi Kong | 48a6cd2 | 2018-07-18 10:07:09 -0700 | [diff] [blame] | 93 | return setError(EGL_NOT_INITIALIZED, egl_display_ptr(nullptr)); | 
| Eric Hassold | 3ede7c1 | 2011-03-23 15:59:00 -0700 | [diff] [blame] | 94 |  | 
|  | 95 | return dp; | 
|  | 96 | } | 
|  | 97 |  | 
| Jesse Hall | b29e5e8 | 2012-04-04 16:53:42 -0700 | [diff] [blame] | 98 | egl_display_ptr validate_display_connection(EGLDisplay dpy, | 
|  | 99 | egl_connection_t*& cnx) { | 
| Yi Kong | 48a6cd2 | 2018-07-18 10:07:09 -0700 | [diff] [blame] | 100 | cnx = nullptr; | 
| Jesse Hall | b29e5e8 | 2012-04-04 16:53:42 -0700 | [diff] [blame] | 101 | egl_display_ptr dp = validate_display(dpy); | 
| Mathias Agopian | 5b287a6 | 2011-05-16 18:58:55 -0700 | [diff] [blame] | 102 | if (!dp) | 
| Jesse Hall | b29e5e8 | 2012-04-04 16:53:42 -0700 | [diff] [blame] | 103 | return dp; | 
|  | 104 | cnx = &gEGLImpl; | 
| Yi Kong | 48a6cd2 | 2018-07-18 10:07:09 -0700 | [diff] [blame] | 105 | if (cnx->dso == nullptr) { | 
|  | 106 | return setError(EGL_BAD_CONFIG, egl_display_ptr(nullptr)); | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 107 | } | 
| Jesse Hall | b29e5e8 | 2012-04-04 16:53:42 -0700 | [diff] [blame] | 108 | return dp; | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 109 | } | 
|  | 110 |  | 
| Mathias Agopian | 518ec11 | 2011-05-13 16:21:08 -0700 | [diff] [blame] | 111 | // ---------------------------------------------------------------------------- | 
|  | 112 |  | 
| Mathias Agopian | 48d438d | 2012-01-28 21:44:00 -0800 | [diff] [blame] | 113 | const GLubyte * egl_get_string_for_current_context(GLenum name) { | 
|  | 114 | // NOTE: returning NULL here will fall-back to the default | 
|  | 115 | // implementation. | 
|  | 116 |  | 
|  | 117 | EGLContext context = egl_tls_t::getContext(); | 
|  | 118 | if (context == EGL_NO_CONTEXT) | 
| Yi Kong | 48a6cd2 | 2018-07-18 10:07:09 -0700 | [diff] [blame] | 119 | return nullptr; | 
| Mathias Agopian | 48d438d | 2012-01-28 21:44:00 -0800 | [diff] [blame] | 120 |  | 
|  | 121 | egl_context_t const * const c = get_context(context); | 
| Yi Kong | 48a6cd2 | 2018-07-18 10:07:09 -0700 | [diff] [blame] | 122 | if (c == nullptr) // this should never happen, by construction | 
|  | 123 | return nullptr; | 
| Mathias Agopian | 48d438d | 2012-01-28 21:44:00 -0800 | [diff] [blame] | 124 |  | 
|  | 125 | if (name != GL_EXTENSIONS) | 
| Yi Kong | 48a6cd2 | 2018-07-18 10:07:09 -0700 | [diff] [blame] | 126 | return nullptr; | 
| Mathias Agopian | 48d438d | 2012-01-28 21:44:00 -0800 | [diff] [blame] | 127 |  | 
| Mathias Agopian | 6542143 | 2017-03-08 11:49:05 -0800 | [diff] [blame] | 128 | return (const GLubyte *)c->gl_extensions.c_str(); | 
| Mathias Agopian | 48d438d | 2012-01-28 21:44:00 -0800 | [diff] [blame] | 129 | } | 
|  | 130 |  | 
| Alistair Strachan | edfe72e | 2015-05-22 14:10:09 -0700 | [diff] [blame] | 131 | const GLubyte * egl_get_string_for_current_context(GLenum name, GLuint index) { | 
|  | 132 | // NOTE: returning NULL here will fall-back to the default | 
|  | 133 | // implementation. | 
|  | 134 |  | 
|  | 135 | EGLContext context = egl_tls_t::getContext(); | 
|  | 136 | if (context == EGL_NO_CONTEXT) | 
| Yi Kong | 48a6cd2 | 2018-07-18 10:07:09 -0700 | [diff] [blame] | 137 | return nullptr; | 
| Alistair Strachan | edfe72e | 2015-05-22 14:10:09 -0700 | [diff] [blame] | 138 |  | 
|  | 139 | egl_context_t const * const c = get_context(context); | 
| Yi Kong | 48a6cd2 | 2018-07-18 10:07:09 -0700 | [diff] [blame] | 140 | if (c == nullptr) // this should never happen, by construction | 
|  | 141 | return nullptr; | 
| Alistair Strachan | edfe72e | 2015-05-22 14:10:09 -0700 | [diff] [blame] | 142 |  | 
|  | 143 | if (name != GL_EXTENSIONS) | 
| Yi Kong | 48a6cd2 | 2018-07-18 10:07:09 -0700 | [diff] [blame] | 144 | return nullptr; | 
| Alistair Strachan | edfe72e | 2015-05-22 14:10:09 -0700 | [diff] [blame] | 145 |  | 
|  | 146 | // if index is out of bounds, assume it will be in the default | 
|  | 147 | // implementation too, so we don't have to generate a GL error here | 
|  | 148 | if (index >= c->tokenized_gl_extensions.size()) | 
| Yi Kong | 48a6cd2 | 2018-07-18 10:07:09 -0700 | [diff] [blame] | 149 | return nullptr; | 
| Alistair Strachan | edfe72e | 2015-05-22 14:10:09 -0700 | [diff] [blame] | 150 |  | 
| Mathias Agopian | 6542143 | 2017-03-08 11:49:05 -0800 | [diff] [blame] | 151 | return (const GLubyte *)c->tokenized_gl_extensions[index].c_str(); | 
| Alistair Strachan | edfe72e | 2015-05-22 14:10:09 -0700 | [diff] [blame] | 152 | } | 
|  | 153 |  | 
|  | 154 | GLint egl_get_num_extensions_for_current_context() { | 
|  | 155 | // NOTE: returning -1 here will fall-back to the default | 
|  | 156 | // implementation. | 
|  | 157 |  | 
|  | 158 | EGLContext context = egl_tls_t::getContext(); | 
|  | 159 | if (context == EGL_NO_CONTEXT) | 
|  | 160 | return -1; | 
|  | 161 |  | 
|  | 162 | egl_context_t const * const c = get_context(context); | 
| Yi Kong | 48a6cd2 | 2018-07-18 10:07:09 -0700 | [diff] [blame] | 163 | if (c == nullptr) // this should never happen, by construction | 
| Alistair Strachan | edfe72e | 2015-05-22 14:10:09 -0700 | [diff] [blame] | 164 | return -1; | 
|  | 165 |  | 
|  | 166 | return (GLint)c->tokenized_gl_extensions.size(); | 
|  | 167 | } | 
|  | 168 |  | 
| Cody Northrop | 68d1035 | 2018-10-15 07:22:09 -0600 | [diff] [blame] | 169 | egl_connection_t* egl_get_connection() { | 
|  | 170 | return &gEGLImpl; | 
|  | 171 | } | 
|  | 172 |  | 
| Mathias Agopian | 48d438d | 2012-01-28 21:44:00 -0800 | [diff] [blame] | 173 | // ---------------------------------------------------------------------------- | 
|  | 174 |  | 
| Mathias Agopian | 923c661 | 2009-08-17 18:07:06 -0700 | [diff] [blame] | 175 | // this mutex protects: | 
| Mathias Agopian | a69e0ed | 2009-08-24 21:47:13 -0700 | [diff] [blame] | 176 | //    d->disp[] | 
| Mathias Agopian | 923c661 | 2009-08-17 18:07:06 -0700 | [diff] [blame] | 177 | //    egl_init_drivers_locked() | 
|  | 178 | // | 
| Mathias Agopian | 518ec11 | 2011-05-13 16:21:08 -0700 | [diff] [blame] | 179 | static EGLBoolean egl_init_drivers_locked() { | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 180 | if (sEarlyInitState) { | 
| Mathias Agopian | 923c661 | 2009-08-17 18:07:06 -0700 | [diff] [blame] | 181 | // initialized by static ctor. should be set here. | 
|  | 182 | return EGL_FALSE; | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 183 | } | 
|  | 184 |  | 
| Mathias Agopian | de58697 | 2009-05-28 17:39:03 -0700 | [diff] [blame] | 185 | // get our driver loader | 
| Mathias Agopian | 923c661 | 2009-08-17 18:07:06 -0700 | [diff] [blame] | 186 | Loader& loader(Loader::getInstance()); | 
| Mathias Agopian | 518ec11 | 2011-05-13 16:21:08 -0700 | [diff] [blame] | 187 |  | 
| Mathias Agopian | ada798b | 2012-02-13 17:09:30 -0800 | [diff] [blame] | 188 | // dynamically load our EGL implementation | 
|  | 189 | egl_connection_t* cnx = &gEGLImpl; | 
| Yi Kong | 48a6cd2 | 2018-07-18 10:07:09 -0700 | [diff] [blame] | 190 | if (cnx->dso == nullptr) { | 
| Mathias Agopian | 7773c43 | 2012-02-13 20:06:08 -0800 | [diff] [blame] | 191 | cnx->hooks[egl_connection_t::GLESv1_INDEX] = | 
|  | 192 | &gHooks[egl_connection_t::GLESv1_INDEX]; | 
|  | 193 | cnx->hooks[egl_connection_t::GLESv2_INDEX] = | 
|  | 194 | &gHooks[egl_connection_t::GLESv2_INDEX]; | 
| Mathias Agopian | ada798b | 2012-02-13 17:09:30 -0800 | [diff] [blame] | 195 | cnx->dso = loader.open(cnx); | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 196 | } | 
|  | 197 |  | 
| Cody Northrop | 629ce4e | 2018-10-15 07:22:09 -0600 | [diff] [blame] | 198 | // Check to see if any layers are enabled and route functions through them | 
|  | 199 | if (cnx->dso) { | 
|  | 200 | // Layers can be enabled long after the drivers have been loaded. | 
|  | 201 | // They will only be initialized once. | 
|  | 202 | LayerLoader& layer_loader(LayerLoader::getInstance()); | 
|  | 203 | layer_loader.InitLayers(cnx); | 
|  | 204 | } | 
|  | 205 |  | 
| Mathias Agopian | ada798b | 2012-02-13 17:09:30 -0800 | [diff] [blame] | 206 | return cnx->dso ? EGL_TRUE : EGL_FALSE; | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 207 | } | 
|  | 208 |  | 
| Mathias Agopian | 518ec11 | 2011-05-13 16:21:08 -0700 | [diff] [blame] | 209 | static pthread_mutex_t sInitDriverMutex = PTHREAD_MUTEX_INITIALIZER; | 
|  | 210 |  | 
|  | 211 | EGLBoolean egl_init_drivers() { | 
| Mathias Agopian | 923c661 | 2009-08-17 18:07:06 -0700 | [diff] [blame] | 212 | EGLBoolean res; | 
| Mathias Agopian | 518ec11 | 2011-05-13 16:21:08 -0700 | [diff] [blame] | 213 | pthread_mutex_lock(&sInitDriverMutex); | 
| Mathias Agopian | 923c661 | 2009-08-17 18:07:06 -0700 | [diff] [blame] | 214 | res = egl_init_drivers_locked(); | 
| Mathias Agopian | 518ec11 | 2011-05-13 16:21:08 -0700 | [diff] [blame] | 215 | pthread_mutex_unlock(&sInitDriverMutex); | 
| Mathias Agopian | 923c661 | 2009-08-17 18:07:06 -0700 | [diff] [blame] | 216 | return res; | 
|  | 217 | } | 
| Mathias Agopian | 076b1cc | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 218 |  | 
| Michael Lentine | 12c4bda | 2014-09-11 12:24:13 -0700 | [diff] [blame] | 219 | static pthread_mutex_t sLogPrintMutex = PTHREAD_MUTEX_INITIALIZER; | 
| Mathias Agopian | 6542143 | 2017-03-08 11:49:05 -0800 | [diff] [blame] | 220 | static std::chrono::steady_clock::time_point sLogPrintTime; | 
|  | 221 | static constexpr std::chrono::seconds DURATION(1); | 
| Michael Lentine | 12c4bda | 2014-09-11 12:24:13 -0700 | [diff] [blame] | 222 |  | 
| Mathias Agopian | 1cadb25 | 2011-05-23 17:26:14 -0700 | [diff] [blame] | 223 | void gl_unimplemented() { | 
| Michael Lentine | 12c4bda | 2014-09-11 12:24:13 -0700 | [diff] [blame] | 224 | bool printLog = false; | 
| Mathias Agopian | 6542143 | 2017-03-08 11:49:05 -0800 | [diff] [blame] | 225 | auto now = std::chrono::steady_clock::now(); | 
| Michael Lentine | 12c4bda | 2014-09-11 12:24:13 -0700 | [diff] [blame] | 226 | pthread_mutex_lock(&sLogPrintMutex); | 
| Mathias Agopian | 6542143 | 2017-03-08 11:49:05 -0800 | [diff] [blame] | 227 | if ((now - sLogPrintTime) > DURATION) { | 
| Michael Lentine | 12c4bda | 2014-09-11 12:24:13 -0700 | [diff] [blame] | 228 | sLogPrintTime = now; | 
|  | 229 | printLog = true; | 
|  | 230 | } | 
|  | 231 | pthread_mutex_unlock(&sLogPrintMutex); | 
|  | 232 | if (printLog) { | 
|  | 233 | ALOGE("called unimplemented OpenGL ES API"); | 
|  | 234 | char value[PROPERTY_VALUE_MAX]; | 
|  | 235 | property_get("debug.egl.callstack", value, "0"); | 
|  | 236 | if (atoi(value)) { | 
| Mathias Agopian | 5f1af04 | 2017-03-09 18:50:05 -0800 | [diff] [blame] | 237 | CallStack::log(LOG_TAG); | 
| Michael Lentine | 12c4bda | 2014-09-11 12:24:13 -0700 | [diff] [blame] | 238 | } | 
| Mathias Agopian | a6bb107 | 2013-08-07 20:10:20 -0700 | [diff] [blame] | 239 | } | 
| Mathias Agopian | 1cadb25 | 2011-05-23 17:26:14 -0700 | [diff] [blame] | 240 | } | 
|  | 241 |  | 
| Mathias Agopian | 48d438d | 2012-01-28 21:44:00 -0800 | [diff] [blame] | 242 | void gl_noop() { | 
|  | 243 | } | 
|  | 244 |  | 
| Mathias Agopian | 1cadb25 | 2011-05-23 17:26:14 -0700 | [diff] [blame] | 245 | // ---------------------------------------------------------------------------- | 
|  | 246 |  | 
| Mathias Agopian | 1cadb25 | 2011-05-23 17:26:14 -0700 | [diff] [blame] | 247 | void setGlThreadSpecific(gl_hooks_t const *value) { | 
|  | 248 | gl_hooks_t const * volatile * tls_hooks = get_tls_hooks(); | 
|  | 249 | tls_hooks[TLS_SLOT_OPENGL_API] = value; | 
|  | 250 | } | 
|  | 251 |  | 
| Mathias Agopian | 1cadb25 | 2011-05-23 17:26:14 -0700 | [diff] [blame] | 252 | // ---------------------------------------------------------------------------- | 
|  | 253 | // GL / EGL hooks | 
|  | 254 | // ---------------------------------------------------------------------------- | 
|  | 255 |  | 
|  | 256 | #undef GL_ENTRY | 
|  | 257 | #undef EGL_ENTRY | 
|  | 258 | #define GL_ENTRY(_r, _api, ...) #_api, | 
|  | 259 | #define EGL_ENTRY(_r, _api, ...) #_api, | 
|  | 260 |  | 
|  | 261 | char const * const gl_names[] = { | 
| Mathias Agopian | 39c24a2 | 2013-04-04 23:17:56 -0700 | [diff] [blame] | 262 | #include "../entries.in" | 
| Yi Kong | 48a6cd2 | 2018-07-18 10:07:09 -0700 | [diff] [blame] | 263 | nullptr | 
| Mathias Agopian | 1cadb25 | 2011-05-23 17:26:14 -0700 | [diff] [blame] | 264 | }; | 
|  | 265 |  | 
| Yiwei Zhang | 7cc5892 | 2018-10-10 11:37:43 -0700 | [diff] [blame] | 266 | char const * const gl_names_1[] = { | 
|  | 267 | #include "../entries_gles1.in" | 
|  | 268 | nullptr | 
|  | 269 | }; | 
|  | 270 |  | 
| Mathias Agopian | 1cadb25 | 2011-05-23 17:26:14 -0700 | [diff] [blame] | 271 | char const * const egl_names[] = { | 
|  | 272 | #include "egl_entries.in" | 
| Yi Kong | 48a6cd2 | 2018-07-18 10:07:09 -0700 | [diff] [blame] | 273 | nullptr | 
| Mathias Agopian | 1cadb25 | 2011-05-23 17:26:14 -0700 | [diff] [blame] | 274 | }; | 
|  | 275 |  | 
| Cody Northrop | 68d1035 | 2018-10-15 07:22:09 -0600 | [diff] [blame] | 276 | char const * const platform_names[] = { | 
|  | 277 | #include "platform_entries.in" | 
|  | 278 | nullptr | 
|  | 279 | }; | 
|  | 280 |  | 
| Mathias Agopian | 1cadb25 | 2011-05-23 17:26:14 -0700 | [diff] [blame] | 281 | #undef GL_ENTRY | 
|  | 282 | #undef EGL_ENTRY | 
|  | 283 |  | 
|  | 284 |  | 
| Mathias Agopian | 076b1cc | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 285 | // ---------------------------------------------------------------------------- | 
|  | 286 | }; // namespace android | 
|  | 287 | // ---------------------------------------------------------------------------- | 
|  | 288 |  |