summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author John Reck <jreck@google.com> 2021-07-15 15:27:50 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2021-07-15 15:27:50 +0000
commit6a84070852de7fe86d502310b88da0607bbe21fe (patch)
treefe7df133707446b15e37b08c383f0d5c667403c9
parent1c405c33b09214c089fbcd14f260dcb02f3859ca (diff)
parentcf1170fbda6ba5dc3d6890c489d7521cdc6fc3b7 (diff)
Merge "Always submit after texture uploads" into sc-dev
-rw-r--r--libs/hwui/pipeline/skia/SkiaPipeline.cpp8
-rw-r--r--libs/hwui/renderthread/DrawFrameTask.cpp6
2 files changed, 12 insertions, 2 deletions
diff --git a/libs/hwui/pipeline/skia/SkiaPipeline.cpp b/libs/hwui/pipeline/skia/SkiaPipeline.cpp
index 44a6e4354608..4e7471d5d888 100644
--- a/libs/hwui/pipeline/skia/SkiaPipeline.cpp
+++ b/libs/hwui/pipeline/skia/SkiaPipeline.cpp
@@ -207,12 +207,16 @@ bool SkiaPipeline::createOrUpdateLayer(RenderNode* node, const DamageAccumulator
void SkiaPipeline::prepareToDraw(const RenderThread& thread, Bitmap* bitmap) {
GrDirectContext* context = thread.getGrContext();
- if (context) {
+ if (context && !bitmap->isHardware()) {
ATRACE_FORMAT("Bitmap#prepareToDraw %dx%d", bitmap->width(), bitmap->height());
auto image = bitmap->makeImage();
- if (image.get() && !bitmap->isHardware()) {
+ if (image.get()) {
SkImage_pinAsTexture(image.get(), context);
SkImage_unpinAsTexture(image.get(), context);
+ // A submit is necessary as there may not be a frame coming soon, so without a call
+ // to submit these texture uploads can just sit in the queue building up until
+ // we run out of RAM
+ context->flushAndSubmit();
}
}
}
diff --git a/libs/hwui/renderthread/DrawFrameTask.cpp b/libs/hwui/renderthread/DrawFrameTask.cpp
index 5c4b9019b0ad..db29e342855b 100644
--- a/libs/hwui/renderthread/DrawFrameTask.cpp
+++ b/libs/hwui/renderthread/DrawFrameTask.cpp
@@ -130,6 +130,12 @@ void DrawFrameTask::run() {
if (CC_LIKELY(canDrawThisFrame)) {
dequeueBufferDuration = context->draw();
} else {
+ // Do a flush in case syncFrameState performed any texture uploads. Since we skipped
+ // the draw() call, those uploads (or deletes) will end up sitting in the queue.
+ // Do them now
+ if (GrDirectContext* grContext = mRenderThread->getGrContext()) {
+ grContext->flushAndSubmit();
+ }
// wait on fences so tasks don't overlap next frame
context->waitOnFences();
}