summaryrefslogtreecommitdiffstats
path: root/opengl/include
diff options
context:
space:
mode:
authorJesse Hall <jessehall@google.com>2012-04-05 15:53:28 -0700
committerJesse Hall <jessehall@google.com>2012-04-09 21:36:17 -0700
commit258385978c517a47626161b1e644c48bcee28de1 (patch)
tree23832c73a74da659b78104838c3cc1d43bbdc291 /opengl/include
parentb29e5e8c2682ae145e8c56d9afb061f8da7f854c (diff)
downloadframeworks_native-258385978c517a47626161b1e644c48bcee28de1.zip
frameworks_native-258385978c517a47626161b1e644c48bcee28de1.tar.gz
frameworks_native-258385978c517a47626161b1e644c48bcee28de1.tar.bz2
Hibernate the EGL implementation when idle
If the EGL implementation supports the EGL_IMG_hibernate_process extension, use it to hibernate (and hopefully release memory or other resources) when the process isn't actively using EGL or OpenGL ES. The idleness heuristic used in this change is: (a) Wake up when entering any EGL API call, and remain awake for the duration of the call. (b) Do not hibernate when any window surface exists; this means the application is very likely in the foreground. (c) Do not hibernate while any context is made current to a thread. The app may be using a client API without the EGL layer knowing, so it is not safe to hibernate. (d) Only check these conditions and attempt to hibernate after a window surface is destroyed or a thread's context is detached. By not attempting to hibernate at the end of every EGL call, we avoid some transient wakeups/hibernate cycles when the app is mostly idle, or is starting to become active but hasn't created its window surface yet. On a Galaxy Nexus, hibernating frees 1567 VM pages from the process. Both hibernating and waking can take anywhere from 30ms to over 100ms -- measurements have been very inconsistent. Change-Id: Ib555f5d9d069aefccca06e8173a89625b5f32d7e
Diffstat (limited to 'opengl/include')
-rw-r--r--opengl/include/EGL/eglext.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/opengl/include/EGL/eglext.h b/opengl/include/EGL/eglext.h
index ca11863..2d41aa7 100644
--- a/opengl/include/EGL/eglext.h
+++ b/opengl/include/EGL/eglext.h
@@ -248,7 +248,6 @@ typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMEFREQUENCYNVPROC)(void);
typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMENVPROC)(void);
#endif
-
/* EGL_ANDROID_blob_cache
*/
#ifndef EGL_ANDROID_blob_cache
@@ -263,6 +262,14 @@ typedef void (EGLAPIENTRYP PFNEGLSETBLOBCACHEFUNCSANDROIDPROC) (EGLDisplay dpy,
EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get);
#endif
+/* EGL_IMG_hibernate_process
+ */
+#ifndef EGL_IMG_hibernate_process
+#define EGL_IMG_hibernate_process 1
+typedef EGLBoolean (EGLAPIENTRYP PFEGLHIBERNATEPROCESSIMGPROC)(void);
+typedef EGLBoolean (EGLAPIENTRYP PFEGLAWAKENPROCESSIMGPROC)(void);
+#endif
+
#ifdef __cplusplus
}
#endif