intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>,
	Paulo Zanoni <paulo.r.zanoni@intel.com>,
	intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 2/7] drm/i915/fbc: replace a loop with drm_atomic_get_existing_crtc_state()
Date: Fri, 11 Nov 2016 20:01:17 +0200	[thread overview]
Message-ID: <20161111180117.GR31595@intel.com> (raw)
In-Reply-To: <20161111174616.GC9300@nuc-i3427.alporthouse.com>

On Fri, Nov 11, 2016 at 05:46:16PM +0000, Chris Wilson wrote:
> On Fri, Nov 11, 2016 at 02:57:36PM -0200, Paulo Zanoni wrote:
> > Much simpler. Thanks to Ville for pointing this.
> > 
> > Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > Reported-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
> > ---
> >  drivers/gpu/drm/i915/intel_fbc.c | 17 +++++++----------
> >  1 file changed, 7 insertions(+), 10 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/intel_fbc.c b/drivers/gpu/drm/i915/intel_fbc.c
> > index ded77bd..b53b884 100644
> > --- a/drivers/gpu/drm/i915/intel_fbc.c
> > +++ b/drivers/gpu/drm/i915/intel_fbc.c
> > @@ -1071,7 +1071,7 @@ void intel_fbc_choose_crtc(struct drm_i915_private *dev_priv,
> >  	struct drm_plane *plane;
> >  	struct drm_plane_state *plane_state;
> >  	bool fbc_crtc_present = false;
> > -	int i, j;
> > +	int i;
> >  
> >  	mutex_lock(&fbc->lock);
> >  
> > @@ -1092,6 +1092,7 @@ void intel_fbc_choose_crtc(struct drm_i915_private *dev_priv,
> >  	for_each_plane_in_state(state, plane, plane_state, i) {
> >  		struct intel_plane_state *intel_plane_state =
> >  			to_intel_plane_state(plane_state);
> > +		struct intel_crtc_state *intel_crtc_state;
> >  
> >  		if (!intel_plane_state->base.visible)
> >  			continue;
> > @@ -1099,16 +1100,12 @@ void intel_fbc_choose_crtc(struct drm_i915_private *dev_priv,
> >  		if (!intel_fbc_can_choose(to_intel_crtc(plane_state->crtc)))
> >  			continue;
> >  
> > -		for_each_crtc_in_state(state, crtc, crtc_state, j) {
> > -			struct intel_crtc_state *intel_crtc_state =
> > -				to_intel_crtc_state(crtc_state);
> > -
> > -			if (plane_state->crtc != crtc)
> > -				continue;
> > +		intel_crtc_state = to_intel_crtc_state(
> > +			drm_atomic_get_existing_crtc_state(state,
> > +							   plane_state->crtc));
> 
> My knowledge of atomic api is not good enough to say whether this can
> return NULL at this point.

If the plane is part of the state, then plane_state->crtc will be part
of the state as well.

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Just to reaffirm I wanted to point out what
drm_atomic_set_crtc_for_plane() does, but looks like that one was
written with the assumption that it could fail, which is not correct
since drm_atomic_get_plane_state() will always add the current crtc
to the state, and drm_atomic_set_crtc_for_plane() will always add the
new crtc to the state.

drm_atomic_set_crtc_for_connector() is written in the way I was
expecting, so I think I'll fire off a patch for
drm_atomic_set_crtc_for_plane() to follow the same pattern.

-- 
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2016-11-11 18:01 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-11 16:57 [PATCH 0/7] FBC atomic cleanups Paulo Zanoni
2016-11-11 16:57 ` [PATCH 1/7] drm/i915/fbc: move the intel_fbc_can_choose() call out of the loop Paulo Zanoni
2016-11-11 17:33   ` Chris Wilson
2016-11-11 16:57 ` [PATCH 2/7] drm/i915/fbc: replace a loop with drm_atomic_get_existing_crtc_state() Paulo Zanoni
2016-11-11 17:46   ` Chris Wilson
2016-11-11 18:01     ` Ville Syrjälä [this message]
2016-11-11 16:57 ` [PATCH 3/7] drm/i915/fbc: extract intel_fbc_can_enable() Paulo Zanoni
2016-11-11 17:35   ` Chris Wilson
2016-11-11 16:57 ` [PATCH 4/7] drm/i915/fbc: inline intel_fbc_can_choose() Paulo Zanoni
2016-11-11 17:31   ` Chris Wilson
2016-11-11 16:57 ` [PATCH 5/7] drm/i915/fbc: use drm_atomic_get_existing_crtc_state when appropriate Paulo Zanoni
2016-11-11 17:45   ` Chris Wilson
2016-11-11 16:57 ` [PATCH 6/7] drm/i915/fbc: move from crtc_state->enable_fbc to plane_state->enable_fbc Paulo Zanoni
2016-11-11 18:51   ` Ville Syrjälä
2016-11-11 19:01     ` Paulo Zanoni
2016-11-11 19:13       ` Ville Syrjälä
2016-11-11 19:57         ` Paulo Zanoni
2016-11-11 20:24           ` Ville Syrjälä
2016-11-11 20:49             ` Paulo Zanoni
2016-11-14 20:26               ` Ville Syrjälä
2016-11-14 20:49                 ` Paulo Zanoni
2016-11-15  9:43                   ` Ville Syrjälä
2016-11-11 16:57 ` [PATCH 7/7] drm/i915/fbc: convert intel_fbc.c to use INTEL_GEN() Paulo Zanoni
2016-11-11 17:32   ` Chris Wilson
2016-11-11 17:20 ` ✗ Fi.CI.BAT: warning for FBC atomic cleanups Patchwork
2016-11-14 20:04 ` [PATCH 0/7] " Paulo Zanoni

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=20161111180117.GR31595@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=paulo.r.zanoni@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 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).