From 84f18f31ad7b38c8a6ef71a4a96689595217efb3 Mon Sep 17 00:00:00 2001 From: Arunpravin Paneer Selvam Date: Sat, 12 Apr 2025 12:28:11 +0530 Subject: [PATCH] amdgpu: Add queue id support to the user queue wait IOCTL MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add queue id support to the user queue wait IOCTL drm_amdgpu_userq_wait structure. This is required to retrieve the wait user queue and maintain the fence driver references in it so that the user queue in the same context releases their reference to the fence drivers at some point before queue destruction. Otherwise, we would gather those references until we don't have any more space left and crash. Signed-off-by: Arunpravin Paneer Selvam Suggested-by: Christian König Reviewed-by: Marek Olšák Part-of: --- include/drm-uapi/amdgpu_drm.h | 6 ++++++ src/gallium/winsys/amdgpu/drm/amdgpu_cs.cpp | 1 + 2 files changed, 7 insertions(+) diff --git a/include/drm-uapi/amdgpu_drm.h b/include/drm-uapi/amdgpu_drm.h index 7584c73889d..5a48b0acc4d 100644 --- a/include/drm-uapi/amdgpu_drm.h +++ b/include/drm-uapi/amdgpu_drm.h @@ -502,6 +502,12 @@ struct drm_amdgpu_userq_fence_info { }; struct drm_amdgpu_userq_wait { + /** + * @waitq_id: Queue handle used by the userq wait IOCTL to retrieve the + * wait queue and maintain the fence driver references in it. + */ + __u32 waitq_id; + __u32 pad; /** * @syncobj_handles: The list of syncobj handles submitted by the user queue * job to get the va/value pairs. diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.cpp b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.cpp index fe559836961..6b4f2b38489 100644 --- a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.cpp +++ b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.cpp @@ -1495,6 +1495,7 @@ static int amdgpu_cs_submit_ib_userq(struct amdgpu_userq *userq, struct drm_amdgpu_userq_fence_info *fence_info; struct drm_amdgpu_userq_wait userq_wait_data = { + .waitq_id = userq->userq_handle, .syncobj_handles = (uintptr_t)syncobj_dependencies_list, .syncobj_timeline_handles = (uintptr_t)&syncobj_timeline_dependency, .syncobj_timeline_points = (uintptr_t)&syncobj_timeline_dependency_point,