All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 4/9] drm/i915: Make derived plane state correct after crtc_enable
Date: Wed, 11 Mar 2015 11:24:34 +0100	[thread overview]
Message-ID: <20150311102434.GH3800@phenom.ffwll.local> (raw)
In-Reply-To: <20150311100539.GO11371@intel.com>

On Wed, Mar 11, 2015 at 12:05:39PM +0200, Ville Syrjälä wrote:
> On Wed, Mar 11, 2015 at 10:52:29AM +0100, Daniel Vetter wrote:
> > On Tue, Mar 10, 2015 at 07:57:13PM +0200, Ville Syrjälä wrote:
> > > On Tue, Mar 10, 2015 at 10:01:51AM -0700, Matt Roper wrote:
> > > > On Tue, Mar 10, 2015 at 01:15:24PM +0200, ville.syrjala@linux.intel.com wrote:
> > > > > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > > > > -static void disable_plane_internal(struct drm_plane *plane)
> > > > > +static void _intel_crtc_enable_planes(struct intel_crtc *crtc)
> > > > >  {
> > > > > -	struct intel_plane *intel_plane = to_intel_plane(plane);
> > > > > -	struct drm_plane_state *state =
> > > > > -		plane->funcs->atomic_duplicate_state(plane);
> > > > > -	struct intel_plane_state *intel_state = to_intel_plane_state(state);
> > > > > +	struct drm_device *dev = crtc->base.dev;
> > > > > +	enum pipe pipe = crtc->pipe;
> > > > > +	struct intel_plane *plane;
> > > > > +	const struct drm_crtc_helper_funcs *crtc_funcs =
> > > > > +		crtc->base.helper_private;
> > > > >  
> > > > > -	intel_state->visible = false;
> > > > > -	intel_plane->commit_plane(plane, intel_state);
> > > > > +	for_each_intel_plane(dev, plane) {
> > > > > +		const struct drm_plane_helper_funcs *funcs =
> > > > > +			plane->base.helper_private;
> > > > > +		struct intel_plane_state *state =
> > > > > +			to_intel_plane_state(plane->base.state);
> > > > >  
> > > > > -	intel_plane_destroy_state(plane, state);
> > > > > +		if (plane->pipe != pipe)
> > > > > +			continue;
> > > > > +
> > > > > +		if (funcs->atomic_check(&plane->base, &state->base))
> > > > 
> > > > Maybe add a WARN_ON() here?  I'm assuming that this shouldn't really be
> > > > possible since if this fails it means we've already previously done a
> > > > commit of invalid state on a previous atomic transaction.  But if it
> > > > does somehow happen, the WARN will give us a clue why the plane contents
> > > > simply didn't show up.
> > > 
> > > I can think of one way to make it fail. That is, first set a smaller
> > > mode with the primary plane (and fb) configured to cover that fully, and
> > > then switch to a larger mode without reconfiguring the primary plane. If
> > > the hardware requires the primary plane to be fullscreen it'll fail. But
> > > that should actaully not be possible using the legacy modeset API as it
> > > always reconfigures the primary, so we'd only have to worry about that
> > > with full atomic modeset, and for that we anyway need to change the code
> > > to do the check stuff up front.
> > > 
> > > So yeah, with the way things are this should not be able to fail. I'll
> > > respin with the WARN.
> > 
> > I haven't fully dug into the details here, but a few randome comments:
> > - While transitioning we're calling the transitional plane helpers, which
> >   should call the atomic_check stuff for us on the primary plane. If we
> >   need to call atomic_check on other planes too (why?)
> 
> Because we want the derived state to be updated to match the (potentially
> changed) crtc config. We do call the .update_plane() hook from the
> modeset path, but that happens at a time when the pipe is off, so our
> clipping calculations end up saying the plane is invisible. I think fixing
> that the right way pretty much involves the atomic conversion of the
> modeset path.

Why do we conclude it's invisible? If we can fix the state to not depend
upon the dpms state then things should work ...

> >   then I think that
> >   should be done as close as possible to where we do that for the primary
> >   one. Since eventually we need to unbury that call again.
> 
> With my patch _all_ planes get their .atomic_check() called in the same
> place (during plane enable phase of .crtc_enable()).
> 
> > 
> > - I don't like frobbing state objects which are committed (i.e. updating
> >   visible like here), they're supposed to be invariant. With proper atomic
> >   the way to deal with that is to grab all the required plane states and
> >   put them into the drm_atomic_state update structure.
> 
> We really want to frob it so that the derived state will reflect
> reality. Most importantly state->visible should be false whenever the
> pipe is off, otherwise we can't trust state->visible and would also need
> go look at the crtc state whenever we're trying to decide if the plane
> is actually on or not.

Imo that's the correct thing to do. Calling plane hooks when the pipe is
off just doesn't seem like a good idea to me. Together with runtime pm at
least, crtc/atomic helpers have some "interesting" heritage.

But even there you can fix it by just reordering the commit_planes call to
the bottom, where everything should be on. Iirc that's how Laurent fixed
up rcar runtime pm issues to avoid touching planes when the hw is off.

The other reason why ->visible must take into account dpms state is that
we'll screw up the watermark computation otherwise. Which could result
into a failure on a subsequent dpms on, which is a big no-no.

> As for the direct state frobbing, we could make a copy I guess and frob
> that instead, and then commit it. But that seems a lot of work for no gain.

That's how atomic is supposed to work really. But we can't make a copy in
the crtc_enable really since that should never fail, and we can't push it
out since we might not hold all the locks. That's all ofcourse for the
atomic end-state, but I think even as an interim detour this approach here
doesn't feel like a good approach to me.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2015-03-11 10:22 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-10 11:15 [PATCH 0/9] drm/i915: Update derived plane state at crtc enable/disable ville.syrjala
2015-03-10 11:15 ` [PATCH 1/9] drm/i915: Remove debug prints from primary plane update funcs ville.syrjala
2015-03-10 15:55   ` Jesse Barnes
2015-03-10 11:15 ` [PATCH 2/9] drm/i915: Reduce clutter by using the local plane pointer ville.syrjala
2015-03-10 16:00   ` Jesse Barnes
2015-03-10 11:15 ` [PATCH 3/9] drm/i915: Use plane->state->fb instead of plane->fb in intel_plane_restore() ville.syrjala
2015-03-10 17:01   ` Matt Roper
2015-03-10 17:48     ` Ville Syrjälä
2015-03-11  9:41       ` Daniel Vetter
2015-03-11 10:04         ` Daniel Vetter
2015-03-10 11:15 ` [PATCH 4/9] drm/i915: Make derived plane state correct after crtc_enable ville.syrjala
2015-03-10 17:01   ` Matt Roper
2015-03-10 17:57     ` Ville Syrjälä
2015-03-11  9:52       ` Daniel Vetter
2015-03-11 10:03         ` Daniel Vetter
2015-03-11 10:05         ` Ville Syrjälä
2015-03-11 10:24           ` Daniel Vetter [this message]
2015-03-11 12:19             ` Ville Syrjälä
2015-03-11 16:23               ` Daniel Vetter
2015-03-11 16:40                 ` Ville Syrjälä
2015-03-10 11:15 ` [PATCH 5/9] drm/i915: Pass primary plane size to .update_primary_plane() ville.syrjala
2015-03-10 17:10   ` Matt Roper
2015-03-10 17:59     ` Ville Syrjälä
2015-03-10 20:57       ` Matt Roper
2015-03-11  9:42         ` Ville Syrjälä
2015-03-11  9:57       ` Daniel Vetter
2015-03-11  5:09   ` sonika
2015-03-11  9:27     ` Ville Syrjälä
2015-03-11  9:26       ` sonika
2015-03-19 14:28   ` [PATCH v2 " ville.syrjala
2015-03-20  9:49     ` Jindal, Sonika
2015-03-20 10:04       ` Ville Syrjälä
2015-03-20 10:53         ` Jindal, Sonika
2015-03-20 14:26           ` Ville Syrjälä
2015-03-23  4:11     ` sonika
2015-03-10 11:15 ` [PATCH 6/9] drm/i915: Pass the primary plane position " ville.syrjala
2015-03-19 14:29   ` [PATCH v2 " ville.syrjala
2015-03-20 11:22     ` Jindal, Sonika
2015-03-10 11:15 ` [PATCH 7/9] drm/i915: Update watermarks after the derived plane state is uptodate ville.syrjala
2015-03-10 17:13   ` Matt Roper
2015-03-11  9:59     ` Daniel Vetter
2015-03-10 11:15 ` [PATCH 8/9] drm/i915: Use state->visible in wm calculation ville.syrjala
2015-03-10 17:19   ` Matt Roper
2015-03-10 18:01     ` Ville Syrjälä
2015-03-19 14:31   ` [PATCH v2 " ville.syrjala
2015-03-10 11:15 ` [PATCH 9/9] drm/i915: Don't re-enable an explicitly disabled primary plane due to sprite coverage changes ville.syrjala
2015-03-10 17:58   ` shuang.he
2015-03-11 10:00   ` Daniel Vetter
2015-03-11 10:09     ` Ville Syrjälä
2015-03-11 10:28       ` Daniel Vetter

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=20150311102434.GH3800@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=ville.syrjala@linux.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.