diff mbox series

[libdrm] libdrm: wrap new flexible syncobj query interface v2

Message ID 20190725081111.21568-1-david1.zhou@amd.com (mailing list archive)
State New, archived
Headers show
Series [libdrm] libdrm: wrap new flexible syncobj query interface v2 | expand

Commit Message

Chunming Zhou July 25, 2019, 8:11 a.m. UTC
v2: nit-picks fix

Signed-off-by: Chunming Zhou <david1.zhou@amd.com>
Cc: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Cc: Christian König <Christian.Koenig@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
For the xf86drm.[ch] part : Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
---
 amdgpu/amdgpu-symbol-check |  1 +
 amdgpu/amdgpu.h            | 18 ++++++++++++++++++
 amdgpu/amdgpu_cs.c         | 10 ++++++++++
 include/drm/drm.h          |  3 ++-
 xf86drm.c                  | 15 +++++++++++++++
 xf86drm.h                  |  2 ++
 6 files changed, 48 insertions(+), 1 deletion(-)

Comments

Chunming Zhou July 25, 2019, 8:26 a.m. UTC | #1
Thank guys. Since I have write permission to libdrm mast, I need your 
help to push patch.

-David


On 2019年07月25日 16:11, Chunming Zhou wrote:
> v2: nit-picks fix
>
> Signed-off-by: Chunming Zhou <david1.zhou@amd.com>
> Cc: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
> Cc: Christian König <Christian.Koenig@amd.com>
> Reviewed-by: Christian König <christian.koenig@amd.com>
> For the xf86drm.[ch] part : Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
> ---
>   amdgpu/amdgpu-symbol-check |  1 +
>   amdgpu/amdgpu.h            | 18 ++++++++++++++++++
>   amdgpu/amdgpu_cs.c         | 10 ++++++++++
>   include/drm/drm.h          |  3 ++-
>   xf86drm.c                  | 15 +++++++++++++++
>   xf86drm.h                  |  2 ++
>   6 files changed, 48 insertions(+), 1 deletion(-)
>
> diff --git a/amdgpu/amdgpu-symbol-check b/amdgpu/amdgpu-symbol-check
> index 274b4c6d..597a99b2 100755
> --- a/amdgpu/amdgpu-symbol-check
> +++ b/amdgpu/amdgpu-symbol-check
> @@ -56,6 +56,7 @@ amdgpu_cs_syncobj_export_sync_file2
>   amdgpu_cs_syncobj_import_sync_file
>   amdgpu_cs_syncobj_import_sync_file2
>   amdgpu_cs_syncobj_query
> +amdgpu_cs_syncobj_query2
>   amdgpu_cs_syncobj_reset
>   amdgpu_cs_syncobj_signal
>   amdgpu_cs_syncobj_timeline_signal
> diff --git a/amdgpu/amdgpu.h b/amdgpu/amdgpu.h
> index 9d9b0832..19f74bd6 100644
> --- a/amdgpu/amdgpu.h
> +++ b/amdgpu/amdgpu.h
> @@ -1591,6 +1591,24 @@ int amdgpu_cs_syncobj_timeline_wait(amdgpu_device_handle dev,
>   int amdgpu_cs_syncobj_query(amdgpu_device_handle dev,
>   			    uint32_t *handles, uint64_t *points,
>   			    unsigned num_handles);
> +/**
> + *  Query sync objects last signaled or submitted point.
> + *
> + * \param   dev	    - \c [in] self-explanatory
> + * \param   handles - \c [in] array of sync object handles
> + * \param   points - \c [out] array of sync points returned, which presents
> + * syncobj payload.
> + * \param   num_handles - \c [in] self-explanatory
> + * \param   flags   - \c [in] a bitmask of DRM_SYNCOBJ_QUERY_FLAGS_*
> + *
> + * \return   0 on success\n
> + *          -ETIME - Timeout
> + *          <0 - Negative POSIX Error code
> + *
> + */
> +int amdgpu_cs_syncobj_query2(amdgpu_device_handle dev,
> +			     uint32_t *handles, uint64_t *points,
> +			     unsigned num_handles, uint32_t flags);
>   
>   /**
>    *  Export kernel sync object to shareable fd.
> diff --git a/amdgpu/amdgpu_cs.c b/amdgpu/amdgpu_cs.c
> index 977fa3cf..01e2b2c8 100644
> --- a/amdgpu/amdgpu_cs.c
> +++ b/amdgpu/amdgpu_cs.c
> @@ -721,6 +721,16 @@ drm_public int amdgpu_cs_syncobj_query(amdgpu_device_handle dev,
>   	return drmSyncobjQuery(dev->fd, handles, points, num_handles);
>   }
>   
> +drm_public int amdgpu_cs_syncobj_query2(amdgpu_device_handle dev,
> +					uint32_t *handles, uint64_t *points,
> +					unsigned num_handles, uint32_t flags)
> +{
> +	if (!dev)
> +		return -EINVAL;
> +
> +	return drmSyncobjQuery2(dev->fd, handles, points, num_handles, flags);
> +}
> +
>   drm_public int amdgpu_cs_export_syncobj(amdgpu_device_handle dev,
>   					uint32_t handle,
>   					int *shared_fd)
> diff --git a/include/drm/drm.h b/include/drm/drm.h
> index 532787bf..af37a80b 100644
> --- a/include/drm/drm.h
> +++ b/include/drm/drm.h
> @@ -771,11 +771,12 @@ struct drm_syncobj_array {
>   	__u32 pad;
>   };
>   
> +#define DRM_SYNCOBJ_QUERY_FLAGS_LAST_SUBMITTED (1 << 0) /* last available point on timeline syncobj */
>   struct drm_syncobj_timeline_array {
>   	__u64 handles;
>   	__u64 points;
>   	__u32 count_handles;
> -	__u32 pad;
> +	__u32 flags;
>   };
>   
>   
> diff --git a/xf86drm.c b/xf86drm.c
> index 953fc762..28a61264 100644
> --- a/xf86drm.c
> +++ b/xf86drm.c
> @@ -4314,6 +4314,21 @@ drm_public int drmSyncobjQuery(int fd, uint32_t *handles, uint64_t *points,
>       return 0;
>   }
>   
> +drm_public int drmSyncobjQuery2(int fd, uint32_t *handles, uint64_t *points,
> +				uint32_t handle_count, uint32_t flags)
> +{
> +    struct drm_syncobj_timeline_array args;
> +
> +    memclear(args);
> +    args.handles = (uintptr_t)handles;
> +    args.points = (uintptr_t)points;
> +    args.count_handles = handle_count;
> +    args.flags = flags;
> +
> +    return drmIoctl(fd, DRM_IOCTL_SYNCOBJ_QUERY, &args);
> +}
> +
> +
>   drm_public int drmSyncobjTransfer(int fd,
>   				  uint32_t dst_handle, uint64_t dst_point,
>   				  uint32_t src_handle, uint64_t src_point,
> diff --git a/xf86drm.h b/xf86drm.h
> index 3fb1d1ca..55ceaed9 100644
> --- a/xf86drm.h
> +++ b/xf86drm.h
> @@ -884,6 +884,8 @@ extern int drmSyncobjTimelineWait(int fd, uint32_t *handles, uint64_t *points,
>   				  uint32_t *first_signaled);
>   extern int drmSyncobjQuery(int fd, uint32_t *handles, uint64_t *points,
>   			   uint32_t handle_count);
> +extern int drmSyncobjQuery2(int fd, uint32_t *handles, uint64_t *points,
> +			    uint32_t handle_count, uint32_t flags);
>   extern int drmSyncobjTransfer(int fd,
>   			      uint32_t dst_handle, uint64_t dst_point,
>   			      uint32_t src_handle, uint64_t src_point,
Chunming Zhou July 25, 2019, 8:27 a.m. UTC | #2
Thanks guys, since I have no write permission to libdrm, I need your 
help to push patch.

-David
On 2019年07月25日 16:11, Chunming Zhou wrote:
> v2: nit-picks fix
>
> Signed-off-by: Chunming Zhou <david1.zhou@amd.com>
> Cc: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
> Cc: Christian König <Christian.Koenig@amd.com>
> Reviewed-by: Christian König <christian.koenig@amd.com>
> For the xf86drm.[ch] part : Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
> ---
>   amdgpu/amdgpu-symbol-check |  1 +
>   amdgpu/amdgpu.h            | 18 ++++++++++++++++++
>   amdgpu/amdgpu_cs.c         | 10 ++++++++++
>   include/drm/drm.h          |  3 ++-
>   xf86drm.c                  | 15 +++++++++++++++
>   xf86drm.h                  |  2 ++
>   6 files changed, 48 insertions(+), 1 deletion(-)
>
> diff --git a/amdgpu/amdgpu-symbol-check b/amdgpu/amdgpu-symbol-check
> index 274b4c6d..597a99b2 100755
> --- a/amdgpu/amdgpu-symbol-check
> +++ b/amdgpu/amdgpu-symbol-check
> @@ -56,6 +56,7 @@ amdgpu_cs_syncobj_export_sync_file2
>   amdgpu_cs_syncobj_import_sync_file
>   amdgpu_cs_syncobj_import_sync_file2
>   amdgpu_cs_syncobj_query
> +amdgpu_cs_syncobj_query2
>   amdgpu_cs_syncobj_reset
>   amdgpu_cs_syncobj_signal
>   amdgpu_cs_syncobj_timeline_signal
> diff --git a/amdgpu/amdgpu.h b/amdgpu/amdgpu.h
> index 9d9b0832..19f74bd6 100644
> --- a/amdgpu/amdgpu.h
> +++ b/amdgpu/amdgpu.h
> @@ -1591,6 +1591,24 @@ int amdgpu_cs_syncobj_timeline_wait(amdgpu_device_handle dev,
>   int amdgpu_cs_syncobj_query(amdgpu_device_handle dev,
>   			    uint32_t *handles, uint64_t *points,
>   			    unsigned num_handles);
> +/**
> + *  Query sync objects last signaled or submitted point.
> + *
> + * \param   dev	    - \c [in] self-explanatory
> + * \param   handles - \c [in] array of sync object handles
> + * \param   points - \c [out] array of sync points returned, which presents
> + * syncobj payload.
> + * \param   num_handles - \c [in] self-explanatory
> + * \param   flags   - \c [in] a bitmask of DRM_SYNCOBJ_QUERY_FLAGS_*
> + *
> + * \return   0 on success\n
> + *          -ETIME - Timeout
> + *          <0 - Negative POSIX Error code
> + *
> + */
> +int amdgpu_cs_syncobj_query2(amdgpu_device_handle dev,
> +			     uint32_t *handles, uint64_t *points,
> +			     unsigned num_handles, uint32_t flags);
>   
>   /**
>    *  Export kernel sync object to shareable fd.
> diff --git a/amdgpu/amdgpu_cs.c b/amdgpu/amdgpu_cs.c
> index 977fa3cf..01e2b2c8 100644
> --- a/amdgpu/amdgpu_cs.c
> +++ b/amdgpu/amdgpu_cs.c
> @@ -721,6 +721,16 @@ drm_public int amdgpu_cs_syncobj_query(amdgpu_device_handle dev,
>   	return drmSyncobjQuery(dev->fd, handles, points, num_handles);
>   }
>   
> +drm_public int amdgpu_cs_syncobj_query2(amdgpu_device_handle dev,
> +					uint32_t *handles, uint64_t *points,
> +					unsigned num_handles, uint32_t flags)
> +{
> +	if (!dev)
> +		return -EINVAL;
> +
> +	return drmSyncobjQuery2(dev->fd, handles, points, num_handles, flags);
> +}
> +
>   drm_public int amdgpu_cs_export_syncobj(amdgpu_device_handle dev,
>   					uint32_t handle,
>   					int *shared_fd)
> diff --git a/include/drm/drm.h b/include/drm/drm.h
> index 532787bf..af37a80b 100644
> --- a/include/drm/drm.h
> +++ b/include/drm/drm.h
> @@ -771,11 +771,12 @@ struct drm_syncobj_array {
>   	__u32 pad;
>   };
>   
> +#define DRM_SYNCOBJ_QUERY_FLAGS_LAST_SUBMITTED (1 << 0) /* last available point on timeline syncobj */
>   struct drm_syncobj_timeline_array {
>   	__u64 handles;
>   	__u64 points;
>   	__u32 count_handles;
> -	__u32 pad;
> +	__u32 flags;
>   };
>   
>   
> diff --git a/xf86drm.c b/xf86drm.c
> index 953fc762..28a61264 100644
> --- a/xf86drm.c
> +++ b/xf86drm.c
> @@ -4314,6 +4314,21 @@ drm_public int drmSyncobjQuery(int fd, uint32_t *handles, uint64_t *points,
>       return 0;
>   }
>   
> +drm_public int drmSyncobjQuery2(int fd, uint32_t *handles, uint64_t *points,
> +				uint32_t handle_count, uint32_t flags)
> +{
> +    struct drm_syncobj_timeline_array args;
> +
> +    memclear(args);
> +    args.handles = (uintptr_t)handles;
> +    args.points = (uintptr_t)points;
> +    args.count_handles = handle_count;
> +    args.flags = flags;
> +
> +    return drmIoctl(fd, DRM_IOCTL_SYNCOBJ_QUERY, &args);
> +}
> +
> +
>   drm_public int drmSyncobjTransfer(int fd,
>   				  uint32_t dst_handle, uint64_t dst_point,
>   				  uint32_t src_handle, uint64_t src_point,
> diff --git a/xf86drm.h b/xf86drm.h
> index 3fb1d1ca..55ceaed9 100644
> --- a/xf86drm.h
> +++ b/xf86drm.h
> @@ -884,6 +884,8 @@ extern int drmSyncobjTimelineWait(int fd, uint32_t *handles, uint64_t *points,
>   				  uint32_t *first_signaled);
>   extern int drmSyncobjQuery(int fd, uint32_t *handles, uint64_t *points,
>   			   uint32_t handle_count);
> +extern int drmSyncobjQuery2(int fd, uint32_t *handles, uint64_t *points,
> +			    uint32_t handle_count, uint32_t flags);
>   extern int drmSyncobjTransfer(int fd,
>   			      uint32_t dst_handle, uint64_t dst_point,
>   			      uint32_t src_handle, uint64_t src_point,
diff mbox series

Patch

diff --git a/amdgpu/amdgpu-symbol-check b/amdgpu/amdgpu-symbol-check
index 274b4c6d..597a99b2 100755
--- a/amdgpu/amdgpu-symbol-check
+++ b/amdgpu/amdgpu-symbol-check
@@ -56,6 +56,7 @@  amdgpu_cs_syncobj_export_sync_file2
 amdgpu_cs_syncobj_import_sync_file
 amdgpu_cs_syncobj_import_sync_file2
 amdgpu_cs_syncobj_query
+amdgpu_cs_syncobj_query2
 amdgpu_cs_syncobj_reset
 amdgpu_cs_syncobj_signal
 amdgpu_cs_syncobj_timeline_signal
diff --git a/amdgpu/amdgpu.h b/amdgpu/amdgpu.h
index 9d9b0832..19f74bd6 100644
--- a/amdgpu/amdgpu.h
+++ b/amdgpu/amdgpu.h
@@ -1591,6 +1591,24 @@  int amdgpu_cs_syncobj_timeline_wait(amdgpu_device_handle dev,
 int amdgpu_cs_syncobj_query(amdgpu_device_handle dev,
 			    uint32_t *handles, uint64_t *points,
 			    unsigned num_handles);
+/**
+ *  Query sync objects last signaled or submitted point.
+ *
+ * \param   dev	    - \c [in] self-explanatory
+ * \param   handles - \c [in] array of sync object handles
+ * \param   points - \c [out] array of sync points returned, which presents
+ * syncobj payload.
+ * \param   num_handles - \c [in] self-explanatory
+ * \param   flags   - \c [in] a bitmask of DRM_SYNCOBJ_QUERY_FLAGS_*
+ *
+ * \return   0 on success\n
+ *          -ETIME - Timeout
+ *          <0 - Negative POSIX Error code
+ *
+ */
+int amdgpu_cs_syncobj_query2(amdgpu_device_handle dev,
+			     uint32_t *handles, uint64_t *points,
+			     unsigned num_handles, uint32_t flags);
 
 /**
  *  Export kernel sync object to shareable fd.
diff --git a/amdgpu/amdgpu_cs.c b/amdgpu/amdgpu_cs.c
index 977fa3cf..01e2b2c8 100644
--- a/amdgpu/amdgpu_cs.c
+++ b/amdgpu/amdgpu_cs.c
@@ -721,6 +721,16 @@  drm_public int amdgpu_cs_syncobj_query(amdgpu_device_handle dev,
 	return drmSyncobjQuery(dev->fd, handles, points, num_handles);
 }
 
+drm_public int amdgpu_cs_syncobj_query2(amdgpu_device_handle dev,
+					uint32_t *handles, uint64_t *points,
+					unsigned num_handles, uint32_t flags)
+{
+	if (!dev)
+		return -EINVAL;
+
+	return drmSyncobjQuery2(dev->fd, handles, points, num_handles, flags);
+}
+
 drm_public int amdgpu_cs_export_syncobj(amdgpu_device_handle dev,
 					uint32_t handle,
 					int *shared_fd)
diff --git a/include/drm/drm.h b/include/drm/drm.h
index 532787bf..af37a80b 100644
--- a/include/drm/drm.h
+++ b/include/drm/drm.h
@@ -771,11 +771,12 @@  struct drm_syncobj_array {
 	__u32 pad;
 };
 
+#define DRM_SYNCOBJ_QUERY_FLAGS_LAST_SUBMITTED (1 << 0) /* last available point on timeline syncobj */
 struct drm_syncobj_timeline_array {
 	__u64 handles;
 	__u64 points;
 	__u32 count_handles;
-	__u32 pad;
+	__u32 flags;
 };
 
 
diff --git a/xf86drm.c b/xf86drm.c
index 953fc762..28a61264 100644
--- a/xf86drm.c
+++ b/xf86drm.c
@@ -4314,6 +4314,21 @@  drm_public int drmSyncobjQuery(int fd, uint32_t *handles, uint64_t *points,
     return 0;
 }
 
+drm_public int drmSyncobjQuery2(int fd, uint32_t *handles, uint64_t *points,
+				uint32_t handle_count, uint32_t flags)
+{
+    struct drm_syncobj_timeline_array args;
+
+    memclear(args);
+    args.handles = (uintptr_t)handles;
+    args.points = (uintptr_t)points;
+    args.count_handles = handle_count;
+    args.flags = flags;
+
+    return drmIoctl(fd, DRM_IOCTL_SYNCOBJ_QUERY, &args);
+}
+
+
 drm_public int drmSyncobjTransfer(int fd,
 				  uint32_t dst_handle, uint64_t dst_point,
 				  uint32_t src_handle, uint64_t src_point,
diff --git a/xf86drm.h b/xf86drm.h
index 3fb1d1ca..55ceaed9 100644
--- a/xf86drm.h
+++ b/xf86drm.h
@@ -884,6 +884,8 @@  extern int drmSyncobjTimelineWait(int fd, uint32_t *handles, uint64_t *points,
 				  uint32_t *first_signaled);
 extern int drmSyncobjQuery(int fd, uint32_t *handles, uint64_t *points,
 			   uint32_t handle_count);
+extern int drmSyncobjQuery2(int fd, uint32_t *handles, uint64_t *points,
+			    uint32_t handle_count, uint32_t flags);
 extern int drmSyncobjTransfer(int fd,
 			      uint32_t dst_handle, uint64_t dst_point,
 			      uint32_t src_handle, uint64_t src_point,