blob: f5c1422599e79aa227b9004049bd15af8c5b1728 [file] [log] [blame]
Jesse Hall94cdba92013-07-11 09:40:35 -07001/*
Mathias Agopiande586972009-05-28 17:39:03 -07002 ** Copyright 2007, The Android Open Source Project
3 **
Jesse Hall94cdba92013-07-11 09:40:35 -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 Agopiande586972009-05-28 17:39:03 -07007 **
Jesse Hall94cdba92013-07-11 09:40:35 -07008 ** http://www.apache.org/licenses/LICENSE-2.0
Mathias Agopiande586972009-05-28 17:39:03 -07009 **
Jesse Hall94cdba92013-07-11 09:40:35 -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 Agopiande586972009-05-28 17:39:03 -070014 ** limitations under the License.
15 */
16
Jesse Hall1966cf62016-12-20 15:24:28 -080017//#define LOG_NDEBUG 0
18
19#include <array>
Mathias Agopiande586972009-05-28 17:39:03 -070020#include <ctype.h>
Mathias Agopian99381422013-04-23 20:52:29 +020021#include <dirent.h>
Mark Salyzyna5e161b2016-09-29 08:08:05 -070022#include <dlfcn.h>
23#include <errno.h>
24#include <limits.h>
25#include <stdio.h>
26#include <stdlib.h>
27#include <string.h>
Mathias Agopiande586972009-05-28 17:39:03 -070028
Jesse Hall1966cf62016-12-20 15:24:28 -080029#include <android/dlext.h>
David 'Digit' Turner80b30c22011-08-26 17:38:47 +020030#include <cutils/properties.h>
Mark Salyzyn7823e122016-09-29 08:08:05 -070031#include <log/log.h>
Mathias Agopiande586972009-05-28 17:39:03 -070032
33#include <EGL/egl.h>
34
Mathias Agopian1cadb252011-05-23 17:26:14 -070035#include "egldefs.h"
Mathias Agopian1cadb252011-05-23 17:26:14 -070036#include "Loader.h"
Mathias Agopiande586972009-05-28 17:39:03 -070037
38// ----------------------------------------------------------------------------
39namespace android {
40// ----------------------------------------------------------------------------
41
42
43/*
Mathias Agopian99381422013-04-23 20:52:29 +020044 * EGL userspace drivers must be provided either:
45 * - as a single library:
46 * /vendor/lib/egl/libGLES.so
47 *
48 * - as separate libraries:
49 * /vendor/lib/egl/libEGL.so
50 * /vendor/lib/egl/libGLESv1_CM.so
51 * /vendor/lib/egl/libGLESv2.so
52 *
53 * The software renderer for the emulator must be provided as a single
54 * library at:
55 *
56 * /system/lib/egl/libGLES_android.so
57 *
58 *
59 * For backward compatibility and to facilitate the transition to
60 * this new naming scheme, the loader will additionally look for:
Jesse Hall94cdba92013-07-11 09:40:35 -070061 *
Mathias Agopian99381422013-04-23 20:52:29 +020062 * /{vendor|system}/lib/egl/lib{GLES | [EGL|GLESv1_CM|GLESv2]}_*.so
Jesse Hall94cdba92013-07-11 09:40:35 -070063 *
Mathias Agopiande586972009-05-28 17:39:03 -070064 */
65
66ANDROID_SINGLETON_STATIC_INSTANCE( Loader )
67
David 'Digit' Turner80b30c22011-08-26 17:38:47 +020068/* This function is called to check whether we run inside the emulator,
69 * and if this is the case whether GLES GPU emulation is supported.
70 *
71 * Returned values are:
72 * -1 -> not running inside the emulator
73 * 0 -> running inside the emulator, but GPU emulation not supported
74 * 1 -> running inside the emulator, GPU emulation is supported
Nicolas Capens776951f2015-11-06 10:10:21 -050075 * through the "emulation" host-side OpenGL ES implementation.
76 * 2 -> running inside the emulator, GPU emulation is supported
77 * through a guest-side vendor driver's OpenGL ES implementation.
David 'Digit' Turner80b30c22011-08-26 17:38:47 +020078 */
79static int
80checkGlesEmulationStatus(void)
81{
82 /* We're going to check for the following kernel parameters:
83 *
84 * qemu=1 -> tells us that we run inside the emulator
85 * android.qemu.gles=<number> -> tells us the GLES GPU emulation status
86 *
87 * Note that we will return <number> if we find it. This let us support
88 * more additionnal emulation modes in the future.
89 */
90 char prop[PROPERTY_VALUE_MAX];
91 int result = -1;
92
93 /* First, check for qemu=1 */
94 property_get("ro.kernel.qemu",prop,"0");
95 if (atoi(prop) != 1)
96 return -1;
97
98 /* We are in the emulator, get GPU status value */
bohu69e5b1a2016-02-19 17:15:20 -080099 property_get("qemu.gles",prop,"0");
David 'Digit' Turner80b30c22011-08-26 17:38:47 +0200100 return atoi(prop);
101}
102
Mathias Agopiande586972009-05-28 17:39:03 -0700103// ----------------------------------------------------------------------------
104
Mathias Agopiand75f84d2012-06-05 21:44:43 -0700105static char const * getProcessCmdline() {
106 long pid = getpid();
107 char procPath[128];
108 snprintf(procPath, 128, "/proc/%ld/cmdline", pid);
109 FILE * file = fopen(procPath, "r");
110 if (file) {
111 static char cmdline[256];
112 char *str = fgets(cmdline, sizeof(cmdline) - 1, file);
113 fclose(file);
114 if (str) {
115 return cmdline;
116 }
117 }
118 return NULL;
119}
120
121// ----------------------------------------------------------------------------
122
Jesse Hall94cdba92013-07-11 09:40:35 -0700123Loader::driver_t::driver_t(void* gles)
Mathias Agopiande586972009-05-28 17:39:03 -0700124{
125 dso[0] = gles;
126 for (size_t i=1 ; i<NELEM(dso) ; i++)
127 dso[i] = 0;
128}
129
Jesse Hall94cdba92013-07-11 09:40:35 -0700130Loader::driver_t::~driver_t()
Mathias Agopiande586972009-05-28 17:39:03 -0700131{
132 for (size_t i=0 ; i<NELEM(dso) ; i++) {
133 if (dso[i]) {
134 dlclose(dso[i]);
135 dso[i] = 0;
136 }
137 }
138}
139
140status_t Loader::driver_t::set(void* hnd, int32_t api)
141{
142 switch (api) {
143 case EGL:
144 dso[0] = hnd;
145 break;
146 case GLESv1_CM:
147 dso[1] = hnd;
148 break;
149 case GLESv2:
150 dso[2] = hnd;
151 break;
152 default:
153 return BAD_INDEX;
154 }
155 return NO_ERROR;
156}
157
158// ----------------------------------------------------------------------------
159
Mathias Agopiande586972009-05-28 17:39:03 -0700160Loader::Loader()
Jesse Hall1966cf62016-12-20 15:24:28 -0800161 : getProcAddress(NULL),
162 mLibGui(nullptr),
163 mGetDriverNamespace(nullptr)
164{
165 // FIXME: See note in GraphicsEnv.h about android_getDriverNamespace().
166 // libgui should already be loaded in any process that uses libEGL, but
167 // if for some reason it isn't, then we're not going to get a driver
168 // namespace anyway, so don't force it to be loaded.
169 mLibGui = dlopen("libgui.so", RTLD_NOLOAD | RTLD_LOCAL | RTLD_LAZY);
170 if (!mLibGui) {
171 ALOGD("failed to load libgui: %s", dlerror());
172 return;
173 }
174 mGetDriverNamespace = reinterpret_cast<decltype(mGetDriverNamespace)>(
175 dlsym(mLibGui, "android_getDriverNamespace"));
Mathias Agopiande586972009-05-28 17:39:03 -0700176}
177
Mathias Agopian99381422013-04-23 20:52:29 +0200178Loader::~Loader() {
Jesse Hall1966cf62016-12-20 15:24:28 -0800179 if (mLibGui)
180 dlclose(mLibGui);
Mathias Agopiande586972009-05-28 17:39:03 -0700181}
182
Jesse Hallc07b5202013-07-04 12:08:16 -0700183static void* load_wrapper(const char* path) {
184 void* so = dlopen(path, RTLD_NOW | RTLD_LOCAL);
185 ALOGE_IF(!so, "dlopen(\"%s\") failed: %s", path, dlerror());
186 return so;
187}
188
Evgenii Stepanovc2466e62015-07-08 15:49:52 -0700189#ifndef EGL_WRAPPER_DIR
190#if defined(__LP64__)
191#define EGL_WRAPPER_DIR "/system/lib64"
192#else
193#define EGL_WRAPPER_DIR "/system/lib"
194#endif
195#endif
196
bohu69e5b1a2016-02-19 17:15:20 -0800197static void setEmulatorGlesValue(void) {
198 char prop[PROPERTY_VALUE_MAX];
199 property_get("ro.kernel.qemu", prop, "0");
200 if (atoi(prop) != 1) return;
201
202 property_get("ro.kernel.qemu.gles",prop,"0");
203 if (atoi(prop) == 1) {
204 ALOGD("Emulator has host GPU support, qemu.gles is set to 1.");
205 property_set("qemu.gles", "1");
206 return;
207 }
208
209 // for now, checking the following
210 // directory is good enough for emulator system images
211 const char* vendor_lib_path =
212#if defined(__LP64__)
213 "/vendor/lib64/egl";
214#else
215 "/vendor/lib/egl";
216#endif
217
218 const bool has_vendor_lib = (access(vendor_lib_path, R_OK) == 0);
219 if (has_vendor_lib) {
220 ALOGD("Emulator has vendor provided software renderer, qemu.gles is set to 2.");
221 property_set("qemu.gles", "2");
222 } else {
223 ALOGD("Emulator without GPU support detected. "
224 "Fallback to legacy software renderer, qemu.gles is set to 0.");
225 property_set("qemu.gles", "0");
226 }
227}
228
Mathias Agopianada798b2012-02-13 17:09:30 -0800229void* Loader::open(egl_connection_t* cnx)
Mathias Agopiande586972009-05-28 17:39:03 -0700230{
Mathias Agopiande586972009-05-28 17:39:03 -0700231 void* dso;
Mathias Agopiande586972009-05-28 17:39:03 -0700232 driver_t* hnd = 0;
Jesse Hall94cdba92013-07-11 09:40:35 -0700233
bohu69e5b1a2016-02-19 17:15:20 -0800234 setEmulatorGlesValue();
235
Mathias Agopian99381422013-04-23 20:52:29 +0200236 dso = load_driver("GLES", cnx, EGL | GLESv1_CM | GLESv2);
237 if (dso) {
238 hnd = new driver_t(dso);
239 } else {
240 // Always load EGL first
241 dso = load_driver("EGL", cnx, EGL);
Mathias Agopiande586972009-05-28 17:39:03 -0700242 if (dso) {
243 hnd = new driver_t(dso);
Mathias Agopian99381422013-04-23 20:52:29 +0200244 hnd->set( load_driver("GLESv1_CM", cnx, GLESv1_CM), GLESv1_CM );
245 hnd->set( load_driver("GLESv2", cnx, GLESv2), GLESv2 );
Mathias Agopiande586972009-05-28 17:39:03 -0700246 }
247 }
248
Mathias Agopian99381422013-04-23 20:52:29 +0200249 LOG_ALWAYS_FATAL_IF(!hnd, "couldn't find an OpenGL ES implementation");
Jesse Hallc07b5202013-07-04 12:08:16 -0700250
Evgenii Stepanovc2466e62015-07-08 15:49:52 -0700251 cnx->libEgl = load_wrapper(EGL_WRAPPER_DIR "/libEGL.so");
252 cnx->libGles2 = load_wrapper(EGL_WRAPPER_DIR "/libGLESv2.so");
253 cnx->libGles1 = load_wrapper(EGL_WRAPPER_DIR "/libGLESv1_CM.so");
254
Michael Chockc0ec5e22014-01-27 08:14:33 -0800255 LOG_ALWAYS_FATAL_IF(!cnx->libEgl,
256 "couldn't load system EGL wrapper libraries");
257
Jesse Hallc07b5202013-07-04 12:08:16 -0700258 LOG_ALWAYS_FATAL_IF(!cnx->libGles2 || !cnx->libGles1,
259 "couldn't load system OpenGL ES wrapper libraries");
260
Mathias Agopiande586972009-05-28 17:39:03 -0700261 return (void*)hnd;
262}
263
264status_t Loader::close(void* driver)
265{
266 driver_t* hnd = (driver_t*)driver;
267 delete hnd;
268 return NO_ERROR;
269}
270
Jesse Hall94cdba92013-07-11 09:40:35 -0700271void Loader::init_api(void* dso,
272 char const * const * api,
273 __eglMustCastToProperFunctionPointerType* curr,
274 getProcAddressType getProcAddress)
Mathias Agopiande586972009-05-28 17:39:03 -0700275{
Mathias Agopian7773c432012-02-13 20:06:08 -0800276 const ssize_t SIZE = 256;
Mathias Agopian0ad71a92011-05-11 20:37:47 -0700277 char scrap[SIZE];
Mathias Agopiande586972009-05-28 17:39:03 -0700278 while (*api) {
279 char const * name = *api;
Jesse Hall94cdba92013-07-11 09:40:35 -0700280 __eglMustCastToProperFunctionPointerType f =
Mathias Agopiande586972009-05-28 17:39:03 -0700281 (__eglMustCastToProperFunctionPointerType)dlsym(dso, name);
282 if (f == NULL) {
283 // couldn't find the entry-point, use eglGetProcAddress()
284 f = getProcAddress(name);
285 }
286 if (f == NULL) {
287 // Try without the OES postfix
288 ssize_t index = ssize_t(strlen(name)) - 3;
Mathias Agopian0ad71a92011-05-11 20:37:47 -0700289 if ((index>0 && (index<SIZE-1)) && (!strcmp(name+index, "OES"))) {
Mathias Agopiande586972009-05-28 17:39:03 -0700290 strncpy(scrap, name, index);
291 scrap[index] = 0;
292 f = (__eglMustCastToProperFunctionPointerType)dlsym(dso, scrap);
Steve Block9d453682011-12-20 16:23:08 +0000293 //ALOGD_IF(f, "found <%s> instead", scrap);
Mathias Agopiande586972009-05-28 17:39:03 -0700294 }
295 }
296 if (f == NULL) {
297 // Try with the OES postfix
Mathias Agopian0ad71a92011-05-11 20:37:47 -0700298 ssize_t index = ssize_t(strlen(name)) - 3;
299 if (index>0 && strcmp(name+index, "OES")) {
300 snprintf(scrap, SIZE, "%sOES", name);
Mathias Agopiande586972009-05-28 17:39:03 -0700301 f = (__eglMustCastToProperFunctionPointerType)dlsym(dso, scrap);
Steve Block9d453682011-12-20 16:23:08 +0000302 //ALOGD_IF(f, "found <%s> instead", scrap);
Mathias Agopiande586972009-05-28 17:39:03 -0700303 }
304 }
305 if (f == NULL) {
Steve Block9d453682011-12-20 16:23:08 +0000306 //ALOGD("%s", name);
Mathias Agopiande586972009-05-28 17:39:03 -0700307 f = (__eglMustCastToProperFunctionPointerType)gl_unimplemented;
Mathias Agopian48d438d2012-01-28 21:44:00 -0800308
309 /*
310 * GL_EXT_debug_label is special, we always report it as
311 * supported, it's handled by GLES_trace. If GLES_trace is not
312 * enabled, then these are no-ops.
313 */
314 if (!strcmp(name, "glInsertEventMarkerEXT")) {
315 f = (__eglMustCastToProperFunctionPointerType)gl_noop;
316 } else if (!strcmp(name, "glPushGroupMarkerEXT")) {
317 f = (__eglMustCastToProperFunctionPointerType)gl_noop;
318 } else if (!strcmp(name, "glPopGroupMarkerEXT")) {
319 f = (__eglMustCastToProperFunctionPointerType)gl_noop;
320 }
Mathias Agopiande586972009-05-28 17:39:03 -0700321 }
322 *curr++ = f;
323 api++;
324 }
325}
326
Jesse Hall1966cf62016-12-20 15:24:28 -0800327static void* load_system_driver(const char* kind) {
Mathias Agopian99381422013-04-23 20:52:29 +0200328 class MatchFile {
329 public:
330 static String8 find(const char* kind) {
331 String8 result;
Nicolas Capens776951f2015-11-06 10:10:21 -0500332 int emulationStatus = checkGlesEmulationStatus();
333 switch (emulationStatus) {
334 case 0:
Nicolas Capens776951f2015-11-06 10:10:21 -0500335#if defined(__LP64__)
336 result.setTo("/system/lib64/egl/libGLES_android.so");
337#else
338 result.setTo("/system/lib/egl/libGLES_android.so");
339#endif
340 return result;
341 case 1:
342 // Use host-side OpenGL through the "emulation" library
343#if defined(__LP64__)
344 result.appendFormat("/system/lib64/egl/lib%s_emulation.so", kind);
345#else
346 result.appendFormat("/system/lib/egl/lib%s_emulation.so", kind);
347#endif
348 return result;
349 default:
350 // Not in emulator, or use other guest-side implementation
351 break;
352 }
353
Mathias Agopian99381422013-04-23 20:52:29 +0200354 String8 pattern;
355 pattern.appendFormat("lib%s", kind);
356 const char* const searchPaths[] = {
Dan Willemsen8edb8f52014-02-16 10:23:54 -0800357#if defined(__LP64__)
358 "/vendor/lib64/egl",
359 "/system/lib64/egl"
360#else
Mathias Agopian99381422013-04-23 20:52:29 +0200361 "/vendor/lib/egl",
362 "/system/lib/egl"
Dan Willemsen8edb8f52014-02-16 10:23:54 -0800363#endif
Mathias Agopian99381422013-04-23 20:52:29 +0200364 };
Brian Swetland2b9e4f62010-09-20 12:58:15 -0700365
Mathias Agopian99381422013-04-23 20:52:29 +0200366 // first, we search for the exact name of the GLES userspace
367 // driver in both locations.
368 // i.e.:
369 // libGLES.so, or:
370 // libEGL.so, libGLESv1_CM.so, libGLESv2.so
371
372 for (size_t i=0 ; i<NELEM(searchPaths) ; i++) {
373 if (find(result, pattern, searchPaths[i], true)) {
374 return result;
375 }
376 }
377
378 // for compatibility with the old "egl.cfg" naming convention
379 // we look for files that match:
380 // libGLES_*.so, or:
381 // libEGL_*.so, libGLESv1_CM_*.so, libGLESv2_*.so
382
383 pattern.append("_");
384 for (size_t i=0 ; i<NELEM(searchPaths) ; i++) {
385 if (find(result, pattern, searchPaths[i], false)) {
386 return result;
387 }
388 }
389
390 // we didn't find the driver. gah.
391 result.clear();
392 return result;
Brian Swetland2b9e4f62010-09-20 12:58:15 -0700393 }
Mathias Agopian99381422013-04-23 20:52:29 +0200394
395 private:
396 static bool find(String8& result,
397 const String8& pattern, const char* const search, bool exact) {
Mathias Agopian99381422013-04-23 20:52:29 +0200398 if (exact) {
399 String8 absolutePath;
400 absolutePath.appendFormat("%s/%s.so", search, pattern.string());
401 if (!access(absolutePath.string(), R_OK)) {
402 result = absolutePath;
403 return true;
404 }
405 return false;
406 }
407
408 DIR* d = opendir(search);
409 if (d != NULL) {
410 struct dirent cur;
411 struct dirent* e;
412 while (readdir_r(d, &cur, &e) == 0 && e) {
413 if (e->d_type == DT_DIR) {
414 continue;
415 }
416 if (!strcmp(e->d_name, "libGLES_android.so")) {
417 // always skip the software renderer
418 continue;
419 }
420 if (strstr(e->d_name, pattern.string()) == e->d_name) {
421 if (!strcmp(e->d_name + strlen(e->d_name) - 3, ".so")) {
422 result.clear();
423 result.appendFormat("%s/%s", search, e->d_name);
424 closedir(d);
425 return true;
426 }
427 }
428 }
429 closedir(d);
430 }
431 return false;
432 }
433 };
434
435
436 String8 absolutePath = MatchFile::find(kind);
437 if (absolutePath.isEmpty()) {
438 // this happens often, we don't want to log an error
439 return 0;
Mathias Agopian8c173842009-09-20 16:01:02 -0700440 }
Mathias Agopian99381422013-04-23 20:52:29 +0200441 const char* const driver_absolute_path = absolutePath.string();
Mathias Agopiande586972009-05-28 17:39:03 -0700442
Mathias Agopian8c173842009-09-20 16:01:02 -0700443 void* dso = dlopen(driver_absolute_path, RTLD_NOW | RTLD_LOCAL);
444 if (dso == 0) {
445 const char* err = dlerror();
Steve Blocke6f43dd2012-01-06 19:20:56 +0000446 ALOGE("load_driver(%s): %s", driver_absolute_path, err?err:"unknown");
Mathias Agopian8c173842009-09-20 16:01:02 -0700447 return 0;
448 }
449
Steve Block9d453682011-12-20 16:23:08 +0000450 ALOGD("loaded %s", driver_absolute_path);
Mathias Agopianbaca89c2009-08-20 19:09:34 -0700451
Jesse Hall1966cf62016-12-20 15:24:28 -0800452 return dso;
453}
454
455static const std::array<const char*, 2> HAL_SUBNAME_KEY_PROPERTIES = {{
456 "ro.hardware.egl",
457 "ro.board.platform",
458}};
459
460static void* load_updated_driver(const char* kind, android_namespace_t* ns) {
461 const android_dlextinfo dlextinfo = {
462 .flags = ANDROID_DLEXT_USE_NAMESPACE,
463 .library_namespace = ns,
464 };
465 void* so = nullptr;
466 char prop[PROPERTY_VALUE_MAX + 1];
467 for (auto key : HAL_SUBNAME_KEY_PROPERTIES) {
468 if (property_get(key, prop, nullptr) > 0) {
469 String8 name;
470 name.appendFormat("lib%s_%s.so", kind, prop);
471 so = android_dlopen_ext(name.string(), RTLD_LOCAL | RTLD_NOW,
472 &dlextinfo);
473 if (so)
474 return so;
475 }
476 }
477 return nullptr;
478}
479
480void *Loader::load_driver(const char* kind,
481 egl_connection_t* cnx, uint32_t mask)
482{
483 void* dso = nullptr;
484 if (mGetDriverNamespace) {
485 android_namespace_t* ns = mGetDriverNamespace();
486 if (ns) {
487 dso = load_updated_driver(kind, ns);
488 }
489 }
490 if (!dso) {
491 dso = load_system_driver(kind);
492 if (!dso)
493 return NULL;
494 }
495
Mathias Agopiande586972009-05-28 17:39:03 -0700496 if (mask & EGL) {
497 getProcAddress = (getProcAddressType)dlsym(dso, "eglGetProcAddress");
498
Jesse Hall94cdba92013-07-11 09:40:35 -0700499 ALOGE_IF(!getProcAddress,
Jesse Hall1966cf62016-12-20 15:24:28 -0800500 "can't find eglGetProcAddress() in EGL driver library");
Mathias Agopiande586972009-05-28 17:39:03 -0700501
Mathias Agopian618fa102009-10-14 02:06:37 -0700502 egl_t* egl = &cnx->egl;
Mathias Agopiande586972009-05-28 17:39:03 -0700503 __eglMustCastToProperFunctionPointerType* curr =
504 (__eglMustCastToProperFunctionPointerType*)egl;
505 char const * const * api = egl_names;
506 while (*api) {
507 char const * name = *api;
Jesse Hall94cdba92013-07-11 09:40:35 -0700508 __eglMustCastToProperFunctionPointerType f =
Mathias Agopiande586972009-05-28 17:39:03 -0700509 (__eglMustCastToProperFunctionPointerType)dlsym(dso, name);
510 if (f == NULL) {
511 // couldn't find the entry-point, use eglGetProcAddress()
512 f = getProcAddress(name);
513 if (f == NULL) {
514 f = (__eglMustCastToProperFunctionPointerType)0;
515 }
516 }
517 *curr++ = f;
518 api++;
519 }
520 }
Jesse Hall94cdba92013-07-11 09:40:35 -0700521
Mathias Agopiande586972009-05-28 17:39:03 -0700522 if (mask & GLESv1_CM) {
Mathias Agopian618fa102009-10-14 02:06:37 -0700523 init_api(dso, gl_names,
524 (__eglMustCastToProperFunctionPointerType*)
Mathias Agopian7773c432012-02-13 20:06:08 -0800525 &cnx->hooks[egl_connection_t::GLESv1_INDEX]->gl,
Mathias Agopian618fa102009-10-14 02:06:37 -0700526 getProcAddress);
Mathias Agopiande586972009-05-28 17:39:03 -0700527 }
528
529 if (mask & GLESv2) {
Mathias Agopian618fa102009-10-14 02:06:37 -0700530 init_api(dso, gl_names,
531 (__eglMustCastToProperFunctionPointerType*)
Mathias Agopian7773c432012-02-13 20:06:08 -0800532 &cnx->hooks[egl_connection_t::GLESv2_INDEX]->gl,
Mathias Agopiande586972009-05-28 17:39:03 -0700533 getProcAddress);
534 }
Jesse Hall94cdba92013-07-11 09:40:35 -0700535
Mathias Agopiande586972009-05-28 17:39:03 -0700536 return dso;
537}
538
539// ----------------------------------------------------------------------------
540}; // namespace android
541// ----------------------------------------------------------------------------