diff options
author | Mathias Agopian <mathias@google.com> | 2012-06-05 21:44:43 -0700 |
---|---|---|
committer | Ethan Chen <intervigil@gmail.com> | 2014-06-30 20:57:52 +0000 |
commit | 974ff062b05784e94bf43a492dd449447656b88c (patch) | |
tree | 93a4308d7f41e2b94ade6d98cd589c10760436f2 | |
parent | 5f550b26b80f3ad0a077041285840078aa941c59 (diff) | |
download | android_frameworks_native-974ff062b05784e94bf43a492dd449447656b88c.tar.gz android_frameworks_native-974ff062b05784e94bf43a492dd449447656b88c.tar.bz2 android_frameworks_native-974ff062b05784e94bf43a492dd449447656b88c.zip |
reduce PB size from 2MB to 512KB
this allows us to enable h/w acceleration on low-end
devices while keeping memory usage down.
Bug: 6557760
Change-Id: I8af2de3038dc2579360b8b73aa452cb7a0e506a9
-rw-r--r-- | opengl/libs/Android.mk | 4 | ||||
-rw-r--r-- | opengl/libs/EGL/Loader.cpp | 29 |
2 files changed, 33 insertions, 0 deletions
diff --git a/opengl/libs/Android.mk b/opengl/libs/Android.mk index 016a9aecd..ed0724e07 100644 --- a/opengl/libs/Android.mk +++ b/opengl/libs/Android.mk @@ -51,6 +51,10 @@ endif ifeq ($(TARGET_BOARD_PLATFORM), omap4) LOCAL_CFLAGS += -DWORKAROUND_BUG_10194508=1 endif +ifeq ($(BOARD_EGL_SYSTEMUI_PBSIZE_HACK),true) + # see Loader.cpp for details + LOCAL_CFLAGS += -DSYSTEMUI_PBSIZE_HACK=1 +endif ifeq ($(BOARD_EGL_WORKAROUND_BUG_10194508),true) LOCAL_CFLAGS += -DWORKAROUND_BUG_10194508=1 endif diff --git a/opengl/libs/EGL/Loader.cpp b/opengl/libs/EGL/Loader.cpp index 02914a06e..beaa560fb 100644 --- a/opengl/libs/EGL/Loader.cpp +++ b/opengl/libs/EGL/Loader.cpp @@ -374,6 +374,35 @@ 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; |