diff options
author | Stan Iliev <stani@google.com> | 2017-03-23 16:56:51 -0400 |
---|---|---|
committer | Stan Iliev <stani@google.com> | 2017-07-18 19:00:15 -0400 |
commit | 3310fb1b24c6cdd0781674fab69e359caf9d17e5 (patch) | |
tree | f795813741f9e97aad102e4d1b777e52e36beee7 /libs/hwui/renderthread/RenderProxy.cpp | |
parent | a554ba6e2ebc320e9227a0302c8079c0f2cb9e85 (diff) |
Cache VectorDrawables in an atlas
Optimize VectorDrawables for Skia pipeline: draw small VectorDrawables
in a GPU atlas instead of seprate offscreen buffers.
This implementation is using CacheManger and allows for the atlas to
be released if there is a memory pressure.
Test: A new unit test for VectorDrawableAtlas is passing. Systrace shows
0.5ms faster DrawFrame for fling in Settings app main screen.
Change-Id: Ide3884eefae777e1547f1dfdb67b807185839fb4
Diffstat (limited to 'libs/hwui/renderthread/RenderProxy.cpp')
-rw-r--r-- | libs/hwui/renderthread/RenderProxy.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/libs/hwui/renderthread/RenderProxy.cpp b/libs/hwui/renderthread/RenderProxy.cpp index 370cf525fa58..7fe966dde316 100644 --- a/libs/hwui/renderthread/RenderProxy.cpp +++ b/libs/hwui/renderthread/RenderProxy.cpp @@ -21,6 +21,7 @@ #include "Properties.h" #include "Readback.h" #include "Rect.h" +#include "pipeline/skia/VectorDrawableAtlas.h" #include "renderthread/CanvasContext.h" #include "renderthread/EglManager.h" #include "renderthread/RenderTask.h" @@ -718,6 +719,19 @@ void RenderProxy::post(RenderTask* task) { mRenderThread.queue(task); } +CREATE_BRIDGE1(repackVectorDrawableAtlas, RenderThread* thread) { + args->thread->cacheManager().acquireVectorDrawableAtlas()->repackIfNeeded( + args->thread->getGrContext()); + return nullptr; +} + +void RenderProxy::repackVectorDrawableAtlas() { + RenderThread& thread = RenderThread::getInstance(); + SETUP_TASK(repackVectorDrawableAtlas); + args->thread = &thread; + thread.queue(task); +} + void* RenderProxy::postAndWait(MethodInvokeRenderTask* task) { void* retval; task->setReturnPtr(&retval); |