Loading libs/hwui/AmbientShadow.cpp +0 −1 Original line number Diff line number Diff line Loading @@ -54,7 +54,6 @@ #include <math.h> #include <utils/Log.h> #include <utils/Vector.h> #include "AmbientShadow.h" #include "ShadowTessellator.h" Loading libs/hwui/Caches.h +3 −2 Original line number Diff line number Diff line Loading @@ -43,12 +43,13 @@ #include <utils/KeyedVector.h> #include <utils/Singleton.h> #include <utils/Vector.h> #include <cutils/compiler.h> #include <SkPath.h> #include <vector> namespace android { namespace uirenderer { Loading Loading @@ -201,7 +202,7 @@ private: std::unique_ptr<TextureVertex[]> mRegionMesh; mutable Mutex mGarbageLock; Vector<Layer*> mLayerGarbage; std::vector<Layer*> mLayerGarbage; bool mInitialized; Loading libs/hwui/DeferredDisplayList.cpp +15 −15 Original line number Diff line number Diff line Loading @@ -69,7 +69,7 @@ public: // NOTE: ignore empty bounds special case, since we don't merge across those ops mBounds.unionWith(state->mBounds); mAllOpsOpaque &= opaqueOverBounds; mOps.add(OpStatePair(op, state)); mOps.push_back(OpStatePair(op, state)); } bool intersects(const Rect& rect) { Loading Loading @@ -133,7 +133,7 @@ public: inline int count() const { return mOps.size(); } protected: Vector<OpStatePair> mOps; std::vector<OpStatePair> mOps; Rect mBounds; // union of bounds of contained ops private: bool mAllOpsOpaque; Loading Loading @@ -418,7 +418,7 @@ void DeferredDisplayList::addSaveLayer(OpenGLRenderer& renderer, this, op, op->getFlags(), newSaveCount); storeStateOpBarrier(renderer, op); mSaveStack.push(newSaveCount); mSaveStack.push_back(newSaveCount); } /** Loading @@ -433,7 +433,7 @@ void DeferredDisplayList::addSave(OpenGLRenderer& renderer, SaveOp* op, int newS // store and replay the save operation, as it may be needed to correctly playback the clip DEFER_LOGD(" adding save barrier with new save count %d", newSaveCount); storeStateOpBarrier(renderer, op); mSaveStack.push(newSaveCount); mSaveStack.push_back(newSaveCount); } } Loading @@ -456,11 +456,11 @@ void DeferredDisplayList::addRestoreToCount(OpenGLRenderer& renderer, StateOp* o resetBatchingState(); } if (mSaveStack.isEmpty() || newSaveCount > mSaveStack.top()) { if (mSaveStack.empty() || newSaveCount > mSaveStack.back()) { return; } while (!mSaveStack.isEmpty() && mSaveStack.top() >= newSaveCount) mSaveStack.pop(); while (!mSaveStack.empty() && mSaveStack.back() >= newSaveCount) mSaveStack.pop_back(); storeRestoreToCountBarrier(renderer, op, mSaveStack.size() + FLUSH_SAVE_STACK_DEPTH); } Loading Loading @@ -492,7 +492,7 @@ void DeferredDisplayList::addDrawOp(OpenGLRenderer& renderer, DrawOp* op) { // the merge path in those cases deferInfo.mergeable &= !recordingComplexClip(); deferInfo.opaqueOverBounds &= !recordingComplexClip() && mSaveStack.isEmpty() && mSaveStack.empty() && !state->mRoundRectClipState; if (CC_LIKELY(mAvoidOverdraw) && mBatches.size() && Loading @@ -507,7 +507,7 @@ void DeferredDisplayList::addDrawOp(OpenGLRenderer& renderer, DrawOp* op) { // TODO: elegant way to reuse batches? DrawBatch* b = new DrawBatch(deferInfo); b->add(op, state, deferInfo.opaqueOverBounds); mBatches.add(b); mBatches.push_back(b); return; } Loading @@ -517,12 +517,12 @@ void DeferredDisplayList::addDrawOp(OpenGLRenderer& renderer, DrawOp* op) { // insertion point of a new batch, will hopefully be immediately after similar batch // (eventually, should be similar shader) int insertBatchIndex = mBatches.size(); if (!mBatches.isEmpty()) { if (!mBatches.empty()) { if (state->mBounds.isEmpty()) { // don't know the bounds for op, so add to last batch and start from scratch on next op DrawBatch* b = new DrawBatch(deferInfo); b->add(op, state, deferInfo.opaqueOverBounds); mBatches.add(b); mBatches.push_back(b); resetBatchingState(); #if DEBUG_DEFER DEFER_LOGD("Warning: Encountered op with empty bounds, resetting batches"); Loading Loading @@ -586,7 +586,7 @@ void DeferredDisplayList::addDrawOp(OpenGLRenderer& renderer, DrawOp* op) { DEFER_LOGD("creating %singBatch %p, bid %x, at %d", deferInfo.mergeable ? "Merg" : "Draw", targetBatch, deferInfo.batchId, insertBatchIndex); mBatches.insertAt(targetBatch, insertBatchIndex); mBatches.insert(mBatches.begin() + insertBatchIndex, targetBatch); } targetBatch->add(op, state, deferInfo.opaqueOverBounds); Loading @@ -597,7 +597,7 @@ void DeferredDisplayList::storeStateOpBarrier(OpenGLRenderer& renderer, StateOp* DeferredDisplayState* state = createState(); renderer.storeDisplayState(*state, getStateOpDeferFlags()); mBatches.add(new StateOpBatch(op, state)); mBatches.push_back(new StateOpBatch(op, state)); resetBatchingState(); } Loading @@ -610,7 +610,7 @@ void DeferredDisplayList::storeRestoreToCountBarrier(OpenGLRenderer& renderer, S // doesn't have kClip_SaveFlag set DeferredDisplayState* state = createState(); renderer.storeDisplayState(*state, getStateOpDeferFlags()); mBatches.add(new RestoreToCountBatch(op, state, newSaveCount)); mBatches.push_back(new RestoreToCountBatch(op, state, newSaveCount)); resetBatchingState(); } Loading @@ -618,7 +618,7 @@ void DeferredDisplayList::storeRestoreToCountBarrier(OpenGLRenderer& renderer, S // Replay / flush ///////////////////////////////////////////////////////////////////////////////// static void replayBatchList(const Vector<Batch*>& batchList, static void replayBatchList(const std::vector<Batch*>& batchList, OpenGLRenderer& renderer, Rect& dirty) { for (unsigned int i = 0; i < batchList.size(); i++) { Loading Loading @@ -664,7 +664,7 @@ void DeferredDisplayList::discardDrawingBatches(const unsigned int maxIndex) { // leave deferred state ops alone for simplicity (empty save restore pairs may now exist) if (mBatches[i] && mBatches[i]->purelyDrawBatch()) { delete mBatches[i]; mBatches.replaceAt(nullptr, i); mBatches[i] = nullptr; } } mEarliestUnclearedIndex = maxIndex + 1; Loading libs/hwui/DeferredDisplayList.h +5 −4 Original line number Diff line number Diff line Loading @@ -19,13 +19,14 @@ #include <utils/Errors.h> #include <utils/LinearAllocator.h> #include <utils/Vector.h> #include <utils/TinyHashMap.h> #include "Matrix.h" #include "OpenGLRenderer.h" #include "Rect.h" #include <vector> class SkBitmap; namespace android { Loading Loading @@ -100,7 +101,7 @@ public: kOpBatch_Count, // Add other batch ids before this }; bool isEmpty() { return mBatches.isEmpty(); } bool isEmpty() { return mBatches.empty(); } /** * Plays back all of the draw ops recorded into batches to the renderer. Loading Loading @@ -157,10 +158,10 @@ private: * that when an associated restoreToCount is deferred, it can be recorded as a * RestoreToCountBatch */ Vector<int> mSaveStack; std::vector<int> mSaveStack; int mComplexClipStackStart; Vector<Batch*> mBatches; std::vector<Batch*> mBatches; // Maps batch ids to the most recent *non-merging* batch of that id Batch* mBatchLookup[kOpBatch_Count]; Loading libs/hwui/DisplayList.cpp +6 −4 Original line number Diff line number Diff line Loading @@ -40,13 +40,13 @@ void DisplayListData::cleanupResources() { resourceCache.lock(); for (size_t i = 0; i < patchResources.size(); i++) { resourceCache.decrementRefcountLocked(patchResources.itemAt(i)); resourceCache.decrementRefcountLocked(patchResources[i]); } resourceCache.unlock(); for (size_t i = 0; i < pathResources.size(); i++) { const SkPath* path = pathResources.itemAt(i); const SkPath* path = pathResources[i]; if (path->unique() && Caches::hasInstance()) { Caches::getInstance().pathCache.removeDeferred(path); } Loading @@ -60,8 +60,10 @@ void DisplayListData::cleanupResources() { } size_t DisplayListData::addChild(DrawRenderNodeOp* op) { mReferenceHolders.push(op->renderNode()); return mChildren.add(op); mReferenceHolders.push_back(op->renderNode()); size_t index = mChildren.size(); mChildren.push_back(op); return index; } }; // namespace uirenderer Loading Loading
libs/hwui/AmbientShadow.cpp +0 −1 Original line number Diff line number Diff line Loading @@ -54,7 +54,6 @@ #include <math.h> #include <utils/Log.h> #include <utils/Vector.h> #include "AmbientShadow.h" #include "ShadowTessellator.h" Loading
libs/hwui/Caches.h +3 −2 Original line number Diff line number Diff line Loading @@ -43,12 +43,13 @@ #include <utils/KeyedVector.h> #include <utils/Singleton.h> #include <utils/Vector.h> #include <cutils/compiler.h> #include <SkPath.h> #include <vector> namespace android { namespace uirenderer { Loading Loading @@ -201,7 +202,7 @@ private: std::unique_ptr<TextureVertex[]> mRegionMesh; mutable Mutex mGarbageLock; Vector<Layer*> mLayerGarbage; std::vector<Layer*> mLayerGarbage; bool mInitialized; Loading
libs/hwui/DeferredDisplayList.cpp +15 −15 Original line number Diff line number Diff line Loading @@ -69,7 +69,7 @@ public: // NOTE: ignore empty bounds special case, since we don't merge across those ops mBounds.unionWith(state->mBounds); mAllOpsOpaque &= opaqueOverBounds; mOps.add(OpStatePair(op, state)); mOps.push_back(OpStatePair(op, state)); } bool intersects(const Rect& rect) { Loading Loading @@ -133,7 +133,7 @@ public: inline int count() const { return mOps.size(); } protected: Vector<OpStatePair> mOps; std::vector<OpStatePair> mOps; Rect mBounds; // union of bounds of contained ops private: bool mAllOpsOpaque; Loading Loading @@ -418,7 +418,7 @@ void DeferredDisplayList::addSaveLayer(OpenGLRenderer& renderer, this, op, op->getFlags(), newSaveCount); storeStateOpBarrier(renderer, op); mSaveStack.push(newSaveCount); mSaveStack.push_back(newSaveCount); } /** Loading @@ -433,7 +433,7 @@ void DeferredDisplayList::addSave(OpenGLRenderer& renderer, SaveOp* op, int newS // store and replay the save operation, as it may be needed to correctly playback the clip DEFER_LOGD(" adding save barrier with new save count %d", newSaveCount); storeStateOpBarrier(renderer, op); mSaveStack.push(newSaveCount); mSaveStack.push_back(newSaveCount); } } Loading @@ -456,11 +456,11 @@ void DeferredDisplayList::addRestoreToCount(OpenGLRenderer& renderer, StateOp* o resetBatchingState(); } if (mSaveStack.isEmpty() || newSaveCount > mSaveStack.top()) { if (mSaveStack.empty() || newSaveCount > mSaveStack.back()) { return; } while (!mSaveStack.isEmpty() && mSaveStack.top() >= newSaveCount) mSaveStack.pop(); while (!mSaveStack.empty() && mSaveStack.back() >= newSaveCount) mSaveStack.pop_back(); storeRestoreToCountBarrier(renderer, op, mSaveStack.size() + FLUSH_SAVE_STACK_DEPTH); } Loading Loading @@ -492,7 +492,7 @@ void DeferredDisplayList::addDrawOp(OpenGLRenderer& renderer, DrawOp* op) { // the merge path in those cases deferInfo.mergeable &= !recordingComplexClip(); deferInfo.opaqueOverBounds &= !recordingComplexClip() && mSaveStack.isEmpty() && mSaveStack.empty() && !state->mRoundRectClipState; if (CC_LIKELY(mAvoidOverdraw) && mBatches.size() && Loading @@ -507,7 +507,7 @@ void DeferredDisplayList::addDrawOp(OpenGLRenderer& renderer, DrawOp* op) { // TODO: elegant way to reuse batches? DrawBatch* b = new DrawBatch(deferInfo); b->add(op, state, deferInfo.opaqueOverBounds); mBatches.add(b); mBatches.push_back(b); return; } Loading @@ -517,12 +517,12 @@ void DeferredDisplayList::addDrawOp(OpenGLRenderer& renderer, DrawOp* op) { // insertion point of a new batch, will hopefully be immediately after similar batch // (eventually, should be similar shader) int insertBatchIndex = mBatches.size(); if (!mBatches.isEmpty()) { if (!mBatches.empty()) { if (state->mBounds.isEmpty()) { // don't know the bounds for op, so add to last batch and start from scratch on next op DrawBatch* b = new DrawBatch(deferInfo); b->add(op, state, deferInfo.opaqueOverBounds); mBatches.add(b); mBatches.push_back(b); resetBatchingState(); #if DEBUG_DEFER DEFER_LOGD("Warning: Encountered op with empty bounds, resetting batches"); Loading Loading @@ -586,7 +586,7 @@ void DeferredDisplayList::addDrawOp(OpenGLRenderer& renderer, DrawOp* op) { DEFER_LOGD("creating %singBatch %p, bid %x, at %d", deferInfo.mergeable ? "Merg" : "Draw", targetBatch, deferInfo.batchId, insertBatchIndex); mBatches.insertAt(targetBatch, insertBatchIndex); mBatches.insert(mBatches.begin() + insertBatchIndex, targetBatch); } targetBatch->add(op, state, deferInfo.opaqueOverBounds); Loading @@ -597,7 +597,7 @@ void DeferredDisplayList::storeStateOpBarrier(OpenGLRenderer& renderer, StateOp* DeferredDisplayState* state = createState(); renderer.storeDisplayState(*state, getStateOpDeferFlags()); mBatches.add(new StateOpBatch(op, state)); mBatches.push_back(new StateOpBatch(op, state)); resetBatchingState(); } Loading @@ -610,7 +610,7 @@ void DeferredDisplayList::storeRestoreToCountBarrier(OpenGLRenderer& renderer, S // doesn't have kClip_SaveFlag set DeferredDisplayState* state = createState(); renderer.storeDisplayState(*state, getStateOpDeferFlags()); mBatches.add(new RestoreToCountBatch(op, state, newSaveCount)); mBatches.push_back(new RestoreToCountBatch(op, state, newSaveCount)); resetBatchingState(); } Loading @@ -618,7 +618,7 @@ void DeferredDisplayList::storeRestoreToCountBarrier(OpenGLRenderer& renderer, S // Replay / flush ///////////////////////////////////////////////////////////////////////////////// static void replayBatchList(const Vector<Batch*>& batchList, static void replayBatchList(const std::vector<Batch*>& batchList, OpenGLRenderer& renderer, Rect& dirty) { for (unsigned int i = 0; i < batchList.size(); i++) { Loading Loading @@ -664,7 +664,7 @@ void DeferredDisplayList::discardDrawingBatches(const unsigned int maxIndex) { // leave deferred state ops alone for simplicity (empty save restore pairs may now exist) if (mBatches[i] && mBatches[i]->purelyDrawBatch()) { delete mBatches[i]; mBatches.replaceAt(nullptr, i); mBatches[i] = nullptr; } } mEarliestUnclearedIndex = maxIndex + 1; Loading
libs/hwui/DeferredDisplayList.h +5 −4 Original line number Diff line number Diff line Loading @@ -19,13 +19,14 @@ #include <utils/Errors.h> #include <utils/LinearAllocator.h> #include <utils/Vector.h> #include <utils/TinyHashMap.h> #include "Matrix.h" #include "OpenGLRenderer.h" #include "Rect.h" #include <vector> class SkBitmap; namespace android { Loading Loading @@ -100,7 +101,7 @@ public: kOpBatch_Count, // Add other batch ids before this }; bool isEmpty() { return mBatches.isEmpty(); } bool isEmpty() { return mBatches.empty(); } /** * Plays back all of the draw ops recorded into batches to the renderer. Loading Loading @@ -157,10 +158,10 @@ private: * that when an associated restoreToCount is deferred, it can be recorded as a * RestoreToCountBatch */ Vector<int> mSaveStack; std::vector<int> mSaveStack; int mComplexClipStackStart; Vector<Batch*> mBatches; std::vector<Batch*> mBatches; // Maps batch ids to the most recent *non-merging* batch of that id Batch* mBatchLookup[kOpBatch_Count]; Loading
libs/hwui/DisplayList.cpp +6 −4 Original line number Diff line number Diff line Loading @@ -40,13 +40,13 @@ void DisplayListData::cleanupResources() { resourceCache.lock(); for (size_t i = 0; i < patchResources.size(); i++) { resourceCache.decrementRefcountLocked(patchResources.itemAt(i)); resourceCache.decrementRefcountLocked(patchResources[i]); } resourceCache.unlock(); for (size_t i = 0; i < pathResources.size(); i++) { const SkPath* path = pathResources.itemAt(i); const SkPath* path = pathResources[i]; if (path->unique() && Caches::hasInstance()) { Caches::getInstance().pathCache.removeDeferred(path); } Loading @@ -60,8 +60,10 @@ void DisplayListData::cleanupResources() { } size_t DisplayListData::addChild(DrawRenderNodeOp* op) { mReferenceHolders.push(op->renderNode()); return mChildren.add(op); mReferenceHolders.push_back(op->renderNode()); size_t index = mChildren.size(); mChildren.push_back(op); return index; } }; // namespace uirenderer Loading