summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/drm_timeout.c
AgeCommit message (Collapse)Author
2026-09-30drm: Add drm_timeout_rel_to_jiffies()Maíra Canal
drm_timeout_abs_to_jiffies() covers the drivers whose wait UAPI takes an absolute deadline, but there is no equivalent for the drivers that express a wait as a duration. Drivers such as i915 and v3d convert the value themselves. Converting a nanosecond duration to jiffies needs some care. nsecs_to_jiffies() returns unsigned long, so on 32-bit a large userspace-supplied timeout overflows its range and is silently truncated. i915 already handles both cases in a local helper, which v3d has a copy of. Add the same conversion to the core, so that it is available to any driver and both copies can be dropped. Differently from drm_timeout_abs_to_jiffies(), the new function enforces that a timeout in jiffies is a positive value and therefore, returns an unsigned value. Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Christian König <christian.koenig@amd.com> Link: https://patch.msgid.link/20260915-drm-timeout-helpers-v3-2-f2ae987d861f@igalia.com Signed-off-by: Maíra Canal <mcanal@igalia.com>
2026-09-30drm: Move drm_timeout_abs_to_jiffies() to drm_timeout.cMaíra Canal
drm_timeout_abs_to_jiffies() began as a static helper inside the syncobj wait implementation and was later exported in place, so that it could be called by multiple drivers (e.g. panfrost, lima, tegra and accel drivers). All of them reach it through drm_utils.h. Give it a file of its own, so that timeout conversion helpers have a home, which will be useful when we add new timeout handlers. Also create a drm_timeout.h header to host all timeout-related helpers. The function was moved to the new file as it is, including the use of "signed long" as the return type. Note that the return and parameters types should be reconsidered in the future to better represent the non-negative nature of a timeout. No functional change. Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com> Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Christian König <christian.koenig@amd.com> Link: https://patch.msgid.link/20260915-drm-timeout-helpers-v3-1-f2ae987d861f@igalia.com Signed-off-by: Maíra Canal <mcanal@igalia.com>