All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sean Paul <seanpaul@google.com>
To: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Daniel Vetter <daniel.vetter@intel.com>,
	Intel Graphics Development <intel-gfx@lists.freedesktop.org>,
	DRI Development <dri-devel@lists.freedesktop.org>
Subject: Re: [Intel-gfx] [PATCH 12/17] drm/atomic: Integrate fence support
Date: Thu, 6 Nov 2014 12:43:10 -0500	[thread overview]
Message-ID: <CAOw6vbLbdWksbqTK0rT2RW=uqdmw5UoWbSQC5ychVJ4Pzex99w@mail.gmail.com> (raw)
In-Reply-To: <1414934370-11924-13-git-send-email-daniel.vetter@ffwll.ch>

On Sun, Nov 02, 2014 at 02:19:25PM +0100, Daniel Vetter wrote:
> This patch is for enabling async commits. It replaces an earlier
> approach which added an async boolean paramter to the ->prepare_fb
> callbacks. The idea is that prepare_fb picks up the right fence to
> synchronize against, which is then used by the synchronous commit
> helper. For async commits drivers can either register a callback to
> the fence or simply do the synchronous wait in their async work queue.
>
> v2: Remove unused variable.
>
> v3: Only wait for fences after the point of no return in the part
> of the commit function which can be run asynchronously. This is after
> the atomic state has been swapped in, hence now check
> plane->state->fence.
>
> Also add a WARN_ON to make sure we don't try to wait on a fence when
> there's no fb, just as a sanity check.
>
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>

Reviewed-by: Sean Paul <seanpaul@chromium.org>

> ---
>  drivers/gpu/drm/drm_atomic_helper.c | 23 +++++++++++++++++++++++
>  include/drm/drm_crtc.h              |  3 +++
>  2 files changed, 26 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> index 26fe60356a0f..afdc376aa7e7 100644
> --- a/drivers/gpu/drm/drm_atomic_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> @@ -30,6 +30,7 @@
>  #include <drm/drm_plane_helper.h>
>  #include <drm/drm_crtc_helper.h>
>  #include <drm/drm_atomic_helper.h>
> +#include <linux/fence.h>
>
>  static void
>  drm_atomic_helper_plane_changed(struct drm_atomic_state *state,
> @@ -704,6 +705,26 @@ void drm_atomic_helper_commit_post_planes(struct drm_device *dev,
>  }
>  EXPORT_SYMBOL(drm_atomic_helper_commit_post_planes);
>
> +static void wait_for_fences(struct drm_device *dev,
> +    struct drm_atomic_state *state)
> +{
> + int nplanes = dev->mode_config.num_total_plane;
> + int i;
> +
> + for (i = 0; i < nplanes; i++) {
> + struct drm_plane *plane = state->planes[i];
> +
> + if (!plane || !plane->state->fence)
> + continue;
> +
> + WARN_ON(!plane->state->fb);
> +
> + fence_wait(plane->state->fence, false);
> + fence_put(plane->state->fence);
> + plane->state->fence = NULL;
> + }
> +}
> +
>  static void
>  wait_for_vblanks(struct drm_device *dev, struct drm_atomic_state *old_state)
>  {
> @@ -801,6 +822,8 @@ int drm_atomic_helper_commit(struct drm_device *dev,
>   * current layout.
>   */
>
> + wait_for_fences(dev, state);
> +
>   drm_atomic_helper_commit_pre_planes(dev, state);
>
>   drm_atomic_helper_commit_planes(dev, state);
> diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
> index ddff25eb34d4..5c34665ebb9d 100644
> --- a/include/drm/drm_crtc.h
> +++ b/include/drm/drm_crtc.h
> @@ -42,6 +42,7 @@ struct drm_object_properties;
>  struct drm_file;
>  struct drm_clip_rect;
>  struct device_node;
> +struct fence;
>
>  #define DRM_MODE_OBJECT_CRTC 0xcccccccc
>  #define DRM_MODE_OBJECT_CONNECTOR 0xc0c0c0c0
> @@ -659,6 +660,7 @@ struct drm_connector {
>   * struct drm_plane_state - mutable plane state
>   * @crtc: currently bound CRTC, NULL if disabled
>   * @fb: currently bound fb
> + * @fence: optional fence to wait for before scanning out @fb
>   * @crtc_x: left position of visible portion of plane on crtc
>   * @crtc_y: upper position of visible portion of plane on crtc
>   * @crtc_w: width of visible portion of plane on crtc
> @@ -674,6 +676,7 @@ struct drm_connector {
>  struct drm_plane_state {
>   struct drm_crtc *crtc;
>   struct drm_framebuffer *fb;
> + struct fence *fence;
>
>   /* Signed dest location allows it to be partially off screen */
>   int32_t crtc_x, crtc_y;
> --
> 2.1.1
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2014-11-06 17:43 UTC|newest]

Thread overview: 77+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-02 13:19 [PATCH 00/17] atomic modeset core<->driver interfaces and helpers Daniel Vetter
2014-11-02 13:19 ` [PATCH 01/17] drm: Move drm_crtc_init from drm_crtc.h to drm_plane_helper.h Daniel Vetter
2014-11-04 20:31   ` Sean Paul
2014-11-02 13:19 ` [PATCH 02/17] drm: Pull drm_crtc.h into the kerneldoc template Daniel Vetter
2014-11-02 19:18   ` [PATCH] " Daniel Vetter
2014-11-03  3:04     ` Thierry Reding
2014-11-02 13:19 ` [PATCH 03/17] drm: fixup kerneldoc in drm_crtc.h Daniel Vetter
2014-11-02 19:19   ` Daniel Vetter
2014-11-02 13:19 ` [PATCH 04/17] drm/modeset_lock: document trylock_only in kerneldoc Daniel Vetter
2014-11-04 20:31   ` Sean Paul
2014-11-05 16:18   ` Thierry Reding
2014-11-02 13:19 ` [PATCH 05/17] drm: Add atomic driver interface definitions for objects Daniel Vetter
2014-11-04 20:31   ` Sean Paul
2014-11-05 16:26   ` Thierry Reding
2014-11-05 17:04     ` Daniel Vetter
2014-11-05 17:16       ` [Intel-gfx] " Damien Lespiau
2014-11-02 13:19 ` [PATCH 06/17] drm: Global atomic state handling Daniel Vetter
2014-11-03 23:41   ` Matt Roper
2014-11-04  8:40     ` Daniel Vetter
2014-11-04 20:31   ` Sean Paul
2014-11-04 21:30     ` Daniel Vetter
2014-11-04 21:41       ` Daniel Vetter
2014-11-04 21:37   ` [PATCH] " Daniel Vetter
2014-11-04 22:07     ` Daniel Vetter
2014-11-04 22:32       ` Sean Paul
2014-11-05 13:06       ` Ander Conselvan de Oliveira
2014-11-05 13:45       ` Daniel Vetter
2014-11-05 14:22         ` Daniel Vetter
2014-11-05 17:06           ` Daniel Vetter
2015-02-06  9:58             ` [Intel-gfx] " Jani Nikula
2015-02-06 21:14               ` Daniel Vetter
2014-11-02 13:19 ` [PATCH 07/17] drm: Add atomic/plane helpers Daniel Vetter
2014-11-04 22:30   ` Sean Paul
2014-11-04 23:16     ` Daniel Vetter
2014-11-02 13:19 ` [PATCH 08/17] drm/plane-helper: transitional atomic plane helpers Daniel Vetter
2014-11-05 16:45   ` Sean Paul
2014-11-05 16:51     ` Daniel Vetter
2014-11-05 16:59   ` [PATCH] " Daniel Vetter
2014-11-02 13:19 ` [PATCH 09/17] drm/crtc-helper: Transitional functions using " Daniel Vetter
2014-11-05 17:42   ` Sean Paul
2014-11-02 13:19 ` [PATCH 10/17] drm: Atomic crtc/connector updates using crtc/plane helper interfaces Daniel Vetter
2014-11-05 18:53   ` Sean Paul
2014-11-05 21:44     ` Daniel Vetter
2014-11-06 18:28       ` Sean Paul
2014-11-02 13:19 ` [PATCH 11/17] drm/atomic-helper: implementatations for legacy interfaces Daniel Vetter
2014-11-04 22:08   ` [PATCH] " Daniel Vetter
2014-11-05 13:46     ` Daniel Vetter
2014-11-05 19:48       ` Sean Paul
2014-11-05 22:01         ` Daniel Vetter
2014-11-06 18:31           ` Sean Paul
2014-11-02 13:19 ` [PATCH 12/17] drm/atomic: Integrate fence support Daniel Vetter
2014-11-06 17:43   ` Sean Paul [this message]
2014-11-02 13:19 ` [PATCH 13/17] drm/atomic-helpers: document how to implement async commit Daniel Vetter
2014-11-06 17:43   ` Sean Paul
2014-11-02 13:19 ` [PATCH 14/17] drm/atomic-helper: implement ->page_flip Daniel Vetter
2014-11-04 22:09   ` [PATCH] " Daniel Vetter
2014-11-05 11:35     ` Daniel Thompson
2014-11-05 13:46     ` Daniel Vetter
2014-11-06 17:43   ` [PATCH 14/17] " Sean Paul
2014-11-06 18:13     ` Daniel Vetter
2014-11-06 18:53       ` Sean Paul
2014-11-02 13:19 ` [PATCH 15/17] drm/atomic-helpers: functions for state duplicate/destroy/reset Daniel Vetter
2014-11-03 14:45   ` Daniel Thompson
2014-11-03 14:53     ` Daniel Vetter
2014-11-03 15:06       ` Daniel Thompson
2014-11-03 15:11         ` Daniel Vetter
2014-11-06 17:43   ` Sean Paul
2014-11-06 19:57     ` Daniel Vetter
2014-11-06 20:01       ` Sean Paul
2014-11-06 19:55   ` [PATCH] " Daniel Vetter
2014-11-02 13:19 ` [PATCH 16/17] drm: Docbook integration and over sections for all the new helpers Daniel Vetter
2014-11-06 17:43   ` Sean Paul
2014-11-06 20:00   ` [PATCH] " Daniel Vetter
2014-11-06 20:02     ` Sean Paul
2014-11-02 13:19 ` [PATCH 17/17] drm/atomic: Refcounting for plane_state->fb Daniel Vetter
2014-11-04 21:57   ` [PATCH] " Daniel Vetter
2014-11-06 17:44   ` [PATCH 17/17] " Sean Paul

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='CAOw6vbLbdWksbqTK0rT2RW=uqdmw5UoWbSQC5ychVJ4Pzex99w@mail.gmail.com' \
    --to=seanpaul@google.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=daniel.vetter@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --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 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.