Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Mika Kuoppala <mika.kuoppala@linux.intel.com>
To: Intel Graphics Development <intel-gfx@lists.freedesktop.org>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>,
	Daniel Vetter <daniel.vetter@intel.com>
Subject: Re: [PATCH 3/7] drm/atomic-helper: add sync_all helper for	gpu reset
Date: Mon, 17 Jul 2017 15:30:54 +0300	[thread overview]
Message-ID: <878tjn8cu9.fsf@gaia.fi.intel.com> (raw)
In-Reply-To: <20170715114006.6380-4-daniel.vetter@ffwll.ch>

Daniel Vetter <daniel.vetter@ffwll.ch> writes:

> i915 needs this.
>
> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> ---
>  drivers/gpu/drm/drm_atomic_helper.c | 38 +++++++++++++++++++++++++++++++++++++
>  include/drm/drm_atomic_helper.h     |  1 +
>  2 files changed, 39 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> index cea610161af5..545328a9a769 100644
> --- a/drivers/gpu/drm/drm_atomic_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> @@ -1763,6 +1763,44 @@ static struct drm_crtc_commit *preceeding_commit(struct drm_crtc *crtc)
>  }
>  
>  /**
> + * drm_atomic_helper_sync_all - synchronize with all pending nonblocking commits
> + * @dev: DRM device
> + *
> + * This function synchronizes with all pending atomic commits using the
> + * nonblocking helpers (see drm_atomic_helper_setup_commit()) up to the point
> + * where all hardware commits are completed (as signalled using
> + * drm_atomic_helper_commit_hw_done().
> + *
> + * This is useful you need to synchronize with all nonblocking comits, but do

s/comits/commits

> + * not want to or cannot do a full atomic commit touching all CRTC. All CRTC
> + * looks must be held to prevent a concurrent thread from queuing yet another

s/looks/locks

> + * update. Drivers can use this for e.g. their gpu reset handling, when a gpu
> + * reset also affects the display block.
> + */
> +void drm_atomic_helper_sync_all(struct drm_device *dev)
> +{
> +	struct drm_crtc *crtc;
> +	struct drm_crtc_commit *commit;
> +
> +	drm_for_each_crtc(crtc, dev) {
> +		spin_lock(&crtc->commit_lock);
> +		commit = list_first_entry_or_null(&crtc->commit_list,
> +				struct drm_crtc_commit, commit_entry);
> +		if (commit)
> +			drm_crtc_commit_get(commit);
> +		spin_unlock(&crtc->commit_lock);
> +
> +		if (!commit)
> +			continue;
> +
> +		wait_for_completion(&commit->hw_done);
> +
> +		drm_crtc_commit_put(commit);
> +	}
> +}
> +EXPORT_SYMBOL(drm_atomic_helper_sync_all);

Reviewed-by: Mika Kuoppala <mika.kuoppala@intel.com>

> +
> +/**
>   * drm_atomic_helper_wait_for_dependencies - wait for required preceeding commits
>   * @old_state: atomic state object with old state structures
>   *
> diff --git a/include/drm/drm_atomic_helper.h b/include/drm/drm_atomic_helper.h
> index ed90d0c5ba09..95bef7c3632f 100644
> --- a/include/drm/drm_atomic_helper.h
> +++ b/include/drm/drm_atomic_helper.h
> @@ -92,6 +92,7 @@ void drm_atomic_helper_swap_state(struct drm_atomic_state *state,
>  /* nonblocking commit helpers */
>  int drm_atomic_helper_setup_commit(struct drm_atomic_state *state,
>  				   bool nonblock);
> +void drm_atomic_helper_sync_all(struct drm_device *dev);
>  void drm_atomic_helper_wait_for_dependencies(struct drm_atomic_state *state);
>  void drm_atomic_helper_commit_hw_done(struct drm_atomic_state *state);
>  void drm_atomic_helper_commit_cleanup_done(struct drm_atomic_state *state);
> -- 
> 2.13.2
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2017-07-17 12:32 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-15 11:39 [PATCH 0/7] RFC: duct-tape for the gpu reset vs. modeset deadlock Daniel Vetter
2017-07-15 11:40 ` [PATCH 1/7] drm/i915: Nuke legacy flip queueing code Daniel Vetter
2017-07-15 11:40 ` [PATCH 2/7] drm/i915: Unbreak gpu reset vs. modeset locking Daniel Vetter
2017-07-17 17:14   ` Maarten Lankhorst
2017-07-15 11:40 ` [PATCH 3/7] drm/atomic-helper: add sync_all helper for gpu reset Daniel Vetter
2017-07-17 12:30   ` Mika Kuoppala [this message]
2017-07-15 11:40 ` [PATCH 4/7] drm/i915: only disable outputs in simulated gpu resets Daniel Vetter
2017-07-15 11:40 ` [PATCH 5/7] drm/i915: Avoid the gpu reset vs. modeset deadlock Daniel Vetter
2017-07-15 11:40 ` [PATCH 6/7] drm/i915: Push i915_sw_fence_wait into the nonblocking atomic commit Daniel Vetter
2017-07-15 11:40 ` [PATCH 7/7] drm/i915: More surgically unbreak the modeset vs reset deadlock Daniel Vetter
2017-07-15 12:00 ` ✗ Fi.CI.BAT: warning for RFC: duct-tape for the gpu reset vs. modeset deadlock Patchwork
2017-07-15 13:23   ` Daniel Vetter
2017-07-15 13:45     ` Daniel Vetter
2017-07-17 10:01       ` Maarten Lankhorst

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=878tjn8cu9.fsf@gaia.fi.intel.com \
    --to=mika.kuoppala@linux.intel.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=daniel.vetter@intel.com \
    --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