summaryrefslogtreecommitdiff
path: root/services/surfaceflinger/RegionSamplingThread.cpp
diff options
context:
space:
mode:
author Alec Mouri <alecmouri@google.com> 2021-02-26 23:32:32 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2021-02-26 23:32:32 +0000
commit53c4e8aa7c347f8e187090effd15ba7d803b110a (patch)
tree699dacdc15543fd313bc5f0196418ce8db3a29ca /services/surfaceflinger/RegionSamplingThread.cpp
parentd2bed277967c45e19f2310d5c20be46235a08d78 (diff)
parent0d995106c0fb4480ac1de5f58667d918fa9aea62 (diff)
Merge "Dispatch texture destruction off of render thread for screenshots" into sc-dev
Diffstat (limited to 'services/surfaceflinger/RegionSamplingThread.cpp')
-rw-r--r--services/surfaceflinger/RegionSamplingThread.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/services/surfaceflinger/RegionSamplingThread.cpp b/services/surfaceflinger/RegionSamplingThread.cpp
index 09615f920d..e06bc88f7c 100644
--- a/services/surfaceflinger/RegionSamplingThread.cpp
+++ b/services/surfaceflinger/RegionSamplingThread.cpp
@@ -481,6 +481,12 @@ void RegionSamplingThread::captureSample() {
// 1) The region sampling thread is the last owner of the buffer, and the freeing of the buffer
// happens in this thread, as opposed to the main thread.
// 2) The listener(s) receive their notifications prior to freeing the buffer.
+ if (mCachedBuffer != nullptr && mCachedBuffer != buffer) {
+ if (mFlinger.getRenderEngine().getRenderEngineType() ==
+ renderengine::RenderEngine::RenderEngineType::SKIA_GL_THREADED) {
+ mFlinger.getRenderEngine().unbindExternalTextureBuffer(mCachedBuffer->getId());
+ }
+ }
mCachedBuffer = buffer;
ATRACE_INT(lumaSamplingStepTag, static_cast<int>(samplingStep::noWorkNeeded));
}