Skip to content

Commit 4f0b435

Browse files
StanFox1984Manasi Navare
authored andcommitted
drm/i915: Extract cdclk requirements checking to separate function
In Gen11+ whenever we might exceed DBuf bandwidth we might need to recalculate CDCLK which DBuf bandwidth is scaled with. Total Dbuf bw used might change based on particular plane needs. Thus to calculate if cdclk needs to be changed it is not enough anymore to check plane configuration and plane min cdclk, per DBuf bw can be calculated only after wm/ddb calculation is done and all required planes are added into the state. In order to keep all min_cdclk related checks in one place let's extract it into separate function, checking and modifying any_ms. Reviewed-by: Manasi Navare <manasi.d.navare@intel.com> Signed-off-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com> Signed-off-by: Manasi Navare <manasi.d.navare@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200519131117.17190-3-stanislav.lisovskiy@intel.com
1 parent c93b9b2 commit 4f0b435

File tree

1 file changed

+22
-8
lines changed

1 file changed

+22
-8
lines changed

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

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14646,8 +14646,7 @@ static bool active_planes_affects_min_cdclk(struct drm_i915_private *dev_priv)
1464614646
IS_IVYBRIDGE(dev_priv);
1464714647
}
1464814648

14649-
static int intel_atomic_check_planes(struct intel_atomic_state *state,
14650-
bool *need_cdclk_calc)
14649+
static int intel_atomic_check_planes(struct intel_atomic_state *state)
1465114650
{
1465214651
struct drm_i915_private *dev_priv = to_i915(state->base.dev);
1465314652
struct intel_crtc_state *old_crtc_state, *new_crtc_state;
@@ -14697,6 +14696,22 @@ static int intel_atomic_check_planes(struct intel_atomic_state *state,
1469714696
return ret;
1469814697
}
1469914698

14699+
return 0;
14700+
}
14701+
14702+
static int intel_atomic_check_cdclk(struct intel_atomic_state *state,
14703+
bool *need_cdclk_calc)
14704+
{
14705+
struct intel_cdclk_state *new_cdclk_state;
14706+
int i;
14707+
struct intel_plane_state *plane_state;
14708+
struct intel_plane *plane;
14709+
int ret;
14710+
14711+
new_cdclk_state = intel_atomic_get_new_cdclk_state(state);
14712+
if (new_cdclk_state && new_cdclk_state->force_min_cdclk_changed)
14713+
*need_cdclk_calc = true;
14714+
1470014715
/*
1470114716
* active_planes bitmask has been updated, and potentially
1470214717
* affected planes are part of the state. We can now
@@ -14759,7 +14774,6 @@ static int intel_atomic_check(struct drm_device *dev,
1475914774
struct drm_i915_private *dev_priv = to_i915(dev);
1476014775
struct intel_atomic_state *state = to_intel_atomic_state(_state);
1476114776
struct intel_crtc_state *old_crtc_state, *new_crtc_state;
14762-
struct intel_cdclk_state *new_cdclk_state;
1476314777
struct intel_crtc *crtc;
1476414778
int ret, i;
1476514779
bool any_ms = false;
@@ -14870,14 +14884,10 @@ static int intel_atomic_check(struct drm_device *dev,
1487014884
if (ret)
1487114885
goto fail;
1487214886

14873-
ret = intel_atomic_check_planes(state, &any_ms);
14887+
ret = intel_atomic_check_planes(state);
1487414888
if (ret)
1487514889
goto fail;
1487614890

14877-
new_cdclk_state = intel_atomic_get_new_cdclk_state(state);
14878-
if (new_cdclk_state && new_cdclk_state->force_min_cdclk_changed)
14879-
any_ms = true;
14880-
1488114891
/*
1488214892
* distrust_bios_wm will force a full dbuf recomputation
1488314893
* but the hardware state will only get updated accordingly
@@ -14907,6 +14917,10 @@ static int intel_atomic_check(struct drm_device *dev,
1490714917
if (ret)
1490814918
goto fail;
1490914919

14920+
ret = intel_atomic_check_cdclk(state, &any_ms);
14921+
if (ret)
14922+
goto fail;
14923+
1491014924
if (any_ms) {
1491114925
ret = intel_modeset_calc_cdclk(state);
1491214926
if (ret)

0 commit comments

Comments
 (0)