Loading core/java/android/view/ThreadedRenderer.java +15 −0 Original line number Diff line number Diff line Loading @@ -190,6 +190,10 @@ public final class ThreadedRenderer { */ public static final String DEBUG_FPS_DIVISOR = "debug.hwui.fps_divisor"; public static int EGL_CONTEXT_PRIORITY_HIGH_IMG = 0x3101; public static int EGL_CONTEXT_PRIORITY_MEDIUM_IMG = 0x3102; public static int EGL_CONTEXT_PRIORITY_LOW_IMG = 0x3103; static { // Try to check OpenGL support early if possible. isAvailable(); Loading Loading @@ -1140,6 +1144,16 @@ public final class ThreadedRenderer { nHackySetRTAnimationsEnabled(divisor <= 1); } /** * Changes the OpenGL context priority if IMG_context_priority extension is available. Must be * called before any OpenGL context is created. * * @param priority The priority to use. Must be one of EGL_CONTEXT_PRIORITY_* values. */ public static void setContextPriority(int priority) { nSetContextPriority(priority); } /** Not actually public - internal use only. This doc to make lint happy */ public static native void disableVsync(); Loading Loading @@ -1213,4 +1227,5 @@ public final class ThreadedRenderer { private static native void nHackySetRTAnimationsEnabled(boolean enabled); private static native void nSetDebuggingEnabled(boolean enabled); private static native void nSetIsolatedProcess(boolean enabled); private static native void nSetContextPriority(int priority); } core/jni/android_view_ThreadedRenderer.cpp +5 −0 Original line number Diff line number Diff line Loading @@ -992,6 +992,10 @@ static void android_view_ThreadedRenderer_setIsolatedProcess(JNIEnv*, jclass, jb Properties::isolatedProcess = isolated; } static void android_view_ThreadedRenderer_setContextPriority(JNIEnv*, jclass, jint contextPriority) { Properties::contextPriority = contextPriority; } // ---------------------------------------------------------------------------- // FrameMetricsObserver Loading Loading @@ -1103,6 +1107,7 @@ static const JNINativeMethod gMethods[] = { (void*)android_view_ThreadedRenderer_hackySetRTAnimationsEnabled }, { "nSetDebuggingEnabled", "(Z)V", (void*)android_view_ThreadedRenderer_setDebuggingEnabled }, { "nSetIsolatedProcess", "(Z)V", (void*)android_view_ThreadedRenderer_setIsolatedProcess }, { "nSetContextPriority", "(I)V", (void*)android_view_ThreadedRenderer_setContextPriority }, }; static JavaVM* mJvm = nullptr; Loading libs/hwui/Properties.cpp +2 −0 Original line number Diff line number Diff line Loading @@ -65,6 +65,8 @@ bool Properties::runningInEmulator = false; bool Properties::debuggingEnabled = false; bool Properties::isolatedProcess = false; int Properties::contextPriority = 0; static int property_get_int(const char* key, int defaultValue) { char buf[PROPERTY_VALUE_MAX] = { '\0', Loading libs/hwui/Properties.h +2 −0 Original line number Diff line number Diff line Loading @@ -271,6 +271,8 @@ public: ANDROID_API static bool debuggingEnabled; ANDROID_API static bool isolatedProcess; ANDROID_API static int contextPriority; private: static ProfileType sProfileType; static bool sDisableProfileBars; Loading libs/hwui/renderthread/EglManager.cpp +12 −2 Original line number Diff line number Diff line Loading @@ -82,6 +82,7 @@ static struct { bool pixelFormatFloat = false; bool glColorSpace = false; bool scRGB = false; bool contextPriority = false; } EglExtensions; EglManager::EglManager(RenderThread& thread) Loading Loading @@ -168,6 +169,7 @@ void EglManager::initExtensions() { #else EglExtensions.scRGB = extensions.has("EGL_EXT_gl_colorspace_scrgb"); #endif EglExtensions.contextPriority = extensions.has("EGL_IMG_context_priority"); } bool EglManager::hasEglContext() { Loading Loading @@ -247,10 +249,18 @@ void EglManager::loadConfigs() { } void EglManager::createContext() { EGLint attribs[] = {EGL_CONTEXT_CLIENT_VERSION, GLES_VERSION, EGL_NONE}; std::vector<EGLint> contextAttributes; contextAttributes.reserve(5); contextAttributes.push_back(EGL_CONTEXT_CLIENT_VERSION); contextAttributes.push_back(GLES_VERSION); if (Properties::contextPriority != 0 && EglExtensions.contextPriority) { contextAttributes.push_back(EGL_CONTEXT_PRIORITY_LEVEL_IMG); contextAttributes.push_back(Properties::contextPriority); } contextAttributes.push_back(EGL_NONE); mEglContext = eglCreateContext( mEglDisplay, EglExtensions.noConfigContext ? ((EGLConfig) nullptr) : mEglConfig, EGL_NO_CONTEXT, attribs); EGL_NO_CONTEXT, contextAttributes.data()); LOG_ALWAYS_FATAL_IF(mEglContext == EGL_NO_CONTEXT, "Failed to create context, error = %s", eglErrorString()); } Loading Loading
core/java/android/view/ThreadedRenderer.java +15 −0 Original line number Diff line number Diff line Loading @@ -190,6 +190,10 @@ public final class ThreadedRenderer { */ public static final String DEBUG_FPS_DIVISOR = "debug.hwui.fps_divisor"; public static int EGL_CONTEXT_PRIORITY_HIGH_IMG = 0x3101; public static int EGL_CONTEXT_PRIORITY_MEDIUM_IMG = 0x3102; public static int EGL_CONTEXT_PRIORITY_LOW_IMG = 0x3103; static { // Try to check OpenGL support early if possible. isAvailable(); Loading Loading @@ -1140,6 +1144,16 @@ public final class ThreadedRenderer { nHackySetRTAnimationsEnabled(divisor <= 1); } /** * Changes the OpenGL context priority if IMG_context_priority extension is available. Must be * called before any OpenGL context is created. * * @param priority The priority to use. Must be one of EGL_CONTEXT_PRIORITY_* values. */ public static void setContextPriority(int priority) { nSetContextPriority(priority); } /** Not actually public - internal use only. This doc to make lint happy */ public static native void disableVsync(); Loading Loading @@ -1213,4 +1227,5 @@ public final class ThreadedRenderer { private static native void nHackySetRTAnimationsEnabled(boolean enabled); private static native void nSetDebuggingEnabled(boolean enabled); private static native void nSetIsolatedProcess(boolean enabled); private static native void nSetContextPriority(int priority); }
core/jni/android_view_ThreadedRenderer.cpp +5 −0 Original line number Diff line number Diff line Loading @@ -992,6 +992,10 @@ static void android_view_ThreadedRenderer_setIsolatedProcess(JNIEnv*, jclass, jb Properties::isolatedProcess = isolated; } static void android_view_ThreadedRenderer_setContextPriority(JNIEnv*, jclass, jint contextPriority) { Properties::contextPriority = contextPriority; } // ---------------------------------------------------------------------------- // FrameMetricsObserver Loading Loading @@ -1103,6 +1107,7 @@ static const JNINativeMethod gMethods[] = { (void*)android_view_ThreadedRenderer_hackySetRTAnimationsEnabled }, { "nSetDebuggingEnabled", "(Z)V", (void*)android_view_ThreadedRenderer_setDebuggingEnabled }, { "nSetIsolatedProcess", "(Z)V", (void*)android_view_ThreadedRenderer_setIsolatedProcess }, { "nSetContextPriority", "(I)V", (void*)android_view_ThreadedRenderer_setContextPriority }, }; static JavaVM* mJvm = nullptr; Loading
libs/hwui/Properties.cpp +2 −0 Original line number Diff line number Diff line Loading @@ -65,6 +65,8 @@ bool Properties::runningInEmulator = false; bool Properties::debuggingEnabled = false; bool Properties::isolatedProcess = false; int Properties::contextPriority = 0; static int property_get_int(const char* key, int defaultValue) { char buf[PROPERTY_VALUE_MAX] = { '\0', Loading
libs/hwui/Properties.h +2 −0 Original line number Diff line number Diff line Loading @@ -271,6 +271,8 @@ public: ANDROID_API static bool debuggingEnabled; ANDROID_API static bool isolatedProcess; ANDROID_API static int contextPriority; private: static ProfileType sProfileType; static bool sDisableProfileBars; Loading
libs/hwui/renderthread/EglManager.cpp +12 −2 Original line number Diff line number Diff line Loading @@ -82,6 +82,7 @@ static struct { bool pixelFormatFloat = false; bool glColorSpace = false; bool scRGB = false; bool contextPriority = false; } EglExtensions; EglManager::EglManager(RenderThread& thread) Loading Loading @@ -168,6 +169,7 @@ void EglManager::initExtensions() { #else EglExtensions.scRGB = extensions.has("EGL_EXT_gl_colorspace_scrgb"); #endif EglExtensions.contextPriority = extensions.has("EGL_IMG_context_priority"); } bool EglManager::hasEglContext() { Loading Loading @@ -247,10 +249,18 @@ void EglManager::loadConfigs() { } void EglManager::createContext() { EGLint attribs[] = {EGL_CONTEXT_CLIENT_VERSION, GLES_VERSION, EGL_NONE}; std::vector<EGLint> contextAttributes; contextAttributes.reserve(5); contextAttributes.push_back(EGL_CONTEXT_CLIENT_VERSION); contextAttributes.push_back(GLES_VERSION); if (Properties::contextPriority != 0 && EglExtensions.contextPriority) { contextAttributes.push_back(EGL_CONTEXT_PRIORITY_LEVEL_IMG); contextAttributes.push_back(Properties::contextPriority); } contextAttributes.push_back(EGL_NONE); mEglContext = eglCreateContext( mEglDisplay, EglExtensions.noConfigContext ? ((EGLConfig) nullptr) : mEglConfig, EGL_NO_CONTEXT, attribs); EGL_NO_CONTEXT, contextAttributes.data()); LOG_ALWAYS_FATAL_IF(mEglContext == EGL_NO_CONTEXT, "Failed to create context, error = %s", eglErrorString()); } Loading