Loading core/java/android/app/ActivityThread.java +14 −1 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package android.app; import static android.app.ActivityManager.PROCESS_STATE_UNKNOWN; import static android.app.ConfigurationController.createNewConfigAndUpdateIfNotNull; import static android.app.Flags.skipBgMemTrimOnFgApp; import static android.app.Flags.earlyRenderThreadPriorityBoost; import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED; import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED; import static android.app.servertransaction.ActivityLifecycleItem.ON_CREATE; Loading Loading @@ -4494,8 +4495,20 @@ public final class ActivityThread extends ClientTransactionHandler // Initialize before creating the activity if (ThreadedRenderer.sRendererEnabled && (r.activityInfo.flags & ActivityInfo.FLAG_HARDWARE_ACCELERATED) != 0) { if (earlyRenderThreadPriorityBoost()) { final int tid = HardwareRenderer.preload(); // Adjust the RenderThread priority as soon as it's created. if (tid > 0) { try { ActivityManager.getService().setRenderThread(tid); } catch (Throwable t) { Log.w(TAG, "Failed to set scheduler for RenderThread", t); } } } else { HardwareRenderer.preload(); } } WindowManagerGlobal.initialize(); // Hint the GraphicsEnvironment that an activity is launching on the process. Loading core/java/android/app/activity_manager.aconfig +10 −0 Original line number Diff line number Diff line Loading @@ -151,3 +151,13 @@ flag { purpose: PURPOSE_BUGFIX } } flag { namespace: "system_performance" name: "early_render_thread_priority_boost" description: "Boost the render thread priority during preload." bug: "417909658" metadata { purpose: PURPOSE_BUGFIX } } graphics/java/android/graphics/HardwareRenderer.java +6 −2 Original line number Diff line number Diff line Loading @@ -1421,7 +1421,9 @@ public class HardwareRenderer { if (mInitialized) return; mInitialized = true; if (!android.app.Flags.earlyRenderThreadPriorityBoost()) { initSched(renderProxy); } initGraphicsStats(); } Loading Loading @@ -1565,9 +1567,11 @@ public class HardwareRenderer { * its first frame adds directly to user-visible app launch latency. * * Should only be called after GraphicsEnvironment.chooseDriver(). * * @return the tid of the RenderThread. * @hide */ public static native void preload(); public static native int preload(); /** * Initialize the Buffer Allocator singleton Loading libs/hwui/jni/android_graphics_HardwareRenderer.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -854,8 +854,8 @@ static void android_view_ThreadedRenderer_setForceDark(JNIEnv* env, jobject claz proxy->setForceDark(static_cast<ForceDarkType>(type)); } static void android_view_ThreadedRenderer_preload(JNIEnv*, jclass) { RenderProxy::preload(); static int android_view_ThreadedRenderer_preload(JNIEnv*, jclass) { return RenderProxy::preload(); } static void android_view_ThreadedRenderer_preInitBufferAllocator(JNIEnv*, jclass) { Loading Loading @@ -1066,7 +1066,7 @@ static const JNINativeMethod gMethods[] = { {"nSetDisplayDensityDpi", "(I)V", (void*)android_view_ThreadedRenderer_setDisplayDensityDpi}, {"nInitDisplayInfo", "(IIFIJJZZZ)V", (void*)android_view_ThreadedRenderer_initDisplayInfo}, {"preload", "()V", (void*)android_view_ThreadedRenderer_preload}, {"preload", "()I", (void*)android_view_ThreadedRenderer_preload}, {"preInitBufferAllocator", "()V", (void*)android_view_ThreadedRenderer_preInitBufferAllocator}, {"isWebViewOverlaysEnabled", "()Z", Loading libs/hwui/renderthread/RenderProxy.cpp +7 −1 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ #include <SkPicture.h> #include <gui/TraceUtils.h> #include <pthread.h> #include "utils/Thread.h" #ifdef __ANDROID__ #include <gui/SurfaceControl.h> Loading Loading @@ -504,10 +505,15 @@ void RenderProxy::disableVsync() { Properties::disableVsync = true; } void RenderProxy::preload() { int RenderProxy::preload() { // Create RenderThread object and start the thread. Then preload Vulkan/EGL driver. auto& thread = RenderThread::getInstance(); thread.queue().post([&thread]() { thread.preload(); }); #ifdef __ANDROID__ return thread.getTid(); #else return 0; #endif } void RenderProxy::setRtAnimationsEnabled(bool enabled) { Loading Loading
core/java/android/app/ActivityThread.java +14 −1 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package android.app; import static android.app.ActivityManager.PROCESS_STATE_UNKNOWN; import static android.app.ConfigurationController.createNewConfigAndUpdateIfNotNull; import static android.app.Flags.skipBgMemTrimOnFgApp; import static android.app.Flags.earlyRenderThreadPriorityBoost; import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED; import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED; import static android.app.servertransaction.ActivityLifecycleItem.ON_CREATE; Loading Loading @@ -4494,8 +4495,20 @@ public final class ActivityThread extends ClientTransactionHandler // Initialize before creating the activity if (ThreadedRenderer.sRendererEnabled && (r.activityInfo.flags & ActivityInfo.FLAG_HARDWARE_ACCELERATED) != 0) { if (earlyRenderThreadPriorityBoost()) { final int tid = HardwareRenderer.preload(); // Adjust the RenderThread priority as soon as it's created. if (tid > 0) { try { ActivityManager.getService().setRenderThread(tid); } catch (Throwable t) { Log.w(TAG, "Failed to set scheduler for RenderThread", t); } } } else { HardwareRenderer.preload(); } } WindowManagerGlobal.initialize(); // Hint the GraphicsEnvironment that an activity is launching on the process. Loading
core/java/android/app/activity_manager.aconfig +10 −0 Original line number Diff line number Diff line Loading @@ -151,3 +151,13 @@ flag { purpose: PURPOSE_BUGFIX } } flag { namespace: "system_performance" name: "early_render_thread_priority_boost" description: "Boost the render thread priority during preload." bug: "417909658" metadata { purpose: PURPOSE_BUGFIX } }
graphics/java/android/graphics/HardwareRenderer.java +6 −2 Original line number Diff line number Diff line Loading @@ -1421,7 +1421,9 @@ public class HardwareRenderer { if (mInitialized) return; mInitialized = true; if (!android.app.Flags.earlyRenderThreadPriorityBoost()) { initSched(renderProxy); } initGraphicsStats(); } Loading Loading @@ -1565,9 +1567,11 @@ public class HardwareRenderer { * its first frame adds directly to user-visible app launch latency. * * Should only be called after GraphicsEnvironment.chooseDriver(). * * @return the tid of the RenderThread. * @hide */ public static native void preload(); public static native int preload(); /** * Initialize the Buffer Allocator singleton Loading
libs/hwui/jni/android_graphics_HardwareRenderer.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -854,8 +854,8 @@ static void android_view_ThreadedRenderer_setForceDark(JNIEnv* env, jobject claz proxy->setForceDark(static_cast<ForceDarkType>(type)); } static void android_view_ThreadedRenderer_preload(JNIEnv*, jclass) { RenderProxy::preload(); static int android_view_ThreadedRenderer_preload(JNIEnv*, jclass) { return RenderProxy::preload(); } static void android_view_ThreadedRenderer_preInitBufferAllocator(JNIEnv*, jclass) { Loading Loading @@ -1066,7 +1066,7 @@ static const JNINativeMethod gMethods[] = { {"nSetDisplayDensityDpi", "(I)V", (void*)android_view_ThreadedRenderer_setDisplayDensityDpi}, {"nInitDisplayInfo", "(IIFIJJZZZ)V", (void*)android_view_ThreadedRenderer_initDisplayInfo}, {"preload", "()V", (void*)android_view_ThreadedRenderer_preload}, {"preload", "()I", (void*)android_view_ThreadedRenderer_preload}, {"preInitBufferAllocator", "()V", (void*)android_view_ThreadedRenderer_preInitBufferAllocator}, {"isWebViewOverlaysEnabled", "()Z", Loading
libs/hwui/renderthread/RenderProxy.cpp +7 −1 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ #include <SkPicture.h> #include <gui/TraceUtils.h> #include <pthread.h> #include "utils/Thread.h" #ifdef __ANDROID__ #include <gui/SurfaceControl.h> Loading Loading @@ -504,10 +505,15 @@ void RenderProxy::disableVsync() { Properties::disableVsync = true; } void RenderProxy::preload() { int RenderProxy::preload() { // Create RenderThread object and start the thread. Then preload Vulkan/EGL driver. auto& thread = RenderThread::getInstance(); thread.queue().post([&thread]() { thread.preload(); }); #ifdef __ANDROID__ return thread.getTid(); #else return 0; #endif } void RenderProxy::setRtAnimationsEnabled(bool enabled) { Loading