From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Daniel Vetter <daniel@ffwll.ch>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>,
intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
martin.peres@free.fr
Subject: Re: [PATCH 02/23] drm/atomic-helper: Make drm_atomic_helper_disable_all() update the plane->fb pointers
Date: Thu, 29 Mar 2018 19:32:01 +0300 [thread overview]
Message-ID: <20180329163201.GX5453@intel.com> (raw)
In-Reply-To: <20180326202806.GY14155@phenom.ffwll.local>
On Mon, Mar 26, 2018 at 10:28:06PM +0200, Daniel Vetter wrote:
> On Thu, Mar 22, 2018 at 05:22:52PM +0200, Ville Syrjala wrote:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> >
> > drm_atomic_helper_shutdown() needs to release the reference held by
> > plane->fb, so we want to use drm_atomic_clean_old_fb() in
> > drm_atomic_helper_disable_all(). However during suspend/resume, gpu
> > reset and load detection we should probably leave that stuff alone,
> > as otherwise we'd have to make sure we put them back again when
> > we restore the duplicated state to the device. Seems simpler to me
> > to not touch any of it anyway.
> >
> > v2: Don't inflict the clean_old_fbs bool to drivers (Daniel)
> >
> > Cc: martin.peres@free.fr
> > Cc: chris@chris-wilson.co.uk
> > Cc: Dave Airlie <airlied@gmail.com> (v1)
> > Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> > Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> I think this would be cleaner diff to read if you squash the first 2
> patches together. Also avoids the bisect fail. With that (and I trust you
> to come up with a suitably merged commit message):
>
> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Squashed, and commit message rescribbeled. And with sufficient confidence
from a local smoke test I proceeded to push the easy ones 1-13 (except msm),
and 22-23 (the load detect stuff for i915). I'll have to figure out the
correct merge order for the rest next week.
Thanks for the reviews.
>
> I reviewed this by re-reading the analysis from 49d70aeaeca8f62b72b77 and
> trusting my former self :-)
>
> Cheers, Daniel
>
> > ---
> > drivers/gpu/drm/drm_atomic_helper.c | 67 ++++++++++++++++++++++---------------
> > 1 file changed, 40 insertions(+), 27 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> > index c48f187d08de..39a69508d8c9 100644
> > --- a/drivers/gpu/drm/drm_atomic_helper.c
> > +++ b/drivers/gpu/drm/drm_atomic_helper.c
> > @@ -2881,31 +2881,9 @@ int __drm_atomic_helper_set_config(struct drm_mode_set *set,
> > return 0;
> > }
> >
> > -/**
> > - * drm_atomic_helper_disable_all - disable all currently active outputs
> > - * @dev: DRM device
> > - * @ctx: lock acquisition context
> > - *
> > - * Loops through all connectors, finding those that aren't turned off and then
> > - * turns them off by setting their DPMS mode to OFF and deactivating the CRTC
> > - * that they are connected to.
> > - *
> > - * This is used for example in suspend/resume to disable all currently active
> > - * functions when suspending. If you just want to shut down everything at e.g.
> > - * driver unload, look at drm_atomic_helper_shutdown().
> > - *
> > - * Note that if callers haven't already acquired all modeset locks this might
> > - * return -EDEADLK, which must be handled by calling drm_modeset_backoff().
> > - *
> > - * Returns:
> > - * 0 on success or a negative error code on failure.
> > - *
> > - * See also:
> > - * drm_atomic_helper_suspend(), drm_atomic_helper_resume() and
> > - * drm_atomic_helper_shutdown().
> > - */
> > -int drm_atomic_helper_disable_all(struct drm_device *dev,
> > - struct drm_modeset_acquire_ctx *ctx)
> > +static int __drm_atomic_helper_disable_all(struct drm_device *dev,
> > + struct drm_modeset_acquire_ctx *ctx,
> > + bool clean_old_fbs)
> > {
> > struct drm_atomic_state *state;
> > struct drm_connector_state *conn_state;
> > @@ -2914,6 +2892,7 @@ int drm_atomic_helper_disable_all(struct drm_device *dev,
> > struct drm_plane *plane;
> > struct drm_crtc_state *crtc_state;
> > struct drm_crtc *crtc;
> > + unsigned int plane_mask = 0;
> > int ret, i;
> >
> > state = drm_atomic_state_alloc(dev);
> > @@ -2956,14 +2935,48 @@ int drm_atomic_helper_disable_all(struct drm_device *dev,
> > goto free;
> >
> > drm_atomic_set_fb_for_plane(plane_state, NULL);
> > +
> > + if (clean_old_fbs) {
> > + plane->old_fb = plane->fb;
> > + plane_mask |= BIT(drm_plane_index(plane));
> > + }
> > }
> >
> > ret = drm_atomic_commit(state);
> > free:
> > + drm_atomic_clean_old_fb(dev, plane_mask, ret);
> > +
> > drm_atomic_state_put(state);
> > return ret;
> > }
> > -
> > +/**
> > + * drm_atomic_helper_disable_all - disable all currently active outputs
> > + * @dev: DRM device
> > + * @ctx: lock acquisition context
> > + *
> > + * Loops through all connectors, finding those that aren't turned off and then
> > + * turns them off by setting their DPMS mode to OFF and deactivating the CRTC
> > + * that they are connected to.
> > + *
> > + * This is used for example in suspend/resume to disable all currently active
> > + * functions when suspending. If you just want to shut down everything at e.g.
> > + * driver unload, look at drm_atomic_helper_shutdown().
> > + *
> > + * Note that if callers haven't already acquired all modeset locks this might
> > + * return -EDEADLK, which must be handled by calling drm_modeset_backoff().
> > + *
> > + * Returns:
> > + * 0 on success or a negative error code on failure.
> > + *
> > + * See also:
> > + * drm_atomic_helper_suspend(), drm_atomic_helper_resume() and
> > + * drm_atomic_helper_shutdown().
> > + */
> > +int drm_atomic_helper_disable_all(struct drm_device *dev,
> > + struct drm_modeset_acquire_ctx *ctx)
> > +{
> > + return __drm_atomic_helper_disable_all(dev, ctx, false);
> > +}
> > EXPORT_SYMBOL(drm_atomic_helper_disable_all);
> >
> > /**
> > @@ -2986,7 +2999,7 @@ void drm_atomic_helper_shutdown(struct drm_device *dev)
> > while (1) {
> > ret = drm_modeset_lock_all_ctx(dev, &ctx);
> > if (!ret)
> > - ret = drm_atomic_helper_disable_all(dev, &ctx);
> > + ret = __drm_atomic_helper_disable_all(dev, &ctx, true);
> >
> > if (ret != -EDEADLK)
> > break;
> > --
> > 2.16.1
> >
>
> --
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch
--
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2018-03-29 16:32 UTC|newest]
Thread overview: 74+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-22 15:22 [PATCH 00/23] drm: Eliminate plane->fb/crtc usage for atomic drivers Ville Syrjala
2018-03-22 15:22 ` [PATCH 01/23] Revert "drm/atomic-helper: Fix leak in disable_all" Ville Syrjala
2018-03-22 15:22 ` [PATCH 02/23] drm/atomic-helper: Make drm_atomic_helper_disable_all() update the plane->fb pointers Ville Syrjala
2018-03-26 20:28 ` Daniel Vetter
2018-03-29 16:32 ` Ville Syrjälä [this message]
2018-03-26 20:43 ` Daniel Vetter
2018-03-22 15:22 ` [PATCH 03/23] drm: Clear crtc->primary->crtc when disabling the crtc via setcrtc() Ville Syrjala
2018-03-26 20:41 ` Daniel Vetter
2018-03-22 15:22 ` [PATCH 04/23] drm/atomic-helper: WARN if legacy plane fb pointers are bogus when committing duplicated state Ville Syrjala
2018-03-26 20:42 ` [Intel-gfx] " Daniel Vetter
2018-03-22 15:22 ` [PATCH 05/23] drm: Add local 'plane' variable for primary/cursor planes Ville Syrjala
2018-03-26 20:49 ` Daniel Vetter
2018-03-22 15:22 ` [PATCH 06/23] drm: Adjust whitespace for legibility Ville Syrjala
2018-03-26 20:49 ` Daniel Vetter
2018-03-22 15:22 ` [PATCH 07/23] drm: Make the fb refcount handover less magic Ville Syrjala
2018-03-27 7:49 ` Daniel Vetter
2018-03-22 15:22 ` [PATCH 08/23] drm: Use plane->state->fb over plane->fb Ville Syrjala
2018-03-27 8:10 ` Daniel Vetter
2018-03-22 15:22 ` [PATCH 09/23] drm/i915: Stop consulting plane->fb Ville Syrjala
[not found] ` <20180322152313.6561-1-ville.syrjala-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2018-03-22 15:23 ` [PATCH 10/23] drm/msm: " Ville Syrjala
2018-03-22 15:23 ` [PATCH 19/23] drm/msm: Stop updating plane->fb/crtc Ville Syrjala
2018-03-27 8:21 ` [PATCH 00/23] drm: Eliminate plane->fb/crtc usage for atomic drivers Daniel Vetter
2018-03-22 15:23 ` [PATCH 11/23] drm/sti: Stop consulting plane->fb Ville Syrjala
2018-03-22 16:25 ` Benjamin Gaignard
2018-03-22 15:23 ` [PATCH 12/23] drm/vmwgfx: " Ville Syrjala
2018-03-22 15:53 ` Thomas Hellstrom
2018-03-22 15:23 ` [PATCH 13/23] drm/zte: " Ville Syrjala
2018-03-22 16:12 ` Maarten Lankhorst
2018-03-22 17:40 ` [PATCH v2 " Ville Syrjala
2018-03-26 7:25 ` Shawn Guo
2018-03-26 12:14 ` [PATCH v3 13/23] drm/zte: Stop consulting plane->crtc Ville Syrjala
2018-03-22 15:23 ` [PATCH 14/23] drm/atmel-hlcdc: Stop using plane->fb Ville Syrjala
2018-03-22 16:14 ` Maarten Lankhorst
2018-03-22 17:30 ` Ville Syrjälä
2018-03-27 8:13 ` Daniel Vetter
2018-03-22 15:23 ` [PATCH 15/23] drm: Stop updating plane->crtc/fb/old_fb on atomic drivers Ville Syrjala
2018-03-26 20:52 ` Daniel Vetter
2018-03-26 20:56 ` [Intel-gfx] " Daniel Vetter
2018-03-27 7:57 ` Daniel Vetter
2018-03-27 9:44 ` [Intel-gfx] " Ville Syrjälä
2018-03-22 15:23 ` [PATCH 16/23] drm/amdgpu/dc: Stop updating plane->fb Ville Syrjala
2018-03-23 20:23 ` Harry Wentland
2018-03-22 15:23 ` [PATCH 17/23] drm/i915: Stop updating plane->fb/crtc Ville Syrjala
2018-03-22 15:23 ` [PATCH 18/23] drm/exynos: Stop updating plane->crtc Ville Syrjala
2018-03-22 15:23 ` [PATCH 20/23] drm/virtio: Stop updating plane->fb Ville Syrjala
2018-03-22 16:11 ` Gerd Hoffmann
2018-03-22 16:11 ` Gerd Hoffmann
2018-03-22 17:40 ` [PATCH v2 20/23] drm/virtio: Stop updating plane->crtc Ville Syrjala
2018-03-22 17:40 ` Ville Syrjala
2018-03-22 15:23 ` [PATCH 21/23] drm/vc4: Stop updating plane->fb/crtc Ville Syrjala
2018-03-22 16:50 ` Maarten Lankhorst
2018-03-22 15:23 ` [PATCH 22/23] drm/i915: Restore planes after load detection Ville Syrjala
2018-03-22 15:23 ` [PATCH 23/23] drm/i915: Make force_load_detect effective even w/ DMI quirks/hotplug Ville Syrjala
2018-03-22 16:49 ` Maarten Lankhorst
2018-03-22 17:41 ` [PATCH v2 " Ville Syrjala
2018-03-22 16:38 ` ✗ Fi.CI.CHECKPATCH: warning for drm: Eliminate plane->fb/crtc usage for atomic drivers Patchwork
2018-03-22 16:51 ` [PATCH 00/23] " Noralf Trønnes
[not found] ` <b92fe986-295c-fecb-dca1-82cb9bf7b7b1-L59+Z2yzLopAfugRpC6u6w@public.gmane.org>
2018-03-22 18:49 ` Ville Syrjälä
2018-03-22 23:28 ` Noralf Trønnes
2018-03-22 18:49 ` Ville Syrjälä
2018-03-22 16:51 ` Noralf Trønnes
2018-03-22 16:52 ` ✗ Fi.CI.BAT: failure for " Patchwork
2018-03-22 17:54 ` [PATCH 00/23] " Emil Velikov
[not found] ` <CACvgo53B4zLLUqw9y18skpjacmjt-iAYBcG19HkmE=jFwcb4+w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-03-22 18:03 ` Harry Wentland
2018-03-22 18:34 ` Emil Velikov
[not found] ` <a0d3ec32-be68-c96e-607c-0af4a97a3dd6-5C7GfCeVMHo@public.gmane.org>
2018-03-22 18:34 ` Emil Velikov
2018-03-22 17:54 ` Emil Velikov
2018-03-22 17:56 ` ✗ Fi.CI.CHECKPATCH: warning for drm: Eliminate plane->fb/crtc usage for atomic drivers (rev4) Patchwork
2018-03-22 18:12 ` ✓ Fi.CI.BAT: success " Patchwork
2018-03-22 19:59 ` ✗ Fi.CI.IGT: failure " Patchwork
2018-03-26 12:28 ` ✗ Fi.CI.CHECKPATCH: warning for drm: Eliminate plane->fb/crtc usage for atomic drivers (rev5) Patchwork
2018-03-26 12:43 ` ✓ Fi.CI.BAT: success " Patchwork
2018-03-26 15:36 ` ✓ Fi.CI.IGT: " Patchwork
2018-03-27 8:21 ` [PATCH 00/23] drm: Eliminate plane->fb/crtc usage for atomic drivers 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=20180329163201.GX5453@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=daniel.vetter@ffwll.ch \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=martin.peres@free.fr \
/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.