Merge change 22222 into eclair

* changes:
  fix a bug in ComponentSizeChooser where it could pick a software EGLConfig instead of a better h/w one.
This commit is contained in:
Android (Google) Code Review
2009-08-20 19:12:51 -07:00
2 changed files with 19 additions and 17 deletions

View File

@@ -655,25 +655,27 @@ public class GLSurfaceView extends SurfaceView implements SurfaceHolder.Callback
EGLConfig closestConfig = null; EGLConfig closestConfig = null;
int closestDistance = 1000; int closestDistance = 1000;
for(EGLConfig config : configs) { for(EGLConfig config : configs) {
int r = findConfigAttrib(egl, display, config,
EGL10.EGL_RED_SIZE, 0);
int g = findConfigAttrib(egl, display, config,
EGL10.EGL_GREEN_SIZE, 0);
int b = findConfigAttrib(egl, display, config,
EGL10.EGL_BLUE_SIZE, 0);
int a = findConfigAttrib(egl, display, config,
EGL10.EGL_ALPHA_SIZE, 0);
int d = findConfigAttrib(egl, display, config, int d = findConfigAttrib(egl, display, config,
EGL10.EGL_DEPTH_SIZE, 0); EGL10.EGL_DEPTH_SIZE, 0);
int s = findConfigAttrib(egl, display, config, int s = findConfigAttrib(egl, display, config,
EGL10.EGL_STENCIL_SIZE, 0); EGL10.EGL_STENCIL_SIZE, 0);
int distance = Math.abs(r - mRedSize) if (d >= mDepthSize && s>= mStencilSize) {
+ Math.abs(g - mGreenSize) int r = findConfigAttrib(egl, display, config,
+ Math.abs(b - mBlueSize) + Math.abs(a - mAlphaSize) EGL10.EGL_RED_SIZE, 0);
+ Math.abs(d - mDepthSize) + Math.abs(s - mStencilSize); int g = findConfigAttrib(egl, display, config,
if (distance < closestDistance) { EGL10.EGL_GREEN_SIZE, 0);
closestDistance = distance; int b = findConfigAttrib(egl, display, config,
closestConfig = config; EGL10.EGL_BLUE_SIZE, 0);
int a = findConfigAttrib(egl, display, config,
EGL10.EGL_ALPHA_SIZE, 0);
int distance = Math.abs(r - mRedSize)
+ Math.abs(g - mGreenSize)
+ Math.abs(b - mBlueSize)
+ Math.abs(a - mAlphaSize);
if (distance < closestDistance) {
closestDistance = distance;
closestConfig = config;
}
} }
} }
return closestConfig; return closestConfig;

View File

@@ -224,12 +224,12 @@ void Loader::init_api(void* dso,
void *Loader::load_driver(const char* driver, gl_hooks_t* hooks, uint32_t mask) void *Loader::load_driver(const char* driver, gl_hooks_t* hooks, uint32_t mask)
{ {
//LOGD("%s", driver);
void* dso = dlopen(driver, RTLD_NOW | RTLD_LOCAL); void* dso = dlopen(driver, RTLD_NOW | RTLD_LOCAL);
LOGE_IF(!dso, "%s", dlerror());
if (dso == 0) if (dso == 0)
return 0; return 0;
LOGD("loaded %s", driver);
if (mask & EGL) { if (mask & EGL) {
getProcAddress = (getProcAddressType)dlsym(dso, "eglGetProcAddress"); getProcAddress = (getProcAddressType)dlsym(dso, "eglGetProcAddress");