diff options
author | John Reck <jreck@google.com> | 2021-07-14 15:52:19 -0400 |
---|---|---|
committer | John Reck <jreck@google.com> | 2021-07-14 17:06:28 -0400 |
commit | cf1170fbda6ba5dc3d6890c489d7521cdc6fc3b7 (patch) | |
tree | a56b491ba2c6538856d6aee7d233962613c6c48a /libs/hwui/pipeline/skia/SkiaPipeline.cpp | |
parent | ab7b0e89918d8db03830378d5520076cd0a2b970 (diff) |
Always submit after texture uploads
Ensure GrContext::submit() is always called after either
Bitmap#prepareToDraw() or if DrawFrameTask skipped drawing.
In either case texture uploads & deletions will be scheduled,
but without the submit they won't actually be performed. This
can end up running out of RAM.
Bug: 189393671
Test: manual test app
Change-Id: I57477c64457558487e9e5ec0a979ad9099a8cb2c
Diffstat (limited to 'libs/hwui/pipeline/skia/SkiaPipeline.cpp')
-rw-r--r-- | libs/hwui/pipeline/skia/SkiaPipeline.cpp | 8 |
1 files changed, 6 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(); } } } |