From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Rob Clark <robdclark@gmail.com>
Cc: dri-devel@lists.freedesktop.org,
"Rob Clark" <robdclark@chromium.org>,
"Thomas Zimmermann" <tzimmermann@suse.de>,
"Tvrtko Ursulin" <tvrtko.ursulin@intel.com>,
"Christian König" <ckoenig.leichtzumerken@gmail.com>,
"Michel Dänzer" <michel@daenzer.net>,
"open list" <linux-kernel@vger.kernel.org>,
"Daniel Vetter" <daniel.vetter@ffwll.ch>,
"Pekka Paalanen" <ppaalanen@gmail.com>,
"Luben Tuikov" <luben.tuikov@amd.com>,
"Rodrigo Vivi" <rodrigo.vivi@intel.com>,
"Alex Deucher" <alexander.deucher@amd.com>,
freedreno@lists.freedesktop.org
Subject: Re: [PATCH v9 11/15] drm/atomic-helper: Set fence deadline for vblank
Date: Fri, 3 Mar 2023 17:12:42 +0200 [thread overview]
Message-ID: <ZAIOaiogeUhhNVfo@intel.com> (raw)
In-Reply-To: <20230302235356.3148279-12-robdclark@gmail.com>
On Thu, Mar 02, 2023 at 03:53:33PM -0800, Rob Clark wrote:
> From: Rob Clark <robdclark@chromium.org>
>
> For an atomic commit updating a single CRTC (ie. a pageflip) calculate
> the next vblank time, and inform the fence(s) of that deadline.
>
> v2: Comment typo fix (danvet)
>
> Signed-off-by: Rob Clark <robdclark@chromium.org>
> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> Signed-off-by: Rob Clark <robdclark@chromium.org>
> ---
> drivers/gpu/drm/drm_atomic_helper.c | 36 +++++++++++++++++++++++++++++
> 1 file changed, 36 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> index d579fd8f7cb8..d8ee98ce2fc5 100644
> --- a/drivers/gpu/drm/drm_atomic_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> @@ -1511,6 +1511,40 @@ void drm_atomic_helper_commit_modeset_enables(struct drm_device *dev,
> }
> EXPORT_SYMBOL(drm_atomic_helper_commit_modeset_enables);
>
> +/*
> + * For atomic updates which touch just a single CRTC, calculate the time of the
> + * next vblank, and inform all the fences of the deadline.
> + */
> +static void set_fence_deadline(struct drm_device *dev,
> + struct drm_atomic_state *state)
> +{
> + struct drm_crtc *crtc, *wait_crtc = NULL;
> + struct drm_crtc_state *new_crtc_state;
> + struct drm_plane *plane;
> + struct drm_plane_state *new_plane_state;
> + ktime_t vbltime;
> + int i;
> +
> + for_each_new_crtc_in_state (state, crtc, new_crtc_state, i) {
> + if (wait_crtc)
> + return;
> + wait_crtc = crtc;
> + }
> +
> + /* If no CRTCs updated, then nothing to do: */
> + if (!wait_crtc)
> + return;
Is there an actual point in limiting this to single crtc updates?
That immediately excludes tiled displays/etc.
Handling an arbitrary number of crtcs shouldn't really be a lot
more complicated should it?
> +
> + if (drm_crtc_next_vblank_start(wait_crtc, &vbltime))
> + return;
> +
> + for_each_new_plane_in_state (state, plane, new_plane_state, i) {
> + if (!new_plane_state->fence)
> + continue;
> + dma_fence_set_deadline(new_plane_state->fence, vbltime);
> + }
> +}
> +
> /**
> * drm_atomic_helper_wait_for_fences - wait for fences stashed in plane state
> * @dev: DRM device
> @@ -1540,6 +1574,8 @@ int drm_atomic_helper_wait_for_fences(struct drm_device *dev,
> struct drm_plane_state *new_plane_state;
> int i, ret;
>
> + set_fence_deadline(dev, state);
> +
> for_each_new_plane_in_state(state, plane, new_plane_state, i) {
> if (!new_plane_state->fence)
> continue;
> --
> 2.39.1
--
Ville Syrjälä
Intel
next prev parent reply other threads:[~2023-03-03 15:12 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-02 23:53 [PATCH v9 00/15] dma-fence: Deadline awareness Rob Clark
2023-03-02 23:53 ` [PATCH v9 01/15] dma-buf/dma-fence: Add deadline awareness Rob Clark
2023-03-02 23:53 ` [PATCH v9 02/15] dma-buf/fence-array: Add fence deadline support Rob Clark
2023-03-02 23:53 ` [PATCH v9 03/15] dma-buf/fence-chain: " Rob Clark
2023-03-02 23:53 ` [PATCH v9 04/15] dma-buf/dma-resv: Add a way to set fence deadline Rob Clark
2023-03-02 23:53 ` [PATCH v9 05/15] dma-buf/sync_file: Surface sync-file uABI Rob Clark
2023-03-02 23:53 ` [PATCH v9 06/15] dma-buf/sync_file: Add SET_DEADLINE ioctl Rob Clark
2023-03-02 23:53 ` [PATCH v9 07/15] dma-buf/sw_sync: Add fence deadline support Rob Clark
2023-03-02 23:53 ` [PATCH v9 08/15] drm/scheduler: " Rob Clark
2023-03-02 23:53 ` [PATCH v9 09/15] drm/syncobj: Add deadline support for syncobj waits Rob Clark
2023-03-02 23:53 ` [PATCH v9 10/15] drm/vblank: Add helper to get next vblank time Rob Clark
2023-03-02 23:53 ` [PATCH v9 11/15] drm/atomic-helper: Set fence deadline for vblank Rob Clark
2023-03-03 15:12 ` Ville Syrjälä [this message]
2023-03-03 15:45 ` Rob Clark
2023-03-03 15:52 ` Ville Syrjälä
2023-03-02 23:53 ` [PATCH v9 12/15] drm/msm: Add deadline based boost support Rob Clark
2023-03-03 10:10 ` Dmitry Baryshkov
2023-03-03 17:03 ` Rob Clark
2023-03-03 23:53 ` Dmitry Baryshkov
2023-03-02 23:53 ` [PATCH v9 13/15] drm/msm: Add wait-boost support Rob Clark
2023-03-03 10:04 ` Dmitry Baryshkov
2023-03-02 23:53 ` [PATCH v9 14/15] drm/msm/atomic: Switch to vblank_start helper Rob Clark
2023-03-03 10:04 ` Dmitry Baryshkov
2023-03-02 23:53 ` [PATCH v9 15/15] drm/i915: Add deadline based boost support Rob Clark
2023-03-03 3:21 ` Rodrigo Vivi
2023-03-03 9:58 ` Tvrtko Ursulin
2023-03-03 11:21 ` [Intel-gfx] " Andi Shyti
2023-03-03 14:48 ` Rob Clark
2023-03-03 15:00 ` Ville Syrjälä
2023-03-03 15:19 ` Ville Syrjälä
2023-03-03 15:43 ` Rob Clark
2023-03-03 15:07 ` Tvrtko Ursulin
2023-03-03 15:41 ` [Freedreno] " Rob Clark
2023-03-03 18:20 ` Matt Turner
2023-03-03 14:56 ` Rob Clark
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=ZAIOaiogeUhhNVfo@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=alexander.deucher@amd.com \
--cc=ckoenig.leichtzumerken@gmail.com \
--cc=daniel.vetter@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=freedreno@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luben.tuikov@amd.com \
--cc=michel@daenzer.net \
--cc=ppaalanen@gmail.com \
--cc=robdclark@chromium.org \
--cc=robdclark@gmail.com \
--cc=rodrigo.vivi@intel.com \
--cc=tvrtko.ursulin@intel.com \
--cc=tzimmermann@suse.de \
/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