Loading libs/renderengine/gl/GLESRenderEngine.cpp +6 −9 Original line number Diff line number Diff line Loading @@ -1028,20 +1028,17 @@ bool GLESRenderEngine::supportsProtectedContent() const { return mProtectedEGLContext != EGL_NO_CONTEXT; } bool GLESRenderEngine::useProtectedContext(bool useProtectedContext) { if (useProtectedContext == mInProtectedContext) { return true; } if (useProtectedContext && mProtectedEGLContext == EGL_NO_CONTEXT) { return false; void GLESRenderEngine::useProtectedContext(bool useProtectedContext) { if (useProtectedContext == mInProtectedContext || (useProtectedContext && !supportsProtectedContent())) { return; } const EGLSurface surface = useProtectedContext ? mProtectedStubSurface : mStubSurface; const EGLContext context = useProtectedContext ? mProtectedEGLContext : mEGLContext; const bool success = eglMakeCurrent(mEGLDisplay, surface, surface, context) == EGL_TRUE; if (success) { if (eglMakeCurrent(mEGLDisplay, surface, surface, context) == EGL_TRUE) { mInProtectedContext = useProtectedContext; } return success; } EGLImageKHR GLESRenderEngine::createFramebufferImageIfNeeded(ANativeWindowBuffer* nativeBuffer, bool isProtected, Loading libs/renderengine/gl/GLESRenderEngine.h +1 −1 Original line number Diff line number Diff line Loading @@ -62,7 +62,7 @@ public: void deleteTextures(size_t count, uint32_t const* names) override; bool isProtected() const override { return mInProtectedContext; } bool supportsProtectedContent() const override; bool useProtectedContext(bool useProtectedContext) override; void useProtectedContext(bool useProtectedContext) override; status_t drawLayers(const DisplaySettings& display, const std::vector<const LayerSettings*>& layers, const std::shared_ptr<ExternalTexture>& buffer, Loading libs/renderengine/include/renderengine/RenderEngine.h +1 −1 Original line number Diff line number Diff line Loading @@ -127,7 +127,7 @@ public: virtual bool supportsProtectedContent() const = 0; // Attempt to switch RenderEngine into and out of protectedContext mode virtual bool useProtectedContext(bool useProtectedContext) = 0; virtual void useProtectedContext(bool useProtectedContext) = 0; // Notify RenderEngine of changes to the dimensions of the primary display // so that it can configure its internal caches accordingly. Loading libs/renderengine/include/renderengine/mock/RenderEngine.h +1 −1 Original line number Diff line number Diff line Loading @@ -44,7 +44,7 @@ public: MOCK_CONST_METHOD0(getMaxViewportDims, size_t()); MOCK_CONST_METHOD0(isProtected, bool()); MOCK_CONST_METHOD0(supportsProtectedContent, bool()); MOCK_METHOD1(useProtectedContext, bool(bool)); MOCK_METHOD1(useProtectedContext, void(bool)); MOCK_METHOD0(cleanupPostRender, void()); MOCK_CONST_METHOD0(canSkipPostRenderCleanup, bool()); MOCK_METHOD6(drawLayers, Loading libs/renderengine/skia/SkiaGLRenderEngine.cpp +11 −12 Original line number Diff line number Diff line Loading @@ -320,7 +320,8 @@ SkiaGLRenderEngine::SkiaGLRenderEngine(const RenderEngineCreationArgs& args, EGL options.fReducedShaderVariations = true; options.fPersistentCache = &mSkSLCacheMonitor; mGrContext = GrDirectContext::MakeGL(glInterface, options); if (useProtectedContext(true)) { if (supportsProtectedContent()) { useProtectedContext(true); mProtectedGrContext = GrDirectContext::MakeGL(glInterface, options); useProtectedContext(false); } Loading Loading @@ -373,12 +374,10 @@ GrDirectContext* SkiaGLRenderEngine::getActiveGrContext() const { return mInProtectedContext ? mProtectedGrContext.get() : mGrContext.get(); } bool SkiaGLRenderEngine::useProtectedContext(bool useProtectedContext) { if (useProtectedContext == mInProtectedContext) { return true; } if (useProtectedContext && !supportsProtectedContent()) { return false; void SkiaGLRenderEngine::useProtectedContext(bool useProtectedContext) { if (useProtectedContext == mInProtectedContext || (useProtectedContext && !supportsProtectedContent())) { return; } // release any scratch resources before switching into a new mode Loading @@ -389,9 +388,8 @@ bool SkiaGLRenderEngine::useProtectedContext(bool useProtectedContext) { const EGLSurface surface = useProtectedContext ? mProtectedPlaceholderSurface : mPlaceholderSurface; const EGLContext context = useProtectedContext ? mProtectedEGLContext : mEGLContext; const bool success = eglMakeCurrent(mEGLDisplay, surface, surface, context) == EGL_TRUE; if (success) { if (eglMakeCurrent(mEGLDisplay, surface, surface, context) == EGL_TRUE) { mInProtectedContext = useProtectedContext; // given that we are sharing the same thread between two GrContexts we need to // make sure that the thread state is reset when switching between the two. Loading @@ -399,7 +397,6 @@ bool SkiaGLRenderEngine::useProtectedContext(bool useProtectedContext) { getActiveGrContext()->resetContext(); } } return success; } base::unique_fd SkiaGLRenderEngine::flush() { Loading Loading @@ -1413,10 +1410,12 @@ void SkiaGLRenderEngine::onPrimaryDisplaySizeChanged(ui::Size size) { getActiveGrContext()->setResourceCacheLimit(maxResourceBytes); // if it is possible to switch contexts then we will resize the other context if (useProtectedContext(!mInProtectedContext)) { const bool originalProtectedState = mInProtectedContext; useProtectedContext(!mInProtectedContext); if (mInProtectedContext != originalProtectedState) { getActiveGrContext()->setResourceCacheLimit(maxResourceBytes); // reset back to the initial context that was active when this method was called useProtectedContext(!mInProtectedContext); useProtectedContext(originalProtectedState); } } Loading Loading
libs/renderengine/gl/GLESRenderEngine.cpp +6 −9 Original line number Diff line number Diff line Loading @@ -1028,20 +1028,17 @@ bool GLESRenderEngine::supportsProtectedContent() const { return mProtectedEGLContext != EGL_NO_CONTEXT; } bool GLESRenderEngine::useProtectedContext(bool useProtectedContext) { if (useProtectedContext == mInProtectedContext) { return true; } if (useProtectedContext && mProtectedEGLContext == EGL_NO_CONTEXT) { return false; void GLESRenderEngine::useProtectedContext(bool useProtectedContext) { if (useProtectedContext == mInProtectedContext || (useProtectedContext && !supportsProtectedContent())) { return; } const EGLSurface surface = useProtectedContext ? mProtectedStubSurface : mStubSurface; const EGLContext context = useProtectedContext ? mProtectedEGLContext : mEGLContext; const bool success = eglMakeCurrent(mEGLDisplay, surface, surface, context) == EGL_TRUE; if (success) { if (eglMakeCurrent(mEGLDisplay, surface, surface, context) == EGL_TRUE) { mInProtectedContext = useProtectedContext; } return success; } EGLImageKHR GLESRenderEngine::createFramebufferImageIfNeeded(ANativeWindowBuffer* nativeBuffer, bool isProtected, Loading
libs/renderengine/gl/GLESRenderEngine.h +1 −1 Original line number Diff line number Diff line Loading @@ -62,7 +62,7 @@ public: void deleteTextures(size_t count, uint32_t const* names) override; bool isProtected() const override { return mInProtectedContext; } bool supportsProtectedContent() const override; bool useProtectedContext(bool useProtectedContext) override; void useProtectedContext(bool useProtectedContext) override; status_t drawLayers(const DisplaySettings& display, const std::vector<const LayerSettings*>& layers, const std::shared_ptr<ExternalTexture>& buffer, Loading
libs/renderengine/include/renderengine/RenderEngine.h +1 −1 Original line number Diff line number Diff line Loading @@ -127,7 +127,7 @@ public: virtual bool supportsProtectedContent() const = 0; // Attempt to switch RenderEngine into and out of protectedContext mode virtual bool useProtectedContext(bool useProtectedContext) = 0; virtual void useProtectedContext(bool useProtectedContext) = 0; // Notify RenderEngine of changes to the dimensions of the primary display // so that it can configure its internal caches accordingly. Loading
libs/renderengine/include/renderengine/mock/RenderEngine.h +1 −1 Original line number Diff line number Diff line Loading @@ -44,7 +44,7 @@ public: MOCK_CONST_METHOD0(getMaxViewportDims, size_t()); MOCK_CONST_METHOD0(isProtected, bool()); MOCK_CONST_METHOD0(supportsProtectedContent, bool()); MOCK_METHOD1(useProtectedContext, bool(bool)); MOCK_METHOD1(useProtectedContext, void(bool)); MOCK_METHOD0(cleanupPostRender, void()); MOCK_CONST_METHOD0(canSkipPostRenderCleanup, bool()); MOCK_METHOD6(drawLayers, Loading
libs/renderengine/skia/SkiaGLRenderEngine.cpp +11 −12 Original line number Diff line number Diff line Loading @@ -320,7 +320,8 @@ SkiaGLRenderEngine::SkiaGLRenderEngine(const RenderEngineCreationArgs& args, EGL options.fReducedShaderVariations = true; options.fPersistentCache = &mSkSLCacheMonitor; mGrContext = GrDirectContext::MakeGL(glInterface, options); if (useProtectedContext(true)) { if (supportsProtectedContent()) { useProtectedContext(true); mProtectedGrContext = GrDirectContext::MakeGL(glInterface, options); useProtectedContext(false); } Loading Loading @@ -373,12 +374,10 @@ GrDirectContext* SkiaGLRenderEngine::getActiveGrContext() const { return mInProtectedContext ? mProtectedGrContext.get() : mGrContext.get(); } bool SkiaGLRenderEngine::useProtectedContext(bool useProtectedContext) { if (useProtectedContext == mInProtectedContext) { return true; } if (useProtectedContext && !supportsProtectedContent()) { return false; void SkiaGLRenderEngine::useProtectedContext(bool useProtectedContext) { if (useProtectedContext == mInProtectedContext || (useProtectedContext && !supportsProtectedContent())) { return; } // release any scratch resources before switching into a new mode Loading @@ -389,9 +388,8 @@ bool SkiaGLRenderEngine::useProtectedContext(bool useProtectedContext) { const EGLSurface surface = useProtectedContext ? mProtectedPlaceholderSurface : mPlaceholderSurface; const EGLContext context = useProtectedContext ? mProtectedEGLContext : mEGLContext; const bool success = eglMakeCurrent(mEGLDisplay, surface, surface, context) == EGL_TRUE; if (success) { if (eglMakeCurrent(mEGLDisplay, surface, surface, context) == EGL_TRUE) { mInProtectedContext = useProtectedContext; // given that we are sharing the same thread between two GrContexts we need to // make sure that the thread state is reset when switching between the two. Loading @@ -399,7 +397,6 @@ bool SkiaGLRenderEngine::useProtectedContext(bool useProtectedContext) { getActiveGrContext()->resetContext(); } } return success; } base::unique_fd SkiaGLRenderEngine::flush() { Loading Loading @@ -1413,10 +1410,12 @@ void SkiaGLRenderEngine::onPrimaryDisplaySizeChanged(ui::Size size) { getActiveGrContext()->setResourceCacheLimit(maxResourceBytes); // if it is possible to switch contexts then we will resize the other context if (useProtectedContext(!mInProtectedContext)) { const bool originalProtectedState = mInProtectedContext; useProtectedContext(!mInProtectedContext); if (mInProtectedContext != originalProtectedState) { getActiveGrContext()->setResourceCacheLimit(maxResourceBytes); // reset back to the initial context that was active when this method was called useProtectedContext(!mInProtectedContext); useProtectedContext(originalProtectedState); } } Loading