drm: add support of syncobj timeline point wait v5
Subsystems (3)
PATCH 1/5 drm: add support of syncobj timeline point wait v5
points array is one-to-one match with syncobjs array. v2:
add seperate ioctl for timeline point wait, otherwise break uapi. v3:
userspace can specify two kinds waits::
a. Wait for time point to be completed.
b. and wait for time point to become available
v4:
rebase
v5:
add comment for xxx_WAIT_AVAILABLE
--- drivers/gpu/drm/drm_internal.h | 2 + drivers/gpu/drm/drm_ioctl.c | 2 + drivers/gpu/drm/drm_syncobj.c | 115 ++++++++++++++++++++++++++++----- include/uapi/drm/drm.h | 18 ++++++ 4 files changed, 121 insertions(+), 16 deletions(-)
drivers/gpu/drm/drm_internal.h +2 -0
@@ -183,6 +183,8 @@ int drm_syncobj_fd_to_handle_ioctl(struct drm_device *dev, void *data, struct drm_file *file_private);int drm_syncobj_wait_ioctl (struct drm_device *dev,void *data,struct drm_file *file_private); +int drm_syncobj_timeline_wait_ioctl (struct drm_device *dev,void *data, +struct drm_file *file_private);int drm_syncobj_reset_ioctl (struct drm_device *dev,void *data,struct drm_file *file_private); int drm_syncobj_signal_ioctl(struct drm_device *dev, void *data,
drivers/gpu/drm/drm_ioctl.c +2 -0
@@ -675,6 +675,8 @@ static const struct drm_ioctl_desc drm_ioctls[] = { DRM_UNLOCKED|DRM_RENDER_ALLOW),DRM_IOCTL_DEF (DRM_IOCTL_SYNCOBJ_WAIT , drm_syncobj_wait_ioctl,DRM_UNLOCKED |DRM_RENDER_ALLOW ), +DRM_IOCTL_DEF (DRM_IOCTL_SYNCOBJ_TIMELINE_WAIT , drm_syncobj_timeline_wait_ioctl, +DRM_UNLOCKED |DRM_RENDER_ALLOW ),DRM_IOCTL_DEF (DRM_IOCTL_SYNCOBJ_RESET , drm_syncobj_reset_ioctl,DRM_UNLOCKED |DRM_RENDER_ALLOW ), DRM_IOCTL_DEF(DRM_IOCTL_SYNCOBJ_SIGNAL, drm_syncobj_signal_ioctl,
drivers/gpu/drm/drm_syncobj.c +99 -16
191 lines not on this page · raw message
include/uapi/drm/drm.h +18 -0
@@ -738,6 +738,10 @@ struct drm_syncobj_handle {#define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_ALL (1 << 0)#define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT (1 << 1) +/* wait for time point to be completed */ +#define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_COMPLETED (1 << 2) +/* wait for time point to become available */ +#define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_AVAILABLE (1 << 3)struct drm_syncobj_wait {__u64 handles;/* absolute timeout */
@@ -748,6 +752,19 @@ struct drm_syncobj_wait {__u32 pad; }; +struct drm_syncobj_timeline_wait { +__u64 handles; +/* wait on specific timeline point for every handles*/ +__u64 points; +/* absolute timeout */ +__s64 timeout_nsec; +__u32 count_handles; +__u32 flags; +__u32 first_signaled;/* only valid when not waiting all */ +__u32 pad; +}; + +struct drm_syncobj_array {__u64 handles;__u32 count_handles;
@@ -910,6 +927,7 @@ extern "C" {#define DRM_IOCTL_MODE_GET_LEASE DRM_IOWR(0xC8, struct drm_mode_get_lease)#define DRM_IOCTL_MODE_REVOKE_LEASE DRM_IOWR(0xC9, struct drm_mode_revoke_lease) +#define DRM_IOCTL_SYNCOBJ_TIMELINE_WAIT DRM_IOWR(0xCA, struct drm_syncobj_timeline_wait)/** * Device specific ioctls should only be in their respective headers * The device specific ioctl range is from 0x40 to 0x9f.
Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 2/5 drm: add timeline syncobj payload query ioctl v3
user mode can query timeline payload.
v2: check return value of copy_to_user
v3: handle querying entry by entry
--- drivers/gpu/drm/drm_internal.h | 2 ++ drivers/gpu/drm/drm_ioctl.c | 2 ++ drivers/gpu/drm/drm_syncobj.c | 51 ++++++++++++++++++++++++++++++++++ include/uapi/drm/drm.h | 11 ++++++++ 4 files changed, 66 insertions(+)
drivers/gpu/drm/drm_internal.h +2 -0
@@ -189,6 +189,8 @@ int drm_syncobj_reset_ioctl(struct drm_device *dev, void *data, struct drm_file *file_private);int drm_syncobj_signal_ioctl (struct drm_device *dev,void *data,struct drm_file *file_private); +int drm_syncobj_query_ioctl (struct drm_device *dev,void *data, +struct drm_file *file_private);/* drm_framebuffer.c */ void drm_framebuffer_print_info(struct drm_printer *p, unsigned int indent,
drivers/gpu/drm/drm_ioctl.c +2 -0
@@ -681,6 +681,8 @@ static const struct drm_ioctl_desc drm_ioctls[] = { DRM_UNLOCKED|DRM_RENDER_ALLOW),DRM_IOCTL_DEF (DRM_IOCTL_SYNCOBJ_SIGNAL , drm_syncobj_signal_ioctl,DRM_UNLOCKED |DRM_RENDER_ALLOW ), +DRM_IOCTL_DEF (DRM_IOCTL_SYNCOBJ_QUERY , drm_syncobj_query_ioctl, +DRM_UNLOCKED |DRM_RENDER_ALLOW ),DRM_IOCTL_DEF (DRM_IOCTL_CRTC_GET_SEQUENCE , drm_crtc_get_sequence_ioctl,DRM_UNLOCKED ),DRM_IOCTL_DEF (DRM_IOCTL_CRTC_QUEUE_SEQUENCE , drm_crtc_queue_sequence_ioctl,DRM_UNLOCKED ), DRM_IOCTL_DEF(DRM_IOCTL_MODE_CREATE_LEASE, drm_mode_create_lease_ioctl, DRM_MASTER|DRM_UNLOCKED),
drivers/gpu/drm/drm_syncobj.c +51 -0
54 lines not on this page · raw message
include/uapi/drm/drm.h +11 -0
@@ -771,6 +771,15 @@ struct drm_syncobj_array {__u32 pad; }; +struct drm_syncobj_timeline_query { +__u64 handles; +/* points are timeline syncobjs payloads returned by query ioctl */ +__u64 points; +__u32 count_handles; +__u32 pad; +}; + +/* Query current scanout sequence number */ struct drm_crtc_get_sequence {__u32 crtc_id;/* requested crtc_id */
@@ -928,6 +937,8 @@ extern "C" {#define DRM_IOCTL_MODE_REVOKE_LEASE DRM_IOWR(0xC9, struct drm_mode_revoke_lease)#define DRM_IOCTL_SYNCOBJ_TIMELINE_WAIT DRM_IOWR(0xCA, struct drm_syncobj_timeline_wait) +#define DRM_IOCTL_SYNCOBJ_QUERY DRM_IOWR(0xCB, struct drm_syncobj_timeline_query) +/** * Device specific ioctls should only be in their respective headers * The device specific ioctl range is from 0x40 to 0x9f.
Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 3/5 drm: add timeline support for syncobj export/import
In reply to Chunming Zhouuser space can specify timeline point fence to export/import.
--- drivers/gpu/drm/drm_internal.h | 4 ++ drivers/gpu/drm/drm_ioctl.c | 4 ++ drivers/gpu/drm/drm_syncobj.c | 76 ++++++++++++++++++++++++++++++---- include/uapi/drm/drm.h | 11 +++++ 4 files changed, 88 insertions(+), 7 deletions(-)
drivers/gpu/drm/drm_internal.h +4 -0
@@ -181,6 +181,10 @@ int drm_syncobj_handle_to_fd_ioctl(struct drm_device *dev, void *data, struct drm_file *file_private);int drm_syncobj_fd_to_handle_ioctl (struct drm_device *dev,void *data,struct drm_file *file_private); +int drm_syncobj_handle_to_fd_ioctl2 (struct drm_device *dev,void *data, +struct drm_file *file_private); +int drm_syncobj_fd_to_handle_ioctl2 (struct drm_device *dev,void *data, +struct drm_file *file_private);int drm_syncobj_wait_ioctl (struct drm_device *dev,void *data,struct drm_file *file_private); int drm_syncobj_timeline_wait_ioctl(struct drm_device *dev, void *data,
drivers/gpu/drm/drm_ioctl.c +4 -0
@@ -673,6 +673,10 @@ static const struct drm_ioctl_desc drm_ioctls[] = { DRM_UNLOCKED|DRM_RENDER_ALLOW),DRM_IOCTL_DEF (DRM_IOCTL_SYNCOBJ_FD_TO_HANDLE , drm_syncobj_fd_to_handle_ioctl,DRM_UNLOCKED |DRM_RENDER_ALLOW ), +DRM_IOCTL_DEF (DRM_IOCTL_SYNCOBJ_HANDLE_TO_FD2 , drm_syncobj_handle_to_fd_ioctl2, +DRM_UNLOCKED |DRM_RENDER_ALLOW ), +DRM_IOCTL_DEF (DRM_IOCTL_SYNCOBJ_FD_TO_HANDLE2 , drm_syncobj_fd_to_handle_ioctl2, +DRM_UNLOCKED |DRM_RENDER_ALLOW ),DRM_IOCTL_DEF (DRM_IOCTL_SYNCOBJ_WAIT , drm_syncobj_wait_ioctl,DRM_UNLOCKED |DRM_RENDER_ALLOW ), DRM_IOCTL_DEF(DRM_IOCTL_SYNCOBJ_TIMELINE_WAIT, drm_syncobj_timeline_wait_ioctl,
drivers/gpu/drm/drm_syncobj.c +69 -7
121 lines not on this page · raw message
include/uapi/drm/drm.h +11 -0
@@ -735,6 +735,15 @@ struct drm_syncobj_handle {__s32 fd;__u32 pad; }; +struct drm_syncobj_handle2 { +__u32 handle; +__u32 flags; +__u64 point; + +__s32 fd; +__u32 pad; +}; +#define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_ALL (1 << 0)#define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT (1 << 1)
@@ -938,6 +947,8 @@ extern "C" {#define DRM_IOCTL_SYNCOBJ_TIMELINE_WAIT DRM_IOWR(0xCA, struct drm_syncobj_timeline_wait)#define DRM_IOCTL_SYNCOBJ_QUERY DRM_IOWR(0xCB, struct drm_syncobj_timeline_query) +#define DRM_IOCTL_SYNCOBJ_HANDLE_TO_FD2 DRM_IOWR(0xCC, struct drm_syncobj_handle2) +#define DRM_IOCTL_SYNCOBJ_FD_TO_HANDLE2 DRM_IOWR(0xCD, struct drm_syncobj_handle2)/** * Device specific ioctls should only be in their respective headers
Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 4/5 drm/amdgpu: add timeline support in amdgpu CS v2
In reply to Chunming Zhousyncobj wait/signal operation is appending in command submission.
v2: separate to two kinds in/out_deps functions
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 8 +- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 111 +++++++++++++++++++++---- include/uapi/drm/amdgpu_drm.h | 9 ++ 3 files changed, 112 insertions(+), 16 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +6 -2
@@ -543,6 +543,11 @@ struct amdgpu_cs_chunk {void *kdata; }; +struct amdgpu_cs_syncobj_post_dep { +struct drm_syncobj *post_dep_syncobj; +u64 point; +}; +struct amdgpu_cs_parser {struct amdgpu_device *adev;struct drm_file *filp;
@@ -571,9 +576,8 @@ struct amdgpu_cs_parser {/* user fence */ struct amdgpu_bo_list_entry uf_entry; - +struct amdgpu_cs_syncobj_post_dep *post_dep_syncobjs;unsigned num_post_dep_syncobjs; -struct drm_syncobj **post_dep_syncobjs; }; static inline u32 amdgpu_get_ib_value(struct amdgpu_cs_parser *p,
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +97 -14
194 lines not on this page · raw message
include/uapi/drm/amdgpu_drm.h +9 -0
@@ -517,6 +517,8 @@ struct drm_amdgpu_gem_va {#define AMDGPU_CHUNK_ID_SYNCOBJ_IN 0x04#define AMDGPU_CHUNK_ID_SYNCOBJ_OUT 0x05#define AMDGPU_CHUNK_ID_BO_HANDLES 0x06 +#define AMDGPU_CHUNK_ID_SYNCOBJ_TIMELINE_WAIT 0x07 +#define AMDGPU_CHUNK_ID_SYNCOBJ_TIMELINE_SIGNAL 0x08struct drm_amdgpu_cs_chunk {__u32 chunk_id;
@@ -592,6 +594,13 @@ struct drm_amdgpu_cs_chunk_sem {__u32 handle; }; +struct drm_amdgpu_cs_chunk_syncobj { +__u32 handle; +__u32 flags; +__u64 point; +}; + +#define AMDGPU_FENCE_TO_HANDLE_GET_SYNCOBJ 0#define AMDGPU_FENCE_TO_HANDLE_GET_SYNCOBJ_FD 1#define AMDGPU_FENCE_TO_HANDLE_GET_SYNC_FILE_FD 2
Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 5/5 drm/amdgpu: update version for timeline syncobj support in amdgpu
In reply to Chunming Zhou--- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +2 -1
@@ -71,9 +71,10 @@* - 3.25.0 - Add support for sensor query info (stable pstate sclk/mclk). * - 3.26.0 - GFX9: Process AMDGPU_IB_FLAG_TC_WB_NOT_INVALIDATE. * - 3.27.0 - Add new chunk to to AMDGPU_CS to enable BO_LIST creation. +* - 3.28.0 - Add syncobj timeline support to AMDGPU_CS. */ #define KMS_DRIVER_MAJOR 3 -#define KMS_DRIVER_MINOR 27 +#define KMS_DRIVER_MINOR 28#define KMS_DRIVER_PATCHLEVEL 0int amdgpu_vram_limit =0 ;
Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel