public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Matt Roper <matthew.d.roper@intel.com>
To: Daniel Vetter <daniel@ffwll.ch>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 4/4] drm/i915: Intel-specific primary plane handling (v6)
Date: Thu, 15 May 2014 13:59:39 -0700	[thread overview]
Message-ID: <20140515205939.GF23405@intel.com> (raw)
In-Reply-To: <20140515204952.GW8790@phenom.ffwll.local>

On Thu, May 15, 2014 at 10:49:52PM +0200, Daniel Vetter wrote:
> On Thu, May 15, 2014 at 12:35:17PM -0700, Matt Roper wrote:
> > On Thu, May 15, 2014 at 08:00:48PM +0300, Ville Syrjälä wrote:
> > > On Thu, May 15, 2014 at 09:37:55AM -0700, Matt Roper wrote:
> > > > On Thu, May 15, 2014 at 06:52:28PM +0300, Ville Syrjälä wrote:
> > > > ...
> > > > > 
> > > > > > +	};
> > > > > > +	bool visible;
> > > > > > +	int ret;
> > > > > > +
> > > > > > +	ret = drm_primary_helper_check_update(plane, crtc, fb,
> > > > > > +					      &src, &dest, &clip,
> > > > > > +					      DRM_PLANE_HELPER_NO_SCALING,
> > > > > > +					      DRM_PLANE_HELPER_NO_SCALING,
> > > > > > +					      false, true, &visible);
> > > > > > +	if (ret)
> > > > > > +		return ret;
> > > > > > +
> > > > > > +	if (!visible)
> > > > > > +		return intel_primary_plane_disable(plane);
> > > > > 
> > > > > Here we unpin the old fb...
> > > > > 
> > > > > > +
> > > > > > +	/*
> > > > > > +	 * If the CRTC isn't enabled, we're just pinning the framebuffer,
> > > > > > +	 * updating the fb pointer, and returning without touching the
> > > > > > +	 * hardware.  This allows us to later do a drmModeSetCrtc with fb=-1 to
> > > > > > +	 * turn on the display with all planes setup as desired.
> > > > > > +	 */
> > > > > > +	if (!crtc->enabled)
> > > > > > +		/* Pin and return without programming hardware */
> > > > > > +		return intel_pin_and_fence_fb_obj(dev,
> > > > > > +						  to_intel_framebuffer(fb)->obj,
> > > > > > +						  NULL);
> > > > > 
> > > > > ...but here we just pin the new fb and leave the old also pinned?
> > > > > 
> > > > > Something's a bit fishy here. Also a non-enabled crtc but visible primary
> > > > > plane doesn't seem to make sense. We also need to remember that set_base
> > > > > will always unpin the old_fb. So if something can result in set_base
> > > > > being called w/ old_fb!=NULL when it's not pinned, we'll be in deep
> > > > > doodoo.
> > > > 
> > > > Right, I guess we need to unpin the old fb, if any, here as well in case
> > > > they perform several setplane() calls while the crtc is disabled.
> > > > 
> > > > Eventually the crtc will get reenabled by a drmModeSetCrtc call.  If we
> > > > do setcrtc(fb = -1), then it should keep whatever fb we've already
> > > > pinned via the setplane.  If they provide a new fb, then the pinning
> > > > we're doing here will get unpinned by the set_base that gets called.
> > > > 
> > > > I don't see a way that you can hit set_base with an unpinned
> > > > old_fb!=NULL (since the disable plane case farther up also clears
> > > > primary->fb).
> > > 
> > > But it doesn't.
> > > 
> > 
> > Ah, you're right.  I was conflating explicit disables (fb=0) with
> > implicit disables (clipped to invisible).  I think the v7 I just sent
> > should handle this properly...for the implicit disable case we leave the
> > fb pinned and pointed to by primary->fb.  So when we switch to another
> > fb (or explicitly disable with fb=0), we should unpin it properly.
> 
> Do we have proper coverage for this fun in our primary plane helper tests?
> This is the kind of complexity that freaks me out ;-)
> -Daniel

Was 'helper' in your question above a typo?  The i-g-t tests I've
written have been intended for use with this patch (i.e., i915-specific
primary plane support), so I don't really have any tests that only test
the lesser, helper-provided functionality (and drivers using the helpers
shouldn't run into the things Ville is pointing out here because they
can't disable the primary plane independent of the crtc).

But assuming you meant the general i-g-t tests, yeah, I also posted a
slightly updated version so that it now tries to set multiple fb's while
the crtc is off.  Since crtc=off causes the primary plane to be fully
clipped and implicitly disabled, it should exercise these cases and
catch the pin/unpin mistakes that Ville's review caught.


Matt

-- 
Matt Roper
Graphics Software Engineer
IoTG Platform Enabling & Development
Intel Corporation
(916) 356-2795

  reply	other threads:[~2014-05-15 20:58 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-30 17:06 [PATCH 0/4] Intel primary plane support (v6) Matt Roper
2014-04-30 17:07 ` [PATCH 1/4] drm: Check CRTC compatibility in setplane Matt Roper
2014-04-30 17:07 ` [PATCH 2/4] drm/plane-helper: Add drm_primary_helper_check_update() (v2) Matt Roper
2014-05-16  2:51   ` Lee, Chon Ming
2014-05-16  3:04     ` Rob Clark
2014-05-16  5:25       ` Lee, Chon Ming
2014-05-16  8:02         ` Daniel Vetter
2014-05-16 15:45     ` Matt Roper
2014-05-19 21:46   ` [PATCH 2/4] drm/plane-helper: Add drm_plane_helper_check_update() (v3) Matt Roper
2014-04-30 17:07 ` [PATCH 3/4] drm/i915: don't force full modeset if primary plane is disabled Matt Roper
2014-05-15 14:54   ` Ville Syrjälä
2014-05-15 16:13   ` [PATCH 3/4] drm/i915: don't force full modeset if primary plane is disabled (v2) Matt Roper
2014-04-30 17:07 ` [PATCH 4/4] drm/i915: Intel-specific primary plane handling (v6) Matt Roper
2014-05-15 15:52   ` Ville Syrjälä
2014-05-15 16:37     ` Matt Roper
2014-05-15 17:00       ` Ville Syrjälä
2014-05-15 19:35         ` Matt Roper
2014-05-15 20:49           ` Daniel Vetter
2014-05-15 20:59             ` Matt Roper [this message]
2014-05-15 21:20               ` Daniel Vetter
2014-05-15 21:25                 ` Matt Roper
2014-05-15 19:21   ` [PATCH 4/4] drm/i915: Intel-specific primary plane handling (v7) Matt Roper
2014-05-18 15:53     ` Lee, Chon Ming
2014-05-19 21:44       ` Matt Roper
2014-05-19 21:48     ` [PATCH 4/4] drm/i915: Intel-specific primary plane handling (v8) Matt Roper
2014-05-28  5:41       ` Lee, Chon Ming

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=20140515205939.GF23405@intel.com \
    --to=matthew.d.roper@intel.com \
    --cc=daniel@ffwll.ch \
    --cc=intel-gfx@lists.freedesktop.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