blob: 2aec249aa59390644c2c6db873d2c4006ae70157 [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)
119 return NULL;
120
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);
138 cnx->dso = NULL;
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) {
151 if (major != NULL)
152 *major = VERSION_MAJOR;
153 if (minor != NULL)
154 *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);
Krzysztof Kosińskib18333d2018-04-20 19:37:42 -0700243 // Temporary hack: Adreno 530 driver exposes this extension under the draft
244 // KHR name, but during Khronos review it was decided to demote it to EXT.
245 if (ext == "EGL_EXT_image_gl_colorspace" &&
246 findExtension(disp.queryString.extensions, "EGL_KHR_image_gl_colorspace")) {
247 mExtensionString.append("EGL_EXT_image_gl_colorspace ");
248 }
Mathias Agopian65421432017-03-08 11:49:05 -0800249 if (findExtension(disp.queryString.extensions, ext.c_str(), len)) {
Nicolas Capensecc0c9a2015-10-30 12:55:21 -0400250 mExtensionString.append(ext + " ");
Michael Lentine54466bc2015-01-27 09:01:03 -0800251 }
Nicolas Capensecc0c9a2015-10-30 12:55:21 -0400252 // advance to the next extension name, skipping the space.
253 start += len;
254 start += (*start == ' ') ? 1 : 0;
Michael Lentine54466bc2015-01-27 09:01:03 -0800255 }
Nicolas Capensecc0c9a2015-10-30 12:55:21 -0400256 } while (*start != '\0');
Michael Lentine54466bc2015-01-27 09:01:03 -0800257
258 egl_cache_t::get()->initialize(this);
259
260 char value[PROPERTY_VALUE_MAX];
261 property_get("debug.egl.finish", value, "0");
262 if (atoi(value)) {
263 finishOnSwap = true;
264 }
265
266 property_get("debug.egl.traceGpuCompletion", value, "0");
267 if (atoi(value)) {
268 traceGpuCompletion = true;
269 }
270
Mathias Agopian518ec112011-05-13 16:21:08 -0700271 if (major != NULL)
272 *major = VERSION_MAJOR;
273 if (minor != NULL)
274 *minor = VERSION_MINOR;
Mathias Agopian518ec112011-05-13 16:21:08 -0700275 }
276
Mathias Agopian65421432017-03-08 11:49:05 -0800277 { // scope for refLock
278 std::unique_lock<std::mutex> _l(refLock);
Michael Lentine54466bc2015-01-27 09:01:03 -0800279 eglIsInitialized = true;
Mathias Agopian65421432017-03-08 11:49:05 -0800280 refCond.notify_all();
Mathias Agopian518ec112011-05-13 16:21:08 -0700281 }
282
Mathias Agopian7773c432012-02-13 20:06:08 -0800283 return EGL_TRUE;
Mathias Agopian518ec112011-05-13 16:21:08 -0700284}
285
286EGLBoolean egl_display_t::terminate() {
287
Mathias Agopian65421432017-03-08 11:49:05 -0800288 { // scope for refLock
289 std::unique_lock<std::mutex> _rl(refLock);
Michael Lentine54466bc2015-01-27 09:01:03 -0800290 if (refs == 0) {
291 /*
292 * From the EGL spec (3.2):
293 * "Termination of a display that has already been terminated,
294 * (...), is allowed, but the only effect of such a call is
295 * to return EGL_TRUE (...)
296 */
297 return EGL_TRUE;
298 }
Mathias Agopian518ec112011-05-13 16:21:08 -0700299
Michael Lentine54466bc2015-01-27 09:01:03 -0800300 // this is specific to Android, display termination is ref-counted.
Mathias Agopian518ec112011-05-13 16:21:08 -0700301 refs--;
Michael Lentine54466bc2015-01-27 09:01:03 -0800302 if (refs > 0) {
303 return EGL_TRUE;
304 }
Mathias Agopian518ec112011-05-13 16:21:08 -0700305 }
306
307 EGLBoolean res = EGL_FALSE;
Michael Lentine54466bc2015-01-27 09:01:03 -0800308
Mathias Agopian65421432017-03-08 11:49:05 -0800309 { // scope for lock
310 std::lock_guard<std::mutex> _l(lock);
Michael Lentine54466bc2015-01-27 09:01:03 -0800311
312 egl_connection_t* const cnx = &gEGLImpl;
313 if (cnx->dso && disp.state == egl_display_t::INITIALIZED) {
314 if (cnx->egl.eglTerminate(disp.dpy) == EGL_FALSE) {
315 ALOGW("eglTerminate(%p) failed (%s)", disp.dpy,
316 egl_tls_t::egl_strerror(cnx->egl.eglGetError()));
317 }
318 // REVISIT: it's unclear what to do if eglTerminate() fails
319 disp.state = egl_display_t::TERMINATED;
320 res = EGL_TRUE;
Mathias Agopian518ec112011-05-13 16:21:08 -0700321 }
Michael Lentine54466bc2015-01-27 09:01:03 -0800322
Michael Lentine54466bc2015-01-27 09:01:03 -0800323 // Reset the extension string since it will be regenerated if we get
324 // reinitialized.
Mathias Agopian65421432017-03-08 11:49:05 -0800325 mExtensionString.clear();
Michael Lentine54466bc2015-01-27 09:01:03 -0800326
327 // Mark all objects remaining in the list as terminated, unless
328 // there are no reference to them, it which case, we're free to
329 // delete them.
330 size_t count = objects.size();
Dan Alberteacd31f2016-02-02 15:08:34 -0800331 ALOGW_IF(count, "eglTerminate() called w/ %zu objects remaining", count);
Mathias Agopian65421432017-03-08 11:49:05 -0800332 for (auto o : objects) {
Michael Lentine54466bc2015-01-27 09:01:03 -0800333 o->destroy();
334 }
335
336 // this marks all object handles are "terminated"
337 objects.clear();
Mathias Agopian518ec112011-05-13 16:21:08 -0700338 }
339
Mathias Agopian65421432017-03-08 11:49:05 -0800340 { // scope for refLock
341 std::unique_lock<std::mutex> _rl(refLock);
Michael Lentine54466bc2015-01-27 09:01:03 -0800342 eglIsInitialized = false;
Mathias Agopian65421432017-03-08 11:49:05 -0800343 refCond.notify_all();
Mathias Agopian5b287a62011-05-16 18:58:55 -0700344 }
345
Mathias Agopian518ec112011-05-13 16:21:08 -0700346 return res;
347}
348
Mathias Agopianfb87e542012-01-30 18:20:52 -0800349void egl_display_t::loseCurrent(egl_context_t * cur_c)
350{
351 if (cur_c) {
Mathias Agopiana4b2c042012-02-03 15:24:51 -0800352 egl_display_t* display = cur_c->getDisplay();
353 if (display) {
354 display->loseCurrentImpl(cur_c);
355 }
356 }
357}
Mathias Agopianfb87e542012-01-30 18:20:52 -0800358
Mathias Agopiana4b2c042012-02-03 15:24:51 -0800359void egl_display_t::loseCurrentImpl(egl_context_t * cur_c)
360{
361 // by construction, these are either 0 or valid (possibly terminated)
362 // it should be impossible for these to be invalid
363 ContextRef _cur_c(cur_c);
364 SurfaceRef _cur_r(cur_c ? get_surface(cur_c->read) : NULL);
365 SurfaceRef _cur_d(cur_c ? get_surface(cur_c->draw) : NULL);
Mathias Agopianfb87e542012-01-30 18:20:52 -0800366
Mathias Agopiana4b2c042012-02-03 15:24:51 -0800367 { // scope for the lock
Mathias Agopian65421432017-03-08 11:49:05 -0800368 std::lock_guard<std::mutex> _l(lock);
Mathias Agopianfb87e542012-01-30 18:20:52 -0800369 cur_c->onLooseCurrent();
370
Mathias Agopianfb87e542012-01-30 18:20:52 -0800371 }
Mathias Agopiana4b2c042012-02-03 15:24:51 -0800372
373 // This cannot be called with the lock held because it might end-up
374 // calling back into EGL (in particular when a surface is destroyed
375 // it calls ANativeWindow::disconnect
376 _cur_c.release();
377 _cur_r.release();
378 _cur_d.release();
Mathias Agopianfb87e542012-01-30 18:20:52 -0800379}
380
381EGLBoolean egl_display_t::makeCurrent(egl_context_t* c, egl_context_t* cur_c,
Mark Salyzyn92dc3fc2014-03-12 13:12:44 -0700382 EGLSurface draw, EGLSurface read, EGLContext /*ctx*/,
Mathias Agopianfb87e542012-01-30 18:20:52 -0800383 EGLSurface impl_draw, EGLSurface impl_read, EGLContext impl_ctx)
384{
Mathias Agopianfb87e542012-01-30 18:20:52 -0800385 EGLBoolean result;
Mathias Agopiana4b2c042012-02-03 15:24:51 -0800386
387 // by construction, these are either 0 or valid (possibly terminated)
388 // it should be impossible for these to be invalid
389 ContextRef _cur_c(cur_c);
390 SurfaceRef _cur_r(cur_c ? get_surface(cur_c->read) : NULL);
391 SurfaceRef _cur_d(cur_c ? get_surface(cur_c->draw) : NULL);
392
393 { // scope for the lock
Mathias Agopian65421432017-03-08 11:49:05 -0800394 std::lock_guard<std::mutex> _l(lock);
Mathias Agopianfb87e542012-01-30 18:20:52 -0800395 if (c) {
Mathias Agopiana4b2c042012-02-03 15:24:51 -0800396 result = 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 c->onMakeCurrent(draw, read);
400 }
401 } else {
402 result = cur_c->cnx->egl.eglMakeCurrent(
Mathias Agopianada798b2012-02-13 17:09:30 -0800403 disp.dpy, impl_draw, impl_read, impl_ctx);
Mathias Agopiana4b2c042012-02-03 15:24:51 -0800404 if (result == EGL_TRUE) {
405 cur_c->onLooseCurrent();
406 }
Mathias Agopianfb87e542012-01-30 18:20:52 -0800407 }
408 }
Mathias Agopiana4b2c042012-02-03 15:24:51 -0800409
410 if (result == EGL_TRUE) {
411 // This cannot be called with the lock held because it might end-up
412 // calling back into EGL (in particular when a surface is destroyed
413 // it calls ANativeWindow::disconnect
414 _cur_c.release();
415 _cur_r.release();
416 _cur_d.release();
417 }
418
Mathias Agopianfb87e542012-01-30 18:20:52 -0800419 return result;
420}
Mathias Agopian518ec112011-05-13 16:21:08 -0700421
Jesse Hallc2e41222013-08-08 13:40:22 -0700422bool egl_display_t::haveExtension(const char* name, size_t nameLen) const {
423 if (!nameLen) {
424 nameLen = strlen(name);
425 }
Mathias Agopian65421432017-03-08 11:49:05 -0800426 return findExtension(mExtensionString.c_str(), name, nameLen);
Jesse Hallc2e41222013-08-08 13:40:22 -0700427}
428
Jesse Halla0fef1c2012-04-17 12:02:26 -0700429// ----------------------------------------------------------------------------
Mathias Agopian518ec112011-05-13 16:21:08 -0700430}; // namespace android
431// ----------------------------------------------------------------------------