Return to previous RenderEngine behavior for protected buffers
This reverts to the old RenderEngine behavior of not keeping
protected buffers bound as GPU textures. Doing so cause us to
bind the buffer to a GPU texture every frame, but prevents us
from exhausting the protected resources.
Test: atest com.google.android.media.gts.WidevineDashPolicyTests
Bug: 187870007
Change-Id: I5cc95d47fbc0bdfa239fe99dd479aef5c87c0495
diff --git a/libs/renderengine/skia/SkiaGLRenderEngine.cpp b/libs/renderengine/skia/SkiaGLRenderEngine.cpp
index 6cc3d37..aabb5e0 100644
--- a/libs/renderengine/skia/SkiaGLRenderEngine.cpp
+++ b/libs/renderengine/skia/SkiaGLRenderEngine.cpp
@@ -505,10 +505,11 @@
if (mRenderEngineType != RenderEngineType::SKIA_GL_THREADED) {
return;
}
- // we currently don't attempt to map a buffer if the buffer contains protected content
- // because GPU resources for protected buffers is much more limited.
+ // We currently don't attempt to map a buffer if the buffer contains protected content
+ // or we are using a protected context because GPU resources for protected buffers is
+ // much more limited.
const bool isProtectedBuffer = buffer->getUsage() & GRALLOC_USAGE_PROTECTED;
- if (isProtectedBuffer) {
+ if (isProtectedBuffer || mInProtectedContext) {
return;
}
ATRACE_CALL();
@@ -517,7 +518,7 @@
// bound context if we are not already using the protected context (and subsequently switch
// back after the buffer is cached).
auto grContext = getActiveGrContext();
- auto& cache = mInProtectedContext ? mProtectedTextureCache : mTextureCache;
+ auto& cache = mTextureCache;
std::lock_guard<std::mutex> lock(mRenderingMutex);
mGraphicBufferExternalRefs[buffer->getId()]++;