Loading opengl/libs/Android.mk +6 −1 Original line number Diff line number Diff line Loading @@ -44,6 +44,11 @@ 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 endif ifeq ($(ARCH_ARM_HAVE_TLS_REGISTER),true) LOCAL_CFLAGS += -DHAVE_ARM_TLS_REGISTER endif Loading opengl/libs/EGL/Loader.cpp +47 −0 Original line number Diff line number Diff line Loading @@ -81,6 +81,24 @@ checkGlesEmulationStatus(void) // ---------------------------------------------------------------------------- static char const * getProcessCmdline() { long pid = getpid(); char procPath[128]; snprintf(procPath, 128, "/proc/%ld/cmdline", pid); FILE * file = fopen(procPath, "r"); if (file) { static char cmdline[256]; char *str = fgets(cmdline, sizeof(cmdline) - 1, file); fclose(file); if (str) { return cmdline; } } return NULL; } // ---------------------------------------------------------------------------- Loader::driver_t::driver_t(void* gles) { dso[0] = gles; Loading Loading @@ -280,6 +298,35 @@ void *Loader::load_driver(const char* kind, const char *tag, 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; Loading Loading
opengl/libs/Android.mk +6 −1 Original line number Diff line number Diff line Loading @@ -44,6 +44,11 @@ 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 endif ifeq ($(ARCH_ARM_HAVE_TLS_REGISTER),true) LOCAL_CFLAGS += -DHAVE_ARM_TLS_REGISTER endif Loading
opengl/libs/EGL/Loader.cpp +47 −0 Original line number Diff line number Diff line Loading @@ -81,6 +81,24 @@ checkGlesEmulationStatus(void) // ---------------------------------------------------------------------------- static char const * getProcessCmdline() { long pid = getpid(); char procPath[128]; snprintf(procPath, 128, "/proc/%ld/cmdline", pid); FILE * file = fopen(procPath, "r"); if (file) { static char cmdline[256]; char *str = fgets(cmdline, sizeof(cmdline) - 1, file); fclose(file); if (str) { return cmdline; } } return NULL; } // ---------------------------------------------------------------------------- Loader::driver_t::driver_t(void* gles) { dso[0] = gles; Loading Loading @@ -280,6 +298,35 @@ void *Loader::load_driver(const char* kind, const char *tag, 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; Loading