blob: 7012df21ae45187bda921ebb2dbfb3b8cee9ff5d [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
Yiwei Zhangd40aaac2020-06-04 05:26:56 -070020#include "EGL/Loader.h"
Mathias Agopiande586972009-05-28 17:39:03 -070021
Michael Hoisie4e0f56b2020-04-30 18:40:55 -040022#include <android-base/properties.h>
Jesse Hall7a8d83e2016-12-20 15:24:28 -080023#include <android/dlext.h>
Peiyong Lin98db8e02023-04-05 20:09:16 +000024#include <cutils/properties.h>
Yiwei Zhangd40aaac2020-06-04 05:26:56 -070025#include <dirent.h>
26#include <dlfcn.h>
27#include <graphicsenv/GraphicsEnv.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>
Justin Yunb7320302017-05-22 15:13:40 +090030#include <vndksupport/linker.h>
Mathias Agopiande586972009-05-28 17:39:03 -070031
Yiwei Zhangd40aaac2020-06-04 05:26:56 -070032#include <string>
33
Yiwei Zhang8af003e2020-06-04 14:11:30 -070034#include "EGL/eglext_angle.h"
Cody Northrop68d10352018-10-15 07:22:09 -060035#include "egl_platform_entries.h"
Mathias Agopian65421432017-03-08 11:49:05 -080036#include "egl_trace.h"
Mathias Agopian1cadb252011-05-23 17:26:14 -070037#include "egldefs.h"
Mathias Agopiande586972009-05-28 17:39:03 -070038
Mathias Agopiande586972009-05-28 17:39:03 -070039namespace android {
Mathias Agopiande586972009-05-28 17:39:03 -070040
41/*
Mathias Agopian99381422013-04-23 20:52:29 +020042 * EGL userspace drivers must be provided either:
43 * - as a single library:
Peiyong Lind30aaad2023-08-03 19:12:49 +000044 * /vendor/${LIB}/egl/libGLES.so
Mathias Agopian99381422013-04-23 20:52:29 +020045 *
46 * - as separate libraries:
Peiyong Lind30aaad2023-08-03 19:12:49 +000047 * /vendor/${LIB}/egl/libEGL.so
48 * /vendor/${LIB}/egl/libGLESv1_CM.so
49 * /vendor/${LIB}/egl/libGLESv2.so
Mathias Agopian99381422013-04-23 20:52:29 +020050 *
Mathias Agopian99381422013-04-23 20:52:29 +020051 * For backward compatibility and to facilitate the transition to
52 * this new naming scheme, the loader will additionally look for:
Jesse Hall94cdba92013-07-11 09:40:35 -070053 *
Peiyong Lind30aaad2023-08-03 19:12:49 +000054 * /vendor/${LIB}/egl/lib{GLES | [EGL|GLESv1_CM|GLESv2]}_${SUFFIX}.so
Jesse Hall94cdba92013-07-11 09:40:35 -070055 *
Mathias Agopiande586972009-05-28 17:39:03 -070056 */
57
Peiyong Lind30aaad2023-08-03 19:12:49 +000058#ifndef SYSTEM_LIB_PATH
59#if defined(__LP64__)
60#define SYSTEM_LIB_PATH "/system/lib64"
61#else
62#define SYSTEM_LIB_PATH "/system/lib"
63#endif
64#endif
65
66static const char* PERSIST_DRIVER_SUFFIX_PROPERTY = "persist.graphics.egl";
67static const char* RO_DRIVER_SUFFIX_PROPERTY = "ro.hardware.egl";
68static const char* RO_BOARD_PLATFORM_PROPERTY = "ro.board.platform";
Peiyong Line4da7a82023-08-08 20:46:53 +000069static const char* ANGLE_SUFFIX_VALUE = "angle";
Peiyong Lind30aaad2023-08-03 19:12:49 +000070
71static const char* HAL_SUBNAME_KEY_PROPERTIES[3] = {
72 PERSIST_DRIVER_SUFFIX_PROPERTY,
73 RO_DRIVER_SUFFIX_PROPERTY,
74 RO_BOARD_PLATFORM_PROPERTY,
75};
76
77static const char* const VENDOR_LIB_EGL_DIR =
78#if defined(__LP64__)
79 "/vendor/lib64/egl";
80#else
81 "/vendor/lib/egl";
82#endif
Mathias Agopiande586972009-05-28 17:39:03 -070083
Peiyong Line4da7a82023-08-08 20:46:53 +000084static const char* const SYSTEM_LIB_DIR =
85#if defined(__LP64__)
86 "/system/lib64";
87#else
88 "/system/lib";
89#endif
90
Jesse Hall1508ae62017-01-19 17:43:26 -080091static void* do_dlopen(const char* path, int mode) {
92 ATRACE_CALL();
93 return dlopen(path, mode);
94}
95
Jiyong Park5910dc72017-04-05 14:23:52 +090096static void* do_android_dlopen_ext(const char* path, int mode, const android_dlextinfo* info) {
97 ATRACE_CALL();
98 return android_dlopen_ext(path, mode, info);
99}
100
Justin Yunb7320302017-05-22 15:13:40 +0900101static void* do_android_load_sphal_library(const char* path, int mode) {
102 ATRACE_CALL();
103 return android_load_sphal_library(path, mode);
104}
105
Yiwei Zhang5e21eb32019-06-05 00:26:03 -0700106static int do_android_unload_sphal_library(void* dso) {
107 ATRACE_CALL();
108 return android_unload_sphal_library(dso);
109}
110
Peiyong Lind30aaad2023-08-03 19:12:49 +0000111static void* load_wrapper(const char* path) {
112 void* so = do_dlopen(path, RTLD_NOW | RTLD_LOCAL);
113 ALOGE_IF(!so, "dlopen(\"%s\") failed: %s", path, dlerror());
114 return so;
115}
116
117Loader& Loader::getInstance() {
118 static Loader loader;
119 return loader;
120}
121
Jesse Hall94cdba92013-07-11 09:40:35 -0700122Loader::driver_t::driver_t(void* gles)
Mathias Agopiande586972009-05-28 17:39:03 -0700123{
124 dso[0] = gles;
125 for (size_t i=1 ; i<NELEM(dso) ; i++)
Yi Kong48a6cd22018-07-18 10:07:09 -0700126 dso[i] = nullptr;
Mathias Agopiande586972009-05-28 17:39:03 -0700127}
128
Jesse Hall94cdba92013-07-11 09:40:35 -0700129Loader::driver_t::~driver_t()
Mathias Agopiande586972009-05-28 17:39:03 -0700130{
131 for (size_t i=0 ; i<NELEM(dso) ; i++) {
132 if (dso[i]) {
133 dlclose(dso[i]);
Yi Kong48a6cd22018-07-18 10:07:09 -0700134 dso[i] = nullptr;
Mathias Agopiande586972009-05-28 17:39:03 -0700135 }
136 }
137}
138
Mathias Agopian65421432017-03-08 11:49:05 -0800139int Loader::driver_t::set(void* hnd, int32_t api)
Mathias Agopiande586972009-05-28 17:39:03 -0700140{
141 switch (api) {
142 case EGL:
143 dso[0] = hnd;
144 break;
145 case GLESv1_CM:
146 dso[1] = hnd;
147 break;
148 case GLESv2:
149 dso[2] = hnd;
150 break;
151 default:
Mathias Agopian65421432017-03-08 11:49:05 -0800152 return -EOVERFLOW;
Mathias Agopiande586972009-05-28 17:39:03 -0700153 }
Mathias Agopian65421432017-03-08 11:49:05 -0800154 return 0;
Mathias Agopiande586972009-05-28 17:39:03 -0700155}
156
Mathias Agopiande586972009-05-28 17:39:03 -0700157Loader::Loader()
Yi Kong48a6cd22018-07-18 10:07:09 -0700158 : getProcAddress(nullptr)
Jesse Hall7a8d83e2016-12-20 15:24:28 -0800159{
Mathias Agopiande586972009-05-28 17:39:03 -0700160}
161
Mathias Agopian99381422013-04-23 20:52:29 +0200162Loader::~Loader() {
Mathias Agopiande586972009-05-28 17:39:03 -0700163}
164
Peiyong Lin2f51e752023-06-15 22:35:14 +0000165// Check whether the loaded system drivers should be unloaded in order to
166// load ANGLE or the updatable graphics drivers.
167// If ANGLE namespace is set, it means the application is identified to run on top of ANGLE.
168// If updatable graphics driver namespace is set, it means the application is identified to
169// run on top of updatable graphics drivers.
Yiwei Zhang5e21eb32019-06-05 00:26:03 -0700170static bool should_unload_system_driver(egl_connection_t* cnx) {
171 // Return false if the system driver has been unloaded once.
172 if (cnx->systemDriverUnloaded) {
173 return false;
174 }
175
Peiyong Lin2f51e752023-06-15 22:35:14 +0000176 // Return true if ANGLE namespace is set.
Yiwei Zhang5e21eb32019-06-05 00:26:03 -0700177 android_namespace_t* ns = android::GraphicsEnv::getInstance().getAngleNamespace();
178 if (ns) {
Peiyong Line88e0ba2023-06-28 15:09:09 +0000179 // Unless the default GLES driver is ANGLE and the process should use system ANGLE, since
180 // the intended GLES driver is already loaded.
181 // This should be updated in a later patch that cleans up namespaces
182 if (!(cnx->angleLoaded && android::GraphicsEnv::getInstance().shouldUseSystemAngle())) {
183 return true;
184 }
Yiwei Zhang5e21eb32019-06-05 00:26:03 -0700185 }
186
Yuxin Huafba5842024-04-23 20:40:36 +0000187 // Return true if app requests to use ANGLE, but ANGLE is not loaded.
188 // Difference with the case above is on devices that don't have an ANGLE apk installed,
189 // ANGLE namespace is not set. In that case if ANGLE in system partition is not loaded,
190 // we should unload the system driver first, and then load ANGLE from system partition.
191 if (!cnx->angleLoaded && android::GraphicsEnv::getInstance().shouldUseAngle()) {
192 return true;
193 }
194
Peiyong Lin2df5a002023-08-01 23:31:34 +0000195 // Return true if native GLES drivers should be used and ANGLE is already loaded.
196 if (android::GraphicsEnv::getInstance().shouldUseNativeDriver() && cnx->angleLoaded) {
197 return true;
198 }
199
Yiwei Zhang5e21eb32019-06-05 00:26:03 -0700200 // Return true if updated driver namespace is set.
201 ns = android::GraphicsEnv::getInstance().getDriverNamespace();
202 if (ns) {
203 return true;
204 }
Yiwei Zhang5e21eb32019-06-05 00:26:03 -0700205
206 return false;
207}
208
209static void uninit_api(char const* const* api, __eglMustCastToProperFunctionPointerType* curr) {
210 while (*api) {
211 *curr++ = nullptr;
212 api++;
213 }
214}
215
216void Loader::unload_system_driver(egl_connection_t* cnx) {
217 ATRACE_CALL();
218
219 uninit_api(gl_names,
220 (__eglMustCastToProperFunctionPointerType*)&cnx
221 ->hooks[egl_connection_t::GLESv2_INDEX]
222 ->gl);
223 uninit_api(gl_names,
224 (__eglMustCastToProperFunctionPointerType*)&cnx
225 ->hooks[egl_connection_t::GLESv1_INDEX]
226 ->gl);
227 uninit_api(egl_names, (__eglMustCastToProperFunctionPointerType*)&cnx->egl);
228
229 if (cnx->dso) {
230 ALOGD("Unload system gl driver.");
231 driver_t* hnd = (driver_t*)cnx->dso;
232 if (hnd->dso[2]) {
233 do_android_unload_sphal_library(hnd->dso[2]);
234 }
235 if (hnd->dso[1]) {
236 do_android_unload_sphal_library(hnd->dso[1]);
237 }
238 if (hnd->dso[0]) {
239 do_android_unload_sphal_library(hnd->dso[0]);
240 }
241 cnx->dso = nullptr;
Peiyong Line88e0ba2023-06-28 15:09:09 +0000242 cnx->angleLoaded = false;
Yiwei Zhang5e21eb32019-06-05 00:26:03 -0700243 }
244
245 cnx->systemDriverUnloaded = true;
246}
247
Peiyong Line88e0ba2023-06-28 15:09:09 +0000248void* Loader::open(egl_connection_t* cnx) {
Jesse Hall1508ae62017-01-19 17:43:26 -0800249 ATRACE_CALL();
Yiwei Zhangd9861812019-02-13 11:51:55 -0800250 const nsecs_t openTime = systemTime();
Jesse Hall1508ae62017-01-19 17:43:26 -0800251
Peiyong Line88e0ba2023-06-28 15:09:09 +0000252 if (cnx->dso && should_unload_system_driver(cnx)) {
Yiwei Zhang5e21eb32019-06-05 00:26:03 -0700253 unload_system_driver(cnx);
254 }
255
256 // If a driver has been loaded, return the driver directly.
257 if (cnx->dso) {
258 return cnx->dso;
259 }
260
Peiyong Line88e0ba2023-06-28 15:09:09 +0000261 driver_t* hnd = nullptr;
262 // Firstly, try to load ANGLE driver, if ANGLE should be loaded and fail, abort.
263 if (android::GraphicsEnv::getInstance().shouldUseAngle()) {
264 hnd = attempt_to_load_angle(cnx);
265 LOG_ALWAYS_FATAL_IF(!hnd, "Failed to load ANGLE.");
266 }
Ian Elliott5279f862022-04-21 12:41:03 -0600267
Peiyong Lin8cd204d2019-04-19 14:05:17 -0700268 if (!hnd) {
269 // Secondly, try to load from driver apk.
270 hnd = attempt_to_load_updated_driver(cnx);
Peiyong Lin2df5a002023-08-01 23:31:34 +0000271
272 // If updated driver apk is set but fail to load, abort here.
Rob VanReenen45ccd132024-08-01 12:02:58 -0700273 LOG_ALWAYS_FATAL_IF(android::GraphicsEnv::getInstance().getDriverNamespace() && !hnd,
Peiyong Lin2df5a002023-08-01 23:31:34 +0000274 "couldn't find an OpenGL ES implementation from %s",
275 android::GraphicsEnv::getInstance().getDriverPath().c_str());
Peiyong Lin8cd204d2019-04-19 14:05:17 -0700276 }
Peiyong Lin0d10b252019-04-30 18:03:04 -0700277
Peiyong Lin2df5a002023-08-01 23:31:34 +0000278 // Attempt to load native GLES drivers specified by ro.hardware.egl if native is selected.
279 // If native is selected but fail to load, abort.
280 if (!hnd && android::GraphicsEnv::getInstance().shouldUseNativeDriver()) {
281 auto driverSuffix = base::GetProperty(RO_DRIVER_SUFFIX_PROPERTY, "");
282 LOG_ALWAYS_FATAL_IF(driverSuffix.empty(),
283 "Native GLES driver is selected but not specified in %s",
284 RO_DRIVER_SUFFIX_PROPERTY);
285 hnd = attempt_to_load_system_driver(cnx, driverSuffix.c_str(), true);
286 LOG_ALWAYS_FATAL_IF(!hnd, "Native GLES driver is selected but failed to load. %s=%s",
287 RO_DRIVER_SUFFIX_PROPERTY, driverSuffix.c_str());
288 }
289
290 // Finally, try to load default driver.
Peiyong Lin0d10b252019-04-30 18:03:04 -0700291 bool failToLoadFromDriverSuffixProperty = false;
Peiyong Lin8cd204d2019-04-19 14:05:17 -0700292 if (!hnd) {
Peiyong Lin98db8e02023-04-05 20:09:16 +0000293 // Start by searching for the library name appended by the system
294 // properties of the GLES userspace driver in both locations.
295 // i.e.:
296 // libGLES_${prop}.so, or:
297 // libEGL_${prop}.so, libGLESv1_CM_${prop}.so, libGLESv2_${prop}.so
298 for (auto key : HAL_SUBNAME_KEY_PROPERTIES) {
299 auto prop = base::GetProperty(key, "");
300 if (prop.empty()) {
301 continue;
302 }
303 hnd = attempt_to_load_system_driver(cnx, prop.c_str(), true);
Peiyong Linf7878b72023-06-13 20:51:03 +0000304 if (!hnd) {
305 ALOGD("Failed to load drivers from property %s with value %s", key, prop.c_str());
Peiyong Lin98db8e02023-04-05 20:09:16 +0000306 failToLoadFromDriverSuffixProperty = true;
Peiyong Lin9f0c79d2019-04-22 10:14:57 -0700307 }
Peiyong Linf7878b72023-06-13 20:51:03 +0000308
309 // Abort regardless of whether subsequent properties are set, the value must be set
310 // correctly with the first property that has a value.
311 break;
Peiyong Lin9f0c79d2019-04-22 10:14:57 -0700312 }
313 }
314
315 if (!hnd) {
Peiyong Linf7878b72023-06-13 20:51:03 +0000316 // Can't find graphics driver by appending the value from system properties, now search for
317 // the exact name without any suffix of the GLES userspace driver in both locations.
Peiyong Lin9f0c79d2019-04-22 10:14:57 -0700318 // i.e.:
319 // libGLES.so, or:
320 // libEGL.so, libGLESv1_CM.so, libGLESv2.so
Charlie Lao840bd532020-01-16 17:34:37 -0800321 hnd = attempt_to_load_system_driver(cnx, nullptr, true);
Peiyong Lin0d10b252019-04-30 18:03:04 -0700322 }
323
Peiyong Lin98db8e02023-04-05 20:09:16 +0000324 if (!hnd && !failToLoadFromDriverSuffixProperty &&
325 property_get_int32("ro.vendor.api_level", 0) < __ANDROID_API_U__) {
326 // Still can't find the graphics drivers with the exact name. This time try to use wildcard
327 // matching if the device is launched before Android 14.
Charlie Lao840bd532020-01-16 17:34:37 -0800328 hnd = attempt_to_load_system_driver(cnx, nullptr, false);
Mathias Agopiande586972009-05-28 17:39:03 -0700329 }
330
Yiwei Zhangd9861812019-02-13 11:51:55 -0800331 if (!hnd) {
Yiwei Zhang27ab3ac2019-07-02 18:10:55 -0700332 android::GraphicsEnv::getInstance().setDriverLoaded(android::GpuStatsInfo::Api::API_GL,
Yiwei Zhangd9861812019-02-13 11:51:55 -0800333 false, systemTime() - openTime);
Courtney Goeltzenleuchterd1646cf2020-04-23 08:19:11 -0600334 } else {
335 // init_angle_backend will check if loaded driver is ANGLE or not,
Peiyong Lin2f51e752023-06-15 22:35:14 +0000336 // will set cnx->angleLoaded appropriately.
Courtney Goeltzenleuchterd1646cf2020-04-23 08:19:11 -0600337 // Do this here so that we use ANGLE path when driver is ANGLE (e.g. loaded as native),
338 // not just loading ANGLE as option.
Peiyong Lin2f51e752023-06-15 22:35:14 +0000339 attempt_to_init_angle_backend(hnd->dso[2], cnx);
Yiwei Zhangd9861812019-02-13 11:51:55 -0800340 }
341
Peiyong Lin3575b9f2019-04-25 14:26:49 -0700342 LOG_ALWAYS_FATAL_IF(!hnd,
Peiyong Lin9679a982023-04-10 22:00:30 +0000343 "couldn't find an OpenGL ES implementation, make sure one of %s, %s and %s "
344 "is set",
345 HAL_SUBNAME_KEY_PROPERTIES[0], HAL_SUBNAME_KEY_PROPERTIES[1],
346 HAL_SUBNAME_KEY_PROPERTIES[2]);
Jesse Hallc07b5202013-07-04 12:08:16 -0700347
Yiwei Zhang5e21eb32019-06-05 00:26:03 -0700348 if (!cnx->libEgl) {
Peiyong Lind30aaad2023-08-03 19:12:49 +0000349 cnx->libEgl = load_wrapper(SYSTEM_LIB_PATH "/libEGL.so");
Yiwei Zhang5e21eb32019-06-05 00:26:03 -0700350 }
Charlie Lao840bd532020-01-16 17:34:37 -0800351 if (!cnx->libGles1) {
Peiyong Lind30aaad2023-08-03 19:12:49 +0000352 cnx->libGles1 = load_wrapper(SYSTEM_LIB_PATH "/libGLESv1_CM.so");
Charlie Lao840bd532020-01-16 17:34:37 -0800353 }
Yiwei Zhang5e21eb32019-06-05 00:26:03 -0700354 if (!cnx->libGles2) {
Peiyong Lind30aaad2023-08-03 19:12:49 +0000355 cnx->libGles2 = load_wrapper(SYSTEM_LIB_PATH "/libGLESv2.so");
Yiwei Zhang5e21eb32019-06-05 00:26:03 -0700356 }
Evgenii Stepanovc2466e62015-07-08 15:49:52 -0700357
Charlie Lao840bd532020-01-16 17:34:37 -0800358 if (!cnx->libEgl || !cnx->libGles2 || !cnx->libGles1) {
Yiwei Zhang27ab3ac2019-07-02 18:10:55 -0700359 android::GraphicsEnv::getInstance().setDriverLoaded(android::GpuStatsInfo::Api::API_GL,
Yiwei Zhangd9861812019-02-13 11:51:55 -0800360 false, systemTime() - openTime);
361 }
362
Michael Chockc0ec5e22014-01-27 08:14:33 -0800363 LOG_ALWAYS_FATAL_IF(!cnx->libEgl,
364 "couldn't load system EGL wrapper libraries");
365
Charlie Lao840bd532020-01-16 17:34:37 -0800366 LOG_ALWAYS_FATAL_IF(!cnx->libGles2 || !cnx->libGles1,
367 "couldn't load system OpenGL ES wrapper libraries");
Jesse Hallc07b5202013-07-04 12:08:16 -0700368
Yiwei Zhang27ab3ac2019-07-02 18:10:55 -0700369 android::GraphicsEnv::getInstance().setDriverLoaded(android::GpuStatsInfo::Api::API_GL, true,
Yiwei Zhangd9861812019-02-13 11:51:55 -0800370 systemTime() - openTime);
Yiwei Zhangcb9d4e42019-02-06 20:22:59 -0800371
Mathias Agopiande586972009-05-28 17:39:03 -0700372 return (void*)hnd;
373}
374
Courtney Goeltzenleuchteree768c22018-10-25 11:43:52 -0600375void Loader::close(egl_connection_t* cnx)
Mathias Agopiande586972009-05-28 17:39:03 -0700376{
Courtney Goeltzenleuchteree768c22018-10-25 11:43:52 -0600377 driver_t* hnd = (driver_t*) cnx->dso;
Mathias Agopiande586972009-05-28 17:39:03 -0700378 delete hnd;
Courtney Goeltzenleuchteree768c22018-10-25 11:43:52 -0600379 cnx->dso = nullptr;
380
Peiyong Lin2f51e752023-06-15 22:35:14 +0000381 cnx->angleLoaded = false;
Mathias Agopiande586972009-05-28 17:39:03 -0700382}
383
Jesse Hall94cdba92013-07-11 09:40:35 -0700384void Loader::init_api(void* dso,
385 char const * const * api,
Yiwei Zhang7cc58922018-10-10 11:37:43 -0700386 char const * const * ref_api,
Jesse Hall94cdba92013-07-11 09:40:35 -0700387 __eglMustCastToProperFunctionPointerType* curr,
388 getProcAddressType getProcAddress)
Mathias Agopiande586972009-05-28 17:39:03 -0700389{
Jesse Hall1508ae62017-01-19 17:43:26 -0800390 ATRACE_CALL();
391
Mathias Agopian7773c432012-02-13 20:06:08 -0800392 const ssize_t SIZE = 256;
Mathias Agopian0ad71a92011-05-11 20:37:47 -0700393 char scrap[SIZE];
Mathias Agopiande586972009-05-28 17:39:03 -0700394 while (*api) {
395 char const * name = *api;
Yiwei Zhang7cc58922018-10-10 11:37:43 -0700396 if (ref_api) {
397 char const * ref_name = *ref_api;
398 if (std::strcmp(name, ref_name) != 0) {
399 *curr++ = nullptr;
400 ref_api++;
401 continue;
402 }
403 }
404
Jesse Hall94cdba92013-07-11 09:40:35 -0700405 __eglMustCastToProperFunctionPointerType f =
Mathias Agopiande586972009-05-28 17:39:03 -0700406 (__eglMustCastToProperFunctionPointerType)dlsym(dso, name);
Yi Kong48a6cd22018-07-18 10:07:09 -0700407 if (f == nullptr) {
Mathias Agopiande586972009-05-28 17:39:03 -0700408 // couldn't find the entry-point, use eglGetProcAddress()
409 f = getProcAddress(name);
410 }
Yi Kong48a6cd22018-07-18 10:07:09 -0700411 if (f == nullptr) {
Mathias Agopiande586972009-05-28 17:39:03 -0700412 // Try without the OES postfix
413 ssize_t index = ssize_t(strlen(name)) - 3;
Mathias Agopian0ad71a92011-05-11 20:37:47 -0700414 if ((index>0 && (index<SIZE-1)) && (!strcmp(name+index, "OES"))) {
Mathias Agopiande586972009-05-28 17:39:03 -0700415 strncpy(scrap, name, index);
416 scrap[index] = 0;
417 f = (__eglMustCastToProperFunctionPointerType)dlsym(dso, scrap);
Steve Block9d453682011-12-20 16:23:08 +0000418 //ALOGD_IF(f, "found <%s> instead", scrap);
Mathias Agopiande586972009-05-28 17:39:03 -0700419 }
420 }
Yi Kong48a6cd22018-07-18 10:07:09 -0700421 if (f == nullptr) {
Mathias Agopiande586972009-05-28 17:39:03 -0700422 // Try with the OES postfix
Mathias Agopian0ad71a92011-05-11 20:37:47 -0700423 ssize_t index = ssize_t(strlen(name)) - 3;
424 if (index>0 && strcmp(name+index, "OES")) {
425 snprintf(scrap, SIZE, "%sOES", name);
Mathias Agopiande586972009-05-28 17:39:03 -0700426 f = (__eglMustCastToProperFunctionPointerType)dlsym(dso, scrap);
Steve Block9d453682011-12-20 16:23:08 +0000427 //ALOGD_IF(f, "found <%s> instead", scrap);
Mathias Agopiande586972009-05-28 17:39:03 -0700428 }
429 }
Yi Kong48a6cd22018-07-18 10:07:09 -0700430 if (f == nullptr) {
Steve Block9d453682011-12-20 16:23:08 +0000431 //ALOGD("%s", name);
Mathias Agopiande586972009-05-28 17:39:03 -0700432 f = (__eglMustCastToProperFunctionPointerType)gl_unimplemented;
Mathias Agopian48d438d2012-01-28 21:44:00 -0800433
434 /*
Tao Wu1cdfe642020-06-23 12:33:02 -0700435 * GL_EXT_debug_marker is special, we always report it as
Mathias Agopian48d438d2012-01-28 21:44:00 -0800436 * supported, it's handled by GLES_trace. If GLES_trace is not
437 * enabled, then these are no-ops.
438 */
439 if (!strcmp(name, "glInsertEventMarkerEXT")) {
440 f = (__eglMustCastToProperFunctionPointerType)gl_noop;
441 } else if (!strcmp(name, "glPushGroupMarkerEXT")) {
442 f = (__eglMustCastToProperFunctionPointerType)gl_noop;
443 } else if (!strcmp(name, "glPopGroupMarkerEXT")) {
444 f = (__eglMustCastToProperFunctionPointerType)gl_noop;
445 }
Mathias Agopiande586972009-05-28 17:39:03 -0700446 }
447 *curr++ = f;
448 api++;
Yiwei Zhang7cc58922018-10-10 11:37:43 -0700449 if (ref_api) ref_api++;
Mathias Agopiande586972009-05-28 17:39:03 -0700450 }
451}
452
Peiyong Line4da7a82023-08-08 20:46:53 +0000453static std::string findLibrary(const std::string libraryName, const std::string searchPath,
454 const bool exact) {
455 if (exact) {
456 std::string absolutePath = searchPath + "/" + libraryName + ".so";
457 if (!access(absolutePath.c_str(), R_OK)) {
458 return absolutePath;
459 }
460 return std::string();
461 }
462
463 DIR* d = opendir(searchPath.c_str());
464 if (d != nullptr) {
465 struct dirent* e;
466 while ((e = readdir(d)) != nullptr) {
467 if (e->d_type == DT_DIR) {
468 continue;
469 }
470 if (!strcmp(e->d_name, "libGLES_android.so")) {
471 // always skip the software renderer
472 continue;
473 }
474 if (strstr(e->d_name, libraryName.c_str()) == e->d_name) {
475 if (!strcmp(e->d_name + strlen(e->d_name) - 3, ".so")) {
476 std::string result = searchPath + "/" + e->d_name;
477 closedir(d);
478 return result;
479 }
480 }
481 }
482 closedir(d);
483 }
484 // Driver not found. gah.
485 return std::string();
486}
487
Peiyong Lin0d10b252019-04-30 18:03:04 -0700488static void* load_system_driver(const char* kind, const char* suffix, const bool exact) {
Jesse Hall1508ae62017-01-19 17:43:26 -0800489 ATRACE_CALL();
Mathias Agopian99381422013-04-23 20:52:29 +0200490
Peiyong Lin9f0c79d2019-04-22 10:14:57 -0700491 std::string libraryName = std::string("lib") + kind;
492 if (suffix) {
493 libraryName += std::string("_") + suffix;
Peiyong Lin0d10b252019-04-30 18:03:04 -0700494 } else if (!exact) {
Peiyong Line4da7a82023-08-08 20:46:53 +0000495 // Deprecated for devices launching in Android 14
496 // Look for files that match
497 // libGLES_*.so, or,
Peiyong Lin0d10b252019-04-30 18:03:04 -0700498 // libEGL_*.so, libGLESv1_CM_*.so, libGLESv2_*.so
499 libraryName += std::string("_");
Peiyong Lin9f0c79d2019-04-22 10:14:57 -0700500 }
Peiyong Line4da7a82023-08-08 20:46:53 +0000501
502 void* dso = nullptr;
503
Peiyong Lin6b2b28f2023-11-03 04:24:57 +0000504 const bool isSuffixAngle = suffix != nullptr && strcmp(suffix, ANGLE_SUFFIX_VALUE) == 0;
Peiyong Line4da7a82023-08-08 20:46:53 +0000505 const std::string absolutePath =
Peiyong Lin64bb9f62024-02-29 01:39:31 +0000506 findLibrary(libraryName, isSuffixAngle ? SYSTEM_LIB_PATH : VENDOR_LIB_EGL_DIR, exact);
Mathias Agopian65421432017-03-08 11:49:05 -0800507 if (absolutePath.empty()) {
Mathias Agopian99381422013-04-23 20:52:29 +0200508 // this happens often, we don't want to log an error
Yi Kong48a6cd22018-07-18 10:07:09 -0700509 return nullptr;
Mathias Agopian8c173842009-09-20 16:01:02 -0700510 }
Peiyong Line4da7a82023-08-08 20:46:53 +0000511 const char* const driverAbsolutePath = absolutePath.c_str();
Mathias Agopiande586972009-05-28 17:39:03 -0700512
Peiyong Line4da7a82023-08-08 20:46:53 +0000513 // Currently the default driver is unlikely to be ANGLE on most devices,
Peiyong Lin64bb9f62024-02-29 01:39:31 +0000514 // hence put this first. Only use sphal namespace when system ANGLE binaries
515 // are not the default drivers.
516 if (!isSuffixAngle) {
Peiyong Line4da7a82023-08-08 20:46:53 +0000517 // Try to load drivers from the 'sphal' namespace, if it exist. Fall back to
518 // the original routine when the namespace does not exist.
519 // See /system/linkerconfig/contents/namespace for the configuration of the
520 // sphal namespace.
521 dso = do_android_load_sphal_library(driverAbsolutePath, RTLD_NOW | RTLD_LOCAL);
522 } else {
523 // Try to load drivers from the default namespace.
524 // See /system/linkerconfig/contents/namespace for the configuration of the
525 // default namespace.
526 dso = do_dlopen(driverAbsolutePath, RTLD_NOW | RTLD_LOCAL);
527 }
528
Yi Kong48a6cd22018-07-18 10:07:09 -0700529 if (dso == nullptr) {
Mathias Agopian8c173842009-09-20 16:01:02 -0700530 const char* err = dlerror();
Peiyong Line4da7a82023-08-08 20:46:53 +0000531 ALOGE("load_driver(%s): %s", driverAbsolutePath, err ? err : "unknown");
Yi Kong48a6cd22018-07-18 10:07:09 -0700532 return nullptr;
Mathias Agopian8c173842009-09-20 16:01:02 -0700533 }
534
Peiyong Line4da7a82023-08-08 20:46:53 +0000535 ALOGV("loaded %s", driverAbsolutePath);
Mathias Agopianbaca89c2009-08-20 19:09:34 -0700536
Jesse Hall7a8d83e2016-12-20 15:24:28 -0800537 return dso;
538}
539
Courtney Goeltzenleuchterd1646cf2020-04-23 08:19:11 -0600540static void* load_angle(const char* kind, android_namespace_t* ns) {
Cody Northrop1f00e172018-04-02 11:23:31 -0600541 std::string name = std::string("lib") + kind + "_angle.so";
Peiyong Line4da7a82023-08-08 20:46:53 +0000542 void* so = nullptr;
Cody Northrop1f00e172018-04-02 11:23:31 -0600543
Peiyong Line4da7a82023-08-08 20:46:53 +0000544 if (android::GraphicsEnv::getInstance().shouldUseSystemAngle()) {
545 so = do_dlopen(name.c_str(), RTLD_NOW | RTLD_LOCAL);
546 } else {
547 const android_dlextinfo dlextinfo = {
548 .flags = ANDROID_DLEXT_USE_NAMESPACE,
549 .library_namespace = ns,
550 };
Roman Lavrov0ec33d72024-10-15 16:03:52 -0400551 auto prop = base::GetProperty("debug.angle.libs.suffix", "");
552 if (!prop.empty()) {
553 name = std::string("lib") + kind + "_" + prop + ".so";
554 }
Peiyong Line4da7a82023-08-08 20:46:53 +0000555 so = do_android_dlopen_ext(name.c_str(), RTLD_LOCAL | RTLD_NOW, &dlextinfo);
556 }
Cody Northrop1f00e172018-04-02 11:23:31 -0600557
558 if (so) {
Cody Northrop1f00e172018-04-02 11:23:31 -0600559 return so;
560 } else {
561 ALOGE("dlopen_ext(\"%s\") failed: %s", name.c_str(), dlerror());
562 }
563
564 return nullptr;
565}
566
Jesse Hall7a8d83e2016-12-20 15:24:28 -0800567static void* load_updated_driver(const char* kind, android_namespace_t* ns) {
Jesse Hall1508ae62017-01-19 17:43:26 -0800568 ATRACE_CALL();
Jesse Hall7a8d83e2016-12-20 15:24:28 -0800569 const android_dlextinfo dlextinfo = {
570 .flags = ANDROID_DLEXT_USE_NAMESPACE,
571 .library_namespace = ns,
572 };
573 void* so = nullptr;
Jesse Hall7a8d83e2016-12-20 15:24:28 -0800574 for (auto key : HAL_SUBNAME_KEY_PROPERTIES) {
Michael Hoisie4e0f56b2020-04-30 18:40:55 -0400575 auto prop = base::GetProperty(key, "");
576 if (prop.empty()) {
Peiyong Lin9f0c79d2019-04-22 10:14:57 -0700577 continue;
578 }
579 std::string name = std::string("lib") + kind + "_" + prop + ".so";
580 so = do_android_dlopen_ext(name.c_str(), RTLD_LOCAL | RTLD_NOW, &dlextinfo);
581 if (so) {
582 return so;
Jesse Hall7a8d83e2016-12-20 15:24:28 -0800583 }
Yiwei Zhang9058b8f2020-11-12 20:23:00 +0000584 ALOGE("Could not load %s from updatable gfx driver namespace: %s.", name.c_str(),
585 dlerror());
Jesse Hall7a8d83e2016-12-20 15:24:28 -0800586 }
587 return nullptr;
588}
589
Peiyong Lin8cd204d2019-04-19 14:05:17 -0700590Loader::driver_t* Loader::attempt_to_load_angle(egl_connection_t* cnx) {
Jesse Hall1508ae62017-01-19 17:43:26 -0800591 ATRACE_CALL();
Yiwei Zhangb22f0862020-04-23 10:40:24 -0700592
Courtney Goeltzenleuchter30ad2ab2018-10-30 08:20:44 -0600593 android_namespace_t* ns = android::GraphicsEnv::getInstance().getAngleNamespace();
Peiyong Line4da7a82023-08-08 20:46:53 +0000594 // ANGLE namespace is used for loading ANGLE from apk, and hence if namespace is not
595 // constructed, it means ANGLE apk is not set to be the OpenGL ES driver.
596 // Hence skip if ANGLE apk and system ANGLE are not set to be the OpenGL ES driver.
597 if (!ns && !android::GraphicsEnv::getInstance().shouldUseSystemAngle()) {
Peiyong Lin8cd204d2019-04-19 14:05:17 -0700598 return nullptr;
Cody Northrop6d082ef2018-09-11 09:42:31 -0600599 }
Peiyong Lin8cd204d2019-04-19 14:05:17 -0700600
Solti54161bf2023-11-09 21:09:53 +0000601 // use ANGLE APK driver
602 android::GraphicsEnv::getInstance().setDriverToLoad(android::GpuStatsInfo::Driver::ANGLE);
Peiyong Lin8cd204d2019-04-19 14:05:17 -0700603 driver_t* hnd = nullptr;
604
605 // ANGLE doesn't ship with GLES library, and thus we skip GLES driver.
Yuxin Hu97ba1542024-09-30 23:46:50 +0000606 // b/370113081: if there is no libEGL_angle.so in namespace ns, libEGL_angle.so in system
607 // partition will be loaded instead. If there is no libEGL_angle.so in system partition, no
608 // angle libs are loaded, and app that sets to use ANGLE will crash.
Courtney Goeltzenleuchterd1646cf2020-04-23 08:19:11 -0600609 void* dso = load_angle("EGL", ns);
Peiyong Lin8cd204d2019-04-19 14:05:17 -0700610 if (dso) {
611 initialize_api(dso, cnx, EGL);
612 hnd = new driver_t(dso);
613
Courtney Goeltzenleuchterd1646cf2020-04-23 08:19:11 -0600614 dso = load_angle("GLESv1_CM", ns);
Charlie Lao840bd532020-01-16 17:34:37 -0800615 initialize_api(dso, cnx, GLESv1_CM);
616 hnd->set(dso, GLESv1_CM);
617
Courtney Goeltzenleuchterd1646cf2020-04-23 08:19:11 -0600618 dso = load_angle("GLESv2", ns);
Peiyong Lin8cd204d2019-04-19 14:05:17 -0700619 initialize_api(dso, cnx, GLESv2);
620 hnd->set(dso, GLESv2);
621 }
622 return hnd;
623}
624
Peiyong Lin2f51e752023-06-15 22:35:14 +0000625void Loader::attempt_to_init_angle_backend(void* dso, egl_connection_t* cnx) {
Peiyong Lin9fc4cf32023-11-03 05:18:53 +0000626 cnx->angleGetDisplayPlatformFunc = dlsym(dso, "ANGLEGetDisplayPlatform");
627 cnx->angleResetDisplayPlatformFunc = dlsym(dso, "ANGLEResetDisplayPlatform");
628
629 if (cnx->angleGetDisplayPlatformFunc) {
Peiyong Lin2f51e752023-06-15 22:35:14 +0000630 ALOGV("ANGLE GLES library loaded");
631 cnx->angleLoaded = true;
Peiyong Line4da7a82023-08-08 20:46:53 +0000632 android::GraphicsEnv::getInstance().setDriverToLoad(android::GpuStatsInfo::Driver::ANGLE);
Courtney Goeltzenleuchterd1646cf2020-04-23 08:19:11 -0600633 } else {
Peiyong Lin2f51e752023-06-15 22:35:14 +0000634 ALOGV("Native GLES library loaded");
635 cnx->angleLoaded = false;
Courtney Goeltzenleuchterd1646cf2020-04-23 08:19:11 -0600636 }
637}
638
Peiyong Lin8cd204d2019-04-19 14:05:17 -0700639Loader::driver_t* Loader::attempt_to_load_updated_driver(egl_connection_t* cnx) {
640 ATRACE_CALL();
Yiwei Zhangd40aaac2020-06-04 05:26:56 -0700641
Peiyong Lin8cd204d2019-04-19 14:05:17 -0700642 android_namespace_t* ns = android::GraphicsEnv::getInstance().getDriverNamespace();
643 if (!ns) {
644 return nullptr;
Jesse Hall7a8d83e2016-12-20 15:24:28 -0800645 }
646
Yiwei Zhang5e21eb32019-06-05 00:26:03 -0700647 ALOGD("Load updated gl driver.");
Yiwei Zhang27ab3ac2019-07-02 18:10:55 -0700648 android::GraphicsEnv::getInstance().setDriverToLoad(android::GpuStatsInfo::Driver::GL_UPDATED);
Peiyong Lin8cd204d2019-04-19 14:05:17 -0700649 driver_t* hnd = nullptr;
650 void* dso = load_updated_driver("GLES", ns);
Peiyong Line83b8682019-04-18 17:23:02 -0700651 if (dso) {
Charlie Lao840bd532020-01-16 17:34:37 -0800652 initialize_api(dso, cnx, EGL | GLESv1_CM | GLESv2);
Peiyong Lin8cd204d2019-04-19 14:05:17 -0700653 hnd = new driver_t(dso);
654 return hnd;
Peiyong Line83b8682019-04-18 17:23:02 -0700655 }
656
Peiyong Lin8cd204d2019-04-19 14:05:17 -0700657 dso = load_updated_driver("EGL", ns);
658 if (dso) {
659 initialize_api(dso, cnx, EGL);
660 hnd = new driver_t(dso);
661
Charlie Lao840bd532020-01-16 17:34:37 -0800662 dso = load_updated_driver("GLESv1_CM", ns);
663 initialize_api(dso, cnx, GLESv1_CM);
664 hnd->set(dso, GLESv1_CM);
665
Peiyong Lin8cd204d2019-04-19 14:05:17 -0700666 dso = load_updated_driver("GLESv2", ns);
667 initialize_api(dso, cnx, GLESv2);
668 hnd->set(dso, GLESv2);
669 }
670 return hnd;
Peiyong Lin8cd204d2019-04-19 14:05:17 -0700671}
672
Peiyong Lin0d10b252019-04-30 18:03:04 -0700673Loader::driver_t* Loader::attempt_to_load_system_driver(egl_connection_t* cnx, const char* suffix,
674 const bool exact) {
Peiyong Lin8cd204d2019-04-19 14:05:17 -0700675 ATRACE_CALL();
Solti54161bf2023-11-09 21:09:53 +0000676 if (suffix && strcmp(suffix, "angle") == 0) {
677 // use system ANGLE driver
678 android::GraphicsEnv::getInstance().setDriverToLoad(android::GpuStatsInfo::Driver::ANGLE);
679 } else {
680 android::GraphicsEnv::getInstance().setDriverToLoad(android::GpuStatsInfo::Driver::GL);
681 }
682
Peiyong Lin8cd204d2019-04-19 14:05:17 -0700683 driver_t* hnd = nullptr;
Peiyong Lin0d10b252019-04-30 18:03:04 -0700684 void* dso = load_system_driver("GLES", suffix, exact);
Peiyong Lin8cd204d2019-04-19 14:05:17 -0700685 if (dso) {
Charlie Lao840bd532020-01-16 17:34:37 -0800686 initialize_api(dso, cnx, EGL | GLESv1_CM | GLESv2);
Peiyong Lin8cd204d2019-04-19 14:05:17 -0700687 hnd = new driver_t(dso);
688 return hnd;
689 }
Peiyong Lin0d10b252019-04-30 18:03:04 -0700690 dso = load_system_driver("EGL", suffix, exact);
Peiyong Lin8cd204d2019-04-19 14:05:17 -0700691 if (dso) {
692 initialize_api(dso, cnx, EGL);
693 hnd = new driver_t(dso);
694
Charlie Lao840bd532020-01-16 17:34:37 -0800695 dso = load_system_driver("GLESv1_CM", suffix, exact);
696 initialize_api(dso, cnx, GLESv1_CM);
697 hnd->set(dso, GLESv1_CM);
698
Peiyong Lin0d10b252019-04-30 18:03:04 -0700699 dso = load_system_driver("GLESv2", suffix, exact);
Peiyong Lin8cd204d2019-04-19 14:05:17 -0700700 initialize_api(dso, cnx, GLESv2);
701 hnd->set(dso, GLESv2);
702 }
703 return hnd;
Peiyong Line83b8682019-04-18 17:23:02 -0700704}
705
706void Loader::initialize_api(void* dso, egl_connection_t* cnx, uint32_t mask) {
Mathias Agopiande586972009-05-28 17:39:03 -0700707 if (mask & EGL) {
708 getProcAddress = (getProcAddressType)dlsym(dso, "eglGetProcAddress");
709
Jesse Hall94cdba92013-07-11 09:40:35 -0700710 ALOGE_IF(!getProcAddress,
Jesse Hall7a8d83e2016-12-20 15:24:28 -0800711 "can't find eglGetProcAddress() in EGL driver library");
Mathias Agopiande586972009-05-28 17:39:03 -0700712
Mathias Agopian618fa102009-10-14 02:06:37 -0700713 egl_t* egl = &cnx->egl;
Mathias Agopiande586972009-05-28 17:39:03 -0700714 __eglMustCastToProperFunctionPointerType* curr =
715 (__eglMustCastToProperFunctionPointerType*)egl;
716 char const * const * api = egl_names;
717 while (*api) {
718 char const * name = *api;
Jesse Hall94cdba92013-07-11 09:40:35 -0700719 __eglMustCastToProperFunctionPointerType f =
Mathias Agopiande586972009-05-28 17:39:03 -0700720 (__eglMustCastToProperFunctionPointerType)dlsym(dso, name);
Yi Kong48a6cd22018-07-18 10:07:09 -0700721 if (f == nullptr) {
Mathias Agopiande586972009-05-28 17:39:03 -0700722 // couldn't find the entry-point, use eglGetProcAddress()
723 f = getProcAddress(name);
Yi Kong48a6cd22018-07-18 10:07:09 -0700724 if (f == nullptr) {
725 f = (__eglMustCastToProperFunctionPointerType)nullptr;
Mathias Agopiande586972009-05-28 17:39:03 -0700726 }
727 }
728 *curr++ = f;
729 api++;
730 }
731 }
Jesse Hall94cdba92013-07-11 09:40:35 -0700732
Mathias Agopiande586972009-05-28 17:39:03 -0700733 if (mask & GLESv1_CM) {
Yiwei Zhang7cc58922018-10-10 11:37:43 -0700734 init_api(dso, gl_names_1, gl_names,
Mathias Agopian618fa102009-10-14 02:06:37 -0700735 (__eglMustCastToProperFunctionPointerType*)
Mathias Agopian7773c432012-02-13 20:06:08 -0800736 &cnx->hooks[egl_connection_t::GLESv1_INDEX]->gl,
Mathias Agopian618fa102009-10-14 02:06:37 -0700737 getProcAddress);
Mathias Agopiande586972009-05-28 17:39:03 -0700738 }
739
740 if (mask & GLESv2) {
Yiwei Zhang7cc58922018-10-10 11:37:43 -0700741 init_api(dso, gl_names, nullptr,
Mathias Agopian618fa102009-10-14 02:06:37 -0700742 (__eglMustCastToProperFunctionPointerType*)
Mathias Agopian7773c432012-02-13 20:06:08 -0800743 &cnx->hooks[egl_connection_t::GLESv2_INDEX]->gl,
Mathias Agopiande586972009-05-28 17:39:03 -0700744 getProcAddress);
745 }
Mathias Agopiande586972009-05-28 17:39:03 -0700746}
747
Peiyong Lin8cd204d2019-04-19 14:05:17 -0700748} // namespace android