remove multiplexing of multiple EGL implementation
from now on, the system can only have one EGL
implementation. this means the software and h/w renderer
cannot be used at the same time on a device. Of course, the
h/w renderer is always prefered; in its absence we
default to the software renderer.
Change-Id: Ib579f58055dd0ce4c4a99144131efa11c16ca3d3
diff --git a/opengl/libs/EGL/Loader.cpp b/opengl/libs/EGL/Loader.cpp
index 06be2ef..4ccb21e 100644
--- a/opengl/libs/EGL/Loader.cpp
+++ b/opengl/libs/EGL/Loader.cpp
@@ -118,12 +118,6 @@
// ----------------------------------------------------------------------------
-Loader::entry_t::entry_t(int dpy, int impl, const char* tag)
- : dpy(dpy), impl(impl), tag(tag) {
-}
-
-// ----------------------------------------------------------------------------
-
Loader::Loader()
{
char line[256];
@@ -131,8 +125,9 @@
/* Special case for GLES emulation */
if (checkGlesEmulationStatus() == 0) {
- ALOGD("Emulator without GPU support detected. Fallback to software renderer.");
- gConfig.add( entry_t(0, 0, "android") );
+ ALOGD("Emulator without GPU support detected. "
+ "Fallback to software renderer.");
+ mDriverTag.setTo("android");
return;
}
@@ -141,14 +136,16 @@
if (cfg == NULL) {
// default config
ALOGD("egl.cfg not found, using default config");
- gConfig.add( entry_t(0, 0, "android") );
+ mDriverTag.setTo("android");
} else {
while (fgets(line, 256, cfg)) {
- int dpy;
- int impl;
+ int dpy, impl;
if (sscanf(line, "%u %u %s", &dpy, &impl, tag) == 3) {
//ALOGD(">>> %u %u %s", dpy, impl, tag);
- gConfig.add( entry_t(dpy, impl, tag) );
+ // We only load the h/w accelerated implementation
+ if (tag != String8("android")) {
+ mDriverTag = tag;
+ }
}
}
fclose(cfg);
@@ -160,30 +157,12 @@
GLTrace_stop();
}
-const char* Loader::getTag(int dpy, int impl)
+void* Loader::open(egl_connection_t* cnx)
{
- const Vector<entry_t>& cfgs(gConfig);
- const size_t c = cfgs.size();
- for (size_t i=0 ; i<c ; i++) {
- if (dpy == cfgs[i].dpy)
- if (impl == cfgs[i].impl)
- return cfgs[i].tag.string();
- }
- return 0;
-}
-
-void* Loader::open(EGLNativeDisplayType display, int impl, egl_connection_t* cnx)
-{
- /*
- * TODO: if we don't find display/0, then use 0/0
- * (0/0 should always work)
- */
-
void* dso;
- int index = int(display);
driver_t* hnd = 0;
- char const* tag = getTag(index, impl);
+ char const* tag = mDriverTag.string();
if (tag) {
dso = load_driver("GLES", tag, cnx, EGL | GLESv1_CM | GLESv2);
if (dso) {
@@ -193,16 +172,14 @@
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("GLESv2", tag, cnx, GLESv2), GLESv2 );
}
}
}
- LOG_FATAL_IF(!index && !impl && !hnd,
+ LOG_FATAL_IF(!index && !hnd,
"couldn't find the default OpenGL ES implementation "
"for default display");