Loading libs/renderengine/skia/SkiaGLRenderEngine.cpp +8 −14 Original line number Diff line number Diff line Loading @@ -507,17 +507,18 @@ void SkiaGLRenderEngine::mapExternalTextureBuffer(const sp<GraphicBuffer>& buffe return; } // 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. // because GPU resources for protected buffers is much more limited. const bool isProtectedBuffer = buffer->getUsage() & GRALLOC_USAGE_PROTECTED; if (isProtectedBuffer || mInProtectedContext) { if (isProtectedBuffer) { return; } ATRACE_CALL(); // If we were to support caching protected buffers then we will need to switch the currently // bound context if we are not already using the protected context (and subsequently switch // back after the buffer is cached). // If we were to support caching protected buffers then we will need to switch the // currently bound context if we are not already using the protected context (and subsequently // switch back after the buffer is cached). However, for non-protected content we can bind // the texture in either GL context because they are initialized with the same share_context // which allows the texture state to be shared between them. auto grContext = getActiveGrContext(); auto& cache = mTextureCache; Loading Loading @@ -551,7 +552,6 @@ void SkiaGLRenderEngine::unmapExternalTextureBuffer(const sp<GraphicBuffer>& buf if (iter->second == 0) { mTextureCache.erase(buffer->getId()); mProtectedTextureCache.erase(buffer->getId()); mGraphicBufferExternalRefs.erase(buffer->getId()); } } Loading Loading @@ -703,7 +703,7 @@ status_t SkiaGLRenderEngine::drawLayers(const DisplaySettings& display, validateOutputBufferUsage(buffer->getBuffer()); auto grContext = getActiveGrContext(); auto& cache = mInProtectedContext ? mProtectedTextureCache : mTextureCache; auto& cache = mTextureCache; std::shared_ptr<AutoBackendTexture::LocalRef> surfaceTextureRef; if (const auto& it = cache.find(buffer->getBuffer()->getId()); it != cache.end()) { Loading Loading @@ -1446,12 +1446,6 @@ void SkiaGLRenderEngine::dump(std::string& result) { StringAppendF(&result, "Skia's Protected Wrapped Objects:\n"); gpuProtectedReporter.logOutput(result, true); StringAppendF(&result, "RenderEngine protected AHB/BackendTexture cache size: %zu\n", mProtectedTextureCache.size()); StringAppendF(&result, "Dumping buffer ids...\n"); for (const auto& [id, unused] : mProtectedTextureCache) { StringAppendF(&result, "- 0x%" PRIx64 "\n", id); } StringAppendF(&result, "\n"); StringAppendF(&result, "RenderEngine runtime effects: %zu\n", mRuntimeEffects.size()); for (const auto& [linearEffect, unused] : mRuntimeEffects) { Loading libs/renderengine/skia/SkiaGLRenderEngine.h +1 −3 Original line number Diff line number Diff line Loading @@ -126,11 +126,9 @@ private: // Number of external holders of ExternalTexture references, per GraphicBuffer ID. std::unordered_map<GraphicBufferId, int32_t> mGraphicBufferExternalRefs GUARDED_BY(mRenderingMutex); // Cache of GL textures that we'll store per GraphicBuffer ID, sliced by GPU context. // Cache of GL textures that we'll store per GraphicBuffer ID, shared between GPU contexts. std::unordered_map<GraphicBufferId, std::shared_ptr<AutoBackendTexture::LocalRef>> mTextureCache GUARDED_BY(mRenderingMutex); std::unordered_map<GraphicBufferId, std::shared_ptr<AutoBackendTexture::LocalRef>> mProtectedTextureCache GUARDED_BY(mRenderingMutex); std::unordered_map<LinearEffect, sk_sp<SkRuntimeEffect>, LinearEffectHasher> mRuntimeEffects; StretchShaderFactory mStretchShaderFactory; Loading Loading
libs/renderengine/skia/SkiaGLRenderEngine.cpp +8 −14 Original line number Diff line number Diff line Loading @@ -507,17 +507,18 @@ void SkiaGLRenderEngine::mapExternalTextureBuffer(const sp<GraphicBuffer>& buffe return; } // 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. // because GPU resources for protected buffers is much more limited. const bool isProtectedBuffer = buffer->getUsage() & GRALLOC_USAGE_PROTECTED; if (isProtectedBuffer || mInProtectedContext) { if (isProtectedBuffer) { return; } ATRACE_CALL(); // If we were to support caching protected buffers then we will need to switch the currently // bound context if we are not already using the protected context (and subsequently switch // back after the buffer is cached). // If we were to support caching protected buffers then we will need to switch the // currently bound context if we are not already using the protected context (and subsequently // switch back after the buffer is cached). However, for non-protected content we can bind // the texture in either GL context because they are initialized with the same share_context // which allows the texture state to be shared between them. auto grContext = getActiveGrContext(); auto& cache = mTextureCache; Loading Loading @@ -551,7 +552,6 @@ void SkiaGLRenderEngine::unmapExternalTextureBuffer(const sp<GraphicBuffer>& buf if (iter->second == 0) { mTextureCache.erase(buffer->getId()); mProtectedTextureCache.erase(buffer->getId()); mGraphicBufferExternalRefs.erase(buffer->getId()); } } Loading Loading @@ -703,7 +703,7 @@ status_t SkiaGLRenderEngine::drawLayers(const DisplaySettings& display, validateOutputBufferUsage(buffer->getBuffer()); auto grContext = getActiveGrContext(); auto& cache = mInProtectedContext ? mProtectedTextureCache : mTextureCache; auto& cache = mTextureCache; std::shared_ptr<AutoBackendTexture::LocalRef> surfaceTextureRef; if (const auto& it = cache.find(buffer->getBuffer()->getId()); it != cache.end()) { Loading Loading @@ -1446,12 +1446,6 @@ void SkiaGLRenderEngine::dump(std::string& result) { StringAppendF(&result, "Skia's Protected Wrapped Objects:\n"); gpuProtectedReporter.logOutput(result, true); StringAppendF(&result, "RenderEngine protected AHB/BackendTexture cache size: %zu\n", mProtectedTextureCache.size()); StringAppendF(&result, "Dumping buffer ids...\n"); for (const auto& [id, unused] : mProtectedTextureCache) { StringAppendF(&result, "- 0x%" PRIx64 "\n", id); } StringAppendF(&result, "\n"); StringAppendF(&result, "RenderEngine runtime effects: %zu\n", mRuntimeEffects.size()); for (const auto& [linearEffect, unused] : mRuntimeEffects) { Loading
libs/renderengine/skia/SkiaGLRenderEngine.h +1 −3 Original line number Diff line number Diff line Loading @@ -126,11 +126,9 @@ private: // Number of external holders of ExternalTexture references, per GraphicBuffer ID. std::unordered_map<GraphicBufferId, int32_t> mGraphicBufferExternalRefs GUARDED_BY(mRenderingMutex); // Cache of GL textures that we'll store per GraphicBuffer ID, sliced by GPU context. // Cache of GL textures that we'll store per GraphicBuffer ID, shared between GPU contexts. std::unordered_map<GraphicBufferId, std::shared_ptr<AutoBackendTexture::LocalRef>> mTextureCache GUARDED_BY(mRenderingMutex); std::unordered_map<GraphicBufferId, std::shared_ptr<AutoBackendTexture::LocalRef>> mProtectedTextureCache GUARDED_BY(mRenderingMutex); std::unordered_map<LinearEffect, sk_sp<SkRuntimeEffect>, LinearEffectHasher> mRuntimeEffects; StretchShaderFactory mStretchShaderFactory; Loading