Commit 4f0b4352 authored by Stanislav Lisovskiy's avatar Stanislav Lisovskiy Committed by Manasi Navare

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: default avatarManasi Navare <manasi.d.navare@intel.com>
Signed-off-by: default avatarStanislav Lisovskiy <stanislav.lisovskiy@intel.com>
Signed-off-by: default avatarManasi Navare <manasi.d.navare@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200519131117.17190-3-stanislav.lisovskiy@intel.com
parent c93b9b2c
...@@ -14646,8 +14646,7 @@ static bool active_planes_affects_min_cdclk(struct drm_i915_private *dev_priv) ...@@ -14646,8 +14646,7 @@ static bool active_planes_affects_min_cdclk(struct drm_i915_private *dev_priv)
IS_IVYBRIDGE(dev_priv); IS_IVYBRIDGE(dev_priv);
} }
static int intel_atomic_check_planes(struct intel_atomic_state *state, static int intel_atomic_check_planes(struct intel_atomic_state *state)
bool *need_cdclk_calc)
{ {
struct drm_i915_private *dev_priv = to_i915(state->base.dev); struct drm_i915_private *dev_priv = to_i915(state->base.dev);
struct intel_crtc_state *old_crtc_state, *new_crtc_state; 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, ...@@ -14697,6 +14696,22 @@ static int intel_atomic_check_planes(struct intel_atomic_state *state,
return ret; return ret;
} }
return 0;
}
static int intel_atomic_check_cdclk(struct intel_atomic_state *state,
bool *need_cdclk_calc)
{
struct intel_cdclk_state *new_cdclk_state;
int i;
struct intel_plane_state *plane_state;
struct intel_plane *plane;
int ret;
new_cdclk_state = intel_atomic_get_new_cdclk_state(state);
if (new_cdclk_state && new_cdclk_state->force_min_cdclk_changed)
*need_cdclk_calc = true;
/* /*
* active_planes bitmask has been updated, and potentially * active_planes bitmask has been updated, and potentially
* affected planes are part of the state. We can now * affected planes are part of the state. We can now
...@@ -14759,7 +14774,6 @@ static int intel_atomic_check(struct drm_device *dev, ...@@ -14759,7 +14774,6 @@ static int intel_atomic_check(struct drm_device *dev,
struct drm_i915_private *dev_priv = to_i915(dev); struct drm_i915_private *dev_priv = to_i915(dev);
struct intel_atomic_state *state = to_intel_atomic_state(_state); struct intel_atomic_state *state = to_intel_atomic_state(_state);
struct intel_crtc_state *old_crtc_state, *new_crtc_state; struct intel_crtc_state *old_crtc_state, *new_crtc_state;
struct intel_cdclk_state *new_cdclk_state;
struct intel_crtc *crtc; struct intel_crtc *crtc;
int ret, i; int ret, i;
bool any_ms = false; bool any_ms = false;
...@@ -14870,14 +14884,10 @@ static int intel_atomic_check(struct drm_device *dev, ...@@ -14870,14 +14884,10 @@ static int intel_atomic_check(struct drm_device *dev,
if (ret) if (ret)
goto fail; goto fail;
ret = intel_atomic_check_planes(state, &any_ms); ret = intel_atomic_check_planes(state);
if (ret) if (ret)
goto fail; goto fail;
new_cdclk_state = intel_atomic_get_new_cdclk_state(state);
if (new_cdclk_state && new_cdclk_state->force_min_cdclk_changed)
any_ms = true;
/* /*
* distrust_bios_wm will force a full dbuf recomputation * distrust_bios_wm will force a full dbuf recomputation
* but the hardware state will only get updated accordingly * but the hardware state will only get updated accordingly
...@@ -14907,6 +14917,10 @@ static int intel_atomic_check(struct drm_device *dev, ...@@ -14907,6 +14917,10 @@ static int intel_atomic_check(struct drm_device *dev,
if (ret) if (ret)
goto fail; goto fail;
ret = intel_atomic_check_cdclk(state, &any_ms);
if (ret)
goto fail;
if (any_ms) { if (any_ms) {
ret = intel_modeset_calc_cdclk(state); ret = intel_modeset_calc_cdclk(state);
if (ret) if (ret)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment