Loading libs/gui/Surface.cpp +2 −0 Original line number Diff line number Diff line Loading @@ -1871,12 +1871,14 @@ int Surface::dispatchSetFrameTimelineInfo(va_list args) { auto frameTimelineVsyncId = static_cast<int64_t>(va_arg(args, int64_t)); auto inputEventId = static_cast<int32_t>(va_arg(args, int32_t)); auto startTimeNanos = static_cast<int64_t>(va_arg(args, int64_t)); auto useForRefreshRateSelection = static_cast<bool>(va_arg(args, int32_t)); ALOGV("Surface::%s", __func__); FrameTimelineInfo ftlInfo; ftlInfo.vsyncId = frameTimelineVsyncId; ftlInfo.inputEventId = inputEventId; ftlInfo.startTimeNanos = startTimeNanos; ftlInfo.useForRefreshRateSelection = useForRefreshRateSelection; return setFrameTimelineInfo(frameNumber, ftlInfo); } Loading libs/gui/SurfaceComposerClient.cpp +3 −0 Original line number Diff line number Diff line Loading @@ -2245,11 +2245,13 @@ void SurfaceComposerClient::Transaction::mergeFrameTimelineInfo(FrameTimelineInf t.vsyncId = other.vsyncId; t.inputEventId = other.inputEventId; t.startTimeNanos = other.startTimeNanos; t.useForRefreshRateSelection = other.useForRefreshRateSelection; } } else if (t.vsyncId == FrameTimelineInfo::INVALID_VSYNC_ID) { t.vsyncId = other.vsyncId; t.inputEventId = other.inputEventId; t.startTimeNanos = other.startTimeNanos; t.useForRefreshRateSelection = other.useForRefreshRateSelection; } } Loading @@ -2258,6 +2260,7 @@ void SurfaceComposerClient::Transaction::clearFrameTimelineInfo(FrameTimelineInf t.vsyncId = FrameTimelineInfo::INVALID_VSYNC_ID; t.inputEventId = os::IInputConstants::INVALID_INPUT_EVENT_ID; t.startTimeNanos = 0; t.useForRefreshRateSelection = false; } SurfaceComposerClient::Transaction& Loading libs/gui/aidl/android/gui/FrameTimelineInfo.aidl +4 −0 Original line number Diff line number Diff line Loading @@ -33,4 +33,8 @@ parcelable FrameTimelineInfo { // The current time in nanoseconds the application started to render the frame. long startTimeNanos = 0; // Whether this vsyncId should be used to heuristically select the display refresh rate // TODO(b/281695725): Clean this up once TextureView use setFrameRate API boolean useForRefreshRateSelection = false; } libs/nativewindow/include/system/window.h +5 −6 Original line number Diff line number Diff line Loading @@ -1066,13 +1066,12 @@ static inline int native_window_set_frame_rate(struct ANativeWindow* window, flo (int)compatibility, (int)changeFrameRateStrategy); } static inline int native_window_set_frame_timeline_info(struct ANativeWindow* window, uint64_t frameNumber, int64_t frameTimelineVsyncId, int32_t inputEventId, int64_t startTimeNanos) { static inline int native_window_set_frame_timeline_info( struct ANativeWindow* window, uint64_t frameNumber, int64_t frameTimelineVsyncId, int32_t inputEventId, int64_t startTimeNanos, int32_t useForRefreshRateSelection) { return window->perform(window, NATIVE_WINDOW_SET_FRAME_TIMELINE_INFO, frameNumber, frameTimelineVsyncId, inputEventId, startTimeNanos); frameTimelineVsyncId, inputEventId, startTimeNanos, useForRefreshRateSelection); } // ------------------------------------------------------------------------------------------------ Loading services/surfaceflinger/Layer.cpp +21 −4 Original line number Diff line number Diff line Loading @@ -3077,6 +3077,7 @@ bool Layer::setBuffer(std::shared_ptr<renderengine::ExternalTexture>& buffer, mDrawingState.desiredPresentTime = desiredPresentTime; mDrawingState.isAutoTimestamp = isAutoTimestamp; mDrawingState.latchedVsyncId = info.vsyncId; mDrawingState.useVsyncIdForRefreshRateSelection = info.useForRefreshRateSelection; mDrawingState.modified = true; if (!buffer) { resetDrawingStateBufferInfo(); Loading Loading @@ -3139,15 +3140,31 @@ void Layer::setDesiredPresentTime(nsecs_t desiredPresentTime, bool isAutoTimesta } void Layer::recordLayerHistoryBufferUpdate(const scheduler::LayerProps& layerProps) { ATRACE_CALL(); const nsecs_t presentTime = [&] { if (!mDrawingState.isAutoTimestamp) return mDrawingState.desiredPresentTime; if (!mDrawingState.isAutoTimestamp) { ATRACE_FORMAT_INSTANT("desiredPresentTime"); return mDrawingState.desiredPresentTime; } const auto prediction = mFlinger->mFrameTimeline->getTokenManager()->getPredictionsForToken( if (mDrawingState.useVsyncIdForRefreshRateSelection) { const auto prediction = mFlinger->mFrameTimeline->getTokenManager()->getPredictionsForToken( mDrawingState.latchedVsyncId); if (prediction.has_value()) return prediction->presentTime; if (prediction.has_value()) { ATRACE_FORMAT_INSTANT("predictedPresentTime"); return prediction->presentTime; } } return static_cast<nsecs_t>(0); }(); if (ATRACE_ENABLED() && presentTime > 0) { const auto presentIn = TimePoint::fromNs(presentTime) - TimePoint::now(); ATRACE_FORMAT_INSTANT("presentIn %s", to_string(presentIn).c_str()); } mFlinger->mScheduler->recordLayerHistory(sequence, layerProps, presentTime, scheduler::LayerHistory::LayerUpdateType::Buffer); } Loading Loading
libs/gui/Surface.cpp +2 −0 Original line number Diff line number Diff line Loading @@ -1871,12 +1871,14 @@ int Surface::dispatchSetFrameTimelineInfo(va_list args) { auto frameTimelineVsyncId = static_cast<int64_t>(va_arg(args, int64_t)); auto inputEventId = static_cast<int32_t>(va_arg(args, int32_t)); auto startTimeNanos = static_cast<int64_t>(va_arg(args, int64_t)); auto useForRefreshRateSelection = static_cast<bool>(va_arg(args, int32_t)); ALOGV("Surface::%s", __func__); FrameTimelineInfo ftlInfo; ftlInfo.vsyncId = frameTimelineVsyncId; ftlInfo.inputEventId = inputEventId; ftlInfo.startTimeNanos = startTimeNanos; ftlInfo.useForRefreshRateSelection = useForRefreshRateSelection; return setFrameTimelineInfo(frameNumber, ftlInfo); } Loading
libs/gui/SurfaceComposerClient.cpp +3 −0 Original line number Diff line number Diff line Loading @@ -2245,11 +2245,13 @@ void SurfaceComposerClient::Transaction::mergeFrameTimelineInfo(FrameTimelineInf t.vsyncId = other.vsyncId; t.inputEventId = other.inputEventId; t.startTimeNanos = other.startTimeNanos; t.useForRefreshRateSelection = other.useForRefreshRateSelection; } } else if (t.vsyncId == FrameTimelineInfo::INVALID_VSYNC_ID) { t.vsyncId = other.vsyncId; t.inputEventId = other.inputEventId; t.startTimeNanos = other.startTimeNanos; t.useForRefreshRateSelection = other.useForRefreshRateSelection; } } Loading @@ -2258,6 +2260,7 @@ void SurfaceComposerClient::Transaction::clearFrameTimelineInfo(FrameTimelineInf t.vsyncId = FrameTimelineInfo::INVALID_VSYNC_ID; t.inputEventId = os::IInputConstants::INVALID_INPUT_EVENT_ID; t.startTimeNanos = 0; t.useForRefreshRateSelection = false; } SurfaceComposerClient::Transaction& Loading
libs/gui/aidl/android/gui/FrameTimelineInfo.aidl +4 −0 Original line number Diff line number Diff line Loading @@ -33,4 +33,8 @@ parcelable FrameTimelineInfo { // The current time in nanoseconds the application started to render the frame. long startTimeNanos = 0; // Whether this vsyncId should be used to heuristically select the display refresh rate // TODO(b/281695725): Clean this up once TextureView use setFrameRate API boolean useForRefreshRateSelection = false; }
libs/nativewindow/include/system/window.h +5 −6 Original line number Diff line number Diff line Loading @@ -1066,13 +1066,12 @@ static inline int native_window_set_frame_rate(struct ANativeWindow* window, flo (int)compatibility, (int)changeFrameRateStrategy); } static inline int native_window_set_frame_timeline_info(struct ANativeWindow* window, uint64_t frameNumber, int64_t frameTimelineVsyncId, int32_t inputEventId, int64_t startTimeNanos) { static inline int native_window_set_frame_timeline_info( struct ANativeWindow* window, uint64_t frameNumber, int64_t frameTimelineVsyncId, int32_t inputEventId, int64_t startTimeNanos, int32_t useForRefreshRateSelection) { return window->perform(window, NATIVE_WINDOW_SET_FRAME_TIMELINE_INFO, frameNumber, frameTimelineVsyncId, inputEventId, startTimeNanos); frameTimelineVsyncId, inputEventId, startTimeNanos, useForRefreshRateSelection); } // ------------------------------------------------------------------------------------------------ Loading
services/surfaceflinger/Layer.cpp +21 −4 Original line number Diff line number Diff line Loading @@ -3077,6 +3077,7 @@ bool Layer::setBuffer(std::shared_ptr<renderengine::ExternalTexture>& buffer, mDrawingState.desiredPresentTime = desiredPresentTime; mDrawingState.isAutoTimestamp = isAutoTimestamp; mDrawingState.latchedVsyncId = info.vsyncId; mDrawingState.useVsyncIdForRefreshRateSelection = info.useForRefreshRateSelection; mDrawingState.modified = true; if (!buffer) { resetDrawingStateBufferInfo(); Loading Loading @@ -3139,15 +3140,31 @@ void Layer::setDesiredPresentTime(nsecs_t desiredPresentTime, bool isAutoTimesta } void Layer::recordLayerHistoryBufferUpdate(const scheduler::LayerProps& layerProps) { ATRACE_CALL(); const nsecs_t presentTime = [&] { if (!mDrawingState.isAutoTimestamp) return mDrawingState.desiredPresentTime; if (!mDrawingState.isAutoTimestamp) { ATRACE_FORMAT_INSTANT("desiredPresentTime"); return mDrawingState.desiredPresentTime; } const auto prediction = mFlinger->mFrameTimeline->getTokenManager()->getPredictionsForToken( if (mDrawingState.useVsyncIdForRefreshRateSelection) { const auto prediction = mFlinger->mFrameTimeline->getTokenManager()->getPredictionsForToken( mDrawingState.latchedVsyncId); if (prediction.has_value()) return prediction->presentTime; if (prediction.has_value()) { ATRACE_FORMAT_INSTANT("predictedPresentTime"); return prediction->presentTime; } } return static_cast<nsecs_t>(0); }(); if (ATRACE_ENABLED() && presentTime > 0) { const auto presentIn = TimePoint::fromNs(presentTime) - TimePoint::now(); ATRACE_FORMAT_INSTANT("presentIn %s", to_string(presentIn).c_str()); } mFlinger->mScheduler->recordLayerHistory(sequence, layerProps, presentTime, scheduler::LayerHistory::LayerUpdateType::Buffer); } Loading