blob: 5f04f644b66149f6f257fc7e8d2f9ffb783570fb [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 Hall7a8d83e2016-12-20 15:24:28 -080017//#define LOG_NDEBUG 0
Jesse Hall1508ae62017-01-19 17:43:26 -080018#define ATRACE_TAG ATRACE_TAG_GRAPHICS
Jesse Hall7a8d83e2016-12-20 15:24:28 -080019
Tim Van Patten5f744f12018-12-12 11:46:21 -070020#include <EGL/Loader.h>
Mathias Agopian311b4792017-02-28 15:00:49 -080021
Mathias Agopian65421432017-03-08 11:49:05 -080022#include <string>
23
Mathias Agopian99381422013-04-23 20:52:29 +020024#include <dirent.h>
Mark Salyzyna5e161b2016-09-29 08:08:05 -070025#include <dlfcn.h>
Mathias Agopiande586972009-05-28 17:39:03 -070026
Jesse Hall7a8d83e2016-12-20 15:24:28 -080027#include <android/dlext.h>
Mark Salyzyn7823e122016-09-29 08:08:05 -070028#include <log/log.h>
Yiwei Zhangd9861812019-02-13 11:51:55 -080029#include <utils/Timers.h>
Mathias Agopian311b4792017-02-28 15:00:49 -080030
Jiyong Parka243e5d2017-06-21 12:26:51 +090031#ifndef __ANDROID_VNDK__
Jiyong Park27c39e12017-05-08 13:00:02 +090032#include <graphicsenv/GraphicsEnv.h>
Jiyong Parka243e5d2017-06-21 12:26:51 +090033#endif
Justin Yunb7320302017-05-22 15:13:40 +090034#include <vndksupport/linker.h>
Mathias Agopiande586972009-05-28 17:39:03 -070035
Cody Northrop68d10352018-10-15 07:22:09 -060036#include "egl_platform_entries.h"
Mathias Agopian65421432017-03-08 11:49:05 -080037#include "egl_trace.h"
Mathias Agopian1cadb252011-05-23 17:26:14 -070038#include "egldefs.h"
Courtney Goeltzenleuchterb91b9892018-10-23 16:28:00 -060039#include <EGL/eglext_angle.h>
Mathias Agopiande586972009-05-28 17:39:03 -070040
Mathias Agopiande586972009-05-28 17:39:03 -070041namespace android {
Mathias Agopiande586972009-05-28 17:39:03 -070042
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 *
Mathias Agopian99381422013-04-23 20:52:29 +020053 * For backward compatibility and to facilitate the transition to
54 * this new naming scheme, the loader will additionally look for:
Jesse Hall94cdba92013-07-11 09:40:35 -070055 *
Mathias Agopian99381422013-04-23 20:52:29 +020056 * /{vendor|system}/lib/egl/lib{GLES | [EGL|GLESv1_CM|GLESv2]}_*.so
Jesse Hall94cdba92013-07-11 09:40:35 -070057 *
Mathias Agopiande586972009-05-28 17:39:03 -070058 */
59
Mathias Agopian65421432017-03-08 11:49:05 -080060Loader& Loader::getInstance() {
61 static Loader loader;
62 return loader;
63}
Mathias Agopiande586972009-05-28 17:39:03 -070064
Jesse Hall1508ae62017-01-19 17:43:26 -080065static void* do_dlopen(const char* path, int mode) {
66 ATRACE_CALL();
67 return dlopen(path, mode);
68}
69
Jiyong Park5910dc72017-04-05 14:23:52 +090070static void* do_android_dlopen_ext(const char* path, int mode, const android_dlextinfo* info) {
71 ATRACE_CALL();
72 return android_dlopen_ext(path, mode, info);
73}
74
Justin Yunb7320302017-05-22 15:13:40 +090075static void* do_android_load_sphal_library(const char* path, int mode) {
76 ATRACE_CALL();
77 return android_load_sphal_library(path, mode);
78}
79
Yiwei Zhang5e21eb32019-06-05 00:26:03 -070080static int do_android_unload_sphal_library(void* dso) {
81 ATRACE_CALL();
82 return android_unload_sphal_library(dso);
83}
84
Jesse Hall94cdba92013-07-11 09:40:35 -070085Loader::driver_t::driver_t(void* gles)
Mathias Agopiande586972009-05-28 17:39:03 -070086{
87 dso[0] = gles;
88 for (size_t i=1 ; i<NELEM(dso) ; i++)
Yi Kong48a6cd22018-07-18 10:07:09 -070089 dso[i] = nullptr;
Mathias Agopiande586972009-05-28 17:39:03 -070090}
91
Jesse Hall94cdba92013-07-11 09:40:35 -070092Loader::driver_t::~driver_t()
Mathias Agopiande586972009-05-28 17:39:03 -070093{
94 for (size_t i=0 ; i<NELEM(dso) ; i++) {
95 if (dso[i]) {
96 dlclose(dso[i]);
Yi Kong48a6cd22018-07-18 10:07:09 -070097 dso[i] = nullptr;
Mathias Agopiande586972009-05-28 17:39:03 -070098 }
99 }
100}
101
Mathias Agopian65421432017-03-08 11:49:05 -0800102int Loader::driver_t::set(void* hnd, int32_t api)
Mathias Agopiande586972009-05-28 17:39:03 -0700103{
104 switch (api) {
105 case EGL:
106 dso[0] = hnd;
107 break;
108 case GLESv1_CM:
109 dso[1] = hnd;
110 break;
111 case GLESv2:
112 dso[2] = hnd;
113 break;
114 default:
Mathias Agopian65421432017-03-08 11:49:05 -0800115 return -EOVERFLOW;
Mathias Agopiande586972009-05-28 17:39:03 -0700116 }
Mathias Agopian65421432017-03-08 11:49:05 -0800117 return 0;
Mathias Agopiande586972009-05-28 17:39:03 -0700118}
119
Mathias Agopiande586972009-05-28 17:39:03 -0700120Loader::Loader()
Yi Kong48a6cd22018-07-18 10:07:09 -0700121 : getProcAddress(nullptr)
Jesse Hall7a8d83e2016-12-20 15:24:28 -0800122{
Mathias Agopiande586972009-05-28 17:39:03 -0700123}
124
Mathias Agopian99381422013-04-23 20:52:29 +0200125Loader::~Loader() {
Mathias Agopiande586972009-05-28 17:39:03 -0700126}
127
Jesse Hallc07b5202013-07-04 12:08:16 -0700128static void* load_wrapper(const char* path) {
Jesse Hall1508ae62017-01-19 17:43:26 -0800129 void* so = do_dlopen(path, RTLD_NOW | RTLD_LOCAL);
Jesse Hallc07b5202013-07-04 12:08:16 -0700130 ALOGE_IF(!so, "dlopen(\"%s\") failed: %s", path, dlerror());
131 return so;
132}
133
Evgenii Stepanovc2466e62015-07-08 15:49:52 -0700134#ifndef EGL_WRAPPER_DIR
135#if defined(__LP64__)
136#define EGL_WRAPPER_DIR "/system/lib64"
137#else
138#define EGL_WRAPPER_DIR "/system/lib"
139#endif
140#endif
141
Peiyong Lin0d10b252019-04-30 18:03:04 -0700142static const char* DRIVER_SUFFIX_PROPERTY = "ro.hardware.egl";
143
Peiyong Lin9f0c79d2019-04-22 10:14:57 -0700144static const char* HAL_SUBNAME_KEY_PROPERTIES[2] = {
Peiyong Lin0d10b252019-04-30 18:03:04 -0700145 DRIVER_SUFFIX_PROPERTY,
Peiyong Lin9f0c79d2019-04-22 10:14:57 -0700146 "ro.board.platform",
147};
148
Yiwei Zhang5e21eb32019-06-05 00:26:03 -0700149static bool should_unload_system_driver(egl_connection_t* cnx) {
150 // Return false if the system driver has been unloaded once.
151 if (cnx->systemDriverUnloaded) {
152 return false;
153 }
154
155 // Return true if Angle namespace is set.
156 android_namespace_t* ns = android::GraphicsEnv::getInstance().getAngleNamespace();
157 if (ns) {
158 return true;
159 }
160
161#ifndef __ANDROID_VNDK__
162 // Return true if updated driver namespace is set.
163 ns = android::GraphicsEnv::getInstance().getDriverNamespace();
164 if (ns) {
165 return true;
166 }
167#endif
168
169 return false;
170}
171
172static void uninit_api(char const* const* api, __eglMustCastToProperFunctionPointerType* curr) {
173 while (*api) {
174 *curr++ = nullptr;
175 api++;
176 }
177}
178
179void Loader::unload_system_driver(egl_connection_t* cnx) {
180 ATRACE_CALL();
181
182 uninit_api(gl_names,
183 (__eglMustCastToProperFunctionPointerType*)&cnx
184 ->hooks[egl_connection_t::GLESv2_INDEX]
185 ->gl);
186 uninit_api(gl_names,
187 (__eglMustCastToProperFunctionPointerType*)&cnx
188 ->hooks[egl_connection_t::GLESv1_INDEX]
189 ->gl);
190 uninit_api(egl_names, (__eglMustCastToProperFunctionPointerType*)&cnx->egl);
191
192 if (cnx->dso) {
193 ALOGD("Unload system gl driver.");
194 driver_t* hnd = (driver_t*)cnx->dso;
195 if (hnd->dso[2]) {
196 do_android_unload_sphal_library(hnd->dso[2]);
197 }
198 if (hnd->dso[1]) {
199 do_android_unload_sphal_library(hnd->dso[1]);
200 }
201 if (hnd->dso[0]) {
202 do_android_unload_sphal_library(hnd->dso[0]);
203 }
204 cnx->dso = nullptr;
205 }
206
207 cnx->systemDriverUnloaded = true;
Charlie Lao95c7aea2020-01-10 11:12:03 -0800208 cnx->loadedDriverType = egl_connection_t::GLES_NO_DRIVER;
Yiwei Zhang5e21eb32019-06-05 00:26:03 -0700209}
210
Mathias Agopianada798b2012-02-13 17:09:30 -0800211void* Loader::open(egl_connection_t* cnx)
Mathias Agopiande586972009-05-28 17:39:03 -0700212{
Jesse Hall1508ae62017-01-19 17:43:26 -0800213 ATRACE_CALL();
Yiwei Zhangd9861812019-02-13 11:51:55 -0800214 const nsecs_t openTime = systemTime();
Jesse Hall1508ae62017-01-19 17:43:26 -0800215
Yiwei Zhang5e21eb32019-06-05 00:26:03 -0700216 if (should_unload_system_driver(cnx)) {
217 unload_system_driver(cnx);
218 }
219
220 // If a driver has been loaded, return the driver directly.
221 if (cnx->dso) {
222 return cnx->dso;
223 }
224
Tim Van Patten5f744f12018-12-12 11:46:21 -0700225 // Check if we should use ANGLE early, so loading each driver doesn't require repeated queries.
226 if (android::GraphicsEnv::getInstance().shouldUseAngle()) {
227 cnx->shouldUseAngle = true;
228 } else {
229 cnx->shouldUseAngle = false;
230 }
Charlie Lao95c7aea2020-01-10 11:12:03 -0800231 cnx->loadedDriverType = egl_connection_t::GLES_NO_DRIVER;
Tim Van Patten5f744f12018-12-12 11:46:21 -0700232
Peiyong Lin8cd204d2019-04-19 14:05:17 -0700233 // Firstly, try to load ANGLE driver.
234 driver_t* hnd = attempt_to_load_angle(cnx);
235 if (!hnd) {
236 // Secondly, try to load from driver apk.
237 hnd = attempt_to_load_updated_driver(cnx);
238 }
Peiyong Lin0d10b252019-04-30 18:03:04 -0700239
240 bool failToLoadFromDriverSuffixProperty = false;
Charlie Lao95c7aea2020-01-10 11:12:03 -0800241 cnx->systemDriverUseExactName = true;
Peiyong Lin8cd204d2019-04-19 14:05:17 -0700242 if (!hnd) {
Peiyong Lin9f0c79d2019-04-22 10:14:57 -0700243 // Finally, try to load system driver, start by searching for the library name appended by
244 // the system properties of the GLES userspace driver in both locations.
245 // i.e.:
246 // libGLES_${prop}.so, or:
247 // libEGL_${prop}.so, libGLESv1_CM_${prop}.so, libGLESv2_${prop}.so
Peiyong Lin9f0c79d2019-04-22 10:14:57 -0700248 for (auto key : HAL_SUBNAME_KEY_PROPERTIES) {
Charlie Lao95c7aea2020-01-10 11:12:03 -0800249 if (property_get(key, cnx->systemDriverProperty, nullptr) <= 0) {
Peiyong Lin9f0c79d2019-04-22 10:14:57 -0700250 continue;
251 }
Charlie Lao95c7aea2020-01-10 11:12:03 -0800252 hnd = attempt_to_load_system_driver(cnx, cnx->systemDriverProperty,
253 cnx->systemDriverUseExactName);
Peiyong Lin9f0c79d2019-04-22 10:14:57 -0700254 if (hnd) {
Charlie Lao95c7aea2020-01-10 11:12:03 -0800255 cnx->systemDriverUseProperty = true;
Peiyong Lin9f0c79d2019-04-22 10:14:57 -0700256 break;
Charlie Lao95c7aea2020-01-10 11:12:03 -0800257 } else {
258 if (strcmp(key, DRIVER_SUFFIX_PROPERTY) == 0) {
259 failToLoadFromDriverSuffixProperty = true;
260 }
Peiyong Lin9f0c79d2019-04-22 10:14:57 -0700261 }
262 }
263 }
264
265 if (!hnd) {
266 // Can't find graphics driver by appending system properties, now search for the exact name
267 // without any suffix of the GLES userspace driver in both locations.
268 // i.e.:
269 // libGLES.so, or:
270 // libEGL.so, libGLESv1_CM.so, libGLESv2.so
Charlie Lao95c7aea2020-01-10 11:12:03 -0800271 hnd = attempt_to_load_system_driver(cnx, nullptr, cnx->systemDriverUseExactName);
Peiyong Lin0d10b252019-04-30 18:03:04 -0700272 }
273
274 if (!hnd && !failToLoadFromDriverSuffixProperty) {
Charlie Lao95c7aea2020-01-10 11:12:03 -0800275 cnx->systemDriverUseExactName = false;
276 hnd = attempt_to_load_system_driver(cnx, nullptr, cnx->systemDriverUseExactName);
Mathias Agopiande586972009-05-28 17:39:03 -0700277 }
278
Yiwei Zhangd9861812019-02-13 11:51:55 -0800279 if (!hnd) {
Yiwei Zhang27ab3ac2019-07-02 18:10:55 -0700280 android::GraphicsEnv::getInstance().setDriverLoaded(android::GpuStatsInfo::Api::API_GL,
Yiwei Zhangd9861812019-02-13 11:51:55 -0800281 false, systemTime() - openTime);
282 }
283
Peiyong Lin3575b9f2019-04-25 14:26:49 -0700284 LOG_ALWAYS_FATAL_IF(!hnd,
285 "couldn't find an OpenGL ES implementation, make sure you set %s or %s",
286 HAL_SUBNAME_KEY_PROPERTIES[0], HAL_SUBNAME_KEY_PROPERTIES[1]);
Jesse Hallc07b5202013-07-04 12:08:16 -0700287
Yiwei Zhang5e21eb32019-06-05 00:26:03 -0700288 if (!cnx->libEgl) {
289 cnx->libEgl = load_wrapper(EGL_WRAPPER_DIR "/libEGL.so");
290 }
Yiwei Zhang5e21eb32019-06-05 00:26:03 -0700291 if (!cnx->libGles2) {
292 cnx->libGles2 = load_wrapper(EGL_WRAPPER_DIR "/libGLESv2.so");
293 }
Evgenii Stepanovc2466e62015-07-08 15:49:52 -0700294
Charlie Lao95c7aea2020-01-10 11:12:03 -0800295 if (!cnx->libEgl || !cnx->libGles2) {
Yiwei Zhang27ab3ac2019-07-02 18:10:55 -0700296 android::GraphicsEnv::getInstance().setDriverLoaded(android::GpuStatsInfo::Api::API_GL,
Yiwei Zhangd9861812019-02-13 11:51:55 -0800297 false, systemTime() - openTime);
298 }
299
Michael Chockc0ec5e22014-01-27 08:14:33 -0800300 LOG_ALWAYS_FATAL_IF(!cnx->libEgl,
301 "couldn't load system EGL wrapper libraries");
302
Charlie Lao95c7aea2020-01-10 11:12:03 -0800303 LOG_ALWAYS_FATAL_IF(!cnx->libGles2, "couldn't load system OpenGL ESv2+ wrapper libraries");
Jesse Hallc07b5202013-07-04 12:08:16 -0700304
Yiwei Zhang27ab3ac2019-07-02 18:10:55 -0700305 android::GraphicsEnv::getInstance().setDriverLoaded(android::GpuStatsInfo::Api::API_GL, true,
Yiwei Zhangd9861812019-02-13 11:51:55 -0800306 systemTime() - openTime);
Yiwei Zhangcb9d4e42019-02-06 20:22:59 -0800307
Mathias Agopiande586972009-05-28 17:39:03 -0700308 return (void*)hnd;
309}
310
Courtney Goeltzenleuchteree768c22018-10-25 11:43:52 -0600311void Loader::close(egl_connection_t* cnx)
Mathias Agopiande586972009-05-28 17:39:03 -0700312{
Courtney Goeltzenleuchteree768c22018-10-25 11:43:52 -0600313 driver_t* hnd = (driver_t*) cnx->dso;
Mathias Agopiande586972009-05-28 17:39:03 -0700314 delete hnd;
Courtney Goeltzenleuchteree768c22018-10-25 11:43:52 -0600315 cnx->dso = nullptr;
316
Tim Van Patten5f744f12018-12-12 11:46:21 -0700317 cnx->shouldUseAngle = false;
Courtney Goeltzenleuchteree768c22018-10-25 11:43:52 -0600318 cnx->angleDecided = false;
Charlie Lao95c7aea2020-01-10 11:12:03 -0800319 cnx->loadedDriverType = egl_connection_t::GLES_NO_DRIVER;
Courtney Goeltzenleuchteree768c22018-10-25 11:43:52 -0600320
321 if (cnx->vendorEGL) {
322 dlclose(cnx->vendorEGL);
323 cnx->vendorEGL = nullptr;
324 }
Mathias Agopiande586972009-05-28 17:39:03 -0700325}
326
Jesse Hall94cdba92013-07-11 09:40:35 -0700327void Loader::init_api(void* dso,
328 char const * const * api,
Yiwei Zhang7cc58922018-10-10 11:37:43 -0700329 char const * const * ref_api,
Jesse Hall94cdba92013-07-11 09:40:35 -0700330 __eglMustCastToProperFunctionPointerType* curr,
331 getProcAddressType getProcAddress)
Mathias Agopiande586972009-05-28 17:39:03 -0700332{
Jesse Hall1508ae62017-01-19 17:43:26 -0800333 ATRACE_CALL();
334
Mathias Agopian7773c432012-02-13 20:06:08 -0800335 const ssize_t SIZE = 256;
Mathias Agopian0ad71a92011-05-11 20:37:47 -0700336 char scrap[SIZE];
Mathias Agopiande586972009-05-28 17:39:03 -0700337 while (*api) {
338 char const * name = *api;
Yiwei Zhang7cc58922018-10-10 11:37:43 -0700339 if (ref_api) {
340 char const * ref_name = *ref_api;
341 if (std::strcmp(name, ref_name) != 0) {
342 *curr++ = nullptr;
343 ref_api++;
344 continue;
345 }
346 }
347
Jesse Hall94cdba92013-07-11 09:40:35 -0700348 __eglMustCastToProperFunctionPointerType f =
Mathias Agopiande586972009-05-28 17:39:03 -0700349 (__eglMustCastToProperFunctionPointerType)dlsym(dso, name);
Yi Kong48a6cd22018-07-18 10:07:09 -0700350 if (f == nullptr) {
Mathias Agopiande586972009-05-28 17:39:03 -0700351 // couldn't find the entry-point, use eglGetProcAddress()
352 f = getProcAddress(name);
353 }
Yi Kong48a6cd22018-07-18 10:07:09 -0700354 if (f == nullptr) {
Mathias Agopiande586972009-05-28 17:39:03 -0700355 // Try without the OES postfix
356 ssize_t index = ssize_t(strlen(name)) - 3;
Mathias Agopian0ad71a92011-05-11 20:37:47 -0700357 if ((index>0 && (index<SIZE-1)) && (!strcmp(name+index, "OES"))) {
Mathias Agopiande586972009-05-28 17:39:03 -0700358 strncpy(scrap, name, index);
359 scrap[index] = 0;
360 f = (__eglMustCastToProperFunctionPointerType)dlsym(dso, scrap);
Steve Block9d453682011-12-20 16:23:08 +0000361 //ALOGD_IF(f, "found <%s> instead", scrap);
Mathias Agopiande586972009-05-28 17:39:03 -0700362 }
363 }
Yi Kong48a6cd22018-07-18 10:07:09 -0700364 if (f == nullptr) {
Mathias Agopiande586972009-05-28 17:39:03 -0700365 // Try with the OES postfix
Mathias Agopian0ad71a92011-05-11 20:37:47 -0700366 ssize_t index = ssize_t(strlen(name)) - 3;
367 if (index>0 && strcmp(name+index, "OES")) {
368 snprintf(scrap, SIZE, "%sOES", name);
Mathias Agopiande586972009-05-28 17:39:03 -0700369 f = (__eglMustCastToProperFunctionPointerType)dlsym(dso, scrap);
Steve Block9d453682011-12-20 16:23:08 +0000370 //ALOGD_IF(f, "found <%s> instead", scrap);
Mathias Agopiande586972009-05-28 17:39:03 -0700371 }
372 }
Yi Kong48a6cd22018-07-18 10:07:09 -0700373 if (f == nullptr) {
Steve Block9d453682011-12-20 16:23:08 +0000374 //ALOGD("%s", name);
Mathias Agopiande586972009-05-28 17:39:03 -0700375 f = (__eglMustCastToProperFunctionPointerType)gl_unimplemented;
Mathias Agopian48d438d2012-01-28 21:44:00 -0800376
377 /*
378 * GL_EXT_debug_label is special, we always report it as
379 * supported, it's handled by GLES_trace. If GLES_trace is not
380 * enabled, then these are no-ops.
381 */
382 if (!strcmp(name, "glInsertEventMarkerEXT")) {
383 f = (__eglMustCastToProperFunctionPointerType)gl_noop;
384 } else if (!strcmp(name, "glPushGroupMarkerEXT")) {
385 f = (__eglMustCastToProperFunctionPointerType)gl_noop;
386 } else if (!strcmp(name, "glPopGroupMarkerEXT")) {
387 f = (__eglMustCastToProperFunctionPointerType)gl_noop;
388 }
Mathias Agopiande586972009-05-28 17:39:03 -0700389 }
390 *curr++ = f;
391 api++;
Yiwei Zhang7cc58922018-10-10 11:37:43 -0700392 if (ref_api) ref_api++;
Mathias Agopiande586972009-05-28 17:39:03 -0700393 }
394}
395
Peiyong Lin0d10b252019-04-30 18:03:04 -0700396static void* load_system_driver(const char* kind, const char* suffix, const bool exact) {
Jesse Hall1508ae62017-01-19 17:43:26 -0800397 ATRACE_CALL();
Mathias Agopian99381422013-04-23 20:52:29 +0200398 class MatchFile {
399 public:
Peiyong Lin0d10b252019-04-30 18:03:04 -0700400 static std::string find(const char* libraryName, const bool exact) {
Mathias Agopian99381422013-04-23 20:52:29 +0200401 const char* const searchPaths[] = {
Dan Willemsen8edb8f52014-02-16 10:23:54 -0800402#if defined(__LP64__)
403 "/vendor/lib64/egl",
404 "/system/lib64/egl"
405#else
Mathias Agopian99381422013-04-23 20:52:29 +0200406 "/vendor/lib/egl",
407 "/system/lib/egl"
Dan Willemsen8edb8f52014-02-16 10:23:54 -0800408#endif
Mathias Agopian99381422013-04-23 20:52:29 +0200409 };
Brian Swetland2b9e4f62010-09-20 12:58:15 -0700410
Peiyong Lin9f0c79d2019-04-22 10:14:57 -0700411 for (auto dir : searchPaths) {
Peiyong Lin0d10b252019-04-30 18:03:04 -0700412 std::string absolutePath;
413 if (find(absolutePath, libraryName, dir, exact)) {
Peiyong Lin9f0c79d2019-04-22 10:14:57 -0700414 return absolutePath;
Mathias Agopian99381422013-04-23 20:52:29 +0200415 }
Mathias Agopian99381422013-04-23 20:52:29 +0200416 }
417
Peiyong Lin9f0c79d2019-04-22 10:14:57 -0700418 // Driver not found. gah.
419 return std::string();
Mathias Agopian99381422013-04-23 20:52:29 +0200420 }
Peiyong Lin0d10b252019-04-30 18:03:04 -0700421 private:
422 static bool find(std::string& result,
423 const std::string& pattern, const char* const search, bool exact) {
424 if (exact) {
425 std::string absolutePath = std::string(search) + "/" + pattern + ".so";
426 if (!access(absolutePath.c_str(), R_OK)) {
427 result = absolutePath;
428 return true;
429 }
430 return false;
431 }
432
433 DIR* d = opendir(search);
434 if (d != nullptr) {
435 struct dirent* e;
436 while ((e = readdir(d)) != nullptr) {
437 if (e->d_type == DT_DIR) {
438 continue;
439 }
440 if (!strcmp(e->d_name, "libGLES_android.so")) {
441 // always skip the software renderer
442 continue;
443 }
444 if (strstr(e->d_name, pattern.c_str()) == e->d_name) {
445 if (!strcmp(e->d_name + strlen(e->d_name) - 3, ".so")) {
446 result = std::string(search) + "/" + e->d_name;
447 closedir(d);
448 return true;
449 }
450 }
451 }
452 closedir(d);
453 }
454 return false;
455 }
Mathias Agopian99381422013-04-23 20:52:29 +0200456 };
457
Peiyong Lin9f0c79d2019-04-22 10:14:57 -0700458 std::string libraryName = std::string("lib") + kind;
459 if (suffix) {
460 libraryName += std::string("_") + suffix;
Peiyong Lin0d10b252019-04-30 18:03:04 -0700461 } else if (!exact) {
462 // Deprecated: we look for files that match
463 // libGLES_*.so, or:
464 // libEGL_*.so, libGLESv1_CM_*.so, libGLESv2_*.so
465 libraryName += std::string("_");
Peiyong Lin9f0c79d2019-04-22 10:14:57 -0700466 }
Peiyong Lin0d10b252019-04-30 18:03:04 -0700467 std::string absolutePath = MatchFile::find(libraryName.c_str(), exact);
Mathias Agopian65421432017-03-08 11:49:05 -0800468 if (absolutePath.empty()) {
Mathias Agopian99381422013-04-23 20:52:29 +0200469 // this happens often, we don't want to log an error
Yi Kong48a6cd22018-07-18 10:07:09 -0700470 return nullptr;
Mathias Agopian8c173842009-09-20 16:01:02 -0700471 }
Mathias Agopian65421432017-03-08 11:49:05 -0800472 const char* const driver_absolute_path = absolutePath.c_str();
Mathias Agopiande586972009-05-28 17:39:03 -0700473
Jiyong Park5910dc72017-04-05 14:23:52 +0900474 // Try to load drivers from the 'sphal' namespace, if it exist. Fall back to
Justin Yunb7320302017-05-22 15:13:40 +0900475 // the original routine when the namespace does not exist.
Jiyong Park5910dc72017-04-05 14:23:52 +0900476 // See /system/core/rootdir/etc/ld.config.txt for the configuration of the
477 // sphal namespace.
Justin Yunb7320302017-05-22 15:13:40 +0900478 void* dso = do_android_load_sphal_library(driver_absolute_path,
479 RTLD_NOW | RTLD_LOCAL);
Yi Kong48a6cd22018-07-18 10:07:09 -0700480 if (dso == nullptr) {
Mathias Agopian8c173842009-09-20 16:01:02 -0700481 const char* err = dlerror();
Mathias Agopian65421432017-03-08 11:49:05 -0800482 ALOGE("load_driver(%s): %s", driver_absolute_path, err ? err : "unknown");
Yi Kong48a6cd22018-07-18 10:07:09 -0700483 return nullptr;
Mathias Agopian8c173842009-09-20 16:01:02 -0700484 }
485
Steve Block9d453682011-12-20 16:23:08 +0000486 ALOGD("loaded %s", driver_absolute_path);
Mathias Agopianbaca89c2009-08-20 19:09:34 -0700487
Jesse Hall7a8d83e2016-12-20 15:24:28 -0800488 return dso;
489}
490
Cody Northrop1f00e172018-04-02 11:23:31 -0600491static void* load_angle_from_namespace(const char* kind, android_namespace_t* ns) {
492 const android_dlextinfo dlextinfo = {
493 .flags = ANDROID_DLEXT_USE_NAMESPACE,
494 .library_namespace = ns,
495 };
496
497 std::string name = std::string("lib") + kind + "_angle.so";
498
499 void* so = do_android_dlopen_ext(name.c_str(), RTLD_LOCAL | RTLD_NOW, &dlextinfo);
500
501 if (so) {
502 ALOGD("dlopen_ext from APK (%s) success at %p", name.c_str(), so);
503 return so;
504 } else {
505 ALOGE("dlopen_ext(\"%s\") failed: %s", name.c_str(), dlerror());
506 }
507
508 return nullptr;
509}
510
Cody Northrop6d082ef2018-09-11 09:42:31 -0600511static void* load_angle(const char* kind, android_namespace_t* ns, egl_connection_t* cnx) {
Courtney Goeltzenleuchter985bc282018-11-02 14:24:55 -0600512 void* so = nullptr;
Tim Van Patten5f744f12018-12-12 11:46:21 -0700513
514 if ((cnx->shouldUseAngle) || android::GraphicsEnv::getInstance().shouldUseAngle()) {
Ian Elliott34474472018-09-05 10:57:07 -0600515 so = load_angle_from_namespace(kind, ns);
Tim Van Patten5f744f12018-12-12 11:46:21 -0700516 cnx->shouldUseAngle = true;
517 } else {
518 cnx->shouldUseAngle = false;
Ian Elliott34474472018-09-05 10:57:07 -0600519 }
Cody Northrop1f00e172018-04-02 11:23:31 -0600520
521 if (so) {
Tim Van Patten5f744f12018-12-12 11:46:21 -0700522 ALOGV("Loaded ANGLE %s library for '%s' (instead of native)", kind,
523 android::GraphicsEnv::getInstance().getAngleAppName().c_str());
Courtney Goeltzenleuchterb91b9892018-10-23 16:28:00 -0600524
Courtney Goeltzenleuchterb91b9892018-10-23 16:28:00 -0600525 char prop[PROPERTY_VALUE_MAX];
Tim Van Patten5f744f12018-12-12 11:46:21 -0700526
527 property_get("debug.hwui.renderer", prop, "UNSET");
528 ALOGV("Skia's renderer set to %s", prop);
529
530 EGLint angleBackendDefault = EGL_PLATFORM_ANGLE_TYPE_VULKAN_ANGLE;
Courtney Goeltzenleuchterb91b9892018-10-23 16:28:00 -0600531 property_get("debug.angle.backend", prop, "0");
532 switch (atoi(prop)) {
533 case 1:
534 ALOGV("%s: Requesting OpenGLES back-end", __FUNCTION__);
535 angleBackendDefault = EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE;
536 break;
537 case 2:
538 ALOGV("%s: Requesting Vulkan back-end", __FUNCTION__);
539 angleBackendDefault = EGL_PLATFORM_ANGLE_TYPE_VULKAN_ANGLE;
540 break;
541 default:
542 break;
543 }
544
545 cnx->angleBackend = angleBackendDefault;
546 if (!cnx->vendorEGL && (cnx->angleBackend == EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE)) {
547 // Find and load vendor libEGL for ANGLE's GL back-end to use.
Peiyong Lin9f0c79d2019-04-22 10:14:57 -0700548 char prop[PROPERTY_VALUE_MAX + 1];
549 for (auto key : HAL_SUBNAME_KEY_PROPERTIES) {
550 if (property_get(key, prop, nullptr) <= 0) {
551 continue;
552 }
Peiyong Lin0d10b252019-04-30 18:03:04 -0700553 void* dso = load_system_driver("EGL", prop, true);
Peiyong Lin9f0c79d2019-04-22 10:14:57 -0700554 if (dso) {
555 cnx->vendorEGL = dso;
556 break;
557 }
558 }
559 if (!cnx->vendorEGL) {
Peiyong Lin0d10b252019-04-30 18:03:04 -0700560 cnx->vendorEGL = load_system_driver("EGL", nullptr, true);
Peiyong Lin9f0c79d2019-04-22 10:14:57 -0700561 }
Cody Northrop1f00e172018-04-02 11:23:31 -0600562 }
Ian Elliottb058aff2018-08-09 12:00:55 -0600563 } else {
Tim Van Patten5f744f12018-12-12 11:46:21 -0700564 ALOGV("Loaded native %s library for '%s' (instead of ANGLE)", kind,
565 android::GraphicsEnv::getInstance().getAngleAppName().c_str());
Cody Northrop1f00e172018-04-02 11:23:31 -0600566 }
Tim Van Patten5f744f12018-12-12 11:46:21 -0700567 cnx->angleDecided = true;
Cody Northrop1f00e172018-04-02 11:23:31 -0600568
Tim Van Patten5f744f12018-12-12 11:46:21 -0700569 return so;
Cody Northrop1f00e172018-04-02 11:23:31 -0600570}
571
Jesse Hall7a8d83e2016-12-20 15:24:28 -0800572static void* load_updated_driver(const char* kind, android_namespace_t* ns) {
Jesse Hall1508ae62017-01-19 17:43:26 -0800573 ATRACE_CALL();
Jesse Hall7a8d83e2016-12-20 15:24:28 -0800574 const android_dlextinfo dlextinfo = {
575 .flags = ANDROID_DLEXT_USE_NAMESPACE,
576 .library_namespace = ns,
577 };
578 void* so = nullptr;
579 char prop[PROPERTY_VALUE_MAX + 1];
580 for (auto key : HAL_SUBNAME_KEY_PROPERTIES) {
Peiyong Lin9f0c79d2019-04-22 10:14:57 -0700581 if (property_get(key, prop, nullptr) <= 0) {
582 continue;
583 }
584 std::string name = std::string("lib") + kind + "_" + prop + ".so";
585 so = do_android_dlopen_ext(name.c_str(), RTLD_LOCAL | RTLD_NOW, &dlextinfo);
586 if (so) {
587 return so;
Jesse Hall7a8d83e2016-12-20 15:24:28 -0800588 }
589 }
590 return nullptr;
591}
592
Peiyong Lin8cd204d2019-04-19 14:05:17 -0700593Loader::driver_t* Loader::attempt_to_load_angle(egl_connection_t* cnx) {
Jesse Hall1508ae62017-01-19 17:43:26 -0800594 ATRACE_CALL();
Charlie Lao95c7aea2020-01-10 11:12:03 -0800595 assert(cnx->loadedDriverType == egl_connection_t::GLES_NO_DRIVER);
Courtney Goeltzenleuchter30ad2ab2018-10-30 08:20:44 -0600596 android_namespace_t* ns = android::GraphicsEnv::getInstance().getAngleNamespace();
Peiyong Lin8cd204d2019-04-19 14:05:17 -0700597 if (!ns) {
598 return nullptr;
Cody Northrop6d082ef2018-09-11 09:42:31 -0600599 }
Peiyong Lin8cd204d2019-04-19 14:05:17 -0700600
Yiwei Zhang27ab3ac2019-07-02 18:10:55 -0700601 android::GraphicsEnv::getInstance().setDriverToLoad(android::GpuStatsInfo::Driver::ANGLE);
Peiyong Lin8cd204d2019-04-19 14:05:17 -0700602 driver_t* hnd = nullptr;
603
604 // ANGLE doesn't ship with GLES library, and thus we skip GLES driver.
605 void* dso = load_angle("EGL", ns, cnx);
606 if (dso) {
607 initialize_api(dso, cnx, EGL);
608 hnd = new driver_t(dso);
609
Peiyong Lin8cd204d2019-04-19 14:05:17 -0700610 dso = load_angle("GLESv2", ns, cnx);
611 initialize_api(dso, cnx, GLESv2);
612 hnd->set(dso, GLESv2);
Charlie Lao95c7aea2020-01-10 11:12:03 -0800613 cnx->loadedDriverType = egl_connection_t::GLES_ANGLE_STANDALONE_DRIVER;
Peiyong Lin8cd204d2019-04-19 14:05:17 -0700614 }
615 return hnd;
616}
617
618Loader::driver_t* Loader::attempt_to_load_updated_driver(egl_connection_t* cnx) {
619 ATRACE_CALL();
Charlie Lao95c7aea2020-01-10 11:12:03 -0800620 assert(cnx->loadedDriverType == egl_connection_t::GLES_NO_DRIVER);
Jiyong Parka243e5d2017-06-21 12:26:51 +0900621#ifndef __ANDROID_VNDK__
Peiyong Lin8cd204d2019-04-19 14:05:17 -0700622 android_namespace_t* ns = android::GraphicsEnv::getInstance().getDriverNamespace();
623 if (!ns) {
624 return nullptr;
Jesse Hall7a8d83e2016-12-20 15:24:28 -0800625 }
626
Yiwei Zhang5e21eb32019-06-05 00:26:03 -0700627 ALOGD("Load updated gl driver.");
Yiwei Zhang27ab3ac2019-07-02 18:10:55 -0700628 android::GraphicsEnv::getInstance().setDriverToLoad(android::GpuStatsInfo::Driver::GL_UPDATED);
Peiyong Lin8cd204d2019-04-19 14:05:17 -0700629 driver_t* hnd = nullptr;
630 void* dso = load_updated_driver("GLES", ns);
Peiyong Line83b8682019-04-18 17:23:02 -0700631 if (dso) {
Charlie Lao95c7aea2020-01-10 11:12:03 -0800632 initialize_api(dso, cnx, EGL | GLESv2);
Peiyong Lin8cd204d2019-04-19 14:05:17 -0700633 hnd = new driver_t(dso);
Charlie Lao95c7aea2020-01-10 11:12:03 -0800634 if (hnd) cnx->loadedDriverType = egl_connection_t::GLES_UPDATED_COMBO_DRIVER;
Peiyong Lin8cd204d2019-04-19 14:05:17 -0700635 return hnd;
Peiyong Line83b8682019-04-18 17:23:02 -0700636 }
637
Peiyong Lin8cd204d2019-04-19 14:05:17 -0700638 dso = load_updated_driver("EGL", ns);
639 if (dso) {
640 initialize_api(dso, cnx, EGL);
641 hnd = new driver_t(dso);
642
Peiyong Lin8cd204d2019-04-19 14:05:17 -0700643 dso = load_updated_driver("GLESv2", ns);
644 initialize_api(dso, cnx, GLESv2);
645 hnd->set(dso, GLESv2);
Charlie Lao95c7aea2020-01-10 11:12:03 -0800646 cnx->loadedDriverType = egl_connection_t::GLES_UPDATED_STANDALONE_DRIVER;
Peiyong Lin8cd204d2019-04-19 14:05:17 -0700647 }
648 return hnd;
649#else
Peiyong Line83b8682019-04-18 17:23:02 -0700650 return nullptr;
Peiyong Lin8cd204d2019-04-19 14:05:17 -0700651#endif
652}
653
Peiyong Lin0d10b252019-04-30 18:03:04 -0700654Loader::driver_t* Loader::attempt_to_load_system_driver(egl_connection_t* cnx, const char* suffix,
655 const bool exact) {
Peiyong Lin8cd204d2019-04-19 14:05:17 -0700656 ATRACE_CALL();
Charlie Lao95c7aea2020-01-10 11:12:03 -0800657 assert(cnx->loadedDriverType == egl_connection_t::GLES_NO_DRIVER);
Yiwei Zhang27ab3ac2019-07-02 18:10:55 -0700658 android::GraphicsEnv::getInstance().setDriverToLoad(android::GpuStatsInfo::Driver::GL);
Peiyong Lin8cd204d2019-04-19 14:05:17 -0700659 driver_t* hnd = nullptr;
Peiyong Lin0d10b252019-04-30 18:03:04 -0700660 void* dso = load_system_driver("GLES", suffix, exact);
Peiyong Lin8cd204d2019-04-19 14:05:17 -0700661 if (dso) {
Charlie Lao95c7aea2020-01-10 11:12:03 -0800662 initialize_api(dso, cnx, EGL | GLESv2);
Peiyong Lin8cd204d2019-04-19 14:05:17 -0700663 hnd = new driver_t(dso);
Charlie Lao95c7aea2020-01-10 11:12:03 -0800664 if (hnd) cnx->loadedDriverType = egl_connection_t::GLES_SYSTEM_COMBO_DRIVER;
Peiyong Lin8cd204d2019-04-19 14:05:17 -0700665 return hnd;
666 }
Charlie Lao95c7aea2020-01-10 11:12:03 -0800667
Peiyong Lin0d10b252019-04-30 18:03:04 -0700668 dso = load_system_driver("EGL", suffix, exact);
Peiyong Lin8cd204d2019-04-19 14:05:17 -0700669 if (dso) {
670 initialize_api(dso, cnx, EGL);
671 hnd = new driver_t(dso);
672
Peiyong Lin0d10b252019-04-30 18:03:04 -0700673 dso = load_system_driver("GLESv2", suffix, exact);
Peiyong Lin8cd204d2019-04-19 14:05:17 -0700674 initialize_api(dso, cnx, GLESv2);
675 hnd->set(dso, GLESv2);
Charlie Lao95c7aea2020-01-10 11:12:03 -0800676 cnx->loadedDriverType = egl_connection_t::GLES_SYSTEM_STANDALONE_DRIVER;
Peiyong Lin8cd204d2019-04-19 14:05:17 -0700677 }
678 return hnd;
Peiyong Line83b8682019-04-18 17:23:02 -0700679}
680
Charlie Lao95c7aea2020-01-10 11:12:03 -0800681bool Loader::load_glesv1_driver(egl_connection_t* cnx) {
682 ATRACE_CALL();
683 void* dso = nullptr;
684
685 driver_t* hnd = (driver_t*)cnx->dso;
686 // EGL driver must have been loaded. if not, something went wrong.
687 if (!hnd || cnx->loadedDriverType == egl_connection_t::GLES_NO_DRIVER) {
688 return false;
689 }
690
691 if (cnx->libGles1) return EGL_TRUE;
692
693 // If there is a GLES driver, use that first
694 switch (cnx->loadedDriverType) {
695 case egl_connection_t::GLES_SYSTEM_COMBO_DRIVER:
696 case egl_connection_t::GLES_UPDATED_COMBO_DRIVER: {
697 dso = hnd->dso[0];
698 initialize_api(dso, cnx, GLESv1_CM);
699 break;
700 }
701 case egl_connection_t::GLES_ANGLE_STANDALONE_DRIVER: {
702 android_namespace_t* ns = android::GraphicsEnv::getInstance().getAngleNamespace();
703 dso = load_angle("GLESv1_CM", ns, cnx);
704 if (dso) {
705 initialize_api(dso, cnx, GLESv1_CM);
706 hnd->set(dso, GLESv1_CM);
707 }
708 break;
709 }
710 case egl_connection_t::GLES_UPDATED_STANDALONE_DRIVER: {
711 android_namespace_t* ns = android::GraphicsEnv::getInstance().getDriverNamespace();
712 void* dso = load_updated_driver("GLESv1_CM", ns);
713 if (dso) {
714 initialize_api(dso, cnx, GLESv1_CM);
715 hnd->set(dso, GLESv1_CM);
716 }
717 break;
718 }
719 case egl_connection_t::GLES_SYSTEM_STANDALONE_DRIVER: {
720 dso = load_system_driver("GLESv1_CM",
721 cnx->systemDriverUseProperty ? cnx->systemDriverProperty
722 : nullptr,
723 cnx->systemDriverUseExactName);
724 if (dso) {
725 initialize_api(dso, cnx, GLESv1_CM);
726 hnd->set(dso, GLESv1_CM);
727 }
728 break;
729 }
730 default: {
731 ALOGE("Bad loadedDriverType (%d)", cnx->loadedDriverType);
732 break;
733 }
734 }
735
736 if (!cnx->libGles1) {
737 cnx->libGles1 = load_wrapper(EGL_WRAPPER_DIR "/libGLESv1_CM.so");
738 }
739
740 LOG_ALWAYS_FATAL_IF(!cnx->libGles1, "couldn't load system OpenGL ES V1 wrapper libraries");
741
742 return dso ? true : false;
743}
744
Peiyong Line83b8682019-04-18 17:23:02 -0700745void Loader::initialize_api(void* dso, egl_connection_t* cnx, uint32_t mask) {
Mathias Agopiande586972009-05-28 17:39:03 -0700746 if (mask & EGL) {
747 getProcAddress = (getProcAddressType)dlsym(dso, "eglGetProcAddress");
748
Jesse Hall94cdba92013-07-11 09:40:35 -0700749 ALOGE_IF(!getProcAddress,
Jesse Hall7a8d83e2016-12-20 15:24:28 -0800750 "can't find eglGetProcAddress() in EGL driver library");
Mathias Agopiande586972009-05-28 17:39:03 -0700751
Mathias Agopian618fa102009-10-14 02:06:37 -0700752 egl_t* egl = &cnx->egl;
Mathias Agopiande586972009-05-28 17:39:03 -0700753 __eglMustCastToProperFunctionPointerType* curr =
754 (__eglMustCastToProperFunctionPointerType*)egl;
755 char const * const * api = egl_names;
756 while (*api) {
757 char const * name = *api;
Jesse Hall94cdba92013-07-11 09:40:35 -0700758 __eglMustCastToProperFunctionPointerType f =
Mathias Agopiande586972009-05-28 17:39:03 -0700759 (__eglMustCastToProperFunctionPointerType)dlsym(dso, name);
Yi Kong48a6cd22018-07-18 10:07:09 -0700760 if (f == nullptr) {
Mathias Agopiande586972009-05-28 17:39:03 -0700761 // couldn't find the entry-point, use eglGetProcAddress()
762 f = getProcAddress(name);
Yi Kong48a6cd22018-07-18 10:07:09 -0700763 if (f == nullptr) {
764 f = (__eglMustCastToProperFunctionPointerType)nullptr;
Mathias Agopiande586972009-05-28 17:39:03 -0700765 }
766 }
767 *curr++ = f;
768 api++;
769 }
770 }
Jesse Hall94cdba92013-07-11 09:40:35 -0700771
Mathias Agopiande586972009-05-28 17:39:03 -0700772 if (mask & GLESv1_CM) {
Yiwei Zhang7cc58922018-10-10 11:37:43 -0700773 init_api(dso, gl_names_1, gl_names,
Mathias Agopian618fa102009-10-14 02:06:37 -0700774 (__eglMustCastToProperFunctionPointerType*)
Mathias Agopian7773c432012-02-13 20:06:08 -0800775 &cnx->hooks[egl_connection_t::GLESv1_INDEX]->gl,
Mathias Agopian618fa102009-10-14 02:06:37 -0700776 getProcAddress);
Mathias Agopiande586972009-05-28 17:39:03 -0700777 }
778
779 if (mask & GLESv2) {
Yiwei Zhang7cc58922018-10-10 11:37:43 -0700780 init_api(dso, gl_names, nullptr,
Mathias Agopian618fa102009-10-14 02:06:37 -0700781 (__eglMustCastToProperFunctionPointerType*)
Mathias Agopian7773c432012-02-13 20:06:08 -0800782 &cnx->hooks[egl_connection_t::GLESv2_INDEX]->gl,
Mathias Agopiande586972009-05-28 17:39:03 -0700783 getProcAddress);
784 }
Mathias Agopiande586972009-05-28 17:39:03 -0700785}
786
Peiyong Lin8cd204d2019-04-19 14:05:17 -0700787} // namespace android