All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Anholt <eric@anholt.net>
To: DRI Development <dri-devel@lists.freedesktop.org>
Cc: Alex Deucher <alexander.deucher@amd.com>,
	Daniel Vetter <daniel.vetter@ffwll.ch>,
	Thomas Hellstrom <thellstrom@vmware.com>,
	Gerd Hoffmann <kraxel@redhat.com>,
	Daniel Vetter <daniel.vetter@intel.com>
Subject: Re: [PATCH 6/9] drm/atomic: better doc for implicit vs explicit fencing
Date: Fri, 20 Apr 2018 15:04:58 -0700	[thread overview]
Message-ID: <87efj9ilf9.fsf@anholt.net> (raw)
In-Reply-To: <20180405154449.23038-7-daniel.vetter@ffwll.ch>


[-- Attachment #1.1: Type: text/plain, Size: 3787 bytes --]

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

> Note that a pile of drivers don't seem to take implicit fencing into
> account, or at least don't call drm_atoimc_set_fence_for_plane().

                                     ^atomic

> Cc'ing relevant people, or at least some. Some drivers also look like
> they don't disable implicit fencing (e.g. amdgpu) because the explicit
> fences and implicit fences are handled by entirely independent code
> paths.
>
> I also wonder whether we shouldn't just make the recommended helpers
> the default ones, since a lot of drivers don't bother to handle the
> implicit fences at all it seems. The helpers won't blow up even for
> non-GEM drivers or GEM drivers which don't fill out the gem bo
> pointers in struct drm_framebuffer.
>
> Cc: Gerd Hoffmann <kraxel@redhat.com>
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Cc: Harry Wentland <harry.wentland@amd.com>
> Cc: Sinclair Yeh <syeh@vmware.com>
> Cc: Thomas Hellstrom <thellstrom@vmware.com>
> Cc: Gustavo Padovan <gustavo@padovan.org>
> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Sean Paul <seanpaul@chromium.org>
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> ---
>  drivers/gpu/drm/drm_atomic.c             | 8 ++++++++
>  include/drm/drm_modeset_helper_vtables.h | 5 ++++-
>  include/drm/drm_plane.h                  | 7 ++++++-
>  3 files changed, 18 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
> index 7d25c42f22db..ec77afbda0c3 100644
> --- a/drivers/gpu/drm/drm_atomic.c
> +++ b/drivers/gpu/drm/drm_atomic.c
> @@ -1492,6 +1492,14 @@ EXPORT_SYMBOL(drm_atomic_set_fb_for_plane);
>   * Otherwise, if &drm_plane_state.fence is not set this function we just set it
>   * with the received implicit fence. In both cases this function consumes a
>   * reference for @fence.
> + *
> + * This way explicit fencing can be used to overrule implicit fencing, which is
> + * important to make explicit fencing use-cases work: One example is using one
> + * buffer for 2 screens with different refresh rates. Implicit fencing will
> + * clamp rendering to the refresh rate of the slower screen, whereas explicit
> + * fence allows 2 independent render and display loops on a single buffer. If a
> + * driver allows obeys both implicit and explicit fences for plane updates, then
> + * it will break all the benefits of explicit fencing.
>   */

Thanks for explaining why we should care about explicit fencing for
display!  I'd been trying and failing to generate a usecase.

> diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h
> index d6da26d66a4b..1e2622e33208 100644
> --- a/include/drm/drm_plane.h
> +++ b/include/drm/drm_plane.h
> @@ -80,7 +80,12 @@ struct drm_plane_state {
>  	 * @fence:
>  	 *
>  	 * Optional fence to wait for before scanning out @fb. Do not write this
> -	 * directly, use drm_atomic_set_fence_for_plane()
> +	 * directly, use drm_atomic_set_fence_for_plane(). The core atomic code
> +	 * will set this when userspace is using explicit fencing.

Optional suggestion:

	 * Optional fence to wait for before scanning out @fb. The core
	 * atomic code will set this when userspace is using explicit
	 * fencing. Do not write this directly for a driver's implicit
	 * fence, use drm_atomic_set_fence_for_plane() to ensure that
	 * an explicit fence is preserved.

> +	 *
> +	 * Drivers should store any implicit fences in this from their

Maybe s/fences/fence/ to make it more obvious that you can only attach
one?

> +	 * &drm_plane_helper.prepare_fb callback. See drm_gem_fb_prepare_fb()
> +	 * and drm_gem_fb_simple_display_pipe_prepare_fb() for suitable helpers.
>  	 */
>  	struct dma_fence *fence;

Regardless,

Reviewed-by: Eric Anholt <eric@anholt.net>

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2018-04-20 22:05 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-05 15:44 [PATCH 0/9] implicit fencing clarification Daniel Vetter
2018-04-05 15:44 ` [PATCH 1/9] drm/vmwgfx: Remove no-op prepare/cleanup_fb callbacks Daniel Vetter
2018-04-05 17:06   ` Thomas Hellstrom
2018-04-05 19:59     ` Daniel Vetter
2018-04-05 15:44 ` [PATCH 2/9] drm: Move simple_display_pipe prepare_fb helper into gem fb helpers Daniel Vetter
2018-04-06  9:42   ` Noralf Trønnes
2018-04-09  8:42     ` Daniel Vetter
2018-04-09 15:23   ` David Lechner
2018-04-10  5:55   ` Oleksandr Andrushchenko
2018-04-05 15:44 ` [PATCH 3/9] drm/tve200: Use simple_display_pipe prepare_fb helper Daniel Vetter
2018-04-06  9:40   ` Linus Walleij
2018-04-05 15:44 ` [PATCH 4/9] drm/pl111: " Daniel Vetter
2018-04-05 15:44 ` [PATCH 5/9] drm/mxsfb: " Daniel Vetter
2018-04-20 21:54   ` Eric Anholt
2018-04-05 15:44 ` [PATCH 6/9] drm/atomic: better doc for implicit vs explicit fencing Daniel Vetter
2018-04-20 22:04   ` Eric Anholt [this message]
2018-04-24 12:01     ` Daniel Vetter
2018-04-05 15:44 ` [PATCH 7/9] drm/gem-fb-helper: Always do implicit sync Daniel Vetter
2018-04-20 22:11   ` Eric Anholt
2018-04-24 12:04     ` Daniel Vetter
2018-06-20 12:46       ` Daniel Vetter
2018-04-05 15:44 ` [PATCH 8/9] drm/vc4: Always obey " Daniel Vetter
2018-04-20 22:12   ` Eric Anholt
     [not found] ` <20180405154449.23038-1-daniel.vetter-/w4YWyX8dFk@public.gmane.org>
2018-04-05 15:44   ` [PATCH 9/9] drm/msm: Always obey implicit fencing Daniel Vetter
     [not found]     ` <20180405154449.23038-10-daniel.vetter-/w4YWyX8dFk@public.gmane.org>
2018-06-20  9:12       ` Daniel Vetter
2018-04-06  7:38 ` [PATCH 0/9] implicit fencing clarification Oleksandr Andrushchenko
2018-04-09  8:44   ` Daniel Vetter
2018-04-09  8:51   ` [PATCH] drm/xen-front: use simple display pipe prepare_fb helper Daniel Vetter
2018-04-10  5:56     ` Oleksandr Andrushchenko
2018-04-10  5:56     ` Oleksandr Andrushchenko
2018-04-09  8:51   ` 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=87efj9ilf9.fsf@anholt.net \
    --to=eric@anholt.net \
    --cc=alexander.deucher@amd.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=daniel.vetter@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=kraxel@redhat.com \
    --cc=thellstrom@vmware.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 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.