diff --git a/drivers/cpufreq/Kconfig b/drivers/cpufreq/Kconfig index 978c693e36e2..e7461a2a2f08 100644 --- a/drivers/cpufreq/Kconfig +++ b/drivers/cpufreq/Kconfig @@ -301,6 +301,13 @@ config INPUT_STUNE_BOOST of process groups in order to bias core selection as well as CPU frequency selection. A value of 0 disables this functionality. +config FRAME_BOOST_TIMEOUT + int "Post-input timeout for frame boost" + default "3250" + help + The amount of time in milliseconds to boost on frame updates after the + last input event. + config REMOVE_INPUT_BOOST_FREQ_LP int "Low-power cluster return frequency" default "0" diff --git a/drivers/cpufreq/cpu_input_boost.c b/drivers/cpufreq/cpu_input_boost.c index 55796ed2e96a..20795b4b159d 100644 --- a/drivers/cpufreq/cpu_input_boost.c +++ b/drivers/cpufreq/cpu_input_boost.c @@ -12,6 +12,8 @@ #include #include +unsigned long last_input_jiffies; + static __read_mostly unsigned int input_boost_freq_lp = CONFIG_INPUT_BOOST_FREQ_LP; static __read_mostly unsigned int input_boost_freq_hp = CONFIG_INPUT_BOOST_FREQ_PERF; static __read_mostly unsigned int input_boost_return_freq_lp = CONFIG_REMOVE_INPUT_BOOST_FREQ_LP; @@ -19,6 +21,7 @@ static __read_mostly unsigned int input_boost_return_freq_hp = CONFIG_REMOVE_INP static __read_mostly unsigned int frame_boost_freq_lp = CONFIG_FRAME_BOOST_FREQ_LP; static __read_mostly unsigned int frame_boost_freq_hp = CONFIG_FRAME_BOOST_FREQ_PERF; static __read_mostly unsigned short input_boost_duration = CONFIG_INPUT_BOOST_DURATION_MS; +static __read_mostly int frame_boost_timeout = CONFIG_FRAME_BOOST_TIMEOUT; module_param(input_boost_freq_lp, uint, 0644); module_param(input_boost_freq_hp, uint, 0644); @@ -27,6 +30,7 @@ module_param_named(remove_input_boost_freq_perf, input_boost_return_freq_hp, uin module_param(frame_boost_freq_lp, uint, 0644); module_param(frame_boost_freq_hp, uint, 0644); module_param(input_boost_duration, short, 0644); +module_param(frame_boost_timeout, int, 0644); #ifdef CONFIG_DYNAMIC_STUNE_BOOST static __read_mostly int input_stune_boost = CONFIG_INPUT_STUNE_BOOST; @@ -149,6 +153,18 @@ static void unboost_all_cpus(struct boost_drv *b) clear_stune_boost(b, &b->frame_stune_active, b->frame_stune_slot); } +bool should_kick_frame_boost(void) +{ + if (frame_boost_timeout == 0) + return true; + + if (frame_boost_timeout < 0) + return false; + + return time_before(jiffies, last_input_jiffies + + msecs_to_jiffies(frame_boost_timeout)); +} + static void __cpu_input_boost_kick(struct boost_drv *b) { if (!(get_boost_state(b) & SCREEN_AWAKE)) @@ -378,6 +394,8 @@ static void cpu_input_boost_input_event(struct input_handle *handle, struct boost_drv *b = handle->handler->private; __cpu_input_boost_kick(b); + + last_input_jiffies = jiffies; } static int cpu_input_boost_input_connect(struct input_handler *handler, diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c index ea57b9106503..9346c0146fc5 100644 --- a/drivers/gpu/drm/drm_atomic.c +++ b/drivers/gpu/drm/drm_atomic.c @@ -1906,10 +1906,15 @@ int drm_mode_atomic_ioctl(struct drm_device *dev, (arg->flags & DRM_MODE_PAGE_FLIP_EVENT)) return -EINVAL; - if (!(arg->flags & DRM_MODE_ATOMIC_TEST_ONLY)) { +#ifdef CONFIG_CPU_INPUT_BOOST + if (!(arg->flags & DRM_MODE_ATOMIC_TEST_ONLY) && + should_kick_frame_boost()) { cpu_frame_boost_kick(64); +#ifdef CONFIG_DEVFREQ_BOOST devfreq_boost_kick(DEVFREQ_MSM_CPUBW); +#endif } +#endif drm_modeset_acquire_init(&ctx, 0); diff --git a/include/linux/cpu_input_boost.h b/include/linux/cpu_input_boost.h index b5b7858aba63..aa6919f0a15c 100644 --- a/include/linux/cpu_input_boost.h +++ b/include/linux/cpu_input_boost.h @@ -6,9 +6,13 @@ #define _CPU_INPUT_BOOST_H_ #ifdef CONFIG_CPU_INPUT_BOOST +extern unsigned long last_input_jiffies; + void cpu_input_boost_kick(void); void cpu_input_boost_kick_max(unsigned int duration_ms); void cpu_frame_boost_kick(unsigned int duration_ms); + +bool should_kick_frame_boost(void); #else static inline void cpu_input_boost_kick(void) { @@ -19,6 +23,11 @@ static inline void cpu_input_boost_kick_max(unsigned int duration_ms) static inline void cpu_frame_boost_kick(unsigned int duration_ms) { } + +static inline bool should_kick_frame_boost(void) +{ + return false; +} #endif #endif /* _CPU_INPUT_BOOST_H_ */