diff options
4 files changed, 27 insertions, 1 deletions
diff --git a/services/surfaceflinger/Scheduler/Scheduler.cpp b/services/surfaceflinger/Scheduler/Scheduler.cpp index e05c985e47..f3a7f87e2f 100644 --- a/services/surfaceflinger/Scheduler/Scheduler.cpp +++ b/services/surfaceflinger/Scheduler/Scheduler.cpp @@ -67,9 +67,14 @@ Scheduler::Scheduler(impl::EventControlThread::SetVSyncEnabledFunction function) mPrimaryDispSync = std::move(primaryDispSync); mEventControlThread = std::make_unique<impl::EventControlThread>(function); + mSetIdleTimerMs = set_idle_timer_ms(0); + char value[PROPERTY_VALUE_MAX]; property_get("debug.sf.set_idle_timer_ms", value, "0"); - mSetIdleTimerMs = atoi(value); + int int_value = atoi(value); + if (int_value) { + mSetIdleTimerMs = atoi(value); + } if (mSetIdleTimerMs > 0) { mIdleTimer = diff --git a/services/surfaceflinger/SurfaceFlingerProperties.cpp b/services/surfaceflinger/SurfaceFlingerProperties.cpp index cb9a6c0daa..875fca801c 100644 --- a/services/surfaceflinger/SurfaceFlingerProperties.cpp +++ b/services/surfaceflinger/SurfaceFlingerProperties.cpp @@ -209,6 +209,14 @@ int32_t wcg_composition_pixel_format(PixelFormat defaultValue) { return static_cast<int32_t>(defaultValue); } +int32_t set_idle_timer_ms(int32_t defaultValue) { + auto temp = SurfaceFlingerProperties::set_idle_timer_ms(); + if (temp.has_value()) { + return *temp; + } + return defaultValue; +} + #define DISPLAY_PRIMARY_SIZE 3 constexpr float kSrgbRedX = 0.4123f; diff --git a/services/surfaceflinger/SurfaceFlingerProperties.h b/services/surfaceflinger/SurfaceFlingerProperties.h index 991768322c..0199d79c24 100644 --- a/services/surfaceflinger/SurfaceFlingerProperties.h +++ b/services/surfaceflinger/SurfaceFlingerProperties.h @@ -55,6 +55,8 @@ int64_t wcg_composition_dataspace( int32_t wcg_composition_pixel_format( android::hardware::graphics::common::V1_2::PixelFormat defaultValue); +int32_t set_idle_timer_ms(int32_t defaultValue); + android::ui::DisplayPrimaries getDisplayNativePrimaries(); } // namespace sysprop } // namespace android diff --git a/services/surfaceflinger/sysprop/SurfaceFlingerProperties.sysprop b/services/surfaceflinger/sysprop/SurfaceFlingerProperties.sysprop index 429636b4a7..949c23c40f 100644 --- a/services/surfaceflinger/sysprop/SurfaceFlingerProperties.sysprop +++ b/services/surfaceflinger/sysprop/SurfaceFlingerProperties.sysprop @@ -286,3 +286,14 @@ prop { access: Readonly prop_name: "ro.surface_flinger.display_primary_white" } + +# setIdleTimerMs indicates what is considered a timeout in milliseconds for Scheduler. This value is +# used by the Scheduler to trigger inactivity callbacks that will switch the display to a lower +# refresh rate. Setting this property to 0 means there is no timer. +prop { + api_name: "set_idle_timer_ms" + type: Integer + scope: Internal + access: Readonly + prop_name: "ro.surface_flinger.set_idle_timer_ms" +} |