Commit 53cc6880 authored by Ville Syrjälä's avatar Ville Syrjälä

drm/i915: Generalize skl_ddb_allocation_overlaps()

Make skl_ddb_allocation_overlaps() useful for other callers
besides skl_update_crtcs(). We'll need it to do plane updates
as well.

And while we're here we can reduce the stack utilization a
bit by noting that each struct skl_ddb_entry is 4 bytes whereas
a pointer to one is 8 bytes (on 64bit). So we'll switch to an
array of structs from the array of pointers we used before.
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20181101150605.18235-9-ville.syrjala@linux.intel.comReviewed-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
parent 07464c7c
...@@ -12651,13 +12651,12 @@ static void skl_update_crtcs(struct drm_atomic_state *state) ...@@ -12651,13 +12651,12 @@ static void skl_update_crtcs(struct drm_atomic_state *state)
int i; int i;
u8 hw_enabled_slices = dev_priv->wm.skl_hw.ddb.enabled_slices; u8 hw_enabled_slices = dev_priv->wm.skl_hw.ddb.enabled_slices;
u8 required_slices = intel_state->wm_results.ddb.enabled_slices; u8 required_slices = intel_state->wm_results.ddb.enabled_slices;
struct skl_ddb_entry entries[I915_MAX_PIPES] = {};
const struct skl_ddb_entry *entries[I915_MAX_PIPES] = {};
for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i)
/* ignore allocations for crtc's that have been turned off. */ /* ignore allocations for crtc's that have been turned off. */
if (new_crtc_state->active) if (new_crtc_state->active)
entries[i] = &to_intel_crtc_state(old_crtc_state)->wm.skl.ddb; entries[i] = to_intel_crtc_state(old_crtc_state)->wm.skl.ddb;
/* If 2nd DBuf slice required, enable it here */ /* If 2nd DBuf slice required, enable it here */
if (INTEL_GEN(dev_priv) >= 11 && required_slices > hw_enabled_slices) if (INTEL_GEN(dev_priv) >= 11 && required_slices > hw_enabled_slices)
...@@ -12683,14 +12682,13 @@ static void skl_update_crtcs(struct drm_atomic_state *state) ...@@ -12683,14 +12682,13 @@ static void skl_update_crtcs(struct drm_atomic_state *state)
if (updated & cmask || !cstate->base.active) if (updated & cmask || !cstate->base.active)
continue; continue;
if (skl_ddb_allocation_overlaps(dev_priv, if (skl_ddb_allocation_overlaps(&cstate->wm.skl.ddb,
entries, entries,
&cstate->wm.skl.ddb, INTEL_INFO(dev_priv)->num_pipes, i))
i))
continue; continue;
updated |= cmask; updated |= cmask;
entries[i] = &cstate->wm.skl.ddb; entries[i] = cstate->wm.skl.ddb;
/* /*
* If this is an already active pipe, it's DDB changed, * If this is an already active pipe, it's DDB changed,
......
...@@ -2191,10 +2191,9 @@ int intel_enable_sagv(struct drm_i915_private *dev_priv); ...@@ -2191,10 +2191,9 @@ int intel_enable_sagv(struct drm_i915_private *dev_priv);
int intel_disable_sagv(struct drm_i915_private *dev_priv); int intel_disable_sagv(struct drm_i915_private *dev_priv);
bool skl_wm_level_equals(const struct skl_wm_level *l1, bool skl_wm_level_equals(const struct skl_wm_level *l1,
const struct skl_wm_level *l2); const struct skl_wm_level *l2);
bool skl_ddb_allocation_overlaps(struct drm_i915_private *dev_priv, bool skl_ddb_allocation_overlaps(const struct skl_ddb_entry *ddb,
const struct skl_ddb_entry **entries, const struct skl_ddb_entry entries[],
const struct skl_ddb_entry *ddb, int num_entries, int ignore_idx);
int ignore);
bool ilk_disable_lp_wm(struct drm_device *dev); bool ilk_disable_lp_wm(struct drm_device *dev);
int skl_check_pipe_max_pixel_rate(struct intel_crtc *intel_crtc, int skl_check_pipe_max_pixel_rate(struct intel_crtc *intel_crtc,
struct intel_crtc_state *cstate); struct intel_crtc_state *cstate);
......
...@@ -5186,16 +5186,15 @@ static inline bool skl_ddb_entries_overlap(const struct skl_ddb_entry *a, ...@@ -5186,16 +5186,15 @@ static inline bool skl_ddb_entries_overlap(const struct skl_ddb_entry *a,
return a->start < b->end && b->start < a->end; return a->start < b->end && b->start < a->end;
} }
bool skl_ddb_allocation_overlaps(struct drm_i915_private *dev_priv, bool skl_ddb_allocation_overlaps(const struct skl_ddb_entry *ddb,
const struct skl_ddb_entry **entries, const struct skl_ddb_entry entries[],
const struct skl_ddb_entry *ddb, int num_entries, int ignore_idx)
int ignore)
{ {
enum pipe pipe; int i;
for_each_pipe(dev_priv, pipe) { for (i = 0; i < num_entries; i++) {
if (pipe != ignore && entries[pipe] && if (i != ignore_idx &&
skl_ddb_entries_overlap(ddb, entries[pipe])) skl_ddb_entries_overlap(ddb, &entries[i]))
return true; return true;
} }
......
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