diff options
Diffstat (limited to 'libs')
-rw-r--r-- | libs/gui/SurfaceTexture.cpp | 5 | ||||
-rw-r--r-- | libs/gui/SurfaceTextureClient.cpp | 11 | ||||
-rw-r--r-- | libs/hwui/DisplayListRenderer.cpp | 12 | ||||
-rw-r--r-- | libs/hwui/DisplayListRenderer.h | 14 | ||||
-rw-r--r-- | libs/hwui/OpenGLRenderer.cpp | 2 |
5 files changed, 38 insertions, 6 deletions
diff --git a/libs/gui/SurfaceTexture.cpp b/libs/gui/SurfaceTexture.cpp index ac9b33b..79a01a3 100644 --- a/libs/gui/SurfaceTexture.cpp +++ b/libs/gui/SurfaceTexture.cpp @@ -608,6 +608,9 @@ status_t SurfaceTexture::disconnect(int api) { if (mConnectedApi == api) { drainQueueAndFreeBuffersLocked(); mConnectedApi = NO_CONNECTED_API; + mNextCrop.makeInvalid(); + mNextScalingMode = NATIVE_WINDOW_SCALING_MODE_FREEZE; + mNextTransform = 0; mDequeueCondition.signal(); } else { LOGE("disconnect: connected to another api (cur=%d, req=%d)", @@ -1022,7 +1025,7 @@ void SurfaceTexture::dump(String8& result, const char* prefix, mCurrentCrop.top, mCurrentCrop.right, mCurrentCrop.bottom, mCurrentTransform, mCurrentTexture, prefix, mNextCrop.left, mNextCrop.top, mNextCrop.right, mNextCrop.bottom, - mCurrentTransform, fifoSize, fifo.string() + mNextTransform, fifoSize, fifo.string() ); result.append(buffer); diff --git a/libs/gui/SurfaceTextureClient.cpp b/libs/gui/SurfaceTextureClient.cpp index 5a35b4d..710ef94 100644 --- a/libs/gui/SurfaceTextureClient.cpp +++ b/libs/gui/SurfaceTextureClient.cpp @@ -407,8 +407,15 @@ int SurfaceTextureClient::disconnect(int api) { LOGV("SurfaceTextureClient::disconnect"); Mutex::Autolock lock(mMutex); int err = mSurfaceTexture->disconnect(api); - if (!err && api == NATIVE_WINDOW_API_CPU) { - mConnectedToCpu = false; + if (!err) { + freeAllBuffers(); + mReqFormat = 0; + mReqWidth = 0; + mReqHeight = 0; + mReqUsage = 0; + if (api == NATIVE_WINDOW_API_CPU) { + mConnectedToCpu = false; + } } return err; } diff --git a/libs/hwui/DisplayListRenderer.cpp b/libs/hwui/DisplayListRenderer.cpp index 88cfc5a..cedf456 100644 --- a/libs/hwui/DisplayListRenderer.cpp +++ b/libs/hwui/DisplayListRenderer.cpp @@ -194,6 +194,7 @@ void DisplayList::initFromDisplayListRenderer(const DisplayListRenderer& recorde void DisplayList::init() { mSize = 0; + mIsRenderable = true; } size_t DisplayList::getSize() { @@ -892,7 +893,7 @@ bool DisplayList::replay(OpenGLRenderer& renderer, Rect& dirty, uint32_t level) // Base structure /////////////////////////////////////////////////////////////////////////////// -DisplayListRenderer::DisplayListRenderer(): mWriter(MIN_WRITER_SIZE) { +DisplayListRenderer::DisplayListRenderer(): mWriter(MIN_WRITER_SIZE), mHasDrawOps(false) { } DisplayListRenderer::~DisplayListRenderer() { @@ -926,6 +927,8 @@ void DisplayListRenderer::reset() { mPathMap.clear(); mMatrices.clear(); + + mHasDrawOps = false; } /////////////////////////////////////////////////////////////////////////////// @@ -938,6 +941,7 @@ DisplayList* DisplayListRenderer::getDisplayList(DisplayList* displayList) { } else { displayList->initFromDisplayListRenderer(*this, true); } + displayList->setRenderable(mHasDrawOps); return displayList; } @@ -982,7 +986,11 @@ int DisplayListRenderer::save(int flags) { } void DisplayListRenderer::restore() { - addOp(DisplayList::Restore); + if (mRestoreSaveCount < 0) { + addOp(DisplayList::Restore); + } else { + mRestoreSaveCount--; + } OpenGLRenderer::restore(); } diff --git a/libs/hwui/DisplayListRenderer.h b/libs/hwui/DisplayListRenderer.h index 69e72a4..8cd7fea 100644 --- a/libs/hwui/DisplayListRenderer.h +++ b/libs/hwui/DisplayListRenderer.h @@ -63,6 +63,7 @@ public: // IMPORTANT: Update the intialization of OP_NAMES in the .cpp file // when modifying this file enum Op { + // Non-drawing operations Save = 0, Restore, RestoreToCount, @@ -75,6 +76,7 @@ public: SetMatrix, ConcatMatrix, ClipRect, + // Drawing operations DrawDisplayList, DrawLayer, DrawBitmap, @@ -113,6 +115,14 @@ public: static void outputLogBuffer(int fd); + void setRenderable(bool renderable) { + mIsRenderable = renderable; + } + + bool isRenderable() const { + return mIsRenderable; + } + private: void init(); @@ -207,6 +217,8 @@ private: mutable SkFlattenableReadBuffer mReader; size_t mSize; + + bool mIsRenderable; }; /////////////////////////////////////////////////////////////////////////////// @@ -328,6 +340,7 @@ private: inline void addOp(DisplayList::Op drawOp) { insertRestoreToCount(); mWriter.writeInt(drawOp); + mHasDrawOps = mHasDrawOps || drawOp >= DisplayList::DrawDisplayList; } inline void addInt(int value) { @@ -479,6 +492,7 @@ private: SkWriter32 mWriter; int mRestoreSaveCount; + bool mHasDrawOps; friend class DisplayList; diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp index 04f3c58..a20a88e 100644 --- a/libs/hwui/OpenGLRenderer.cpp +++ b/libs/hwui/OpenGLRenderer.cpp @@ -1278,7 +1278,7 @@ bool OpenGLRenderer::drawDisplayList(DisplayList* displayList, uint32_t width, u // All the usual checks and setup operations (quickReject, setupDraw, etc.) // will be performed by the display list itself - if (displayList) { + if (displayList && displayList->isRenderable()) { return displayList->replay(*this, dirty, level); } |