OSDN Git Service

try to keep omap4 alive
authorMathias Agopian <mathias@google.com>
Wed, 28 Aug 2013 22:22:29 +0000 (15:22 -0700)
committerMathias Agopian <mathias@google.com>
Wed, 28 Aug 2013 22:22:29 +0000 (15:22 -0700)
Bug: 10527646
Change-Id: Iec572a910e932115cf4f2e1215142b10cd91bd6f

opengl/libs/Android.mk
opengl/libs/EGL/Loader.cpp
opengl/libs/EGL/eglApi.cpp

index b4756dd..eb263d3 100644 (file)
@@ -52,12 +52,9 @@ endif
 ifeq ($(TARGET_BOARD_PLATFORM),msm7k)
   LOCAL_CFLAGS += -DADRENO130=1
 endif
-
-ifeq ($(TARGET_BOARD_PLATFORM), s5pc110)
-  # see Loader.cpp for details
-  LOCAL_CFLAGS += -DSYSTEMUI_PBSIZE_HACK=1
+ifeq ($(TARGET_BOARD_PLATFORM), omap4)
+  LOCAL_CFLAGS += -DWORKAROUND_BUG_10194508=1
 endif
-
 ifneq ($(MAX_EGL_CACHE_ENTRY_SIZE),)
   LOCAL_CFLAGS += -DMAX_EGL_CACHE_ENTRY_SIZE=$(MAX_EGL_CACHE_ENTRY_SIZE)
 endif
index beaa560..02914a0 100644 (file)
@@ -374,35 +374,6 @@ void *Loader::load_driver(const char* kind,
         ALOGE_IF(!getProcAddress,
                 "can't find eglGetProcAddress() in %s", driver_absolute_path);
 
-#ifdef SYSTEMUI_PBSIZE_HACK
-#warning "SYSTEMUI_PBSIZE_HACK enabled"
-        /*
-         * TODO: replace SYSTEMUI_PBSIZE_HACK by something less hackish
-         *
-         * Here we adjust the PB size from its default value to 512KB which
-         * is the minimum acceptable for the systemui process.
-         * We do this on low-end devices only because it allows us to enable
-         * h/w acceleration in the systemui process while keeping the
-         * memory usage down.
-         *
-         * Obviously, this is the wrong place and wrong way to make this
-         * adjustment, but at the time of this writing this was the safest
-         * solution.
-         */
-        const char *cmdline = getProcessCmdline();
-        if (strstr(cmdline, "systemui")) {
-            void *imgegl = dlopen("/vendor/lib/libIMGegl.so", RTLD_LAZY);
-            if (imgegl) {
-                unsigned int *PVRDefaultPBS =
-                        (unsigned int *)dlsym(imgegl, "PVRDefaultPBS");
-                if (PVRDefaultPBS) {
-                    ALOGD("setting default PBS to 512KB, was %d KB", *PVRDefaultPBS / 1024);
-                    *PVRDefaultPBS = 512*1024;
-                }
-            }
-        }
-#endif
-
         egl_t* egl = &cnx->egl;
         __eglMustCastToProperFunctionPointerType* curr =
             (__eglMustCastToProperFunctionPointerType*)egl;
index 7410c12..9d792fb 100644 (file)
@@ -413,7 +413,25 @@ EGLSurface eglCreateWindowSurface(  EGLDisplay dpy, EGLConfig config,
         // of our native format. So if sRGB gamma is requested, we have to
         // modify the EGLconfig's format before setting the native window's
         // format.
-
+#if WORKAROUND_BUG_10194508
+#warning "WORKAROUND_10194508 enabled"
+        EGLint format;
+        if (!cnx->egl.eglGetConfigAttrib(iDpy, config, EGL_NATIVE_VISUAL_ID,
+                &format)) {
+            ALOGE("eglGetConfigAttrib(EGL_NATIVE_VISUAL_ID) failed: %#x",
+                    eglGetError());
+            format = 0;
+        }
+        if (attrib_list) {
+            for (const EGLint* attr = attrib_list; *attr != EGL_NONE;
+                    attr += 2) {
+                if (*attr == EGL_GL_COLORSPACE_KHR &&
+                        dp->haveExtension("EGL_KHR_gl_colorspace")) {
+                    format = modifyFormatColorspace(format, *(attr+1));
+                }
+            }
+        }
+#else
         // by default, just pick RGBA_8888
         EGLint format = HAL_PIXEL_FORMAT_RGBA_8888;
 
@@ -444,6 +462,7 @@ EGLSurface eglCreateWindowSurface(  EGLDisplay dpy, EGLConfig config,
                 }
             }
         }
+#endif
         if (format != 0) {
             int err = native_window_set_buffers_format(window, format);
             if (err != 0) {