The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1 | /* |
| 2 | ** Copyright 2007, The Android Open Source Project |
| 3 | ** |
| 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 |
| 7 | ** |
| 8 | ** http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | ** |
| 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 |
| 14 | ** limitations under the License. |
| 15 | */ |
| 16 | |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 17 | #include <ctype.h> |
Mathias Agopian | d8fb7b5 | 2009-05-17 18:50:16 -0700 | [diff] [blame] | 18 | #include <stdlib.h> |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 19 | #include <string.h> |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 20 | |
Mathias Agopian | 518ec11 | 2011-05-13 16:21:08 -0700 | [diff] [blame] | 21 | #include <hardware/gralloc.h> |
| 22 | #include <system/window.h> |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 23 | |
| 24 | #include <EGL/egl.h> |
| 25 | #include <EGL/eglext.h> |
| 26 | #include <GLES/gl.h> |
| 27 | #include <GLES/glext.h> |
| 28 | |
| 29 | #include <cutils/log.h> |
| 30 | #include <cutils/atomic.h> |
| 31 | #include <cutils/properties.h> |
| 32 | #include <cutils/memory.h> |
| 33 | |
Mathias Agopian | 2403533 | 2010-08-02 17:34:32 -0700 | [diff] [blame] | 34 | #include <utils/String8.h> |
Mathias Agopian | 9429e9c | 2009-08-21 02:18:25 -0700 | [diff] [blame] | 35 | |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 36 | #include "egl_impl.h" |
David Li | 864f839 | 2011-03-28 10:39:28 -0700 | [diff] [blame] | 37 | #include "egl_tls.h" |
Mathias Agopian | 518ec11 | 2011-05-13 16:21:08 -0700 | [diff] [blame] | 38 | #include "glesv2dbg.h" |
| 39 | #include "hooks.h" |
| 40 | #include "Loader.h" |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 41 | |
Mathias Agopian | 518ec11 | 2011-05-13 16:21:08 -0700 | [diff] [blame] | 42 | #include "egl_display.h" |
| 43 | #include "egl_object.h" |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 44 | |
| 45 | // ---------------------------------------------------------------------------- |
| 46 | namespace android { |
| 47 | // ---------------------------------------------------------------------------- |
| 48 | |
Mathias Agopian | 518ec11 | 2011-05-13 16:21:08 -0700 | [diff] [blame] | 49 | egl_connection_t gEGLImpl[IMPL_NUM_IMPLEMENTATIONS]; |
| 50 | gl_hooks_t gHooks[2][IMPL_NUM_IMPLEMENTATIONS]; |
| 51 | gl_hooks_t gHooksNoContext; |
| 52 | pthread_key_t gGLWrapperKey = -1; |
Mathias Agopian | 076b1cc | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 53 | |
| 54 | // ---------------------------------------------------------------------------- |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 55 | |
Jack Palevich | a2dd6cf | 2010-10-26 15:21:24 -0700 | [diff] [blame] | 56 | #if EGL_TRACE |
| 57 | |
| 58 | EGLAPI pthread_key_t gGLTraceKey = -1; |
| 59 | |
| 60 | // ---------------------------------------------------------------------------- |
| 61 | |
Mathias Agopian | 518ec11 | 2011-05-13 16:21:08 -0700 | [diff] [blame] | 62 | int gEGLDebugLevel; |
| 63 | |
| 64 | static int sEGLTraceLevel; |
| 65 | static int sEGLApplicationTraceLevel; |
| 66 | |
| 67 | extern gl_hooks_t gHooksTrace; |
| 68 | extern gl_hooks_t gHooksDebug; |
Jack Palevich | a2dd6cf | 2010-10-26 15:21:24 -0700 | [diff] [blame] | 69 | |
| 70 | static inline void setGlTraceThreadSpecific(gl_hooks_t const *value) { |
| 71 | pthread_setspecific(gGLTraceKey, value); |
| 72 | } |
| 73 | |
| 74 | gl_hooks_t const* getGLTraceThreadSpecific() { |
| 75 | return static_cast<gl_hooks_t*>(pthread_getspecific(gGLTraceKey)); |
| 76 | } |
| 77 | |
Mathias Agopian | 518ec11 | 2011-05-13 16:21:08 -0700 | [diff] [blame] | 78 | void initEglTraceLevel() { |
Jack Palevich | a2dd6cf | 2010-10-26 15:21:24 -0700 | [diff] [blame] | 79 | char value[PROPERTY_VALUE_MAX]; |
| 80 | property_get("debug.egl.trace", value, "0"); |
| 81 | int propertyLevel = atoi(value); |
Mathias Agopian | 518ec11 | 2011-05-13 16:21:08 -0700 | [diff] [blame] | 82 | int applicationLevel = sEGLApplicationTraceLevel; |
| 83 | sEGLTraceLevel = propertyLevel > applicationLevel ? propertyLevel : applicationLevel; |
David Li | 499c6f0 | 2011-04-08 18:43:16 -0700 | [diff] [blame] | 84 | |
David Li | 2f5a655 | 2011-03-01 16:08:10 -0800 | [diff] [blame] | 85 | property_get("debug.egl.debug_proc", value, ""); |
| 86 | long pid = getpid(); |
| 87 | char procPath[128] = {}; |
| 88 | sprintf(procPath, "/proc/%ld/cmdline", pid); |
| 89 | FILE * file = fopen(procPath, "r"); |
| 90 | if (file) |
| 91 | { |
| 92 | char cmdline[256] = {}; |
| 93 | if (fgets(cmdline, sizeof(cmdline) - 1, file)) |
| 94 | { |
David Li | 2f5a655 | 2011-03-01 16:08:10 -0800 | [diff] [blame] | 95 | if (!strcmp(value, cmdline)) |
Mathias Agopian | 518ec11 | 2011-05-13 16:21:08 -0700 | [diff] [blame] | 96 | sEGLTraceLevel = 1; |
David Li | 499c6f0 | 2011-04-08 18:43:16 -0700 | [diff] [blame] | 97 | } |
David Li | 2f5a655 | 2011-03-01 16:08:10 -0800 | [diff] [blame] | 98 | fclose(file); |
| 99 | } |
David Li | 499c6f0 | 2011-04-08 18:43:16 -0700 | [diff] [blame] | 100 | |
Mathias Agopian | 518ec11 | 2011-05-13 16:21:08 -0700 | [diff] [blame] | 101 | if (sEGLTraceLevel > 0) |
David Li | 85f33a7 | 2011-03-10 19:07:42 -0800 | [diff] [blame] | 102 | { |
| 103 | property_get("debug.egl.debug_port", value, "5039"); |
David Li | 499c6f0 | 2011-04-08 18:43:16 -0700 | [diff] [blame] | 104 | const unsigned short port = (unsigned short)atoi(value); |
| 105 | property_get("debug.egl.debug_forceUseFile", value, "0"); |
| 106 | const bool forceUseFile = (bool)atoi(value); |
| 107 | property_get("debug.egl.debug_maxFileSize", value, "8"); |
| 108 | const unsigned int maxFileSize = atoi(value) << 20; |
| 109 | property_get("debug.egl.debug_filePath", value, "/data/local/tmp/dump.gles2dbg"); |
| 110 | StartDebugServer(port, forceUseFile, maxFileSize, value); |
David Li | 85f33a7 | 2011-03-10 19:07:42 -0800 | [diff] [blame] | 111 | } |
Jack Palevich | a2dd6cf | 2010-10-26 15:21:24 -0700 | [diff] [blame] | 112 | } |
| 113 | |
Mathias Agopian | 518ec11 | 2011-05-13 16:21:08 -0700 | [diff] [blame] | 114 | void setGLHooksThreadSpecific(gl_hooks_t const *value) { |
| 115 | if (sEGLTraceLevel > 0) { |
Jack Palevich | a2dd6cf | 2010-10-26 15:21:24 -0700 | [diff] [blame] | 116 | setGlTraceThreadSpecific(value); |
| 117 | setGlThreadSpecific(&gHooksTrace); |
Mathias Agopian | 518ec11 | 2011-05-13 16:21:08 -0700 | [diff] [blame] | 118 | } else if (sEGLTraceLevel > 0 && value != &gHooksNoContext) { |
David Li | 2f5a655 | 2011-03-01 16:08:10 -0800 | [diff] [blame] | 119 | setGlTraceThreadSpecific(value); |
| 120 | setGlThreadSpecific(&gHooksDebug); |
Jack Palevich | a2dd6cf | 2010-10-26 15:21:24 -0700 | [diff] [blame] | 121 | } else { |
| 122 | setGlThreadSpecific(value); |
| 123 | } |
| 124 | } |
| 125 | |
| 126 | /* |
| 127 | * Global entry point to allow applications to modify their own trace level. |
| 128 | * The effective trace level is the max of this level and the value of debug.egl.trace. |
| 129 | */ |
| 130 | extern "C" |
| 131 | void setGLTraceLevel(int level) { |
Mathias Agopian | 518ec11 | 2011-05-13 16:21:08 -0700 | [diff] [blame] | 132 | sEGLApplicationTraceLevel = level; |
Jack Palevich | a2dd6cf | 2010-10-26 15:21:24 -0700 | [diff] [blame] | 133 | } |
| 134 | |
| 135 | #else |
| 136 | |
Mathias Agopian | 518ec11 | 2011-05-13 16:21:08 -0700 | [diff] [blame] | 137 | void setGLHooksThreadSpecific(gl_hooks_t const *value) { |
Jack Palevich | a2dd6cf | 2010-10-26 15:21:24 -0700 | [diff] [blame] | 138 | setGlThreadSpecific(value); |
| 139 | } |
| 140 | |
| 141 | #endif |
| 142 | |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 143 | /*****************************************************************************/ |
| 144 | |
Mathias Agopian | 6f08712 | 2010-09-23 16:38:38 -0700 | [diff] [blame] | 145 | static int gl_no_context() { |
Mathias Agopian | 518ec11 | 2011-05-13 16:21:08 -0700 | [diff] [blame] | 146 | if (egl_tls_t::logNoContextCall()) { |
Mathias Agopian | d274eae | 2009-07-31 16:21:17 -0700 | [diff] [blame] | 147 | LOGE("call to OpenGL ES API with no current context " |
| 148 | "(logged once per thread)"); |
| 149 | } |
Mathias Agopian | 6f08712 | 2010-09-23 16:38:38 -0700 | [diff] [blame] | 150 | return 0; |
Mathias Agopian | 05c5311 | 2010-09-23 11:32:52 -0700 | [diff] [blame] | 151 | } |
| 152 | |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 153 | static void early_egl_init(void) |
| 154 | { |
| 155 | #if !USE_FAST_TLS_KEY |
| 156 | pthread_key_create(&gGLWrapperKey, NULL); |
| 157 | #endif |
Jack Palevich | a2dd6cf | 2010-10-26 15:21:24 -0700 | [diff] [blame] | 158 | #if EGL_TRACE |
| 159 | pthread_key_create(&gGLTraceKey, NULL); |
| 160 | initEglTraceLevel(); |
| 161 | #endif |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 162 | uint32_t addr = (uint32_t)((void*)gl_no_context); |
| 163 | android_memset32( |
Mathias Agopian | 618fa10 | 2009-10-14 02:06:37 -0700 | [diff] [blame] | 164 | (uint32_t*)(void*)&gHooksNoContext, |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 165 | addr, |
Mathias Agopian | 618fa10 | 2009-10-14 02:06:37 -0700 | [diff] [blame] | 166 | sizeof(gHooksNoContext)); |
Mathias Agopian | 05c5311 | 2010-09-23 11:32:52 -0700 | [diff] [blame] | 167 | |
Jack Palevich | a2dd6cf | 2010-10-26 15:21:24 -0700 | [diff] [blame] | 168 | setGLHooksThreadSpecific(&gHooksNoContext); |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 169 | } |
| 170 | |
| 171 | static pthread_once_t once_control = PTHREAD_ONCE_INIT; |
| 172 | static int sEarlyInitState = pthread_once(&once_control, &early_egl_init); |
| 173 | |
Mathias Agopian | 518ec11 | 2011-05-13 16:21:08 -0700 | [diff] [blame] | 174 | // ---------------------------------------------------------------------------- |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 175 | |
Mathias Agopian | 5b287a6 | 2011-05-16 18:58:55 -0700 | [diff] [blame^] | 176 | egl_display_t* validate_display(EGLDisplay dpy) { |
Eric Hassold | 3ede7c1 | 2011-03-23 15:59:00 -0700 | [diff] [blame] | 177 | egl_display_t * const dp = get_display(dpy); |
Mathias Agopian | 5b287a6 | 2011-05-16 18:58:55 -0700 | [diff] [blame^] | 178 | if (!dp) |
| 179 | return setError(EGL_BAD_DISPLAY, (egl_display_t*)NULL); |
| 180 | if (!dp->isReady()) |
| 181 | return setError(EGL_NOT_INITIALIZED, (egl_display_t*)NULL); |
Eric Hassold | 3ede7c1 | 2011-03-23 15:59:00 -0700 | [diff] [blame] | 182 | |
| 183 | return dp; |
| 184 | } |
| 185 | |
Mathias Agopian | 5b287a6 | 2011-05-16 18:58:55 -0700 | [diff] [blame^] | 186 | egl_connection_t* validate_display_config(EGLDisplay dpy, EGLConfig config, |
| 187 | egl_display_t const*& dp) { |
Eric Hassold | 3ede7c1 | 2011-03-23 15:59:00 -0700 | [diff] [blame] | 188 | dp = validate_display(dpy); |
Mathias Agopian | 5b287a6 | 2011-05-16 18:58:55 -0700 | [diff] [blame^] | 189 | if (!dp) |
| 190 | return (egl_connection_t*) NULL; |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 191 | |
Mathias Agopian | cee7939 | 2010-07-26 21:14:59 -0700 | [diff] [blame] | 192 | if (intptr_t(config) >= dp->numTotalConfigs) { |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 193 | return setError(EGL_BAD_CONFIG, (egl_connection_t*)NULL); |
| 194 | } |
Mathias Agopian | cee7939 | 2010-07-26 21:14:59 -0700 | [diff] [blame] | 195 | egl_connection_t* const cnx = &gEGLImpl[dp->configs[intptr_t(config)].impl]; |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 196 | if (cnx->dso == 0) { |
| 197 | return setError(EGL_BAD_CONFIG, (egl_connection_t*)NULL); |
| 198 | } |
| 199 | return cnx; |
| 200 | } |
| 201 | |
Mathias Agopian | 518ec11 | 2011-05-13 16:21:08 -0700 | [diff] [blame] | 202 | // ---------------------------------------------------------------------------- |
| 203 | |
Mathias Agopian | 076b1cc | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 204 | EGLImageKHR egl_get_image_for_current_context(EGLImageKHR image) |
| 205 | { |
Mathias Agopian | 9429e9c | 2009-08-21 02:18:25 -0700 | [diff] [blame] | 206 | ImageRef _i(image); |
Mathias Agopian | 5b287a6 | 2011-05-16 18:58:55 -0700 | [diff] [blame^] | 207 | if (!_i.get()) |
| 208 | return EGL_NO_IMAGE_KHR; |
| 209 | |
Mathias Agopian | 518ec11 | 2011-05-13 16:21:08 -0700 | [diff] [blame] | 210 | EGLContext context = egl_tls_t::getContext(); |
Mathias Agopian | 076b1cc | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 211 | if (context == EGL_NO_CONTEXT || image == EGL_NO_IMAGE_KHR) |
| 212 | return EGL_NO_IMAGE_KHR; |
Mathias Agopian | 5b287a6 | 2011-05-16 18:58:55 -0700 | [diff] [blame^] | 213 | |
Mathias Agopian | 076b1cc | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 214 | egl_context_t const * const c = get_context(context); |
Mathias Agopian | 5b287a6 | 2011-05-16 18:58:55 -0700 | [diff] [blame^] | 215 | if (c == NULL) // this should never happen |
Mathias Agopian | 076b1cc | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 216 | return EGL_NO_IMAGE_KHR; |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 217 | |
Mathias Agopian | 5b287a6 | 2011-05-16 18:58:55 -0700 | [diff] [blame^] | 218 | // here we don't validate the context because if it's been marked for |
| 219 | // termination, this call should still succeed since it's internal to |
| 220 | // EGL. |
| 221 | |
Mathias Agopian | 076b1cc | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 222 | egl_image_t const * const i = get_image(image); |
Mathias Agopian | 076b1cc | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 223 | return i->images[c->impl]; |
| 224 | } |
| 225 | |
Mathias Agopian | 923c661 | 2009-08-17 18:07:06 -0700 | [diff] [blame] | 226 | // ---------------------------------------------------------------------------- |
Mathias Agopian | 076b1cc | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 227 | |
Mathias Agopian | 923c661 | 2009-08-17 18:07:06 -0700 | [diff] [blame] | 228 | // this mutex protects: |
Mathias Agopian | a69e0ed | 2009-08-24 21:47:13 -0700 | [diff] [blame] | 229 | // d->disp[] |
Mathias Agopian | 923c661 | 2009-08-17 18:07:06 -0700 | [diff] [blame] | 230 | // egl_init_drivers_locked() |
| 231 | // |
Mathias Agopian | 518ec11 | 2011-05-13 16:21:08 -0700 | [diff] [blame] | 232 | static EGLBoolean egl_init_drivers_locked() { |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 233 | if (sEarlyInitState) { |
Mathias Agopian | 923c661 | 2009-08-17 18:07:06 -0700 | [diff] [blame] | 234 | // initialized by static ctor. should be set here. |
| 235 | return EGL_FALSE; |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 236 | } |
| 237 | |
Mathias Agopian | de58697 | 2009-05-28 17:39:03 -0700 | [diff] [blame] | 238 | // get our driver loader |
Mathias Agopian | 923c661 | 2009-08-17 18:07:06 -0700 | [diff] [blame] | 239 | Loader& loader(Loader::getInstance()); |
Mathias Agopian | 518ec11 | 2011-05-13 16:21:08 -0700 | [diff] [blame] | 240 | |
| 241 | // dynamically load all our EGL implementations |
Mathias Agopian | 923c661 | 2009-08-17 18:07:06 -0700 | [diff] [blame] | 242 | egl_connection_t* cnx; |
Mathias Agopian | 923c661 | 2009-08-17 18:07:06 -0700 | [diff] [blame] | 243 | |
| 244 | cnx = &gEGLImpl[IMPL_SOFTWARE]; |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 245 | if (cnx->dso == 0) { |
Mathias Agopian | 618fa10 | 2009-10-14 02:06:37 -0700 | [diff] [blame] | 246 | cnx->hooks[GLESv1_INDEX] = &gHooks[GLESv1_INDEX][IMPL_SOFTWARE]; |
| 247 | cnx->hooks[GLESv2_INDEX] = &gHooks[GLESv2_INDEX][IMPL_SOFTWARE]; |
| 248 | cnx->dso = loader.open(EGL_DEFAULT_DISPLAY, 0, cnx); |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 249 | } |
| 250 | |
| 251 | cnx = &gEGLImpl[IMPL_HARDWARE]; |
Mathias Agopian | 923c661 | 2009-08-17 18:07:06 -0700 | [diff] [blame] | 252 | if (cnx->dso == 0) { |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 253 | char value[PROPERTY_VALUE_MAX]; |
| 254 | property_get("debug.egl.hw", value, "1"); |
| 255 | if (atoi(value) != 0) { |
Mathias Agopian | 618fa10 | 2009-10-14 02:06:37 -0700 | [diff] [blame] | 256 | cnx->hooks[GLESv1_INDEX] = &gHooks[GLESv1_INDEX][IMPL_HARDWARE]; |
| 257 | cnx->hooks[GLESv2_INDEX] = &gHooks[GLESv2_INDEX][IMPL_HARDWARE]; |
| 258 | cnx->dso = loader.open(EGL_DEFAULT_DISPLAY, 1, cnx); |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 259 | } else { |
| 260 | LOGD("3D hardware acceleration is disabled"); |
| 261 | } |
| 262 | } |
Mathias Agopian | a69e0ed | 2009-08-24 21:47:13 -0700 | [diff] [blame] | 263 | |
Mathias Agopian | 923c661 | 2009-08-17 18:07:06 -0700 | [diff] [blame] | 264 | if (!gEGLImpl[IMPL_SOFTWARE].dso && !gEGLImpl[IMPL_HARDWARE].dso) { |
| 265 | return EGL_FALSE; |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 266 | } |
| 267 | |
Mathias Agopian | 923c661 | 2009-08-17 18:07:06 -0700 | [diff] [blame] | 268 | return EGL_TRUE; |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 269 | } |
| 270 | |
Mathias Agopian | 518ec11 | 2011-05-13 16:21:08 -0700 | [diff] [blame] | 271 | static pthread_mutex_t sInitDriverMutex = PTHREAD_MUTEX_INITIALIZER; |
| 272 | |
| 273 | EGLBoolean egl_init_drivers() { |
Mathias Agopian | 923c661 | 2009-08-17 18:07:06 -0700 | [diff] [blame] | 274 | EGLBoolean res; |
Mathias Agopian | 518ec11 | 2011-05-13 16:21:08 -0700 | [diff] [blame] | 275 | pthread_mutex_lock(&sInitDriverMutex); |
Mathias Agopian | 923c661 | 2009-08-17 18:07:06 -0700 | [diff] [blame] | 276 | res = egl_init_drivers_locked(); |
Mathias Agopian | 518ec11 | 2011-05-13 16:21:08 -0700 | [diff] [blame] | 277 | pthread_mutex_unlock(&sInitDriverMutex); |
Mathias Agopian | 923c661 | 2009-08-17 18:07:06 -0700 | [diff] [blame] | 278 | return res; |
| 279 | } |
Mathias Agopian | 076b1cc | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 280 | |
| 281 | // ---------------------------------------------------------------------------- |
| 282 | }; // namespace android |
| 283 | // ---------------------------------------------------------------------------- |
| 284 | |