intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 01/19] drm/atomic: Add new iterators over all state
Date: Tue, 1 Nov 2016 15:41:01 +0200	[thread overview]
Message-ID: <20161101134101.GX4617@intel.com> (raw)
In-Reply-To: <9d2955ef-a45e-6a04-958a-6b490bc08c65@linux.intel.com>

On Tue, Nov 01, 2016 at 02:34:00PM +0100, Maarten Lankhorst wrote:
> Op 01-11-16 om 14:09 schreef Ville Syrjälä:
> > On Mon, Oct 17, 2016 at 02:37:00PM +0200, Maarten Lankhorst wrote:
> >> Add for_each_(old)(new)_(plane,connector,crtc)_in_state iterators to
> >> replace the old for_each_xxx_in_state ones. This is useful for >1 flip
> >> depth and getting rid of all xxx->state dereferences.
> >>
> >> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> >> ---
> >>  drivers/gpu/drm/drm_atomic.c         |  6 +++
> >>  drivers/gpu/drm/drm_atomic_helper.c  | 52 +++++++++++++++++++++--
> >>  drivers/gpu/drm/i915/intel_display.c | 11 ++---
> >>  include/drm/drm_atomic.h             | 81 ++++++++++++++++++++++++++++++++++--
> >>  include/drm/drm_atomic_helper.h      |  3 ++
> >>  5 files changed, 142 insertions(+), 11 deletions(-)
> >>
> >> diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
> >> index 5dd70540219c..120775fcfb70 100644
> >> --- a/drivers/gpu/drm/drm_atomic.c
> >> +++ b/drivers/gpu/drm/drm_atomic.c
> >> @@ -278,6 +278,8 @@ drm_atomic_get_crtc_state(struct drm_atomic_state *state,
> >>  		return ERR_PTR(-ENOMEM);
> >>  
> >>  	state->crtcs[index].state = crtc_state;
> >> +	state->crtcs[index].old_state = crtc->state;
> >> +	state->crtcs[index].new_state = crtc_state;
> >>  	state->crtcs[index].ptr = crtc;
> >>  	crtc_state->state = state;
> >>  
> >> @@ -640,6 +642,8 @@ drm_atomic_get_plane_state(struct drm_atomic_state *state,
> >>  
> >>  	state->planes[index].state = plane_state;
> >>  	state->planes[index].ptr = plane;
> >> +	state->planes[index].old_state = plane->state;
> >> +	state->planes[index].new_state = plane_state;
> >>  	plane_state->state = state;
> >>  
> >>  	DRM_DEBUG_ATOMIC("Added [PLANE:%d:%s] %p state to %p\n",
> >> @@ -931,6 +935,8 @@ drm_atomic_get_connector_state(struct drm_atomic_state *state,
> >>  
> >>  	drm_connector_reference(connector);
> >>  	state->connectors[index].state = connector_state;
> >> +	state->connectors[index].old_state = connector->state;
> >> +	state->connectors[index].new_state = connector_state;
> >>  	state->connectors[index].ptr = connector;
> >>  	connector_state->state = state;
> >>  
> >> diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> >> index 07b432f43b98..fcb6e5b55217 100644
> >> --- a/drivers/gpu/drm/drm_atomic_helper.c
> >> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> >> @@ -2495,7 +2495,7 @@ EXPORT_SYMBOL(drm_atomic_helper_disable_all);
> >>   *
> >>   * See also:
> >>   * drm_atomic_helper_duplicate_state(), drm_atomic_helper_disable_all(),
> >> - * drm_atomic_helper_resume()
> >> + * drm_atomic_helper_resume(), drm_atomic_helper_commit_duplicated_state()
> >>   */
> >>  struct drm_atomic_state *drm_atomic_helper_suspend(struct drm_device *dev)
> >>  {
> >> @@ -2536,6 +2536,52 @@ unlock:
> >>  EXPORT_SYMBOL(drm_atomic_helper_suspend);
> >>  
> >>  /**
> >> + * drm_atomic_helper_commit_duplicated_state - commit duplicated state
> >> + * @state: duplicated atomic state to commit
> >> + * @ctx: pointer to acquire_ctx to use for commit.
> >> + * @nonblock: commit the state non-blocking.
> >> + *
> >> + * The state returned by drm_atomic_helper_duplicate_state() and
> >> + * drm_atomic_helper_suspend() is partially invalid, and needs to
> >> + * be fixed up before commit.
> > So the old_state pointers are potentially invalid because whatever->state
> > may have changed since we duplicated the state?
> 
> Yes when you use drm_atomic_helper_duplicate_state, and commit a different state before committing the duplicated state.
> This only happens during suspend/resume and gpu reset.

Should we maybe have something like drm_atomic_refresh_old_state(state)?
Would allow the caller then to check something in the old vs. new state
before committing?

-- 
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-01 13:41 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-17 12:36 [PATCH 00/19] drm/atomic: Use less confusing iterator names Maarten Lankhorst
2016-10-17 12:37 ` [PATCH 01/19] drm/atomic: Add new iterators over all state Maarten Lankhorst
2016-11-01 13:09   ` [Intel-gfx] " Ville Syrjälä
2016-11-01 13:34     ` Maarten Lankhorst
2016-11-01 13:41       ` Ville Syrjälä [this message]
2016-11-02  8:28         ` Maarten Lankhorst
2016-11-03 15:11           ` [Intel-gfx] " Ville Syrjälä
2016-11-16 12:56             ` Maarten Lankhorst
2016-11-08  8:50       ` [Intel-gfx] " Daniel Vetter
2016-10-17 12:37 ` [PATCH 02/19] drm/atmel-hlcdc: Use new atomic iterator macros Maarten Lankhorst
2016-10-17 12:37 ` [PATCH 03/19] drm/exynos: " Maarten Lankhorst
2016-10-17 12:37 ` [PATCH 04/19] drm/blend: " Maarten Lankhorst
2016-11-03 15:26   ` Ville Syrjälä
2016-10-17 12:37 ` [PATCH 05/19] drm/atomic: Make add_affected_connectors look at crtc_state Maarten Lankhorst
2016-11-03 15:32   ` Ville Syrjälä
2016-11-08  8:51     ` [Intel-gfx] " Daniel Vetter
2016-10-17 12:37 ` [PATCH 06/19] drm/atomic: Use new atomic iterator macros Maarten Lankhorst
2016-11-03 15:35   ` [Intel-gfx] " Ville Syrjälä
2016-10-17 12:37 ` [PATCH 07/19] drm/atomic: Fix atomic helpers to use the new " Maarten Lankhorst
2016-11-03 16:22   ` Ville Syrjälä
2016-11-08  8:53     ` Daniel Vetter
2016-10-17 12:37 ` [PATCH 08/19] drm/vc4: Use new atomic " Maarten Lankhorst
2016-10-17 12:37 ` [PATCH 09/19] drm/rockchip: " Maarten Lankhorst
2016-10-17 12:37 ` [PATCH 10/19] drm/rcar-du: " Maarten Lankhorst
2016-10-17 12:37 ` [PATCH 11/19] drm/omap: " Maarten Lankhorst
2016-10-17 12:37 ` [PATCH 12/19] drm/msm: " Maarten Lankhorst
2016-11-03 16:37   ` [Intel-gfx] " Ville Syrjälä
2016-10-17 12:37 ` [PATCH 13/19] drm/imx: " Maarten Lankhorst
2016-10-17 12:37 ` [PATCH 14/19] drm/mediatek: " Maarten Lankhorst
2016-11-03 16:39   ` Ville Syrjälä
2016-10-17 12:37 ` [PATCH 15/19] drm/i915: Use new atomic iterator macros in ddi Maarten Lankhorst
2016-11-03 17:07   ` Ville Syrjälä
2016-10-17 12:37 ` [PATCH 16/19] drm/i915: Use new atomic iterator macros in fbc Maarten Lankhorst
2016-11-03 16:45   ` Ville Syrjälä
2016-11-03 17:45     ` Paulo Zanoni
2016-11-03 17:55       ` [Intel-gfx] " Ville Syrjälä
2016-11-03 17:59         ` Ville Syrjälä
2016-10-17 12:37 ` [PATCH 17/19] drm/i915: Use new atomic iterator macros in wm code Maarten Lankhorst
2016-11-03 16:49   ` [Intel-gfx] " Ville Syrjälä
2016-11-03 17:53     ` Paulo Zanoni
2016-10-17 12:37 ` [PATCH 18/19] drm/i915: Use new atomic iterator macros in display code Maarten Lankhorst
2016-11-03 17:04   ` [Intel-gfx] " Ville Syrjälä
2016-10-17 12:37 ` [PATCH 19/19] drm/atomic: Rename atomic oldnew iterator Maarten Lankhorst
2016-11-03 17:11   ` [Intel-gfx] " Ville Syrjälä
2016-10-17 13:25 ` ✗ Fi.CI.BAT: warning for drm/atomic: Use less confusing iterator names Patchwork

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=20161101134101.GX4617@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=maarten.lankhorst@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 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).