diff options
author | Romain Guy <romainguy@google.com> | 2012-10-18 15:05:02 -0700 |
---|---|---|
committer | Romain Guy <romainguy@google.com> | 2012-10-18 15:05:02 -0700 |
commit | 7c25aab491707f7324f9941b8cfa9bd2b4b97e76 (patch) | |
tree | 2e670c818c33bf2ead5342dad73b48e000d2e94c /libs/hwui/OpenGLRenderer.h | |
parent | b2e2f2470693e78baed20617f989d9a166864ed4 (diff) | |
download | frameworks_base-7c25aab491707f7324f9941b8cfa9bd2b4b97e76.zip frameworks_base-7c25aab491707f7324f9941b8cfa9bd2b4b97e76.tar.gz frameworks_base-7c25aab491707f7324f9941b8cfa9bd2b4b97e76.tar.bz2 |
Defer layer rendering to avoid stalls
Bug #7326824
When a layer is taken out of the cache and initialized it gets cleared
to prepare it for future rendering. This triggers the following sequence
of operations:
glBindFramebuffer(layer.fbo)
attach texture storage to FBO
glClear()
glBindFramebuffer(defaultFbo)
The clear forces a resolve on tilers which stalls the CPU for a little
while, thus producing jank during animations. This change moves the
clear to the next frame when we know we will have to execute a resolve
anyway.
Change-Id: Ic1939c25df20ed65a4c48dc81ee549b2cd8b6ec3
Diffstat (limited to 'libs/hwui/OpenGLRenderer.h')
-rw-r--r-- | libs/hwui/OpenGLRenderer.h | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/libs/hwui/OpenGLRenderer.h b/libs/hwui/OpenGLRenderer.h index a40d69a..c5e4c8e 100644 --- a/libs/hwui/OpenGLRenderer.h +++ b/libs/hwui/OpenGLRenderer.h @@ -94,7 +94,7 @@ public: * and will not be cleared. If false, the target surface * will be cleared */ - ANDROID_API int prepare(bool opaque); + ANDROID_API status_t prepare(bool opaque); /** * Prepares the renderer to draw a frame. This method must be invoked @@ -110,7 +110,7 @@ public: * and will not be cleared. If false, the target surface * will be cleared in the specified dirty rectangle */ - virtual int prepareDirty(float left, float top, float right, float bottom, bool opaque); + virtual status_t prepareDirty(float left, float top, float right, float bottom, bool opaque); /** * Indicates the end of a frame. This method must be invoked whenever @@ -270,6 +270,11 @@ protected: void initViewport(int width, int height); /** + * Clears the underlying surface if needed. + */ + virtual status_t clear(float left, float top, float right, float bottom, bool opaque); + + /** * Call this method after updating a layer during a drawing pass. */ void resumeAfterLayer(); @@ -355,6 +360,10 @@ protected: return false; } + Caches& getCaches() { + return mCaches; + } + private: /** * Ensures the state of the renderer is the same as the state of |