--/*
++/*
** Copyright 2007, The Android Open Source Project
**
-- ** Licensed under the Apache License, Version 2.0 (the "License");
-- ** you may not use this file except in compliance with the License.
-- ** You may obtain a copy of the License at
++ ** Licensed under the Apache License, Version 2.0 (the "License");
++ ** you may not use this file except in compliance with the License.
++ ** You may obtain a copy of the License at
**
-- ** http://www.apache.org/licenses/LICENSE-2.0
++ ** http://www.apache.org/licenses/LICENSE-2.0
**
-- ** Unless required by applicable law or agreed to in writing, software
-- ** distributed under the License is distributed on an "AS IS" BASIS,
-- ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- ** See the License for the specific language governing permissions and
++ ** Unless required by applicable law or agreed to in writing, software
++ ** distributed under the License is distributed on an "AS IS" BASIS,
++ ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
++ ** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*
- * EGL drivers are called
- *
- * /system/lib/egl/lib{[EGL|GLESv1_CM|GLESv2] | GLES}_$TAG.so
- *
+ * EGL userspace drivers must be provided either:
+ * - as a single library:
+ * /vendor/lib/egl/libGLES.so
+ *
+ * - as separate libraries:
+ * /vendor/lib/egl/libEGL.so
+ * /vendor/lib/egl/libGLESv1_CM.so
+ * /vendor/lib/egl/libGLESv2.so
+ *
+ * The software renderer for the emulator must be provided as a single
+ * library at:
+ *
+ * /system/lib/egl/libGLES_android.so
+ *
+ *
+ * For backward compatibility and to facilitate the transition to
+ * this new naming scheme, the loader will additionally look for:
- *
++ *
+ * /{vendor|system}/lib/egl/lib{GLES | [EGL|GLESv1_CM|GLESv2]}_*.so
- *
++ *
*/
ANDROID_SINGLETON_STATIC_INSTANCE( Loader )
// ----------------------------------------------------------------------------
--Loader::driver_t::driver_t(void* gles)
++Loader::driver_t::driver_t(void* gles)
{
dso[0] = gles;
for (size_t i=1 ; i<NELEM(dso) ; i++)
dso[i] = 0;
}
--Loader::driver_t::~driver_t()
++Loader::driver_t::~driver_t()
{
for (size_t i=0 ; i<NELEM(dso) ; i++) {
if (dso[i]) {
{
void* dso;
driver_t* hnd = 0;
--
- char const* tag = mDriverTag.string();
- if (tag) {
- dso = load_driver("GLES", tag, cnx, EGL | GLESv1_CM | GLESv2);
++
+ dso = load_driver("GLES", cnx, EGL | GLESv1_CM | GLESv2);
+ if (dso) {
+ hnd = new driver_t(dso);
+ } else {
+ // Always load EGL first
+ dso = load_driver("EGL", cnx, EGL);
if (dso) {
hnd = new driver_t(dso);
- } else {
- // Always load EGL first
- dso = load_driver("EGL", tag, cnx, EGL);
- if (dso) {
- hnd = new driver_t(dso);
- // TODO: make this more automated
- hnd->set( load_driver("GLESv1_CM", tag, cnx, GLESv1_CM), GLESv1_CM );
- hnd->set( load_driver("GLESv2", tag, cnx, GLESv2), GLESv2 );
- }
+ hnd->set( load_driver("GLESv1_CM", cnx, GLESv1_CM), GLESv1_CM );
+ hnd->set( load_driver("GLESv2", cnx, GLESv2), GLESv2 );
}
}
- LOG_FATAL_IF(!index && !hnd,
- "couldn't find the default OpenGL ES implementation "
- "for default display");
+ LOG_ALWAYS_FATAL_IF(!hnd, "couldn't find an OpenGL ES implementation");
-
+
- cnx->libGles2 = load_wrapper("system/lib/libGLESv2.so");
- cnx->libGles1 = load_wrapper("system/lib/libGLESv1_CM.so");
++ cnx->libGles2 = load_wrapper("/system/lib/libGLESv2.so");
++ cnx->libGles1 = load_wrapper("/system/lib/libGLESv1_CM.so");
+ LOG_ALWAYS_FATAL_IF(!cnx->libGles2 || !cnx->libGles1,
+ "couldn't load system OpenGL ES wrapper libraries");
+
return (void*)hnd;
}
return NO_ERROR;
}
--void Loader::init_api(void* dso,
-- char const * const * api,
-- __eglMustCastToProperFunctionPointerType* curr,
-- getProcAddressType getProcAddress)
++void Loader::init_api(void* dso,
++ char const * const * api,
++ __eglMustCastToProperFunctionPointerType* curr,
++ getProcAddressType getProcAddress)
{
const ssize_t SIZE = 256;
char scrap[SIZE];
while (*api) {
char const * name = *api;
-- __eglMustCastToProperFunctionPointerType f =
++ __eglMustCastToProperFunctionPointerType f =
(__eglMustCastToProperFunctionPointerType)dlsym(dso, name);
if (f == NULL) {
// couldn't find the entry-point, use eglGetProcAddress()
if (mask & EGL) {
getProcAddress = (getProcAddressType)dlsym(dso, "eglGetProcAddress");
-- ALOGE_IF(!getProcAddress,
++ ALOGE_IF(!getProcAddress,
"can't find eglGetProcAddress() in %s", driver_absolute_path);
#ifdef SYSTEMUI_PBSIZE_HACK
char const * const * api = egl_names;
while (*api) {
char const * name = *api;
-- __eglMustCastToProperFunctionPointerType f =
++ __eglMustCastToProperFunctionPointerType f =
(__eglMustCastToProperFunctionPointerType)dlsym(dso, name);
if (f == NULL) {
// couldn't find the entry-point, use eglGetProcAddress()
api++;
}
}
--
++
if (mask & GLESv1_CM) {
init_api(dso, gl_names,
(__eglMustCastToProperFunctionPointerType*)
&cnx->hooks[egl_connection_t::GLESv2_INDEX]->gl,
getProcAddress);
}
--
++
return dso;
}