@@ -1230,8 +1230,8 @@ void SurfaceFlinger::getDynamicDisplayInfoInternal(ui::DynamicDisplayInfo*& info
12301230 outMode.peakRefreshRate = peakFps.getValue ();
12311231 outMode.vsyncRate = mode->getVsyncRate ().getValue ();
12321232
1233- const auto vsyncConfigSet = mScheduler -> getVsyncConfiguration (). getConfigsForRefreshRate (
1234- Fps::fromValue (outMode.peakRefreshRate ));
1233+ const auto vsyncConfigSet =
1234+ mScheduler -> getVsyncConfigsForRefreshRate ( Fps::fromValue (outMode.peakRefreshRate ));
12351235 outMode.appVsyncOffset = vsyncConfigSet.late .appOffset ;
12361236 outMode.sfVsyncOffset = vsyncConfigSet.late .sfOffset ;
12371237 outMode.group = mode->getGroup ();
@@ -3331,8 +3331,7 @@ void SurfaceFlinger::onCompositionPresented(PhysicalDisplayId pacesetterId,
33313331 const auto schedule = mScheduler ->getVsyncSchedule ();
33323332 const TimePoint vsyncDeadline = schedule->vsyncDeadlineAfter (presentTime);
33333333 const Fps renderRate = pacesetterDisplay->refreshRateSelector ().getActiveMode ().fps ;
3334- const nsecs_t vsyncPhase =
3335- mScheduler ->getVsyncConfiguration ().getCurrentConfigs ().late .sfOffset ;
3334+ const nsecs_t vsyncPhase = mScheduler ->getCurrentVsyncConfigs ().late .sfOffset ;
33363335
33373336 const CompositorTiming compositorTiming (vsyncDeadline.ns (), renderRate.getPeriodNsecs (),
33383337 vsyncPhase, presentLatency.ns ());
@@ -4664,7 +4663,7 @@ void SurfaceFlinger::initScheduler(const sp<const DisplayDevice>& display) {
46644663 /* applyImmediately*/ true );
46654664 }
46664665
4667- const auto configs = mScheduler ->getVsyncConfiguration (). getCurrentConfigs ();
4666+ const auto configs = mScheduler ->getCurrentVsyncConfigs ();
46684667
46694668 mScheduler ->createEventThread (scheduler::Cycle::Render, mFrameTimeline ->getTokenManager (),
46704669 /* workDuration */ configs.late .appWorkDuration ,
@@ -6655,9 +6654,9 @@ status_t SurfaceFlinger::CheckTransactCodeCredentials(uint32_t code) {
66556654 code == IBinder::SYSPROPS_TRANSACTION) {
66566655 return OK;
66576656 }
6658- // Numbers from 1000 to 1045 are currently used for backdoors. The code
6657+ // Numbers from 1000 to 1047 are currently used for backdoors. The code
66596658 // in onTransact verifies that the user is root, and has access to use SF.
6660- if (code >= 1000 && code <= 1046 ) {
6659+ if (code >= 1000 && code <= 1047 ) {
66616660 ALOGV (" Accessing SurfaceFlinger through backdoor code: %u" , code);
66626661 return OK;
66636662 }
@@ -7199,6 +7198,34 @@ status_t SurfaceFlinger::onTransact(uint32_t code, const Parcel& data, Parcel* r
71997198 mScheduler ->setDebugPresentDelay (TimePoint::fromNs (ms2ns (jankDelayMs)));
72007199 return NO_ERROR;
72017200 }
7201+ // Update WorkDuration
7202+ // parameters:
7203+ // - (required) i64 minSfNs, used as the late.sf WorkDuration.
7204+ // - (required) i64 maxSfNs, used as the early.sf and earlyGl.sf WorkDuration.
7205+ // - (required) i64 appDurationNs, used as the late.app, early.app and earlyGl.app
7206+ // WorkDuration.
7207+ // Usage:
7208+ // adb shell service call SurfaceFlinger 1047 i64 12333333 i64 16666666 i64 16666666
7209+ case 1047 : {
7210+ if (!property_get_bool (" debug.sf.use_phase_offsets_as_durations" , false )) {
7211+ ALOGE (" Not supported when work duration is not enabled" );
7212+ return INVALID_OPERATION;
7213+ }
7214+ int64_t minSfNs = 0 ;
7215+ int64_t maxSfNs = 0 ;
7216+ int64_t appDurationNs = 0 ;
7217+ if (data.readInt64 (&minSfNs) != NO_ERROR || data.readInt64 (&maxSfNs) != NO_ERROR ||
7218+ data.readInt64 (&appDurationNs) != NO_ERROR) {
7219+ return BAD_VALUE;
7220+ }
7221+ mScheduler ->reloadPhaseConfiguration (mDisplayModeController
7222+ .getActiveMode (mActiveDisplayId )
7223+ .fps ,
7224+ Duration::fromNs (minSfNs),
7225+ Duration::fromNs (maxSfNs),
7226+ Duration::fromNs (appDurationNs));
7227+ return NO_ERROR;
7228+ }
72027229 }
72037230 }
72047231 return err;
@@ -8385,8 +8412,7 @@ uint32_t SurfaceFlinger::getMaxAcquiredBufferCountForCurrentRefreshRate(uid_t ui
83858412}
83868413
83878414int SurfaceFlinger::getMaxAcquiredBufferCountForRefreshRate (Fps refreshRate) const {
8388- const auto vsyncConfig =
8389- mScheduler ->getVsyncConfiguration ().getConfigsForRefreshRate (refreshRate).late ;
8415+ const auto vsyncConfig = mScheduler ->getVsyncConfigsForRefreshRate (refreshRate).late ;
83908416 const auto presentLatency = vsyncConfig.appWorkDuration + vsyncConfig.sfWorkDuration ;
83918417 return calculateMaxAcquiredBufferCount (refreshRate, presentLatency);
83928418}
0 commit comments