Skip to content

Commit 555a09d

Browse files
committed
drm/i915/display: Refactor DPKGC code to call it from atomic_commit_tail
Refactor the code to check the fixed refresh rate condition in the dpkgc function itself and call it from intel_atomic_commit_tail so that we have all the required values specially linetime which is computed after intel_wm_compute, this will also help implement some WA's which requires linetime. This also avoid writing into any of the registers while we are in compute_config phase. Signed-off-by: Suraj Kandpal <[email protected]> Reviewed-by: Mitul Golani <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 11c7392 commit 555a09d

File tree

3 files changed

+19
-12
lines changed

3 files changed

+19
-12
lines changed

drivers/gpu/drm/i915/display/intel_display.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7831,6 +7831,8 @@ static void intel_atomic_commit_tail(struct intel_atomic_state *state)
78317831
/* Now enable the clocks, plane, pipe, and connectors that we set up. */
78327832
dev_priv->display.funcs.display->commit_modeset_enables(state);
78337833

7834+
intel_program_dpkgc_latency(state);
7835+
78347836
if (state->modeset)
78357837
intel_set_cdclk_post_plane_update(state);
78367838

drivers/gpu/drm/i915/display/skl_watermark.c

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2854,18 +2854,30 @@ static int skl_wm_add_affected_planes(struct intel_atomic_state *state,
28542854
* Program DEEP PKG_C_LATENCY Pkg C with all 1's.
28552855
* Program PKG_C_LATENCY Added Wake Time = 0
28562856
*/
2857-
static void
2858-
skl_program_dpkgc_latency(struct drm_i915_private *i915, bool enable_dpkgc)
2857+
void
2858+
intel_program_dpkgc_latency(struct intel_atomic_state *state)
28592859
{
2860-
struct intel_display *display = to_intel_display(&i915->drm);
2860+
struct intel_display *display = to_intel_display(state);
2861+
struct drm_i915_private *i915 = to_i915(display->drm);
2862+
struct intel_crtc *crtc;
2863+
struct intel_crtc_state *new_crtc_state;
28612864
u32 max_latency = LNL_PKG_C_LATENCY_MASK;
28622865
u32 clear, val;
28632866
u32 added_wake_time = 0;
2867+
bool fixed_refresh_rate = false;
2868+
int i;
28642869

28652870
if (DISPLAY_VER(display) < 20)
28662871
return;
28672872

2868-
if (enable_dpkgc) {
2873+
for_each_new_intel_crtc_in_state(state, crtc, new_crtc_state, i) {
2874+
if (!new_crtc_state->vrr.enable ||
2875+
(new_crtc_state->vrr.vmin == new_crtc_state->vrr.vmax &&
2876+
new_crtc_state->vrr.vmin == new_crtc_state->vrr.flipline))
2877+
fixed_refresh_rate = true;
2878+
}
2879+
2880+
if (fixed_refresh_rate) {
28692881
max_latency = skl_watermark_max_latency(i915, 1);
28702882
if (max_latency == 0)
28712883
max_latency = LNL_PKG_C_LATENCY_MASK;
@@ -2886,7 +2898,6 @@ skl_compute_wm(struct intel_atomic_state *state)
28862898
struct intel_crtc *crtc;
28872899
struct intel_crtc_state __maybe_unused *new_crtc_state;
28882900
int ret, i;
2889-
bool enable_dpkgc = false;
28902901

28912902
for_each_new_intel_crtc_in_state(state, crtc, new_crtc_state, i) {
28922903
ret = skl_build_pipe_wm(state, crtc);
@@ -2911,15 +2922,8 @@ skl_compute_wm(struct intel_atomic_state *state)
29112922
ret = skl_wm_add_affected_planes(state, crtc);
29122923
if (ret)
29132924
return ret;
2914-
2915-
if ((new_crtc_state->vrr.vmin == new_crtc_state->vrr.vmax &&
2916-
new_crtc_state->vrr.vmin == new_crtc_state->vrr.flipline) ||
2917-
!new_crtc_state->vrr.enable)
2918-
enable_dpkgc = true;
29192925
}
29202926

2921-
skl_program_dpkgc_latency(to_i915(state->base.dev), enable_dpkgc);
2922-
29232927
skl_print_wm_changes(state);
29242928

29252929
return 0;

drivers/gpu/drm/i915/display/skl_watermark.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ void intel_dbuf_mdclk_cdclk_ratio_update(struct drm_i915_private *i915,
8787
int ratio, bool joined_mbus);
8888
void intel_dbuf_mbus_pre_ddb_update(struct intel_atomic_state *state);
8989
void intel_dbuf_mbus_post_ddb_update(struct intel_atomic_state *state);
90+
void intel_program_dpkgc_latency(struct intel_atomic_state *state);
9091

9192
#endif /* __SKL_WATERMARK_H__ */
9293

0 commit comments

Comments
 (0)