This series adds a WAIT_EVENT interface for AMDGPU render-node clients. WAIT_EVENT lets userspace wait for GPU events and receive information about those events. EVENTFD provides notifications, while WAIT_EVENT provides the event details.
This series follows the same approach used by the EVENTFD series. - queue_id is treated as a userspace handle. - queue_id is used only at the ioctl boundary and in metadata returned to userspace. - Internally, queue-scoped events use queue pointers instead of queue_id for matching. - Pending WAIT_EVENT records keep queue references while they are queued. - USERQ continues to own the queue lifetime. - WAIT_EVENT records are removed before USERQ destroys a queue. - The WAIT_EVENT manager is tied to drm_file so that pending records are cleaned up and blocked waiters are woken before file-private data is - destroyed. For reference, the EVENTFD series that follows the same design can be found here: https://patchwork.freedesktop.org/series/164618/#rev7 This series only adds the core WAIT_EVENT infrastructure. Event producers will be added in follow-up patches so that the review can stay focused on the basic WAIT_EVENT design and lifetime handling. Testing: Compilation tested Srinivasan Shanmugam (4): drm/amdgpu/uapi: Add WAIT_EVENT ioctl and metadata structures drm/amdgpu: Add wait-event manager and per-file lifetime plumbing drm/amdgpu: Register WAIT_EVENT ioctl drm/amdgpu: Remove queue-scoped WAIT_EVENT records on queue teardown drivers/gpu/drm/amd/amdgpu/Makefile | 3 +- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 5 +- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 5 +- drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c | 21 ++ drivers/gpu/drm/amd/amdgpu/amdgpu_userq.h | 2 + .../gpu/drm/amd/amdgpu/amdgpu_wait_event.c | 286 ++++++++++++++++++ .../gpu/drm/amd/amdgpu/amdgpu_wait_event.h | 74 +++++ include/uapi/drm/amdgpu_drm.h | 103 +++++++ 9 files changed, 497 insertions(+), 3 deletions(-) create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_wait_event.c create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_wait_event.h -- 2.34.1
