mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-25 13:43:55 +08:00
d4da4e3334
Currently the self refresh idle timer is a const set by the crtc. This is fine if the self refresh entry/exit times are well-known for all panels used on that crtc. However panels and workloads can vary quite a bit, and a timeout which works well for one doesn't work well for another. In the extreme, if the timeout is too short we could get in a situation where the self refresh exits are taking so long we queue up a self refresh entry before the exit commit is even finished. This patch changes the idle timeout to a moving average of the entry times + a moving average of exit times + the crtc constant. This patch was tested on rockchip, with a kevin CrOS panel the idle delay averages out to about ~235ms (35 entry + 100 exit + 100 const). On the same board, the bob panel idle delay lands around ~340ms (90 entry + 150 exit + 100 const). WRT the dedicated mutex in self_refresh_data, it would be nice if we could rely on drm_crtc.mutex to protect the average times, but there are a few reasons why a separate lock is a better choice: - We can't rely on drm_crtc.mutex being held if we're doing a nonblocking commit - We can't grab drm_crtc.mutex since drm_modeset_lock() doesn't tell us whether the lock was already held in the acquire context (it eats -EALREADY), so we can't tell if we should drop it or not - We don't need such a heavy-handed lock for what we're trying to do, commit ordering doesn't matter, so a point-of-use lock will be less contentious Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Sean Paul <seanpaul@chromium.org> Link to v1: https://patchwork.freedesktop.org/patch/msgid/20190917200443.64481-2-sean@poorly.run Link: https://patchwork.freedesktop.org/patch/msgid/20190918200734.149876-2-sean@poorly.run Changes in v2: - Migrate locking explanation from comment to commit msg (Daniel) - Turf constant entry delay and multiply the avg times by 2 (Daniel)
21 lines
559 B
C
21 lines
559 B
C
// SPDX-License-Identifier: MIT
|
|
/*
|
|
* Copyright (C) 2019 Google, Inc.
|
|
*
|
|
* Authors:
|
|
* Sean Paul <seanpaul@chromium.org>
|
|
*/
|
|
#ifndef DRM_SELF_REFRESH_HELPER_H_
|
|
#define DRM_SELF_REFRESH_HELPER_H_
|
|
|
|
struct drm_atomic_state;
|
|
struct drm_crtc;
|
|
|
|
void drm_self_refresh_helper_alter_state(struct drm_atomic_state *state);
|
|
void drm_self_refresh_helper_update_avg_times(struct drm_atomic_state *state,
|
|
unsigned int commit_time_ms);
|
|
|
|
int drm_self_refresh_helper_init(struct drm_crtc *crtc);
|
|
void drm_self_refresh_helper_cleanup(struct drm_crtc *crtc);
|
|
#endif
|