Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/6] drm: Consolidate the wait timeout conversion helpers
@ 2026-08-17 21:05 Maíra Canal
  2026-08-17 21:05 ` [PATCH v2 1/6] drm: Move drm_timeout_abs_to_jiffies() to drm_timeout.c Maíra Canal
                   ` (7 more replies)
  0 siblings, 8 replies; 14+ messages in thread
From: Maíra Canal @ 2026-08-17 21:05 UTC (permalink / raw)
  To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter, Alex Deucher, Christian König, Melissa Wen,
	Iago Toral, Jani Nikula, Joonas Lahtinen, Rodrigo Vivi,
	Tvrtko Ursulin, Dave Stevenson, Raspberry Pi Kernel Maintenance
  Cc: kernel-dev, dri-devel, amd-gfx, intel-gfx, Maíra Canal

DRM wait ioctls express their timeout in one of two ways: as an absolute
deadline in ns, or as a duration in ns. The core has a helper for the first
form, drm_timeout_abs_to_jiffies(), which panfrost, lima, tegra, xe and
some accel drivers use. However, there is no equivalent for the second
form, so the drivers that take a duration convert it themselves.

For example, i915 has a local helper to handle the relative timeout case,
and v3d carries a copy of it. This series moves that conversion into a DRM
helper called drm_timeout_rel_to_jiffies(), next to the absolute variant,
and converts the drivers that were open-coding either form.

This series becomes particularly relevant as the new helper will be used
in the next version of the series "drm/vc4: Switch to DRM GPU scheduler"
[1]. With this series, we avoid another duplication of the
nsecs_to_jiffies_timeout() function (and thanks Tvrtko for the suggestion).

PATCH 1 moves drm_timeout_abs_to_jiffies() out of drm_syncobj.c and into a
file of its own, so that both helpers live together. PATCH 2 adds a helper
for the relative variant. Patches 3 to 6 convert amdgpu, v3d, i915 and vc4.

Let me know your thoughts about it.

[1] https://lore.kernel.org/dri-devel/20260712-vc4-drm-scheduler-v3-0-ed6dc4defa53@igalia.com/T/

Best regards,
- Maíra

---
v1 -> v2: https://lore.kernel.org/r/20260809-drm-timeout-helpers-v1-0-2de67405a145@igalia.com

- [2/6] Add comment discouraging the use of relative timeouts in uAPIs
        (Christian König)
- [3/6] Make it more explicit that any timeout that doesn't fit in a s64
        is mapped into an infinite wait (Christian König)

---
Maíra Canal (6):
      drm: Move drm_timeout_abs_to_jiffies() to drm_timeout.c
      drm: Add drm_timeout_rel_to_jiffies()
      drm/amdgpu: Use drm_timeout_abs_to_jiffies()
      drm/v3d: Use drm_timeout_rel_to_jiffies()
      drm/i915: Use drm_timeout_rel_to_jiffies()
      drm/vc4: Use drm_timeout_rel_to_jiffies()

 drivers/gpu/drm/Makefile                 |  1 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c  | 20 ++------
 drivers/gpu/drm/drm_syncobj.c            | 33 -------------
 drivers/gpu/drm/drm_timeout.c            | 81 ++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/gem/i915_gem_wait.c | 17 ++-----
 drivers/gpu/drm/v3d/v3d_bo.c             |  3 +-
 drivers/gpu/drm/v3d/v3d_drv.h            | 10 ----
 drivers/gpu/drm/vc4/vc4_gem.c            |  3 +-
 include/drm/drm_utils.h                  |  1 +
 9 files changed, 94 insertions(+), 75 deletions(-)
---
base-commit: 5d2584e2ffaabf2d420edcb2d120209e151f8dce
change-id: 20260809-drm-timeout-helpers-55473e4879d1


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2026-08-20  6:54 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-17 21:05 [PATCH v2 0/6] drm: Consolidate the wait timeout conversion helpers Maíra Canal
2026-08-17 21:05 ` [PATCH v2 1/6] drm: Move drm_timeout_abs_to_jiffies() to drm_timeout.c Maíra Canal
2026-08-20  6:37   ` Thomas Zimmermann
2026-08-20  6:50   ` Thomas Zimmermann
2026-08-17 21:05 ` [PATCH v2 2/6] drm: Add drm_timeout_rel_to_jiffies() Maíra Canal
2026-08-17 21:15   ` sashiko-bot
2026-08-20  6:54   ` Thomas Zimmermann
2026-08-17 21:05 ` [PATCH v2 3/6] drm/amdgpu: Use drm_timeout_abs_to_jiffies() Maíra Canal
2026-08-17 21:05 ` [PATCH v2 4/6] drm/v3d: Use drm_timeout_rel_to_jiffies() Maíra Canal
2026-08-17 21:05 ` [PATCH v2 5/6] drm/i915: " Maíra Canal
2026-08-17 21:05 ` [PATCH v2 6/6] drm/vc4: " Maíra Canal
2026-08-17 21:15   ` sashiko-bot
2026-08-17 21:55 ` ✓ i915.CI.BAT: success for drm: Consolidate the wait timeout conversion helpers (rev2) Patchwork
2026-08-18 11:43 ` ✓ i915.CI.Full: " Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox