blob: d16d33a77132a9c5a17ede9759db58e924d150e6 [file] [log] [blame]
Jesse Hall21558da2013-08-06 15:31:22 -07001/*
Mathias Agopian518ec112011-05-13 16:21:08 -07002 ** Copyright 2007, The Android Open Source Project
3 **
Jesse Hall21558da2013-08-06 15:31:22 -07004 ** 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
Mathias Agopian518ec112011-05-13 16:21:08 -07007 **
Jesse Hall21558da2013-08-06 15:31:22 -07008 ** http://www.apache.org/licenses/LICENSE-2.0
Mathias Agopian518ec112011-05-13 16:21:08 -07009 **
Jesse Hall21558da2013-08-06 15:31:22 -070010 ** 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
Mathias Agopian518ec112011-05-13 16:21:08 -070014 ** limitations under the License.
15 */
16
Jesse Hallb29e5e82012-04-04 16:53:42 -070017#define __STDC_LIMIT_MACROS 1
Jesse Hall1508ae62017-01-19 17:43:26 -080018#define ATRACE_TAG ATRACE_TAG_GRAPHICS
Jesse Hallb29e5e82012-04-04 16:53:42 -070019
Mathias Agopian311b4792017-02-28 15:00:49 -080020#include "egl_display.h"
Mathias Agopian4b9511c2011-11-13 23:52:47 -080021
Mathias Agopian39c24a22013-04-04 23:17:56 -070022#include "../egl_impl.h"
23
Mathias Agopianb7f9a242017-03-08 22:29:31 -080024#include <private/EGL/display.h>
25
Jamie Gennisaca51c02011-11-03 17:42:43 -070026#include "egl_cache.h"
Mathias Agopian518ec112011-05-13 16:21:08 -070027#include "egl_object.h"
28#include "egl_tls.h"
Mathias Agopian65421432017-03-08 11:49:05 -080029#include "egl_trace.h"
Mathias Agopian518ec112011-05-13 16:21:08 -070030#include "Loader.h"
Mathias Agopian7db993a2012-03-25 00:49:46 -070031#include <cutils/properties.h>
Mathias Agopian311b4792017-02-28 15:00:49 -080032
Courtney Goeltzenleuchtere5d6f992017-07-07 14:55:40 -060033#include <android/hardware/configstore/1.0/ISurfaceFlingerConfigs.h>
34#include <configstore/Utils.h>
35
36using namespace android::hardware::configstore;
37using namespace android::hardware::configstore::V1_0;
38
Mathias Agopian518ec112011-05-13 16:21:08 -070039// ----------------------------------------------------------------------------
40namespace android {
41// ----------------------------------------------------------------------------
42
Mathias Agopian4b9511c2011-11-13 23:52:47 -080043static char const * const sVendorString = "Android";
44static char const * const sVersionString = "1.4 Android META-EGL";
Mathias Agopiancc2b1562012-05-21 14:01:37 -070045static char const * const sClientApiString = "OpenGL_ES";
Mathias Agopian4b9511c2011-11-13 23:52:47 -080046
Jesse Hall21558da2013-08-06 15:31:22 -070047extern char const * const gBuiltinExtensionString;
Mathias Agopiane9b3dfb2013-03-27 14:30:19 -070048extern char const * const gExtensionString;
Mathias Agopian4b9511c2011-11-13 23:52:47 -080049
Mathias Agopian518ec112011-05-13 16:21:08 -070050extern void setGLHooksThreadSpecific(gl_hooks_t const *value);
51
Mathias Agopian518ec112011-05-13 16:21:08 -070052// ----------------------------------------------------------------------------
53
Courtney Goeltzenleuchtera1e59f12018-03-05 08:19:25 -070054bool findExtension(const char* exts, const char* name, size_t nameLen) {
Jesse Hallc2e41222013-08-08 13:40:22 -070055 if (exts) {
Courtney Goeltzenleuchtera1e59f12018-03-05 08:19:25 -070056 if (!nameLen) {
57 nameLen = strlen(name);
58 }
Kalle Raita7804aa22016-04-18 16:03:37 -070059 for (const char* match = strstr(exts, name); match; match = strstr(match + nameLen, name)) {
60 if (match[nameLen] == '\0' || match[nameLen] == ' ') {
61 return true;
62 }
Jesse Hallc2e41222013-08-08 13:40:22 -070063 }
64 }
65 return false;
66}
67
Mathias Agopianb7f9a242017-03-08 22:29:31 -080068int egl_get_init_count(EGLDisplay dpy) {
69 egl_display_t* eglDisplay = egl_display_t::get(dpy);
70 return eglDisplay ? eglDisplay->getRefsCount() : 0;
71}
72
Mathias Agopian518ec112011-05-13 16:21:08 -070073egl_display_t egl_display_t::sDisplay[NUM_DISPLAYS];
74
75egl_display_t::egl_display_t() :
Michael Lentine54466bc2015-01-27 09:01:03 -080076 magic('_dpy'), finishOnSwap(false), traceGpuCompletion(false), refs(0), eglIsInitialized(false) {
Mathias Agopian518ec112011-05-13 16:21:08 -070077}
78
79egl_display_t::~egl_display_t() {
80 magic = 0;
Jamie Gennis76601082011-11-06 14:14:33 -080081 egl_cache_t::get()->terminate();
Mathias Agopian518ec112011-05-13 16:21:08 -070082}
83
84egl_display_t* egl_display_t::get(EGLDisplay dpy) {
Ivan Lozano7025b542017-12-06 14:19:44 -080085 if (uintptr_t(dpy) == 0) {
86 return nullptr;
87 }
88
Mathias Agopian518ec112011-05-13 16:21:08 -070089 uintptr_t index = uintptr_t(dpy)-1U;
Jesse Halld6e99462016-09-28 11:26:57 -070090 if (index >= NUM_DISPLAYS || !sDisplay[index].isValid()) {
91 return nullptr;
92 }
93 return &sDisplay[index];
Mathias Agopian518ec112011-05-13 16:21:08 -070094}
95
96void egl_display_t::addObject(egl_object_t* object) {
Mathias Agopian65421432017-03-08 11:49:05 -080097 std::lock_guard<std::mutex> _l(lock);
98 objects.insert(object);
Mathias Agopian518ec112011-05-13 16:21:08 -070099}
100
Mathias Agopian5b287a62011-05-16 18:58:55 -0700101void egl_display_t::removeObject(egl_object_t* object) {
Mathias Agopian65421432017-03-08 11:49:05 -0800102 std::lock_guard<std::mutex> _l(lock);
103 objects.erase(object);
Mathias Agopian5b287a62011-05-16 18:58:55 -0700104}
105
Mathias Agopianf0480de2011-11-13 20:50:07 -0800106bool egl_display_t::getObject(egl_object_t* object) const {
Mathias Agopian65421432017-03-08 11:49:05 -0800107 std::lock_guard<std::mutex> _l(lock);
108 if (objects.find(object) != objects.end()) {
Mathias Agopianf0480de2011-11-13 20:50:07 -0800109 if (object->getDisplay() == this) {
110 object->incRef();
111 return true;
112 }
Mathias Agopian518ec112011-05-13 16:21:08 -0700113 }
114 return false;
115}
116
Mathias Agopian518ec112011-05-13 16:21:08 -0700117EGLDisplay egl_display_t::getFromNativeDisplay(EGLNativeDisplayType disp) {
118 if (uintptr_t(disp) >= NUM_DISPLAYS)
Yi Kong48a6cd22018-07-18 10:07:09 -0700119 return nullptr;
Mathias Agopian518ec112011-05-13 16:21:08 -0700120
121 return sDisplay[uintptr_t(disp)].getDisplay(disp);
122}
123
124EGLDisplay egl_display_t::getDisplay(EGLNativeDisplayType display) {
125
Mathias Agopian65421432017-03-08 11:49:05 -0800126 std::lock_guard<std::mutex> _l(lock);
Jesse Hall1508ae62017-01-19 17:43:26 -0800127 ATRACE_CALL();
Mathias Agopian518ec112011-05-13 16:21:08 -0700128
129 // get our driver loader
130 Loader& loader(Loader::getInstance());
131
Mathias Agopianada798b2012-02-13 17:09:30 -0800132 egl_connection_t* const cnx = &gEGLImpl;
133 if (cnx->dso && disp.dpy == EGL_NO_DISPLAY) {
134 EGLDisplay dpy = cnx->egl.eglGetDisplay(display);
135 disp.dpy = dpy;
136 if (dpy == EGL_NO_DISPLAY) {
137 loader.close(cnx->dso);
Yi Kong48a6cd22018-07-18 10:07:09 -0700138 cnx->dso = nullptr;
Mathias Agopian518ec112011-05-13 16:21:08 -0700139 }
140 }
141
142 return EGLDisplay(uintptr_t(display) + 1U);
143}
144
145EGLBoolean egl_display_t::initialize(EGLint *major, EGLint *minor) {
146
Mathias Agopian65421432017-03-08 11:49:05 -0800147 { // scope for refLock
148 std::unique_lock<std::mutex> _l(refLock);
Michael Lentine54466bc2015-01-27 09:01:03 -0800149 refs++;
150 if (refs > 1) {
Yi Kong48a6cd22018-07-18 10:07:09 -0700151 if (major != nullptr)
Michael Lentine54466bc2015-01-27 09:01:03 -0800152 *major = VERSION_MAJOR;
Yi Kong48a6cd22018-07-18 10:07:09 -0700153 if (minor != nullptr)
Michael Lentine54466bc2015-01-27 09:01:03 -0800154 *minor = VERSION_MINOR;
Mathias Agopian65421432017-03-08 11:49:05 -0800155 while(!eglIsInitialized) {
156 refCond.wait(_l);
157 }
Michael Lentine54466bc2015-01-27 09:01:03 -0800158 return EGL_TRUE;
159 }
Mathias Agopian65421432017-03-08 11:49:05 -0800160 while(eglIsInitialized) {
161 refCond.wait(_l);
162 }
Michael Lentine54466bc2015-01-27 09:01:03 -0800163 }
164
Mathias Agopian65421432017-03-08 11:49:05 -0800165 { // scope for lock
166 std::lock_guard<std::mutex> _l(lock);
Michael Lentine54466bc2015-01-27 09:01:03 -0800167
Michael Lentine54466bc2015-01-27 09:01:03 -0800168 setGLHooksThreadSpecific(&gHooksNoContext);
169
170 // initialize each EGL and
171 // build our own extension string first, based on the extension we know
172 // and the extension supported by our client implementation
173
174 egl_connection_t* const cnx = &gEGLImpl;
175 cnx->major = -1;
176 cnx->minor = -1;
177 if (cnx->dso) {
178 EGLDisplay idpy = disp.dpy;
179 if (cnx->egl.eglInitialize(idpy, &cnx->major, &cnx->minor)) {
180 //ALOGD("initialized dpy=%p, ver=%d.%d, cnx=%p",
181 // idpy, cnx->major, cnx->minor, cnx);
182
183 // display is now initialized
184 disp.state = egl_display_t::INITIALIZED;
185
186 // get the query-strings for this display for each implementation
187 disp.queryString.vendor = cnx->egl.eglQueryString(idpy,
188 EGL_VENDOR);
189 disp.queryString.version = cnx->egl.eglQueryString(idpy,
190 EGL_VERSION);
191 disp.queryString.extensions = cnx->egl.eglQueryString(idpy,
192 EGL_EXTENSIONS);
193 disp.queryString.clientApi = cnx->egl.eglQueryString(idpy,
194 EGL_CLIENT_APIS);
195
196 } else {
197 ALOGW("eglInitialize(%p) failed (%s)", idpy,
198 egl_tls_t::egl_strerror(cnx->egl.eglGetError()));
199 }
200 }
201
202 // the query strings are per-display
Mathias Agopian65421432017-03-08 11:49:05 -0800203 mVendorString = sVendorString;
204 mVersionString = sVersionString;
205 mClientApiString = sClientApiString;
Michael Lentine54466bc2015-01-27 09:01:03 -0800206
Mathias Agopian65421432017-03-08 11:49:05 -0800207 mExtensionString = gBuiltinExtensionString;
Courtney Goeltzenleuchtere5d6f992017-07-07 14:55:40 -0600208
Krzysztof Kosińskif2fc4e92018-04-18 16:29:49 -0700209 hasColorSpaceSupport = findExtension(disp.queryString.extensions, "EGL_KHR_gl_colorspace");
210
211 // Note: CDD requires that devices supporting wide color and/or HDR color also support
212 // the EGL_KHR_gl_colorspace extension.
Courtney Goeltzenleuchtere5d6f992017-07-07 14:55:40 -0600213 bool wideColorBoardConfig =
214 getBool<ISurfaceFlingerConfigs, &ISurfaceFlingerConfigs::hasWideColorDisplay>(
215 false);
216
217 // Add wide-color extensions if device can support wide-color
Krzysztof Kosińskif2fc4e92018-04-18 16:29:49 -0700218 if (wideColorBoardConfig && hasColorSpaceSupport) {
Courtney Goeltzenleuchtere5d6f992017-07-07 14:55:40 -0600219 mExtensionString.append(
220 "EGL_EXT_gl_colorspace_scrgb EGL_EXT_gl_colorspace_scrgb_linear "
221 "EGL_EXT_gl_colorspace_display_p3_linear EGL_EXT_gl_colorspace_display_p3 ");
222 }
223
Courtney Goeltzenleuchter12ffe092017-11-16 14:27:48 -0700224 bool hasHdrBoardConfig =
225 getBool<ISurfaceFlingerConfigs, &ISurfaceFlingerConfigs::hasHDRDisplay>(false);
226
Krzysztof Kosińskif2fc4e92018-04-18 16:29:49 -0700227 if (hasHdrBoardConfig && hasColorSpaceSupport) {
Courtney Goeltzenleuchter12ffe092017-11-16 14:27:48 -0700228 // hasHDRBoardConfig indicates the system is capable of supporting HDR content.
229 // Typically that means there is an HDR capable display attached, but could be
230 // support for attaching an HDR display. In either case, advertise support for
231 // HDR color spaces.
232 mExtensionString.append(
233 "EGL_EXT_gl_colorspace_bt2020_linear EGL_EXT_gl_colorspace_bt2020_pq ");
234 }
235
Michael Lentine54466bc2015-01-27 09:01:03 -0800236 char const* start = gExtensionString;
Michael Lentine54466bc2015-01-27 09:01:03 -0800237 do {
Nicolas Capensecc0c9a2015-10-30 12:55:21 -0400238 // length of the extension name
239 size_t len = strcspn(start, " ");
240 if (len) {
241 // NOTE: we could avoid the copy if we had strnstr.
Mathias Agopian65421432017-03-08 11:49:05 -0800242 const std::string ext(start, len);
243 if (findExtension(disp.queryString.extensions, ext.c_str(), len)) {
Nicolas Capensecc0c9a2015-10-30 12:55:21 -0400244 mExtensionString.append(ext + " ");
Michael Lentine54466bc2015-01-27 09:01:03 -0800245 }
Nicolas Capensecc0c9a2015-10-30 12:55:21 -0400246 // advance to the next extension name, skipping the space.
247 start += len;
248 start += (*start == ' ') ? 1 : 0;
Michael Lentine54466bc2015-01-27 09:01:03 -0800249 }
Nicolas Capensecc0c9a2015-10-30 12:55:21 -0400250 } while (*start != '\0');
Michael Lentine54466bc2015-01-27 09:01:03 -0800251
252 egl_cache_t::get()->initialize(this);
253
254 char value[PROPERTY_VALUE_MAX];
255 property_get("debug.egl.finish", value, "0");
256 if (atoi(value)) {
257 finishOnSwap = true;
258 }
259
260 property_get("debug.egl.traceGpuCompletion", value, "0");
261 if (atoi(value)) {
262 traceGpuCompletion = true;
263 }
264
Yi Kong48a6cd22018-07-18 10:07:09 -0700265 if (major != nullptr)
Mathias Agopian518ec112011-05-13 16:21:08 -0700266 *major = VERSION_MAJOR;
Yi Kong48a6cd22018-07-18 10:07:09 -0700267 if (minor != nullptr)
Mathias Agopian518ec112011-05-13 16:21:08 -0700268 *minor = VERSION_MINOR;
Mathias Agopian518ec112011-05-13 16:21:08 -0700269 }
270
Mathias Agopian65421432017-03-08 11:49:05 -0800271 { // scope for refLock
272 std::unique_lock<std::mutex> _l(refLock);
Michael Lentine54466bc2015-01-27 09:01:03 -0800273 eglIsInitialized = true;
Mathias Agopian65421432017-03-08 11:49:05 -0800274 refCond.notify_all();
Mathias Agopian518ec112011-05-13 16:21:08 -0700275 }
276
Mathias Agopian7773c432012-02-13 20:06:08 -0800277 return EGL_TRUE;
Mathias Agopian518ec112011-05-13 16:21:08 -0700278}
279
280EGLBoolean egl_display_t::terminate() {
281
Mathias Agopian65421432017-03-08 11:49:05 -0800282 { // scope for refLock
283 std::unique_lock<std::mutex> _rl(refLock);
Michael Lentine54466bc2015-01-27 09:01:03 -0800284 if (refs == 0) {
285 /*
286 * From the EGL spec (3.2):
287 * "Termination of a display that has already been terminated,
288 * (...), is allowed, but the only effect of such a call is
289 * to return EGL_TRUE (...)
290 */
291 return EGL_TRUE;
292 }
Mathias Agopian518ec112011-05-13 16:21:08 -0700293
Michael Lentine54466bc2015-01-27 09:01:03 -0800294 // this is specific to Android, display termination is ref-counted.
Mathias Agopian518ec112011-05-13 16:21:08 -0700295 refs--;
Michael Lentine54466bc2015-01-27 09:01:03 -0800296 if (refs > 0) {
297 return EGL_TRUE;
298 }
Mathias Agopian518ec112011-05-13 16:21:08 -0700299 }
300
301 EGLBoolean res = EGL_FALSE;
Michael Lentine54466bc2015-01-27 09:01:03 -0800302
Mathias Agopian65421432017-03-08 11:49:05 -0800303 { // scope for lock
304 std::lock_guard<std::mutex> _l(lock);
Michael Lentine54466bc2015-01-27 09:01:03 -0800305
306 egl_connection_t* const cnx = &gEGLImpl;
307 if (cnx->dso && disp.state == egl_display_t::INITIALIZED) {
308 if (cnx->egl.eglTerminate(disp.dpy) == EGL_FALSE) {
309 ALOGW("eglTerminate(%p) failed (%s)", disp.dpy,
310 egl_tls_t::egl_strerror(cnx->egl.eglGetError()));
311 }
312 // REVISIT: it's unclear what to do if eglTerminate() fails
313 disp.state = egl_display_t::TERMINATED;
314 res = EGL_TRUE;
Mathias Agopian518ec112011-05-13 16:21:08 -0700315 }
Michael Lentine54466bc2015-01-27 09:01:03 -0800316
Michael Lentine54466bc2015-01-27 09:01:03 -0800317 // Reset the extension string since it will be regenerated if we get
318 // reinitialized.
Mathias Agopian65421432017-03-08 11:49:05 -0800319 mExtensionString.clear();
Michael Lentine54466bc2015-01-27 09:01:03 -0800320
321 // Mark all objects remaining in the list as terminated, unless
322 // there are no reference to them, it which case, we're free to
323 // delete them.
324 size_t count = objects.size();
Dan Alberteacd31f2016-02-02 15:08:34 -0800325 ALOGW_IF(count, "eglTerminate() called w/ %zu objects remaining", count);
Mathias Agopian65421432017-03-08 11:49:05 -0800326 for (auto o : objects) {
Michael Lentine54466bc2015-01-27 09:01:03 -0800327 o->destroy();
328 }
329
330 // this marks all object handles are "terminated"
331 objects.clear();
Mathias Agopian518ec112011-05-13 16:21:08 -0700332 }
333
Mathias Agopian65421432017-03-08 11:49:05 -0800334 { // scope for refLock
335 std::unique_lock<std::mutex> _rl(refLock);
Michael Lentine54466bc2015-01-27 09:01:03 -0800336 eglIsInitialized = false;
Mathias Agopian65421432017-03-08 11:49:05 -0800337 refCond.notify_all();
Mathias Agopian5b287a62011-05-16 18:58:55 -0700338 }
339
Mathias Agopian518ec112011-05-13 16:21:08 -0700340 return res;
341}
342
Mathias Agopianfb87e542012-01-30 18:20:52 -0800343void egl_display_t::loseCurrent(egl_context_t * cur_c)
344{
345 if (cur_c) {
Mathias Agopiana4b2c042012-02-03 15:24:51 -0800346 egl_display_t* display = cur_c->getDisplay();
347 if (display) {
348 display->loseCurrentImpl(cur_c);
349 }
350 }
351}
Mathias Agopianfb87e542012-01-30 18:20:52 -0800352
Mathias Agopiana4b2c042012-02-03 15:24:51 -0800353void egl_display_t::loseCurrentImpl(egl_context_t * cur_c)
354{
355 // by construction, these are either 0 or valid (possibly terminated)
356 // it should be impossible for these to be invalid
357 ContextRef _cur_c(cur_c);
Yi Kong48a6cd22018-07-18 10:07:09 -0700358 SurfaceRef _cur_r(cur_c ? get_surface(cur_c->read) : nullptr);
359 SurfaceRef _cur_d(cur_c ? get_surface(cur_c->draw) : nullptr);
Mathias Agopianfb87e542012-01-30 18:20:52 -0800360
Mathias Agopiana4b2c042012-02-03 15:24:51 -0800361 { // scope for the lock
Mathias Agopian65421432017-03-08 11:49:05 -0800362 std::lock_guard<std::mutex> _l(lock);
Mathias Agopianfb87e542012-01-30 18:20:52 -0800363 cur_c->onLooseCurrent();
364
Mathias Agopianfb87e542012-01-30 18:20:52 -0800365 }
Mathias Agopiana4b2c042012-02-03 15:24:51 -0800366
367 // This cannot be called with the lock held because it might end-up
368 // calling back into EGL (in particular when a surface is destroyed
369 // it calls ANativeWindow::disconnect
370 _cur_c.release();
371 _cur_r.release();
372 _cur_d.release();
Mathias Agopianfb87e542012-01-30 18:20:52 -0800373}
374
375EGLBoolean egl_display_t::makeCurrent(egl_context_t* c, egl_context_t* cur_c,
Mark Salyzyn92dc3fc2014-03-12 13:12:44 -0700376 EGLSurface draw, EGLSurface read, EGLContext /*ctx*/,
Mathias Agopianfb87e542012-01-30 18:20:52 -0800377 EGLSurface impl_draw, EGLSurface impl_read, EGLContext impl_ctx)
378{
Mathias Agopianfb87e542012-01-30 18:20:52 -0800379 EGLBoolean result;
Mathias Agopiana4b2c042012-02-03 15:24:51 -0800380
381 // by construction, these are either 0 or valid (possibly terminated)
382 // it should be impossible for these to be invalid
383 ContextRef _cur_c(cur_c);
Yi Kong48a6cd22018-07-18 10:07:09 -0700384 SurfaceRef _cur_r(cur_c ? get_surface(cur_c->read) : nullptr);
385 SurfaceRef _cur_d(cur_c ? get_surface(cur_c->draw) : nullptr);
Mathias Agopiana4b2c042012-02-03 15:24:51 -0800386
387 { // scope for the lock
Mathias Agopian65421432017-03-08 11:49:05 -0800388 std::lock_guard<std::mutex> _l(lock);
Mathias Agopianfb87e542012-01-30 18:20:52 -0800389 if (c) {
Mathias Agopiana4b2c042012-02-03 15:24:51 -0800390 result = c->cnx->egl.eglMakeCurrent(
Mathias Agopianada798b2012-02-13 17:09:30 -0800391 disp.dpy, impl_draw, impl_read, impl_ctx);
Mathias Agopiana4b2c042012-02-03 15:24:51 -0800392 if (result == EGL_TRUE) {
393 c->onMakeCurrent(draw, read);
394 }
395 } else {
396 result = cur_c->cnx->egl.eglMakeCurrent(
Mathias Agopianada798b2012-02-13 17:09:30 -0800397 disp.dpy, impl_draw, impl_read, impl_ctx);
Mathias Agopiana4b2c042012-02-03 15:24:51 -0800398 if (result == EGL_TRUE) {
399 cur_c->onLooseCurrent();
400 }
Mathias Agopianfb87e542012-01-30 18:20:52 -0800401 }
402 }
Mathias Agopiana4b2c042012-02-03 15:24:51 -0800403
404 if (result == EGL_TRUE) {
405 // This cannot be called with the lock held because it might end-up
406 // calling back into EGL (in particular when a surface is destroyed
407 // it calls ANativeWindow::disconnect
408 _cur_c.release();
409 _cur_r.release();
410 _cur_d.release();
411 }
412
Mathias Agopianfb87e542012-01-30 18:20:52 -0800413 return result;
414}
Mathias Agopian518ec112011-05-13 16:21:08 -0700415
Jesse Hallc2e41222013-08-08 13:40:22 -0700416bool egl_display_t::haveExtension(const char* name, size_t nameLen) const {
417 if (!nameLen) {
418 nameLen = strlen(name);
419 }
Mathias Agopian65421432017-03-08 11:49:05 -0800420 return findExtension(mExtensionString.c_str(), name, nameLen);
Jesse Hallc2e41222013-08-08 13:40:22 -0700421}
422
Jesse Halla0fef1c2012-04-17 12:02:26 -0700423// ----------------------------------------------------------------------------
Mathias Agopian518ec112011-05-13 16:21:08 -0700424}; // namespace android
425// ----------------------------------------------------------------------------