Loading services/surfaceflinger/RenderEngine/GLExtensions.cpp +3 −0 Original line number Diff line number Diff line Loading @@ -106,6 +106,9 @@ void GLExtensions::initWithEGLStrings(char const* eglVersion, char const* eglExt if (hasEGLExtension("EGL_EXT_protected_content")) { mHasProtectedContent = true; } if (hasEGLExtension("EGL_IMG_context_priority")) { mHasContextPriority = true; } } char const* GLExtensions::getEGLVersion() const { Loading services/surfaceflinger/RenderEngine/GLExtensions.h +2 −0 Original line number Diff line number Diff line Loading @@ -41,6 +41,7 @@ class GLExtensions : public Singleton<GLExtensions> { bool mHasWaitSync = false; bool mHasImageCrop = false; bool mHasProtectedContent = false; bool mHasContextPriority = false; String8 mVendor; String8 mRenderer; Loading @@ -67,6 +68,7 @@ public: bool hasWaitSync() const { return mHasWaitSync; } bool hasImageCrop() const { return mHasImageCrop; } bool hasProtectedContent() const { return mHasProtectedContent; } bool hasContextPriority() const { return mHasContextPriority; } void initWithGLStrings(GLubyte const* vendor, GLubyte const* renderer, GLubyte const* version, GLubyte const* extensions); Loading services/surfaceflinger/RenderEngine/RenderEngine.cpp +20 −4 Original line number Diff line number Diff line Loading @@ -27,6 +27,12 @@ #include <SurfaceFlinger.h> #include <vector> #include <android/hardware/configstore/1.0/ISurfaceFlingerConfigs.h> #include <configstore/Utils.h> using namespace android::hardware::configstore; using namespace android::hardware::configstore::V1_0; extern "C" EGLAPI const char* eglQueryStringImplementationANDROID(EGLDisplay dpy, EGLint name); // --------------------------------------------------------------------------- Loading Loading @@ -70,13 +76,11 @@ std::unique_ptr<RenderEngine> RenderEngine::create(int hwcFormat, uint32_t featu contextAttributes.reserve(6); contextAttributes.push_back(EGL_CONTEXT_CLIENT_VERSION); contextAttributes.push_back(contextClientVersion); #ifdef EGL_IMG_context_priority if (SurfaceFlinger::useContextPriority) { bool useContextPriority = overrideUseContextPriorityFromConfig(extensions.hasContextPriority()); if (useContextPriority) { contextAttributes.push_back(EGL_CONTEXT_PRIORITY_LEVEL_IMG); contextAttributes.push_back(EGL_CONTEXT_PRIORITY_HIGH_IMG); } #endif contextAttributes.push_back(EGL_NONE); contextAttributes.push_back(EGL_NONE); EGLContext ctxt = eglCreateContext(display, config, nullptr, contextAttributes.data()); Loading Loading @@ -131,6 +135,18 @@ std::unique_ptr<RenderEngine> RenderEngine::create(int hwcFormat, uint32_t featu return engine; } bool RenderEngine::overrideUseContextPriorityFromConfig(bool useContextPriority) { OptionalBool ret; ISurfaceFlingerConfigs::getService()->useContextPriority([&ret](OptionalBool b) { ret = b; }); if (ret.specified) { return ret.value; } else { return useContextPriority; } } RenderEngine::RenderEngine() : mEGLDisplay(EGL_NO_DISPLAY), mEGLConfig(nullptr), mEGLContext(EGL_NO_CONTEXT) {} Loading services/surfaceflinger/RenderEngine/RenderEngine.h +2 −0 Original line number Diff line number Diff line Loading @@ -66,6 +66,8 @@ class RenderEngine { uint32_t* status) = 0; virtual void unbindFramebuffer(uint32_t texName, uint32_t fbName) = 0; static bool overrideUseContextPriorityFromConfig(bool useContextPriority); protected: RenderEngine(); Loading services/surfaceflinger/SurfaceFlinger.cpp +0 −5 Original line number Diff line number Diff line Loading @@ -129,7 +129,6 @@ const String16 sDump("android.permission.DUMP"); // --------------------------------------------------------------------------- int64_t SurfaceFlinger::vsyncPhaseOffsetNs; int64_t SurfaceFlinger::sfVsyncPhaseOffsetNs; bool SurfaceFlinger::useContextPriority; int64_t SurfaceFlinger::dispSyncPresentTimeOffset; bool SurfaceFlinger::useHwcForRgbToYuv; uint64_t SurfaceFlinger::maxVirtualDisplaySize; Loading Loading @@ -207,9 +206,6 @@ SurfaceFlinger::SurfaceFlinger() hasSyncFramework = getBool< ISurfaceFlingerConfigs, &ISurfaceFlingerConfigs::hasSyncFramework>(true); useContextPriority = getBool< ISurfaceFlingerConfigs, &ISurfaceFlingerConfigs::useContextPriority>(false); dispSyncPresentTimeOffset = getInt64< ISurfaceFlingerConfigs, &ISurfaceFlingerConfigs::presentTimeOffsetFromVSyncNs>(0); Loading Loading @@ -3692,7 +3688,6 @@ void SurfaceFlinger::logFrameStats() { void SurfaceFlinger::appendSfConfigString(String8& result) const { result.append(" [sf"); result.appendFormat(" HAS_CONTEXT_PRIORITY=%d", useContextPriority); if (isLayerTripleBufferingDisabled()) result.append(" DISABLE_TRIPLE_BUFFERING"); Loading Loading
services/surfaceflinger/RenderEngine/GLExtensions.cpp +3 −0 Original line number Diff line number Diff line Loading @@ -106,6 +106,9 @@ void GLExtensions::initWithEGLStrings(char const* eglVersion, char const* eglExt if (hasEGLExtension("EGL_EXT_protected_content")) { mHasProtectedContent = true; } if (hasEGLExtension("EGL_IMG_context_priority")) { mHasContextPriority = true; } } char const* GLExtensions::getEGLVersion() const { Loading
services/surfaceflinger/RenderEngine/GLExtensions.h +2 −0 Original line number Diff line number Diff line Loading @@ -41,6 +41,7 @@ class GLExtensions : public Singleton<GLExtensions> { bool mHasWaitSync = false; bool mHasImageCrop = false; bool mHasProtectedContent = false; bool mHasContextPriority = false; String8 mVendor; String8 mRenderer; Loading @@ -67,6 +68,7 @@ public: bool hasWaitSync() const { return mHasWaitSync; } bool hasImageCrop() const { return mHasImageCrop; } bool hasProtectedContent() const { return mHasProtectedContent; } bool hasContextPriority() const { return mHasContextPriority; } void initWithGLStrings(GLubyte const* vendor, GLubyte const* renderer, GLubyte const* version, GLubyte const* extensions); Loading
services/surfaceflinger/RenderEngine/RenderEngine.cpp +20 −4 Original line number Diff line number Diff line Loading @@ -27,6 +27,12 @@ #include <SurfaceFlinger.h> #include <vector> #include <android/hardware/configstore/1.0/ISurfaceFlingerConfigs.h> #include <configstore/Utils.h> using namespace android::hardware::configstore; using namespace android::hardware::configstore::V1_0; extern "C" EGLAPI const char* eglQueryStringImplementationANDROID(EGLDisplay dpy, EGLint name); // --------------------------------------------------------------------------- Loading Loading @@ -70,13 +76,11 @@ std::unique_ptr<RenderEngine> RenderEngine::create(int hwcFormat, uint32_t featu contextAttributes.reserve(6); contextAttributes.push_back(EGL_CONTEXT_CLIENT_VERSION); contextAttributes.push_back(contextClientVersion); #ifdef EGL_IMG_context_priority if (SurfaceFlinger::useContextPriority) { bool useContextPriority = overrideUseContextPriorityFromConfig(extensions.hasContextPriority()); if (useContextPriority) { contextAttributes.push_back(EGL_CONTEXT_PRIORITY_LEVEL_IMG); contextAttributes.push_back(EGL_CONTEXT_PRIORITY_HIGH_IMG); } #endif contextAttributes.push_back(EGL_NONE); contextAttributes.push_back(EGL_NONE); EGLContext ctxt = eglCreateContext(display, config, nullptr, contextAttributes.data()); Loading Loading @@ -131,6 +135,18 @@ std::unique_ptr<RenderEngine> RenderEngine::create(int hwcFormat, uint32_t featu return engine; } bool RenderEngine::overrideUseContextPriorityFromConfig(bool useContextPriority) { OptionalBool ret; ISurfaceFlingerConfigs::getService()->useContextPriority([&ret](OptionalBool b) { ret = b; }); if (ret.specified) { return ret.value; } else { return useContextPriority; } } RenderEngine::RenderEngine() : mEGLDisplay(EGL_NO_DISPLAY), mEGLConfig(nullptr), mEGLContext(EGL_NO_CONTEXT) {} Loading
services/surfaceflinger/RenderEngine/RenderEngine.h +2 −0 Original line number Diff line number Diff line Loading @@ -66,6 +66,8 @@ class RenderEngine { uint32_t* status) = 0; virtual void unbindFramebuffer(uint32_t texName, uint32_t fbName) = 0; static bool overrideUseContextPriorityFromConfig(bool useContextPriority); protected: RenderEngine(); Loading
services/surfaceflinger/SurfaceFlinger.cpp +0 −5 Original line number Diff line number Diff line Loading @@ -129,7 +129,6 @@ const String16 sDump("android.permission.DUMP"); // --------------------------------------------------------------------------- int64_t SurfaceFlinger::vsyncPhaseOffsetNs; int64_t SurfaceFlinger::sfVsyncPhaseOffsetNs; bool SurfaceFlinger::useContextPriority; int64_t SurfaceFlinger::dispSyncPresentTimeOffset; bool SurfaceFlinger::useHwcForRgbToYuv; uint64_t SurfaceFlinger::maxVirtualDisplaySize; Loading Loading @@ -207,9 +206,6 @@ SurfaceFlinger::SurfaceFlinger() hasSyncFramework = getBool< ISurfaceFlingerConfigs, &ISurfaceFlingerConfigs::hasSyncFramework>(true); useContextPriority = getBool< ISurfaceFlingerConfigs, &ISurfaceFlingerConfigs::useContextPriority>(false); dispSyncPresentTimeOffset = getInt64< ISurfaceFlingerConfigs, &ISurfaceFlingerConfigs::presentTimeOffsetFromVSyncNs>(0); Loading Loading @@ -3692,7 +3688,6 @@ void SurfaceFlinger::logFrameStats() { void SurfaceFlinger::appendSfConfigString(String8& result) const { result.append(" [sf"); result.appendFormat(" HAS_CONTEXT_PRIORITY=%d", useContextPriority); if (isLayerTripleBufferingDisabled()) result.append(" DISABLE_TRIPLE_BUFFERING"); Loading