dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Daniel Kurtz <djkurtz@chromium.org>
Cc: dri-devel <dri-devel@lists.freedesktop.org>
Subject: Re: [RFCv3 04/14] drm/exynos: Restrict plane loops to only operate on overlay planes
Date: Thu, 20 Mar 2014 16:35:20 +0100	[thread overview]
Message-ID: <20140320153520.GR30571@phenom.ffwll.local> (raw)
In-Reply-To: <CAGS+omCRs41XkeXBOGW_o7mBgEbcj0xKt2yZ0VCyCGc2co-Fcw@mail.gmail.com>

On Thu, Mar 20, 2014 at 09:56:24AM +0800, Daniel Kurtz wrote:
> On Thu, Mar 20, 2014 at 3:31 AM, Daniel Vetter <daniel@ffwll.ch> wrote:
> > On Wed, Mar 19, 2014 at 10:26:13PM +0800, Daniel Kurtz wrote:
> >> On Wed, Mar 19, 2014 at 7:51 PM, Daniel Vetter <daniel@ffwll.ch> wrote:
> >> > On Tue, Mar 18, 2014 at 05:22:49PM -0700, Matt Roper wrote:
> >> >> Before we add additional types of planes to the DRM plane list, ensure
> >> >> that existing loops over all planes continue to operate only on
> >> >> "overlay" planes and ignore primary & cursor planes.
> >> >>
> >> >> Cc: Inki Dae <inki.dae@samsung.com>
> >> >> Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
> >> >> ---
> >> >>  drivers/gpu/drm/exynos/exynos_drm_encoder.c | 6 ++++++
> >> >>  1 file changed, 6 insertions(+)
> >> >>
> >> >> diff --git a/drivers/gpu/drm/exynos/exynos_drm_encoder.c b/drivers/gpu/drm/exynos/exynos_drm_encoder.c
> >> >> index 06f1b2a..2fa2685 100644
> >> >> --- a/drivers/gpu/drm/exynos/exynos_drm_encoder.c
> >> >> +++ b/drivers/gpu/drm/exynos/exynos_drm_encoder.c
> >> >> @@ -127,6 +127,9 @@ static void disable_plane_to_crtc(struct drm_device *dev,
> >> >>        * (encoder->crtc)
> >> >>        */
> >> >>       list_for_each_entry(plane, &dev->mode_config.plane_list, head) {
> >> >> +             if (plane->type != DRM_PLANE_TYPE_OVERLAY)
> >> >
> >> > I think a drm_for_each_legacy_plane iteration helper would be neat for
> >> > this one and the following i915 patch.
> >> > -Daniel
> >> >
> >> >> +                     continue;
> >> >> +
> >> >>               if (plane->crtc == old_crtc) {
> >> >>                       /*
> >> >>                        * do not change below call order.
> >> >> @@ -247,6 +250,9 @@ static void exynos_drm_encoder_disable(struct drm_encoder *encoder)
> >> >>
> >> >>       /* all planes connected to this encoder should be also disabled. */
> >> >>       list_for_each_entry(plane, &dev->mode_config.plane_list, head) {
> >> >> +             if (plane->type != DRM_PLANE_TYPE_OVERLAY)
> >> >> +                     continue;
> >> >> +
> >> >>               if (plane->crtc == encoder->crtc)
> >> >>                       plane->funcs->disable_plane(plane);
> >> >>       }
> >>
> >> The original loop disables all planes attached to a crtc when
> >> disabling an encoder attached to the same crtc.  It was added by:
> >>
> >> commit bcf4cef94294992f7cd11d5a90fa58b0eae6c795
> >> Author: Inki Dae <inki.dae@samsung.com>
> >> Date:   Fri Aug 24 10:54:12 2012 -0700
> >>
> >>     drm/exynos: Disable plane when released
> >>
> >>     this patch ensures that each plane connected to encoder is disabled
> >>     when released, by adding disable callback function of encoder helper
> >>
> >>     we had faced with one issue that invalid memory is accessed by dma
> >>     once drm is released and then the dma is turned on again. actually,
> >>     in our case, page fault was incurred with iommu. the reason is that
> >>     a gem buffer accessed by the dma is also released once drm is released.
> >>
> >>     so this patch would fix this issue ensuring the dma is disabled
> >>     when released.
> >>
> >>
> >> An encoder receives and encodes the mixed output of all of the
> >> planes/overlays.  It would seem that whether the individual planes
> >> themselves are enabled or not should be completely independent of the
> >> status any encoder.  However, I find the code in exynos_drm_encoder.c
> >> very difficult to follow, so perhaps there is some extra linkage
> >> between encoder/crtc/plane that is exynos specific.
> >>
> >> In any case, judging from the commit message, this disable loop should
> >> probably still iterate over all of the planes, not just the
> >> "DRM_PLANE_TYPE_OVERLAY" ones.  So, I think this new patch is
> >> incorrect.
> >
> > It keeps full backwars compatibility with existing semantics, which is the
> > right thing to do in such a case. It could be that exynos simply has a
> > bug, but imo that should be a separate patch outside of this series.
> 
> Indeed...  I missed the fact that in the existing code, the "priv"
> (now primary) plane is not added to the plane_list, so it wouldn't
> actually be disabled in this loop here anyway.
> 
> New question: are the planes that will become DRM_PLANE_TYPE_CURSOR
> formerly "priv", or not?
> If they were not, then I think the backwards- and forwards- compatible loop is:
> 
>   list_for_each_entry(plane, &dev->mode_config.plane_list, head) {
>     if (plane->type == DRM_PLANE_TYPE_PRIMARY)
>       continue;
>     /* do something with legacy planes */
>   }

Cursor planes haven't been exposed at all as plane objects before, not
even as private driver objects. So they'd need to be excluded here too.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

  reply	other threads:[~2014-03-20 15:35 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-19  0:22 [RFCv3 00/14] Unified plane support Matt Roper
2014-03-19  0:22 ` [RFCv3 01/14] SQUASH! drm/i915: Do not dereference pointers from ring buffer in evict event Matt Roper
2014-03-19  0:22 ` [RFCv3 02/14] drm: Add support for multiple plane types Matt Roper
2014-03-19  0:22 ` [RFCv3 03/14] drm: Add primary plane helpers Matt Roper
2014-03-19 11:28   ` Daniel Vetter
2014-03-19 12:56     ` Rob Clark
2014-03-19 18:15     ` Matt Roper
2014-03-19 19:29       ` Daniel Vetter
2014-03-19 11:50   ` Daniel Vetter
2014-03-19 12:24   ` Daniel Vetter
2014-03-19 23:01     ` Matt Roper
2014-03-20 12:39       ` Daniel Vetter
2014-03-19  0:22 ` [RFCv3 04/14] drm/exynos: Restrict plane loops to only operate on overlay planes Matt Roper
2014-03-19 11:51   ` Daniel Vetter
2014-03-19 14:26     ` Daniel Kurtz
2014-03-19 19:31       ` Daniel Vetter
2014-03-20  1:56         ` Daniel Kurtz
2014-03-20 15:35           ` Daniel Vetter [this message]
2014-03-19  0:22 ` [RFCv3 05/14] drm/i915: " Matt Roper
2014-03-19  0:22 ` [RFCv3 06/14] drm: Add plane type property Matt Roper
2014-03-19 11:31   ` Daniel Vetter
2014-03-19  0:22 ` [RFCv3 07/14] drm: Specify primary plane at CRTC initialization (v2) Matt Roper
2014-03-19 11:41   ` Daniel Vetter
2014-03-20  5:43   ` Inki Dae
2014-03-20 15:38     ` Daniel Vetter
2014-03-19  0:22 ` [RFCv3 08/14] drm: Replace crtc fb with primary plane fb (v2) Matt Roper
2014-03-19 11:57   ` Daniel Vetter
2014-03-25  1:20     ` Matt Roper
2014-03-25 10:32       ` Daniel Vetter
2014-03-19  0:22 ` [RFCv3 09/14] drm: Allow userspace to ask for full plane list (universal planes) Matt Roper
2014-03-19 14:27   ` Daniel Vetter
2014-03-19  0:22 ` [RFCv3 10/14] drm/i915: Rename similar plane functions to avoid confusion Matt Roper
2014-03-19 12:05   ` Daniel Vetter
2014-03-19  0:22 ` [RFCv3 11/14] drm/i915: Intel-specific primary plane handling Matt Roper
2014-03-19 12:11   ` [Intel-gfx] " Daniel Vetter
2014-03-19 14:37     ` Daniel Vetter
2014-03-19  0:22 ` [RFCv3 12/14] drm: Specify cursor plane at CRTC initialization Matt Roper
2014-03-28 21:04   ` Daniel Vetter
2014-04-07 10:05     ` Thierry Reding
2014-04-07 17:23       ` Rob Clark
2014-04-07 20:03         ` Daniel Vetter
2014-04-07 20:05           ` Rob Clark
2014-03-19  0:22 ` [RFCv3 13/14] drm/i915: Split cursor update code from cursor ioctl handling Matt Roper
2014-03-19  8:03   ` Chris Wilson
2014-03-19  0:22 ` [RFCv3 14/14] drm/i915: Add cursor handlers and create cursor at crtc init Matt Roper
2014-03-19  0:37 ` [RFCv3 00/14] Unified plane support Rob Clark

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=20140320153520.GR30571@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=djkurtz@chromium.org \
    --cc=dri-devel@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