All of lore.kernel.org
 help / color / mirror / Atom feed
From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
To: Matt Roper <matthew.d.roper@intel.com>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH v2 11/16] drm/i915/gen9: Allow watermark calculation on in-flight atomic state (v2)
Date: Thu, 21 Apr 2016 14:18:15 +0200	[thread overview]
Message-ID: <5718C507.5070904@linux.intel.com> (raw)
In-Reply-To: <1461119183-14267-12-git-send-email-matthew.d.roper@intel.com>

Op 20-04-16 om 04:26 schreef Matt Roper:
> In an upcoming patch we'll move this calculation to the atomic 'check'
> phase so that the display update can be rejected early if no valid
> watermark programming is possible.
>
> v2:
>  - Drop intel_pstate_for_cstate_plane() helper and add note about how
>    the code needs to evolve in the future if we start allowing more than
>    one pending commit against a CRTC.  (Maarten)
>
> Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_pm.c | 51 +++++++++++++++++++++++++++++++----------
>  1 file changed, 39 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
> index 0c0a312..d114375 100644
> --- a/drivers/gpu/drm/i915/intel_pm.c
> +++ b/drivers/gpu/drm/i915/intel_pm.c
> @@ -3330,14 +3330,17 @@ static bool skl_compute_plane_wm(const struct drm_i915_private *dev_priv,
>  	return true;
>  }
>  
> -static void skl_compute_wm_level(const struct drm_i915_private *dev_priv,
> -				 struct skl_ddb_allocation *ddb,
> -				 struct intel_crtc_state *cstate,
> -				 int level,
> -				 struct skl_wm_level *result)
> +static int
> +skl_compute_wm_level(const struct drm_i915_private *dev_priv,
> +		     struct skl_ddb_allocation *ddb,
> +		     struct intel_crtc_state *cstate,
> +		     int level,
> +		     struct skl_wm_level *result)
>  {
>  	struct drm_device *dev = dev_priv->dev;
> +	struct drm_atomic_state *state = cstate->base.state;
>  	struct intel_crtc *intel_crtc = to_intel_crtc(cstate->base.crtc);
> +	struct drm_plane *plane;
>  	struct intel_plane *intel_plane;
>  	struct intel_plane_state *intel_pstate;
>  	uint16_t ddb_blocks;
> @@ -3346,7 +3349,29 @@ static void skl_compute_wm_level(const struct drm_i915_private *dev_priv,
>  	for_each_intel_plane_on_crtc(dev, intel_crtc, intel_plane) {
>  		int i = skl_wm_plane_id(intel_plane);
>  
> -		intel_pstate = to_intel_plane_state(intel_plane->base.state);
> +		plane = &intel_plane->base;
> +		intel_pstate = NULL;
> +		if (state)
> +			intel_pstate =
> +				intel_atomic_get_existing_plane_state(state,
> +								      intel_plane);
> +
> +		/*
> +		 * Note: If we start supporting multiple pending atomic commits
> +		 * against the same planes/CRTC's in the future, plane->state
> +		 * will no longer be the correct pre-state to use for the
> +		 * calculations here and we'll need to change where we get the
> +		 * 'unchanged' plane data from.
> +		 *
> +		 * For now this is fine because we only allow one queued commit
> +		 * against a CRTC.  Even if the plane isn't modified by this
> +		 * transaction and we don't have a plane lock, we still have
> +		 * the CRTC's lock, so we know that no other transactions are
> +		 * racing with us to update it.
> +		 */
> +		if (!intel_pstate)
> +			intel_pstate = to_intel_plane_state(plane->state);
>
You can make this race-free by using using for_each_intel_plane_mask
with crtc_state->plane_mask ¦ old_crtc_state->plane_mask.

Other planes can be assumed to have a data rate of 0, and can unfortunately be updated
in parallel. Since you can only update atomic properties that are not ->crtc or ->fb it wouldn't
change anything visibly on the screen, but it would cause your plane->state to be freed behind
your back if you're not careful.
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2016-04-21 12:18 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-20  2:26 [PATCH v2 00/16] Pre-calculate SKL-style atomic watermarks Matt Roper
2016-04-20  2:26 ` [PATCH v2 01/16] drm/i915: Reorganize WM structs/unions in CRTC state Matt Roper
2016-04-20  2:26 ` [PATCH v2 02/16] drm/i915: Rename s/skl_compute_pipe_wm/skl_build_pipe_wm/ Matt Roper
2016-04-20  2:26 ` [PATCH v2 03/16] drm/i915/gen9: Cache plane data rates in CRTC state Matt Roper
2016-04-20  2:26 ` [PATCH v2 04/16] drm/i915/gen9: Allow calculation of data rate for in-flight state (v2) Matt Roper
2016-04-20  2:26 ` [PATCH v2 05/16] drm/i915/gen9: Store plane minimum blocks in CRTC wm state Matt Roper
2016-04-21 11:55   ` Maarten Lankhorst
2016-04-20  2:26 ` [PATCH v2 06/16] drm/i915: Track whether an atomic transaction changes the active CRTC's Matt Roper
2016-04-20  2:26 ` [PATCH v2 07/16] drm/i915/gen9: Allow skl_allocate_pipe_ddb() to operate on in-flight state (v2) Matt Roper
2016-04-21 12:09   ` Maarten Lankhorst
2016-04-20  2:26 ` [PATCH v2 08/16] drm/i915/gen9: Compute DDB allocation at atomic check time (v2) Matt Roper
2016-04-20  2:26 ` [PATCH v2 09/16] drm/i915/gen9: Drop re-allocation of DDB at atomic commit (v2) Matt Roper
2016-04-21  0:41   ` kbuild test robot
2016-04-20  2:26 ` [PATCH v2 10/16] drm/i915/gen9: Calculate plane WM's from state Matt Roper
2016-04-20  2:26 ` [PATCH v2 11/16] drm/i915/gen9: Allow watermark calculation on in-flight atomic state (v2) Matt Roper
2016-04-21 12:18   ` Maarten Lankhorst [this message]
2016-04-20  2:26 ` [PATCH v2 12/16] drm/i915/gen9: Use a bitmask to track dirty pipe watermarks Matt Roper
2016-04-20  2:26 ` [PATCH v2 13/16] drm/i915/gen9: Propagate watermark calculation failures up the call chain Matt Roper
2016-04-21 12:19   ` Maarten Lankhorst
2016-04-21 23:20     ` Matt Roper
2016-04-24 10:01       ` Maarten Lankhorst
2016-04-20  2:26 ` [PATCH v2 14/16] drm/i915/gen9: Calculate watermarks during atomic 'check' Matt Roper
2016-04-20  2:26 ` [PATCH v2 15/16] drm/i915/gen9: Reject display updates that exceed wm limitations Matt Roper
2016-04-21 21:49   ` Lyude Paul
2016-04-21 23:14     ` Matt Roper
2016-04-22 14:21       ` Lyude Paul
2016-04-22 19:39         ` Matt Roper
2016-04-20  2:26 ` [PATCH v2 16/16] drm/i915: Remove wm_config from dev_priv/intel_atomic_state Matt Roper

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5718C507.5070904@linux.intel.com \
    --to=maarten.lankhorst@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=matthew.d.roper@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.