From: Jani Nikula <jani.nikula@intel.com>
To: Thomas Zimmermann <tzimmermann@suse.de>, dri-devel@lists.freedesktop.org
Cc: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org,
ville.syrjala@linux.intel.com
Subject: Re: [PATCH 2/6] drm/atomic: use drm_crtc_vblank_waitqueue()
Date: Mon, 10 Nov 2025 14:51:36 +0200 [thread overview]
Message-ID: <a605efb1745f0d2c96ff986fed7bdeeb6226b7ad@intel.com> (raw)
In-Reply-To: <29b1cc39-7868-4b15-bac6-7dc97869dbdb@suse.de>
On Mon, 10 Nov 2025, Thomas Zimmermann <tzimmermann@suse.de> wrote:
> Hi
>
> Am 07.11.25 um 12:04 schrieb Jani Nikula:
>> We have drm_crtc_vblank_waitqueue() to get the wait_queue_head_t pointer
>> for a vblank. Use it instead of poking at dev->vblank[] directly.
>>
>> Due to the macro maze of wait_event_timeout() that uses the address-of
>> operator on the argument, we have to pass it in with the indirection
>> operator.
>>
>> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
>
> Reviewed-by Thomas Zimmermann <tzimmermann@suse.de>
>
> But... drm_crtc_vblank_waitqueue() is a terrible interface IMHO, as it
> exports internal details of the vblank implementation.
>
> I wonder if the existing users at [1] and [2] couldn't be replaced with
> a common vblank helper.
>
> And there's drm_wait_one_vblank() [3] and the waiting that's being fixed
> here [4]. The latter looks like [3] but with multiple CRTC waiting for
> their next vblank. I'd say this could be a single implementation within
> the vblank code.
I don't disagree, but getting that done is a bit more involved than what
I have time for right now. Need to think.
In the mean time, pushed the drm_crtc_vblank_crtc() related patches in
the series, and left the drm_crtc_vblank_waitqueue() ones to simmer.
Thanks for the reviews.
BR,
Jani.
>
> [1]
> https://elixir.bootlin.com/linux/v6.18-rc4/source/drivers/gpu/drm/i915/display/intel_display_rps.c#L73
> [2]
> https://elixir.bootlin.com/linux/v6.18-rc4/source/drivers/gpu/drm/i915/display/intel_vblank.c#L715
> [3]
> https://elixir.bootlin.com/linux/v6.18-rc4/source/drivers/gpu/drm/drm_vblank.c#L1304
> [4]
> https://elixir.bootlin.com/linux/v6.18-rc4/source/drivers/gpu/drm/drm_atomic_helper.c#L1837
>
> Best regards
> Thomas
>
>> ---
>> drivers/gpu/drm/drm_atomic_helper.c | 4 +++-
>> 1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
>> index 5a473a274ff0..e641fcf8c568 100644
>> --- a/drivers/gpu/drm/drm_atomic_helper.c
>> +++ b/drivers/gpu/drm/drm_atomic_helper.c
>> @@ -1831,10 +1831,12 @@ drm_atomic_helper_wait_for_vblanks(struct drm_device *dev,
>> }
>>
>> for_each_old_crtc_in_state(state, crtc, old_crtc_state, i) {
>> + wait_queue_head_t *queue = drm_crtc_vblank_waitqueue(crtc);
>> +
>> if (!(crtc_mask & drm_crtc_mask(crtc)))
>> continue;
>>
>> - ret = wait_event_timeout(dev->vblank[i].queue,
>> + ret = wait_event_timeout(*queue,
>> state->crtcs[i].last_vblank_count !=
>> drm_crtc_vblank_count(crtc),
>> msecs_to_jiffies(100));
--
Jani Nikula, Intel
next prev parent reply other threads:[~2025-11-10 12:51 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-07 11:04 [PATCH 0/6] drm: avoid poking at dev->vblank[] directly Jani Nikula
2025-11-07 11:04 ` [PATCH 1/6] drm/vblank: use drm_crtc_vblank_crtc() in workers Jani Nikula
2025-11-10 9:44 ` Thomas Zimmermann
2025-11-07 11:04 ` [PATCH 2/6] drm/atomic: use drm_crtc_vblank_waitqueue() Jani Nikula
2025-11-10 9:57 ` Thomas Zimmermann
2025-11-10 12:51 ` Jani Nikula [this message]
2025-11-10 13:18 ` Thomas Zimmermann
2025-11-10 13:42 ` Jani Nikula
2025-11-07 11:04 ` [PATCH 3/6] drm/msm: " Jani Nikula
2025-11-08 17:00 ` Dmitry Baryshkov
2025-11-07 11:04 ` [PATCH 4/6] drm/tidss: use drm_crtc_vblank_crtc() Jani Nikula
2025-11-08 15:54 ` Jyri Sarha
2025-11-07 11:04 ` [PATCH 5/6] drm/vmwgfx: " Jani Nikula
2025-11-07 16:21 ` Ian Forbes
2025-11-07 11:05 ` [PATCH 6/6] drm/gma500: " Jani Nikula
2025-11-07 13:11 ` Patrik Jakobsson
2026-01-30 12:44 ` Thomas Zimmermann
2026-01-30 15:24 ` Jani Nikula
2025-11-07 12:34 ` ✓ i915.CI.BAT: success for drm: avoid poking at dev->vblank[] directly Patchwork
2025-11-08 3:40 ` ✗ i915.CI.Full: failure " Patchwork
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=a605efb1745f0d2c96ff986fed7bdeeb6226b7ad@intel.com \
--to=jani.nikula@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=tzimmermann@suse.de \
--cc=ville.syrjala@linux.intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox