stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lyude Paul <cpaul@redhat.com>
To: Paulo Zanoni <paulo.r.zanoni@intel.com>, intel-gfx@lists.freedesktop.org
Cc: Mike Lothian <mike@fireburn.co.uk>, stable@vger.kernel.org
Subject: Re: [PATCH] drm/i915/gen9: only add the planes actually affected by ddb changes
Date: Thu, 29 Sep 2016 14:45:05 -0400	[thread overview]
Message-ID: <1475174705.16365.14.camel@redhat.com> (raw)
In-Reply-To: <1475174392-27427-1-git-send-email-paulo.r.zanoni@intel.com>

On Thu, 2016-09-29 at 15:39 -0300, Paulo Zanoni wrote:
> We were previously adding all the planes owned by the CRTC even when
> the ddb partitioning didn't change for them. As a consequence, a lot
> of functions were being called when we were just moving the cursor
> around the screen, such as skylake_update_primary_plane().
> 
> This was causing flickering on the primary plane when moving the
> cursor. I'm not 100% sure which operation caused the flickering, but
> we were writing to a lot of registers, so it could be any of these
> writes. With this patch, just moving the mouse won't add the primary
> plane to the commit since it won't trigger a change in DDB
> partitioning.
> 
> Fixes: 05a76d3d6ad1 ("drm/i915/skl: Ensure pipes with changed wms get
> added to the state")
> 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97888
> Cc: Lyude <cpaul@redhat.com>
> Cc: Mike Lothian <mike@fireburn.co.uk>
> Cc: stable@vger.kernel.org
> Reported-and-bisected-by: Mike Lothian <mike@fireburn.co.uk>
> Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_pm.c | 41
> ++++++++++++++++++++++++++++++++++++++++-
>  1 file changed, 40 insertions(+), 1 deletion(-)
> 
> 
> I can confirm this fixes the flickering I was seeing.
> 
> 
> diff --git a/drivers/gpu/drm/i915/intel_pm.c
> b/drivers/gpu/drm/i915/intel_pm.c
> index 5d39ad2..1cf34a3 100644
> --- a/drivers/gpu/drm/i915/intel_pm.c
> +++ b/drivers/gpu/drm/i915/intel_pm.c
> @@ -3966,6 +3966,45 @@ pipes_modified(struct drm_atomic_state *state)
>  	return ret;
>  }
>  
> +int
> +skl_ddb_add_affected_planes(struct intel_crtc_state *cstate)
> +{
> +	struct drm_atomic_state *state = cstate->base.state;
> +	struct drm_device *dev = state->dev;
> +	struct drm_crtc *crtc = cstate->base.crtc;
> +	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
> +	struct drm_i915_private *dev_priv = to_i915(dev);
> +	struct intel_atomic_state *intel_state =
> to_intel_atomic_state(state);
> +	struct skl_ddb_allocation *new_ddb = &intel_state-
> >wm_results.ddb;
> +	struct skl_ddb_allocation *cur_ddb = &dev_priv-
> >wm.skl_hw.ddb;
> +	struct drm_plane_state *plane_state;
> +	struct drm_plane *plane;
> +	enum pipe pipe = intel_crtc->pipe;
> +	int id;
> +
> +	WARN_ON(!drm_atomic_get_existing_crtc_state(state, crtc));
> +
> +	drm_for_each_plane_mask(plane, dev, crtc->state->plane_mask) 
> {
> +		id = skl_wm_plane_id(to_intel_plane(plane));
> +
> +		if (cur_ddb->plane[pipe][id].start ==
> +		    new_ddb->plane[pipe][id].start &&
> +		    cur_ddb->plane[pipe][id].end ==
> +		    new_ddb->plane[pipe][id].end &&
> +		    cur_ddb->y_plane[pipe][id].start ==
> +		    new_ddb->y_plane[pipe][id].start &&
> +		    cur_ddb->y_plane[pipe][id].end ==
> +		    new_ddb->y_plane[pipe][id].end)
> +			continue;

Just use skl_ddb_entry_equals() here.
With that fixed:

Reviewed-by: Lyude <cpaul@redhat.com>

> +
> +		plane_state = drm_atomic_get_plane_state(state,
> plane);
> +		if (IS_ERR(plane_state))
> +			return PTR_ERR(plane_state);
> +	}
> +
> +	return 0;
> +}
> +
>  static int
>  skl_compute_ddb(struct drm_atomic_state *state)
>  {
> @@ -4030,7 +4069,7 @@ skl_compute_ddb(struct drm_atomic_state *state)
>  		if (ret)
>  			return ret;
>  
> -		ret = drm_atomic_add_affected_planes(state,
> &intel_crtc->base);
> +		ret = skl_ddb_add_affected_planes(cstate);
>  		if (ret)
>  			return ret;
>  	}

  reply	other threads:[~2016-09-29 18:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-29 18:39 [PATCH] drm/i915/gen9: only add the planes actually affected by ddb changes Paulo Zanoni
2016-09-29 18:45 ` Lyude Paul [this message]
2016-09-29 19:36   ` Paulo Zanoni
2016-09-30 17:21     ` Lyude

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=1475174705.16365.14.camel@redhat.com \
    --to=cpaul@redhat.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=mike@fireburn.co.uk \
    --cc=paulo.r.zanoni@intel.com \
    --cc=stable@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).