Commit 6d8ebef5 authored by Ville Syrjälä's avatar Ville Syrjälä

drm/i915: Extract intel_bw_check_data_rate()

Extract the data rate calculation loop out from
intel_bw_atomic_check() to make it a bit less confusing.

v2: Deal with 'bool changed'

Reviewed-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com> #v1
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220218064039.12834-7-ville.syrjala@linux.intel.com
parent d5b8da37
...@@ -836,25 +836,12 @@ static u16 icl_qgv_points_mask(struct drm_i915_private *i915) ...@@ -836,25 +836,12 @@ static u16 icl_qgv_points_mask(struct drm_i915_private *i915)
return mask; return mask;
} }
int intel_bw_atomic_check(struct intel_atomic_state *state) static int intel_bw_check_data_rate(struct intel_atomic_state *state, bool *changed)
{ {
struct drm_i915_private *dev_priv = to_i915(state->base.dev); struct drm_i915_private *i915 = to_i915(state->base.dev);
struct intel_crtc_state *new_crtc_state, *old_crtc_state; const struct intel_crtc_state *new_crtc_state, *old_crtc_state;
struct intel_bw_state *new_bw_state = NULL;
const struct intel_bw_state *old_bw_state = NULL;
unsigned int data_rate;
unsigned int num_active_planes;
struct intel_crtc *crtc; struct intel_crtc *crtc;
int i, ret; int i;
u32 allowed_points = 0;
unsigned int max_bw_point = 0, max_bw = 0;
unsigned int num_qgv_points = dev_priv->max_bw[0].num_qgv_points;
unsigned int num_psf_gv_points = dev_priv->max_bw[0].num_psf_gv_points;
bool changed = false;
/* FIXME earlier gens need some checks too */
if (DISPLAY_VER(dev_priv) < 11)
return 0;
for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state, for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state,
new_crtc_state, i) { new_crtc_state, i) {
...@@ -866,6 +853,7 @@ int intel_bw_atomic_check(struct intel_atomic_state *state) ...@@ -866,6 +853,7 @@ int intel_bw_atomic_check(struct intel_atomic_state *state)
intel_bw_crtc_num_active_planes(old_crtc_state); intel_bw_crtc_num_active_planes(old_crtc_state);
unsigned int new_active_planes = unsigned int new_active_planes =
intel_bw_crtc_num_active_planes(new_crtc_state); intel_bw_crtc_num_active_planes(new_crtc_state);
struct intel_bw_state *new_bw_state;
/* /*
* Avoid locking the bw state when * Avoid locking the bw state when
...@@ -882,15 +870,40 @@ int intel_bw_atomic_check(struct intel_atomic_state *state) ...@@ -882,15 +870,40 @@ int intel_bw_atomic_check(struct intel_atomic_state *state)
new_bw_state->data_rate[crtc->pipe] = new_data_rate; new_bw_state->data_rate[crtc->pipe] = new_data_rate;
new_bw_state->num_active_planes[crtc->pipe] = new_active_planes; new_bw_state->num_active_planes[crtc->pipe] = new_active_planes;
changed = true; *changed = true;
drm_dbg_kms(&dev_priv->drm, drm_dbg_kms(&i915->drm,
"pipe %c data rate %u num active planes %u\n", "[CRTC:%d:%s] data rate %u num active planes %u\n",
pipe_name(crtc->pipe), crtc->base.base.id, crtc->base.name,
new_bw_state->data_rate[crtc->pipe], new_bw_state->data_rate[crtc->pipe],
new_bw_state->num_active_planes[crtc->pipe]); new_bw_state->num_active_planes[crtc->pipe]);
} }
return 0;
}
int intel_bw_atomic_check(struct intel_atomic_state *state)
{
struct drm_i915_private *dev_priv = to_i915(state->base.dev);
const struct intel_bw_state *old_bw_state;
struct intel_bw_state *new_bw_state;
unsigned int data_rate;
unsigned int num_active_planes;
int i, ret;
u32 allowed_points = 0;
unsigned int max_bw_point = 0, max_bw = 0;
unsigned int num_qgv_points = dev_priv->max_bw[0].num_qgv_points;
unsigned int num_psf_gv_points = dev_priv->max_bw[0].num_psf_gv_points;
bool changed = false;
/* FIXME earlier gens need some checks too */
if (DISPLAY_VER(dev_priv) < 11)
return 0;
ret = intel_bw_check_data_rate(state, &changed);
if (ret)
return ret;
old_bw_state = intel_atomic_get_old_bw_state(state); old_bw_state = intel_atomic_get_old_bw_state(state);
new_bw_state = intel_atomic_get_new_bw_state(state); new_bw_state = intel_atomic_get_new_bw_state(state);
......
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