diff options
| author | 2017-05-22 15:04:21 -0700 | |
|---|---|---|
| committer | 2017-05-22 17:17:05 -0700 | |
| commit | 9a814875c4e3a98fea99dae623f22268a9afa38a (patch) | |
| tree | 5d9a07eb07cdacea805609a723f9b35537010420 /libs/hwui/renderthread | |
| parent | 3915e25d41ce40f24fd41d8bcd6a058403d0bbc5 (diff) | |
Improve time to texture destruction
Eliminate textureCache.mGarbage which is only cleared
in a trimMemory. Instead when we hit ~Bitmap post a
message to RenderThread to release the texture immediately
Bug: 38258699
Test: manual
Change-Id: I962ba275e89afb628ba02f74769287edbab9fed4
Diffstat (limited to 'libs/hwui/renderthread')
| -rw-r--r-- | libs/hwui/renderthread/RenderProxy.cpp | 15 | ||||
| -rw-r--r-- | libs/hwui/renderthread/RenderProxy.h | 2 |
2 files changed, 17 insertions, 0 deletions
diff --git a/libs/hwui/renderthread/RenderProxy.cpp b/libs/hwui/renderthread/RenderProxy.cpp index a1f1717e6b96..eed523810403 100644 --- a/libs/hwui/renderthread/RenderProxy.cpp +++ b/libs/hwui/renderthread/RenderProxy.cpp @@ -24,6 +24,7 @@ #include "renderthread/EglManager.h" #include "renderthread/RenderTask.h" #include "renderthread/RenderThread.h" +#include "renderstate/RenderState.h" #include "utils/Macros.h" #include "utils/TimeUtils.h" @@ -693,6 +694,20 @@ int RenderProxy::copyGraphicBufferInto(GraphicBuffer* buffer, SkBitmap* bitmap) } } +CREATE_BRIDGE2(onBitmapDestroyed, RenderThread* thread, uint32_t pixelRefId) { + args->thread->renderState().onBitmapDestroyed(args->pixelRefId); + return nullptr; +} + +void RenderProxy::onBitmapDestroyed(uint32_t pixelRefId) { + if (!RenderThread::hasInstance()) return; + SETUP_TASK(onBitmapDestroyed); + RenderThread& thread = RenderThread::getInstance(); + args->thread = &thread; + args->pixelRefId = pixelRefId; + thread.queue(task); +} + void RenderProxy::post(RenderTask* task) { mRenderThread.queue(task); } diff --git a/libs/hwui/renderthread/RenderProxy.h b/libs/hwui/renderthread/RenderProxy.h index a60ed55c70d2..b21772cd88de 100644 --- a/libs/hwui/renderthread/RenderProxy.h +++ b/libs/hwui/renderthread/RenderProxy.h @@ -135,6 +135,8 @@ public: static sk_sp<Bitmap> allocateHardwareBitmap(SkBitmap& bitmap); static int copyGraphicBufferInto(GraphicBuffer* buffer, SkBitmap* bitmap); + + static void onBitmapDestroyed(uint32_t pixelRefId); private: RenderThread& mRenderThread; CanvasContext* mContext; |