Skip to content

Commit

Permalink
drm/i915: Encapsulate dbuf state handling harder
Browse files Browse the repository at this point in the history
In order to make the dbuf state computation less fragile
let's make it stand on its own feet by not requiring someone
to peek into a crystall ball ahead of time to figure out
which pipes need to be added to the state under which potential
future conditions. Instead we compute each piece of the state
as we go along, and if any fallout occurs that affects more than
the current set of pipes we add the affected pipes to the state
naturally.

That requires that we track a few extra thigns in the global
dbuf state: dbuf slices for each pipe, and the weight each
pipe has when distributing the same set of slice(s) between
multiple pipes. Easy enough.

We do need to follow a somewhat careful sequence of computations
though as there are several steps involved in cooking up the dbuf
state. Thoguh we could avoid some of that by computing more things
on demand instead of relying on earlier step of the algorithm to
have filled it out. I think the end result is still reasonable
as the entire sequence is pretty much consolidated into a single
function instead of being spread around all over.

The rough sequence is this:
1. calculate active_pipes
2. calculate dbuf slices for every pipe
3. calculate total enabled slices
4. calculate new dbuf weights for any crtc in the state
5. calculate new ddb entry for every pipe based on the sets of
   slices and weights, and add any affected crtc to the state
6. calculate new plane ddb entries for all crtcs in the state,
   and add any affected plane to the state so that we'll perform
   the requisite hw reprogramming

And as a nice bonus we get to throw dev_priv->wm.distrust_bios_wm
out the window.

v2: Keep crtc_state->wm.skl.ddb

Reviewed-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210122205633.18492-8-ville.syrjala@linux.intel.com
  • Loading branch information
Ville Syrjälä committed Jan 26, 2021
1 parent 5363096 commit ef79d62
Show file tree
Hide file tree
Showing 5 changed files with 140 additions and 271 deletions.
15 changes: 0 additions & 15 deletions drivers/gpu/drm/i915/display/intel_display.c
Original file line number Diff line number Diff line change
Expand Up @@ -12628,20 +12628,6 @@ static int intel_atomic_check(struct drm_device *dev,
if (ret)
goto fail;

/*
* distrust_bios_wm will force a full dbuf recomputation
* but the hardware state will only get updated accordingly
* if state->modeset==true. Hence distrust_bios_wm==true &&
* state->modeset==false is an invalid combination which
* would cause the hardware and software dbuf state to get
* out of sync. We must prevent that.
*
* FIXME clean up this mess and introduce better
* state tracking for dbuf.
*/
if (dev_priv->wm.distrust_bios_wm)
any_ms = true;

intel_fbc_choose_crtc(dev_priv, state);
ret = calc_watermark_data(state);
if (ret)
Expand Down Expand Up @@ -13526,7 +13512,6 @@ static int intel_atomic_commit(struct drm_device *dev,
intel_runtime_pm_put(&dev_priv->runtime_pm, state->wakeref);
return ret;
}
dev_priv->wm.distrust_bios_wm = false;
intel_shared_dpll_swap_state(state);
intel_atomic_track_fbs(state);

Expand Down
1 change: 0 additions & 1 deletion drivers/gpu/drm/i915/display/intel_display_debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1139,7 +1139,6 @@ static ssize_t i915_ipc_status_write(struct file *file, const char __user *ubuf,
if (!dev_priv->ipc_enabled && enable)
drm_info(&dev_priv->drm,
"Enabling IPC: WM will be proper only after next commit\n");
dev_priv->wm.distrust_bios_wm = true;
dev_priv->ipc_enabled = enable;
intel_enable_ipc(dev_priv);
}
Expand Down
9 changes: 0 additions & 9 deletions drivers/gpu/drm/i915/i915_drv.h
Original file line number Diff line number Diff line change
Expand Up @@ -1122,15 +1122,6 @@ struct drm_i915_private {
* crtc_state->wm.need_postvbl_update.
*/
struct mutex wm_mutex;

/*
* Set during HW readout of watermarks/DDB. Some platforms
* need to know when we're still using BIOS-provided values
* (which we don't fully trust).
*
* FIXME get rid of this.
*/
bool distrust_bios_wm;
} wm;

struct dram_info {
Expand Down
Loading

0 comments on commit ef79d62

Please sign in to comment.