Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save steven676/7287482 to your computer and use it in GitHub Desktop.
Save steven676/7287482 to your computer and use it in GitHub Desktop.
[PATCH 4/6] libEGL: restore SYSTEMUI_PBSIZE_HACK (against android-4.4_r1.2 frameworks/native)
From 5287313505a027834a809228b23183b968562145 Mon Sep 17 00:00:00 2001
From: Steven Luo <steven+android@steven676.net>
Date: Sat, 2 Nov 2013 23:06:18 -0700
Subject: [PATCH 4/4] libEGL: restore SYSTEMUI_PBSIZE_HACK
This was removed in the otherwise unrelated commit f4486c6... ("try to
keep omap4 alive").
Change-Id: I6b62a3a4332a0376eb6865c2674aaf3f8ef262bd
---
opengl/libs/Android.mk | 2 ++
opengl/libs/EGL/Loader.cpp | 29 +++++++++++++++++++++++++++++
2 files changed, 31 insertions(+)
diff --git a/opengl/libs/Android.mk b/opengl/libs/Android.mk
index 43ef27f..55c6c80 100644
--- a/opengl/libs/Android.mk
+++ b/opengl/libs/Android.mk
@@ -53,6 +53,8 @@ ifeq ($(TARGET_BOARD_PLATFORM), omap4)
endif
ifeq ($(TARGET_BOARD_PLATFORM), s5pc110)
LOCAL_CFLAGS += -DWORKAROUND_BUG_10194508=1
+ # see Loader.cpp for details
+ LOCAL_CFLAGS += -DSYSTEMUI_PBSIZE_HACK=1
endif
ifneq ($(MAX_EGL_CACHE_ENTRY_SIZE),)
LOCAL_CFLAGS += -DMAX_EGL_CACHE_ENTRY_SIZE=$(MAX_EGL_CACHE_ENTRY_SIZE)
diff --git a/opengl/libs/EGL/Loader.cpp b/opengl/libs/EGL/Loader.cpp
index 02914a0..beaa560 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;
--
1.7.10.4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment