Loading core/java/android/view/ThreadedRenderer.java +7 −0 Original line number Diff line number Diff line Loading @@ -587,6 +587,13 @@ public final class ThreadedRenderer extends HardwareRenderer { updateWebViewOverlayCallbacks(); } @Override public void notifyCallbackPending() { if (isEnabled()) { super.notifyCallbackPending(); } } /** * Updates the light position based on the position of the window. * Loading core/java/android/view/ViewRootImpl.java +10 −0 Original line number Diff line number Diff line Loading @@ -2309,6 +2309,7 @@ public final class ViewRootImpl implements ViewParent, */ void notifyRendererOfFramePending() { if (mAttachInfo.mThreadedRenderer != null) { mAttachInfo.mThreadedRenderer.notifyCallbackPending(); mAttachInfo.mThreadedRenderer.notifyFramePending(); } } Loading Loading @@ -9127,6 +9128,9 @@ public final class ViewRootImpl implements ViewParent, mConsumeBatchedInputScheduled = true; mChoreographer.postCallback(Choreographer.CALLBACK_INPUT, mConsumedBatchedInputRunnable, null); if (mAttachInfo.mThreadedRenderer != null) { mAttachInfo.mThreadedRenderer.notifyCallbackPending(); } } } Loading Loading @@ -9320,6 +9324,9 @@ public final class ViewRootImpl implements ViewParent, mViews.add(view); postIfNeededLocked(); } if (mAttachInfo.mThreadedRenderer != null) { mAttachInfo.mThreadedRenderer.notifyCallbackPending(); } } public void addViewRect(AttachInfo.InvalidateInfo info) { Loading @@ -9327,6 +9334,9 @@ public final class ViewRootImpl implements ViewParent, mViewRects.add(info); postIfNeededLocked(); } if (mAttachInfo.mThreadedRenderer != null) { mAttachInfo.mThreadedRenderer.notifyCallbackPending(); } } public void removeView(View view) { Loading graphics/java/android/graphics/HardwareRenderer.java +11 −0 Original line number Diff line number Diff line Loading @@ -981,6 +981,15 @@ public class HardwareRenderer { } } /** * Notifies the hardware renderer about pending choreographer callbacks. * * @hide */ public void notifyCallbackPending() { nNotifyCallbackPending(mNativeProxy); } /** * b/68769804, b/66945974: For low FPS experiments. * Loading Loading @@ -1536,4 +1545,6 @@ public class HardwareRenderer { private static native boolean nIsDrawingEnabled(); private static native void nSetRtAnimationsEnabled(boolean rtAnimationsEnabled); private static native void nNotifyCallbackPending(long nativeProxy); } libs/hwui/jni/android_graphics_HardwareRenderer.cpp +7 −0 Original line number Diff line number Diff line Loading @@ -860,6 +860,11 @@ static void android_view_ThreadedRenderer_setRtAnimationsEnabled(JNIEnv* env, jo RenderProxy::setRtAnimationsEnabled(enabled); } static void android_view_ThreadedRenderer_notifyCallbackPending(JNIEnv*, jclass, jlong proxyPtr) { RenderProxy* proxy = reinterpret_cast<RenderProxy*>(proxyPtr); proxy->notifyCallbackPending(); } // Plumbs the display density down to DeviceInfo. static void android_view_ThreadedRenderer_setDisplayDensityDpi(JNIEnv*, jclass, jint densityDpi) { // Convert from dpi to density-independent pixels. Loading Loading @@ -1037,6 +1042,8 @@ static const JNINativeMethod gMethods[] = { {"nIsDrawingEnabled", "()Z", (void*)android_view_ThreadedRenderer_isDrawingEnabled}, {"nSetRtAnimationsEnabled", "(Z)V", (void*)android_view_ThreadedRenderer_setRtAnimationsEnabled}, {"nNotifyCallbackPending", "(J)V", (void*)android_view_ThreadedRenderer_notifyCallbackPending}, }; static JavaVM* mJvm = nullptr; Loading libs/hwui/renderthread/DrawFrameTask.cpp +22 −0 Original line number Diff line number Diff line Loading @@ -42,6 +42,7 @@ typedef APerformanceHintSession* (*APH_createSession)(APerformanceHintManager*, size_t, int64_t); typedef void (*APH_updateTargetWorkDuration)(APerformanceHintSession*, int64_t); typedef void (*APH_reportActualWorkDuration)(APerformanceHintSession*, int64_t); typedef void (*APH_sendHint)(APerformanceHintSession* session, int32_t); typedef void (*APH_closeSession)(APerformanceHintSession* session); bool gAPerformanceHintBindingInitialized = false; Loading @@ -49,6 +50,7 @@ APH_getManager gAPH_getManagerFn = nullptr; APH_createSession gAPH_createSessionFn = nullptr; APH_updateTargetWorkDuration gAPH_updateTargetWorkDurationFn = nullptr; APH_reportActualWorkDuration gAPH_reportActualWorkDurationFn = nullptr; APH_sendHint gAPH_sendHintFn = nullptr; APH_closeSession gAPH_closeSessionFn = nullptr; void ensureAPerformanceHintBindingInitialized() { Loading Loading @@ -77,6 +79,10 @@ void ensureAPerformanceHintBindingInitialized() { gAPH_reportActualWorkDurationFn == nullptr, "Failed to find required symbol APerformanceHint_reportActualWorkDuration!"); gAPH_sendHintFn = (APH_sendHint)dlsym(handle_, "APerformanceHint_sendHint"); LOG_ALWAYS_FATAL_IF(gAPH_sendHintFn == nullptr, "Failed to find required symbol APerformanceHint_sendHint!"); gAPH_closeSessionFn = (APH_closeSession)dlsym(handle_, "APerformanceHint_closeSession"); LOG_ALWAYS_FATAL_IF(gAPH_closeSessionFn == nullptr, "Failed to find required symbol APerformanceHint_closeSession!"); Loading Loading @@ -239,6 +245,16 @@ void DrawFrameTask::run() { mLastDequeueBufferDuration = dequeueBufferDuration; } void DrawFrameTask::sendLoadResetHint() { if (!(Properties::useHintManager && Properties::isDrawingEnabled())) return; if (!mHintSessionWrapper) mHintSessionWrapper.emplace(mUiThreadId, mRenderThreadId); nsecs_t now = systemTime(); if (now - mLastFrameNotification > kResetHintTimeout) { mHintSessionWrapper->sendHint(SessionHint::CPU_LOAD_RESET); } mLastFrameNotification = now; } bool DrawFrameTask::syncFrameState(TreeInfo& info) { ATRACE_CALL(); int64_t vsync = mFrameInfo[static_cast<int>(FrameInfoIndex::Vsync)]; Loading Loading @@ -327,6 +343,12 @@ void DrawFrameTask::HintSessionWrapper::reportActualWorkDuration(long actualDura } } void DrawFrameTask::HintSessionWrapper::sendHint(SessionHint hint) { if (mHintSession && Properties::isDrawingEnabled()) { gAPH_sendHintFn(mHintSession, static_cast<int>(hint)); } } } /* namespace renderthread */ } /* namespace uirenderer */ } /* namespace android */ Loading
core/java/android/view/ThreadedRenderer.java +7 −0 Original line number Diff line number Diff line Loading @@ -587,6 +587,13 @@ public final class ThreadedRenderer extends HardwareRenderer { updateWebViewOverlayCallbacks(); } @Override public void notifyCallbackPending() { if (isEnabled()) { super.notifyCallbackPending(); } } /** * Updates the light position based on the position of the window. * Loading
core/java/android/view/ViewRootImpl.java +10 −0 Original line number Diff line number Diff line Loading @@ -2309,6 +2309,7 @@ public final class ViewRootImpl implements ViewParent, */ void notifyRendererOfFramePending() { if (mAttachInfo.mThreadedRenderer != null) { mAttachInfo.mThreadedRenderer.notifyCallbackPending(); mAttachInfo.mThreadedRenderer.notifyFramePending(); } } Loading Loading @@ -9127,6 +9128,9 @@ public final class ViewRootImpl implements ViewParent, mConsumeBatchedInputScheduled = true; mChoreographer.postCallback(Choreographer.CALLBACK_INPUT, mConsumedBatchedInputRunnable, null); if (mAttachInfo.mThreadedRenderer != null) { mAttachInfo.mThreadedRenderer.notifyCallbackPending(); } } } Loading Loading @@ -9320,6 +9324,9 @@ public final class ViewRootImpl implements ViewParent, mViews.add(view); postIfNeededLocked(); } if (mAttachInfo.mThreadedRenderer != null) { mAttachInfo.mThreadedRenderer.notifyCallbackPending(); } } public void addViewRect(AttachInfo.InvalidateInfo info) { Loading @@ -9327,6 +9334,9 @@ public final class ViewRootImpl implements ViewParent, mViewRects.add(info); postIfNeededLocked(); } if (mAttachInfo.mThreadedRenderer != null) { mAttachInfo.mThreadedRenderer.notifyCallbackPending(); } } public void removeView(View view) { Loading
graphics/java/android/graphics/HardwareRenderer.java +11 −0 Original line number Diff line number Diff line Loading @@ -981,6 +981,15 @@ public class HardwareRenderer { } } /** * Notifies the hardware renderer about pending choreographer callbacks. * * @hide */ public void notifyCallbackPending() { nNotifyCallbackPending(mNativeProxy); } /** * b/68769804, b/66945974: For low FPS experiments. * Loading Loading @@ -1536,4 +1545,6 @@ public class HardwareRenderer { private static native boolean nIsDrawingEnabled(); private static native void nSetRtAnimationsEnabled(boolean rtAnimationsEnabled); private static native void nNotifyCallbackPending(long nativeProxy); }
libs/hwui/jni/android_graphics_HardwareRenderer.cpp +7 −0 Original line number Diff line number Diff line Loading @@ -860,6 +860,11 @@ static void android_view_ThreadedRenderer_setRtAnimationsEnabled(JNIEnv* env, jo RenderProxy::setRtAnimationsEnabled(enabled); } static void android_view_ThreadedRenderer_notifyCallbackPending(JNIEnv*, jclass, jlong proxyPtr) { RenderProxy* proxy = reinterpret_cast<RenderProxy*>(proxyPtr); proxy->notifyCallbackPending(); } // Plumbs the display density down to DeviceInfo. static void android_view_ThreadedRenderer_setDisplayDensityDpi(JNIEnv*, jclass, jint densityDpi) { // Convert from dpi to density-independent pixels. Loading Loading @@ -1037,6 +1042,8 @@ static const JNINativeMethod gMethods[] = { {"nIsDrawingEnabled", "()Z", (void*)android_view_ThreadedRenderer_isDrawingEnabled}, {"nSetRtAnimationsEnabled", "(Z)V", (void*)android_view_ThreadedRenderer_setRtAnimationsEnabled}, {"nNotifyCallbackPending", "(J)V", (void*)android_view_ThreadedRenderer_notifyCallbackPending}, }; static JavaVM* mJvm = nullptr; Loading
libs/hwui/renderthread/DrawFrameTask.cpp +22 −0 Original line number Diff line number Diff line Loading @@ -42,6 +42,7 @@ typedef APerformanceHintSession* (*APH_createSession)(APerformanceHintManager*, size_t, int64_t); typedef void (*APH_updateTargetWorkDuration)(APerformanceHintSession*, int64_t); typedef void (*APH_reportActualWorkDuration)(APerformanceHintSession*, int64_t); typedef void (*APH_sendHint)(APerformanceHintSession* session, int32_t); typedef void (*APH_closeSession)(APerformanceHintSession* session); bool gAPerformanceHintBindingInitialized = false; Loading @@ -49,6 +50,7 @@ APH_getManager gAPH_getManagerFn = nullptr; APH_createSession gAPH_createSessionFn = nullptr; APH_updateTargetWorkDuration gAPH_updateTargetWorkDurationFn = nullptr; APH_reportActualWorkDuration gAPH_reportActualWorkDurationFn = nullptr; APH_sendHint gAPH_sendHintFn = nullptr; APH_closeSession gAPH_closeSessionFn = nullptr; void ensureAPerformanceHintBindingInitialized() { Loading Loading @@ -77,6 +79,10 @@ void ensureAPerformanceHintBindingInitialized() { gAPH_reportActualWorkDurationFn == nullptr, "Failed to find required symbol APerformanceHint_reportActualWorkDuration!"); gAPH_sendHintFn = (APH_sendHint)dlsym(handle_, "APerformanceHint_sendHint"); LOG_ALWAYS_FATAL_IF(gAPH_sendHintFn == nullptr, "Failed to find required symbol APerformanceHint_sendHint!"); gAPH_closeSessionFn = (APH_closeSession)dlsym(handle_, "APerformanceHint_closeSession"); LOG_ALWAYS_FATAL_IF(gAPH_closeSessionFn == nullptr, "Failed to find required symbol APerformanceHint_closeSession!"); Loading Loading @@ -239,6 +245,16 @@ void DrawFrameTask::run() { mLastDequeueBufferDuration = dequeueBufferDuration; } void DrawFrameTask::sendLoadResetHint() { if (!(Properties::useHintManager && Properties::isDrawingEnabled())) return; if (!mHintSessionWrapper) mHintSessionWrapper.emplace(mUiThreadId, mRenderThreadId); nsecs_t now = systemTime(); if (now - mLastFrameNotification > kResetHintTimeout) { mHintSessionWrapper->sendHint(SessionHint::CPU_LOAD_RESET); } mLastFrameNotification = now; } bool DrawFrameTask::syncFrameState(TreeInfo& info) { ATRACE_CALL(); int64_t vsync = mFrameInfo[static_cast<int>(FrameInfoIndex::Vsync)]; Loading Loading @@ -327,6 +343,12 @@ void DrawFrameTask::HintSessionWrapper::reportActualWorkDuration(long actualDura } } void DrawFrameTask::HintSessionWrapper::sendHint(SessionHint hint) { if (mHintSession && Properties::isDrawingEnabled()) { gAPH_sendHintFn(mHintSession, static_cast<int>(hint)); } } } /* namespace renderthread */ } /* namespace uirenderer */ } /* namespace android */