@@ -1226,8 +1226,8 @@ void SurfaceFlinger::getDynamicDisplayInfoInternal(ui::DynamicDisplayInfo*& info
12261226 outMode.peakRefreshRate = peakFps.getValue ();
12271227 outMode.vsyncRate = mode->getVsyncRate ().getValue ();
12281228
1229- const auto vsyncConfigSet = mScheduler -> getVsyncConfiguration (). getConfigsForRefreshRate (
1230- Fps::fromValue (outMode.peakRefreshRate ));
1229+ const auto vsyncConfigSet =
1230+ mScheduler -> getVsyncConfigsForRefreshRate ( Fps::fromValue (outMode.peakRefreshRate ));
12311231 outMode.appVsyncOffset = vsyncConfigSet.late .appOffset ;
12321232 outMode.sfVsyncOffset = vsyncConfigSet.late .sfOffset ;
12331233 outMode.group = mode->getGroup ();
@@ -3326,8 +3326,7 @@ void SurfaceFlinger::onCompositionPresented(PhysicalDisplayId pacesetterId,
33263326 const auto schedule = mScheduler ->getVsyncSchedule ();
33273327 const TimePoint vsyncDeadline = schedule->vsyncDeadlineAfter (presentTime);
33283328 const Fps renderRate = pacesetterDisplay->refreshRateSelector ().getActiveMode ().fps ;
3329- const nsecs_t vsyncPhase =
3330- mScheduler ->getVsyncConfiguration ().getCurrentConfigs ().late .sfOffset ;
3329+ const nsecs_t vsyncPhase = mScheduler ->getCurrentVsyncConfigs ().late .sfOffset ;
33313330
33323331 const CompositorTiming compositorTiming (vsyncDeadline.ns (), renderRate.getPeriodNsecs (),
33333332 vsyncPhase, presentLatency.ns ());
@@ -4657,7 +4656,7 @@ void SurfaceFlinger::initScheduler(const sp<const DisplayDevice>& display) {
46574656 /* applyImmediately*/ true );
46584657 }
46594658
4660- const auto configs = mScheduler ->getVsyncConfiguration (). getCurrentConfigs ();
4659+ const auto configs = mScheduler ->getCurrentVsyncConfigs ();
46614660
46624661 mScheduler ->createEventThread (scheduler::Cycle::Render, mFrameTimeline ->getTokenManager (),
46634662 /* workDuration */ configs.late .appWorkDuration ,
@@ -6647,9 +6646,9 @@ status_t SurfaceFlinger::CheckTransactCodeCredentials(uint32_t code) {
66476646 code == IBinder::SYSPROPS_TRANSACTION) {
66486647 return OK;
66496648 }
6650- // Numbers from 1000 to 1045 are currently used for backdoors. The code
6649+ // Numbers from 1000 to 1047 are currently used for backdoors. The code
66516650 // in onTransact verifies that the user is root, and has access to use SF.
6652- if (code >= 1000 && code <= 1046 ) {
6651+ if (code >= 1000 && code <= 1047 ) {
66536652 ALOGV (" Accessing SurfaceFlinger through backdoor code: %u" , code);
66546653 return OK;
66556654 }
@@ -7192,6 +7191,34 @@ status_t SurfaceFlinger::onTransact(uint32_t code, const Parcel& data, Parcel* r
71927191 mScheduler ->setDebugPresentDelay (TimePoint::fromNs (ms2ns (jankDelayMs)));
71937192 return NO_ERROR;
71947193 }
7194+ // Update WorkDuration
7195+ // parameters:
7196+ // - (required) i64 minSfNs, used as the late.sf WorkDuration.
7197+ // - (required) i64 maxSfNs, used as the early.sf and earlyGl.sf WorkDuration.
7198+ // - (required) i64 appDurationNs, used as the late.app, early.app and earlyGl.app
7199+ // WorkDuration.
7200+ // Usage:
7201+ // adb shell service call SurfaceFlinger 1047 i64 12333333 i64 16666666 i64 16666666
7202+ case 1047 : {
7203+ if (!property_get_bool (" debug.sf.use_phase_offsets_as_durations" , false )) {
7204+ ALOGE (" Not supported when work duration is not enabled" );
7205+ return INVALID_OPERATION;
7206+ }
7207+ int64_t minSfNs = 0 ;
7208+ int64_t maxSfNs = 0 ;
7209+ int64_t appDurationNs = 0 ;
7210+ if (data.readInt64 (&minSfNs) != NO_ERROR || data.readInt64 (&maxSfNs) != NO_ERROR ||
7211+ data.readInt64 (&appDurationNs) != NO_ERROR) {
7212+ return BAD_VALUE;
7213+ }
7214+ mScheduler ->reloadPhaseConfiguration (mDisplayModeController
7215+ .getActiveMode (mActiveDisplayId )
7216+ .fps ,
7217+ Duration::fromNs (minSfNs),
7218+ Duration::fromNs (maxSfNs),
7219+ Duration::fromNs (appDurationNs));
7220+ return NO_ERROR;
7221+ }
71957222 }
71967223 }
71977224 return err;
@@ -8376,8 +8403,7 @@ uint32_t SurfaceFlinger::getMaxAcquiredBufferCountForCurrentRefreshRate(uid_t ui
83768403}
83778404
83788405int SurfaceFlinger::getMaxAcquiredBufferCountForRefreshRate (Fps refreshRate) const {
8379- const auto vsyncConfig =
8380- mScheduler ->getVsyncConfiguration ().getConfigsForRefreshRate (refreshRate).late ;
8406+ const auto vsyncConfig = mScheduler ->getVsyncConfigsForRefreshRate (refreshRate).late ;
83818407 const auto presentLatency = vsyncConfig.appWorkDuration + vsyncConfig.sfWorkDuration ;
83828408 return calculateMaxAcquiredBufferCount (refreshRate, presentLatency);
83838409}
0 commit comments