diff options
author | Chet Haase <chet@google.com> | 2012-06-06 19:03:58 -0700 |
---|---|---|
committer | Chet Haase <chet@google.com> | 2012-06-07 06:25:04 -0700 |
commit | 44b2fe3fc114ee5f7273c6b0fee2cc999bf244a2 (patch) | |
tree | 8d54bda8c5b7021be5d923beb641a9efb22dcf30 /libs | |
parent | 43fa4c5261a732decae3bbfaea2a00f8bb9b709c (diff) | |
download | frameworks_base-44b2fe3fc114ee5f7273c6b0fee2cc999bf244a2.zip frameworks_base-44b2fe3fc114ee5f7273c6b0fee2cc999bf244a2.tar.gz frameworks_base-44b2fe3fc114ee5f7273c6b0fee2cc999bf244a2.tar.bz2 |
Track canvas clearing for swap buffers logic.
A previous fix made it necessary for a frame to render something to GL
in order to cause a call to eglSwapBuffers(). Besides the calls being
tracked as part of issuing a DisplayList, there is also a potential call
to clear the canvas (via glClear()) on non-opaque surfaces. This call is also
good to track, since a surface that gets cleared without any other drawing operations
is worth flipping to the screen (to erase old contents on that surface).
This fix tracks the status of the pre-draw operations to find out whether
glClear() was called and then sets the drawing status appropriately.
Issue #6606422 QuickContact dismissal is janky again (Tracking)
Change-Id: I5fcaccfdc9293dd46b83f2fc279730a5d2740ebf
Diffstat (limited to 'libs')
-rw-r--r-- | libs/hwui/DisplayListRenderer.cpp | 3 | ||||
-rw-r--r-- | libs/hwui/DisplayListRenderer.h | 2 | ||||
-rw-r--r-- | libs/hwui/LayerRenderer.cpp | 6 | ||||
-rw-r--r-- | libs/hwui/LayerRenderer.h | 2 | ||||
-rw-r--r-- | libs/hwui/OpenGLRenderer.cpp | 9 | ||||
-rw-r--r-- | libs/hwui/OpenGLRenderer.h | 4 |
6 files changed, 15 insertions, 11 deletions
diff --git a/libs/hwui/DisplayListRenderer.cpp b/libs/hwui/DisplayListRenderer.cpp index 88d2209..d376e3a 100644 --- a/libs/hwui/DisplayListRenderer.cpp +++ b/libs/hwui/DisplayListRenderer.cpp @@ -1368,13 +1368,14 @@ void DisplayListRenderer::setViewport(int width, int height) { mHeight = height; } -void DisplayListRenderer::prepareDirty(float left, float top, +int DisplayListRenderer::prepareDirty(float left, float top, float right, float bottom, bool opaque) { mSnapshot = new Snapshot(mFirstSnapshot, SkCanvas::kMatrix_SaveFlag | SkCanvas::kClip_SaveFlag); mSaveCount = 1; mSnapshot->setClip(0.0f, 0.0f, mWidth, mHeight); mRestoreSaveCount = -1; + return DrawGlInfo::kStatusDone; // No invalidate needed at record-time } void DisplayListRenderer::finish() { diff --git a/libs/hwui/DisplayListRenderer.h b/libs/hwui/DisplayListRenderer.h index 4fa1baa..6b4c6b2 100644 --- a/libs/hwui/DisplayListRenderer.h +++ b/libs/hwui/DisplayListRenderer.h @@ -547,7 +547,7 @@ public: virtual bool isDeferred(); virtual void setViewport(int width, int height); - virtual void prepareDirty(float left, float top, float right, float bottom, bool opaque); + virtual int prepareDirty(float left, float top, float right, float bottom, bool opaque); virtual void finish(); virtual status_t callDrawGLFunction(Functor *functor, Rect& dirty); diff --git a/libs/hwui/LayerRenderer.cpp b/libs/hwui/LayerRenderer.cpp index 2a4e72b..65f8c7c 100644 --- a/libs/hwui/LayerRenderer.cpp +++ b/libs/hwui/LayerRenderer.cpp @@ -37,7 +37,7 @@ LayerRenderer::LayerRenderer(Layer* layer): mLayer(layer) { LayerRenderer::~LayerRenderer() { } -void LayerRenderer::prepareDirty(float left, float top, float right, float bottom, bool opaque) { +int LayerRenderer::prepareDirty(float left, float top, float right, float bottom, bool opaque) { LAYER_RENDERER_LOGD("Rendering into layer, fbo = %d", mLayer->getFbo()); glBindFramebuffer(GL_FRAMEBUFFER, mLayer->getFbo()); @@ -57,9 +57,9 @@ void LayerRenderer::prepareDirty(float left, float top, float right, float botto mLayer->region.subtractSelf(r); } - OpenGLRenderer::prepareDirty(dirty.left, dirty.top, dirty.right, dirty.bottom, opaque); + return OpenGLRenderer::prepareDirty(dirty.left, dirty.top, dirty.right, dirty.bottom, opaque); #else - OpenGLRenderer::prepareDirty(0.0f, 0.0f, width, height, opaque); + return OpenGLRenderer::prepareDirty(0.0f, 0.0f, width, height, opaque); #endif } diff --git a/libs/hwui/LayerRenderer.h b/libs/hwui/LayerRenderer.h index c461ea7..8f3a0a3 100644 --- a/libs/hwui/LayerRenderer.h +++ b/libs/hwui/LayerRenderer.h @@ -47,7 +47,7 @@ public: ANDROID_API LayerRenderer(Layer* layer); virtual ~LayerRenderer(); - virtual void prepareDirty(float left, float top, float right, float bottom, bool opaque); + virtual int prepareDirty(float left, float top, float right, float bottom, bool opaque); virtual void finish(); virtual bool hasLayer(); diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp index 2dc9726..0d857bf 100644 --- a/libs/hwui/OpenGLRenderer.cpp +++ b/libs/hwui/OpenGLRenderer.cpp @@ -164,11 +164,11 @@ void OpenGLRenderer::setViewport(int width, int height) { glEnableVertexAttribArray(Program::kBindingPosition); } -void OpenGLRenderer::prepare(bool opaque) { - prepareDirty(0.0f, 0.0f, mWidth, mHeight, opaque); +int OpenGLRenderer::prepare(bool opaque) { + return prepareDirty(0.0f, 0.0f, mWidth, mHeight, opaque); } -void OpenGLRenderer::prepareDirty(float left, float top, float right, float bottom, bool opaque) { +int OpenGLRenderer::prepareDirty(float left, float top, float right, float bottom, bool opaque) { mCaches.clearGarbage(); mSnapshot = new Snapshot(mFirstSnapshot, @@ -184,9 +184,12 @@ void OpenGLRenderer::prepareDirty(float left, float top, float right, float bott if (!opaque) { mCaches.setScissor(left, mSnapshot->height - bottom, right - left, bottom - top); glClear(GL_COLOR_BUFFER_BIT); + return DrawGlInfo::kStatusDrew; } else { mCaches.resetScissor(); } + + return DrawGlInfo::kStatusDone; } void OpenGLRenderer::syncState() { diff --git a/libs/hwui/OpenGLRenderer.h b/libs/hwui/OpenGLRenderer.h index 7703e80..b342f50 100644 --- a/libs/hwui/OpenGLRenderer.h +++ b/libs/hwui/OpenGLRenderer.h @@ -67,8 +67,8 @@ public: virtual void setViewport(int width, int height); - ANDROID_API void prepare(bool opaque); - virtual void prepareDirty(float left, float top, float right, float bottom, bool opaque); + ANDROID_API int prepare(bool opaque); + virtual int prepareDirty(float left, float top, float right, float bottom, bool opaque); virtual void finish(); // These two calls must not be recorded in display lists |