From: Rob Clark <robdclark@chromium.org> To: "Michel Dänzer" <michel@daenzer.net> Cc: "Rob Clark" <robdclark@gmail.com>, "Matthew Brost" <matthew.brost@intel.com>, "Thomas Zimmermann" <tzimmermann@suse.de>, "David Airlie" <airlied@linux.ie>, "Christian König" <ckoenig.leichtzumerken@gmail.com>, "open list" <linux-kernel@vger.kernel.org>, dri-devel <dri-devel@lists.freedesktop.org> Subject: Re: [RFC 3/4] drm/atomic-helper: Set fence deadline for vblank Date: Tue, 27 Jul 2021 07:33:01 -0700 [thread overview] Message-ID: <CAJs_Fx6dmNcjAvAJASr-YOZSDPrPfb0iwxNTZwmn1AQXpQevYQ@mail.gmail.com> (raw) In-Reply-To: <db6cdec8-d44c-a09c-3fbd-60fb55c66efb@daenzer.net> On Tue, Jul 27, 2021 at 3:44 AM Michel Dänzer <michel@daenzer.net> wrote: > > On 2021-07-27 1:38 a.m., 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. > > > > 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 bc3487964fb5..f81b20775b15 100644 > > --- a/drivers/gpu/drm/drm_atomic_helper.c > > +++ b/drivers/gpu/drm/drm_atomic_helper.c > > @@ -1406,6 +1406,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 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; > > Either this return or the next one below would always be taken, I doubt this was intended. oops, the condition here is mistakenly inverted, it was meant to bail if there is more than a single CRTC > > > + wait_crtc = crtc; > > + } > > + > > + /* If no CRTCs updated, then nothing to do: */ > > + if (!wait_crtc) > > + return; > > + > > + if (drm_crtc_next_vblank_time(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); > > + } > > vblank timestamps correspond to the end of vertical blank, the deadline should be the start of vertical blank though. > hmm, I suppose this depends on whether the hw actually has separate irq's for frame-done and vblank (and whether the driver differentiates).. and if the display controller is doing some buffering, the point at which it wants to flip could be a bit earlier still. Maybe we just want a kms driver provided offset for how early it wants the deadline relative to vblank? BR, -R > > -- > Earthling Michel Dänzer | https://redhat.com > Libre software enthusiast | Mesa and X developer
WARNING: multiple messages have this Message-ID (diff)
From: Rob Clark <robdclark@chromium.org> To: "Michel Dänzer" <michel@daenzer.net> Cc: "Matthew Brost" <matthew.brost@intel.com>, "David Airlie" <airlied@linux.ie>, "Christian König" <ckoenig.leichtzumerken@gmail.com>, "open list" <linux-kernel@vger.kernel.org>, dri-devel <dri-devel@lists.freedesktop.org>, "Thomas Zimmermann" <tzimmermann@suse.de> Subject: Re: [RFC 3/4] drm/atomic-helper: Set fence deadline for vblank Date: Tue, 27 Jul 2021 07:33:01 -0700 [thread overview] Message-ID: <CAJs_Fx6dmNcjAvAJASr-YOZSDPrPfb0iwxNTZwmn1AQXpQevYQ@mail.gmail.com> (raw) In-Reply-To: <db6cdec8-d44c-a09c-3fbd-60fb55c66efb@daenzer.net> On Tue, Jul 27, 2021 at 3:44 AM Michel Dänzer <michel@daenzer.net> wrote: > > On 2021-07-27 1:38 a.m., 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. > > > > 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 bc3487964fb5..f81b20775b15 100644 > > --- a/drivers/gpu/drm/drm_atomic_helper.c > > +++ b/drivers/gpu/drm/drm_atomic_helper.c > > @@ -1406,6 +1406,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 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; > > Either this return or the next one below would always be taken, I doubt this was intended. oops, the condition here is mistakenly inverted, it was meant to bail if there is more than a single CRTC > > > + wait_crtc = crtc; > > + } > > + > > + /* If no CRTCs updated, then nothing to do: */ > > + if (!wait_crtc) > > + return; > > + > > + if (drm_crtc_next_vblank_time(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); > > + } > > vblank timestamps correspond to the end of vertical blank, the deadline should be the start of vertical blank though. > hmm, I suppose this depends on whether the hw actually has separate irq's for frame-done and vblank (and whether the driver differentiates).. and if the display controller is doing some buffering, the point at which it wants to flip could be a bit earlier still. Maybe we just want a kms driver provided offset for how early it wants the deadline relative to vblank? BR, -R > > -- > Earthling Michel Dänzer | https://redhat.com > Libre software enthusiast | Mesa and X developer
next prev parent reply other threads:[~2021-07-27 14:28 UTC|newest] Thread overview: 100+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-07-26 23:38 [RFC 0/4] dma-fence: Deadline awareness Rob Clark 2021-07-26 23:38 ` Rob Clark 2021-07-26 23:38 ` [RFC 1/4] dma-fence: Add deadline awareness Rob Clark 2021-07-26 23:38 ` Rob Clark 2021-07-27 7:11 ` Christian König 2021-07-27 7:11 ` Christian König 2021-07-27 14:25 ` Rob Clark 2021-07-27 14:25 ` Rob Clark 2021-07-28 7:03 ` Christian König 2021-07-28 7:03 ` Christian König 2021-07-28 11:37 ` Christian König 2021-07-28 11:37 ` Christian König 2021-07-28 15:15 ` Rob Clark 2021-07-28 15:15 ` Rob Clark 2021-07-28 17:23 ` Christian König 2021-07-28 17:23 ` Christian König 2021-07-28 17:58 ` Rob Clark 2021-07-28 17:58 ` Rob Clark 2021-07-29 7:03 ` Daniel Vetter 2021-07-29 7:03 ` Daniel Vetter 2021-07-29 15:23 ` Rob Clark 2021-07-29 15:23 ` Rob Clark 2021-07-29 16:18 ` Daniel Vetter 2021-07-29 16:18 ` Daniel Vetter 2021-07-29 17:32 ` Rob Clark 2021-07-29 17:32 ` Rob Clark 2021-07-26 23:38 ` [RFC 2/4] drm/vblank: Add helper to get next vblank time Rob Clark 2021-07-26 23:38 ` Rob Clark 2021-07-26 23:38 ` [RFC 3/4] drm/atomic-helper: Set fence deadline for vblank Rob Clark 2021-07-26 23:38 ` Rob Clark 2021-07-27 10:44 ` Michel Dänzer 2021-07-27 10:44 ` Michel Dänzer 2021-07-27 14:33 ` Rob Clark [this message] 2021-07-27 14:33 ` Rob Clark 2021-07-26 23:38 ` [RFC 4/4] drm/scheduler: Add fence deadline support Rob Clark 2021-07-26 23:38 ` Rob Clark 2021-07-26 23:51 ` [RFC 0/4] dma-fence: Deadline awareness Rob Clark 2021-07-26 23:51 ` Rob Clark 2021-07-27 14:41 ` Michel Dänzer 2021-07-27 14:41 ` Michel Dänzer 2021-07-27 15:12 ` Rob Clark 2021-07-27 15:12 ` Rob Clark 2021-07-27 15:19 ` Michel Dänzer 2021-07-27 15:37 ` Rob Clark 2021-07-27 15:37 ` Rob Clark 2021-07-28 11:36 ` Christian König 2021-07-28 11:36 ` Christian König 2021-07-28 13:08 ` Michel Dänzer 2021-07-28 13:13 ` Christian König 2021-07-28 13:13 ` Christian König 2021-07-28 13:24 ` Michel Dänzer 2021-07-28 13:24 ` Michel Dänzer 2021-07-28 13:31 ` Christian König 2021-07-28 13:31 ` Christian König 2021-07-28 13:57 ` Pekka Paalanen 2021-07-28 13:57 ` Pekka Paalanen 2021-07-28 14:30 ` Christian König 2021-07-28 14:30 ` Christian König 2021-07-29 8:08 ` Michel Dänzer 2021-07-29 8:23 ` Pekka Paalanen 2021-07-29 8:23 ` Pekka Paalanen 2021-07-29 8:43 ` Christian König 2021-07-29 8:43 ` Christian König 2021-07-29 9:15 ` Pekka Paalanen 2021-07-29 9:15 ` Pekka Paalanen 2021-07-29 10:14 ` Christian König 2021-07-29 10:14 ` Christian König 2021-07-29 10:28 ` Michel Dänzer 2021-07-29 10:28 ` Michel Dänzer 2021-07-29 11:00 ` Pekka Paalanen 2021-07-29 11:00 ` Pekka Paalanen 2021-07-29 11:43 ` Christian König 2021-07-29 11:43 ` Christian König 2021-07-29 12:49 ` Pekka Paalanen 2021-07-29 12:49 ` Pekka Paalanen 2021-07-29 13:41 ` Christian König 2021-07-29 13:41 ` Christian König 2021-07-29 14:10 ` Pekka Paalanen 2021-07-29 14:10 ` Pekka Paalanen 2021-07-28 15:27 ` Rob Clark 2021-07-28 15:27 ` Rob Clark 2021-07-28 17:20 ` Christian König 2021-07-28 15:34 ` Rob Clark 2021-07-28 15:34 ` Rob Clark 2021-07-29 7:09 ` Daniel Vetter 2021-07-29 7:09 ` Daniel Vetter 2021-07-29 8:17 ` Michel Dänzer 2021-07-29 8:17 ` Michel Dänzer 2021-07-29 9:03 ` Daniel Vetter 2021-07-29 9:03 ` Daniel Vetter 2021-07-29 9:37 ` Pekka Paalanen 2021-07-29 9:37 ` Pekka Paalanen 2021-07-29 12:18 ` Daniel Vetter 2021-07-29 12:18 ` Daniel Vetter 2021-07-29 12:59 ` Pekka Paalanen 2021-07-29 12:59 ` Pekka Paalanen 2021-07-29 14:05 ` Daniel Vetter 2021-07-29 14:05 ` Daniel Vetter 2021-07-27 21:17 ` [RFC 5/4] drm/msm: Add deadline based boost support Rob Clark 2021-07-27 21:17 ` 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=CAJs_Fx6dmNcjAvAJASr-YOZSDPrPfb0iwxNTZwmn1AQXpQevYQ@mail.gmail.com \ --to=robdclark@chromium.org \ --cc=airlied@linux.ie \ --cc=ckoenig.leichtzumerken@gmail.com \ --cc=dri-devel@lists.freedesktop.org \ --cc=linux-kernel@vger.kernel.org \ --cc=matthew.brost@intel.com \ --cc=michel@daenzer.net \ --cc=robdclark@gmail.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: linkBe 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.