Skip to contentSkip to conversation

drm/syncobj: extend syncobj query ability v3

PATCH In review Chunming Zhou 6 participants 7 messages Jul 30, 2019 – Oct 24, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/syncobj: extend syncobj query ability v3

user space needs a flexiable query ability. So that umd can get last signaled or submitted point. v2:
add sanitizer checking.
v3:
rebase

Change-Id I6512b430524ebabe715e602a2bf5abb0a7e780ea
Cc Lionel Landwerlin <[email protected]>
Cc Christian König <[email protected]>
---
 drivers/gpu/drm/drm_syncobj.c | 37 +++++++++++++++++++++--------------
 include/uapi/drm/drm.h        |  3 ++-
 2 files changed, 24 insertions(+), 16 deletions(-)
drivers/gpu/drm/drm_syncobj.c +22 -15
index cecff2e447b1..d4432f1513ac 100644
@@ -1197,7 +1197,7 @@ drm_syncobj_timeline_signal_ioctl(struct drm_device *dev, void *data,
 	if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ_TIMELINE))
 		return -EOPNOTSUPP;
 
-	if (args->pad != 0)
+	if (args->flags != 0)
 		return -EINVAL;
 
 	if (args->count_handles == 0)
@@ -1268,7 +1268,7 @@ int drm_syncobj_query_ioctl(struct drm_device *dev, void *data,
 	if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ_TIMELINE))
 		return -EOPNOTSUPP;
 
-	if (args->pad != 0)
+	if (args->flags & ~DRM_SYNCOBJ_QUERY_FLAGS_LAST_SUBMITTED)
 		return -EINVAL;
 
 	if (args->count_handles == 0)
@@ -1289,25 +1289,32 @@ int drm_syncobj_query_ioctl(struct drm_device *dev, void *data,
 		fence = drm_syncobj_fence_get(syncobjs[i]);
 		chain = to_dma_fence_chain(fence);
 		if (chain) {
-			struct dma_fence *iter, *last_signaled = NULL;
-
-			dma_fence_chain_for_each(iter, fence) {
-				if (iter->context != fence->context) {
-					dma_fence_put(iter);
-					/* It is most likely that timeline has
-					 * unorder points. */
-					break;
+			struct dma_fence *iter, *last_signaled =
+				dma_fence_get(fence);
+
+			if (args->flags &
+			    DRM_SYNCOBJ_QUERY_FLAGS_LAST_SUBMITTED) {
+				point = fence->seqno;
+			} else {
+				dma_fence_chain_for_each(iter, fence) {
+					if (iter->context != fence->context) {
+						dma_fence_put(iter);
+						/* It is most likely that timeline has
+						* unorder points. */
+						break;
+					}
+					dma_fence_put(last_signaled);
+					last_signaled = dma_fence_get(iter);
 				}
-				dma_fence_put(last_signaled);
-				last_signaled = dma_fence_get(iter);
+				point = dma_fence_is_signaled(last_signaled) ?
+					last_signaled->seqno :
+					to_dma_fence_chain(last_signaled)->prev_seqno;
 			}
-			point = dma_fence_is_signaled(last_signaled) ?
-				last_signaled->seqno :
-				to_dma_fence_chain(last_signaled)->prev_seqno;
 			dma_fence_put(last_signaled);
 		} else {
 			point = 0;
 		}
+		dma_fence_put(fence);
 		ret = copy_to_user(&points[i], &point, sizeof(uint64_t));
 		ret = ret ? -EFAULT : 0;
 		if (ret)
include/uapi/drm/drm.h +2 -1
index 661d73f9a919..fd987ce24d9f 100644
@@ -777,11 +777,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;
 };
 
 
Signature · 6 lines
2.17.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by Christian König on v1 1/1
#1 lore raw

Am 30.07.19 um 15:02 schrieb Chunming Zhou:

Quoted 7 lines

user space needs a flexiable query ability. So that umd can get last signaled or submitted point. v2:
add sanitizer checking.
v3:
rebase

Quoted 5 lines
Change-Id I6512b430524ebabe715e602a2bf5abb0a7e780ea
Cc Lionel Landwerlin <[email protected]>
Cc Christian König <[email protected]>

Lionel is the Intel code using this already public? Or David any chance that we can get a public amdvlk release using this?

Christian.

Quoted 81 lines
---
  drivers/gpu/drm/drm_syncobj.c | 37 +++++++++++++++++++++--------------
  include/uapi/drm/drm.h        |  3 ++-
  2 files changed, 24 insertions(+), 16 deletions(-)
drivers/gpu/drm/drm_syncobj.c +22 -15
index cecff2e447b1..d4432f1513ac 100644
@@ -1197,7 +1197,7 @@ drm_syncobj_timeline_signal_ioctl(struct drm_device *dev, void *data,
  	if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ_TIMELINE))
  		return -EOPNOTSUPP;
 
-	if (args->pad != 0)
+	if (args->flags != 0)
  		return -EINVAL;
 
  	if (args->count_handles == 0)
@@ -1268,7 +1268,7 @@ int drm_syncobj_query_ioctl(struct drm_device *dev, void *data,
  	if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ_TIMELINE))
  		return -EOPNOTSUPP;
 
-	if (args->pad != 0)
+	if (args->flags & ~DRM_SYNCOBJ_QUERY_FLAGS_LAST_SUBMITTED)
  		return -EINVAL;
 
  	if (args->count_handles == 0)
@@ -1289,25 +1289,32 @@ int drm_syncobj_query_ioctl(struct drm_device *dev, void *data,
  		fence = drm_syncobj_fence_get(syncobjs[i]);
  		chain = to_dma_fence_chain(fence);
  		if (chain) {
-			struct dma_fence *iter, *last_signaled = NULL;
-
-			dma_fence_chain_for_each(iter, fence) {
-				if (iter->context != fence->context) {
-					dma_fence_put(iter);
-					/* It is most likely that timeline has
-					 * unorder points. */
-					break;
+			struct dma_fence *iter, *last_signaled =
+				dma_fence_get(fence);
+
+			if (args->flags &
+			    DRM_SYNCOBJ_QUERY_FLAGS_LAST_SUBMITTED) {
+				point = fence->seqno;
+			} else {
+				dma_fence_chain_for_each(iter, fence) {
+					if (iter->context != fence->context) {
+						dma_fence_put(iter);
+						/* It is most likely that timeline has
+						* unorder points. */
+						break;
+					}
+					dma_fence_put(last_signaled);
+					last_signaled = dma_fence_get(iter);
  				}
-				dma_fence_put(last_signaled);
-				last_signaled = dma_fence_get(iter);
+				point = dma_fence_is_signaled(last_signaled) ?
+					last_signaled->seqno :
+					to_dma_fence_chain(last_signaled)->prev_seqno;
  			}
-			point = dma_fence_is_signaled(last_signaled) ?
-				last_signaled->seqno :
-				to_dma_fence_chain(last_signaled)->prev_seqno;
  			dma_fence_put(last_signaled);
  		} else {
  			point = 0;
  		}
+		dma_fence_put(fence);
  		ret = copy_to_user(&points[i], &point, sizeof(uint64_t));
  		ret = ret ? -EFAULT : 0;
  		if (ret)
include/uapi/drm/drm.h +0 -0
index 661d73f9a919..fd987ce24d9f 100644
@@ -777,11 +777,12 @@ struct drm_syncobj_array {
  	__u32 pad;
  };
 

include/uapi/drm/drm.h struct drm_syncobj_array { · line 788

Quoted 10 lines
include/uapi/drm/drm.h +2 -1
+#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;
  };
 
 

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#2 lore raw
Quoted 13 lines · Christian

Am 30.07.19 um 15:02 schrieb Chunming Zhou:

Quoted 7 lines

user space needs a flexiable query ability. So that umd can get last signaled or submitted point. v2:
add sanitizer checking.
v3:
rebase

Quoted 5 lines
Change-Id I6512b430524ebabe715e602a2bf5abb0a7e780ea
Cc Lionel Landwerlin <[email protected]>
Cc Christian König <[email protected]>
Quoted 4 lines

Lionel is the Intel code using this already public? Or David any chance that we can get a public amdvlk release using this?

In latest public amdvlk, We should be able to see how timeline syncobj is used in it.

-David

Quoted 84 lines

Christian.

Quoted 81 lines
---
   drivers/gpu/drm/drm_syncobj.c | 37 +++++++++++++++++++++--------------
   include/uapi/drm/drm.h        |  3 ++-
   2 files changed, 24 insertions(+), 16 deletions(-)
drivers/gpu/drm/drm_syncobj.c +22 -15
index cecff2e447b1..d4432f1513ac 100644
@@ -1197,7 +1197,7 @@ drm_syncobj_timeline_signal_ioctl(struct drm_device *dev, void *data,
   	if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ_TIMELINE))
   		return -EOPNOTSUPP;
 
-	if (args->pad != 0)
+	if (args->flags != 0)
   		return -EINVAL;
 
   	if (args->count_handles == 0)
@@ -1268,7 +1268,7 @@ int drm_syncobj_query_ioctl(struct drm_device *dev, void *data,
   	if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ_TIMELINE))
   		return -EOPNOTSUPP;
 
-	if (args->pad != 0)
+	if (args->flags & ~DRM_SYNCOBJ_QUERY_FLAGS_LAST_SUBMITTED)
   		return -EINVAL;
 
   	if (args->count_handles == 0)
@@ -1289,25 +1289,32 @@ int drm_syncobj_query_ioctl(struct drm_device *dev, void *data,
   		fence = drm_syncobj_fence_get(syncobjs[i]);
   		chain = to_dma_fence_chain(fence);
   		if (chain) {
-			struct dma_fence *iter, *last_signaled = NULL;
-
-			dma_fence_chain_for_each(iter, fence) {
-				if (iter->context != fence->context) {
-					dma_fence_put(iter);
-					/* It is most likely that timeline has
-					 * unorder points. */
-					break;
+			struct dma_fence *iter, *last_signaled =
+				dma_fence_get(fence);
+
+			if (args->flags &
+			    DRM_SYNCOBJ_QUERY_FLAGS_LAST_SUBMITTED) {
+				point = fence->seqno;
+			} else {
+				dma_fence_chain_for_each(iter, fence) {
+					if (iter->context != fence->context) {
+						dma_fence_put(iter);
+						/* It is most likely that timeline has
+						* unorder points. */
+						break;
+					}
+					dma_fence_put(last_signaled);
+					last_signaled = dma_fence_get(iter);
   				}
-				dma_fence_put(last_signaled);
-				last_signaled = dma_fence_get(iter);
+				point = dma_fence_is_signaled(last_signaled) ?
+					last_signaled->seqno :
+					to_dma_fence_chain(last_signaled)->prev_seqno;
   			}
-			point = dma_fence_is_signaled(last_signaled) ?
-				last_signaled->seqno :
-				to_dma_fence_chain(last_signaled)->prev_seqno;
   			dma_fence_put(last_signaled);
   		} else {
   			point = 0;
   		}
+		dma_fence_put(fence);
   		ret = copy_to_user(&points[i], &point, sizeof(uint64_t));
   		ret = ret ? -EFAULT : 0;
   		if (ret)
include/uapi/drm/drm.h +0 -0
index 661d73f9a919..fd987ce24d9f 100644
@@ -777,11 +777,12 @@ struct drm_syncobj_array {
   	__u32 pad;
   };
 
Quoted 10 lines

include/uapi/drm/drm.h struct drm_syncobj_array { · line 788

Quoted 10 lines
include/uapi/drm/drm.h +2 -1
+#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;
   };
 
 

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#3 lore raw
Quoted 16 lines · Chunming Zhou
Quoted 13 lines · Christian

Am 30.07.19 um 15:02 schrieb Chunming Zhou:

Quoted 12 lines

user space needs a flexiable query ability. So that umd can get last signaled or submitted point. v2:
add sanitizer checking.
v3:
rebase

Change-Id I6512b430524ebabe715e602a2bf5abb0a7e780ea
Cc Lionel Landwerlin <[email protected]>
Cc Christian König <[email protected]>
Quoted 8 lines
Quoted 4 lines

Lionel is the Intel code using this already public? Or David any chance that we can get a public amdvlk release using this?

In latest public amdvlk, We should be able to see how timeline syncobj is used in it.

I couldn't find this anywhere, could you please provide a link?

Sean

Quoted 87 lines

-David

Quoted 84 lines

Christian.

Quoted 81 lines
---
   drivers/gpu/drm/drm_syncobj.c | 37 +++++++++++++++++++++--------------
   include/uapi/drm/drm.h        |  3 ++-
   2 files changed, 24 insertions(+), 16 deletions(-)
drivers/gpu/drm/drm_syncobj.c +22 -15
index cecff2e447b1..d4432f1513ac 100644
@@ -1197,7 +1197,7 @@ drm_syncobj_timeline_signal_ioctl(struct drm_device *dev, void *data,
     if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ_TIMELINE))
             return -EOPNOTSUPP;
 
-    if (args->pad != 0)
+    if (args->flags != 0)
             return -EINVAL;
 
     if (args->count_handles == 0)
@@ -1268,7 +1268,7 @@ int drm_syncobj_query_ioctl(struct drm_device *dev, void *data,
     if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ_TIMELINE))
             return -EOPNOTSUPP;
 
-    if (args->pad != 0)
+    if (args->flags & ~DRM_SYNCOBJ_QUERY_FLAGS_LAST_SUBMITTED)
             return -EINVAL;
 
     if (args->count_handles == 0)
@@ -1289,25 +1289,32 @@ int drm_syncobj_query_ioctl(struct drm_device *dev, void *data,
             fence = drm_syncobj_fence_get(syncobjs[i]);
             chain = to_dma_fence_chain(fence);
             if (chain) {
-                    struct dma_fence *iter, *last_signaled = NULL;
-
-                    dma_fence_chain_for_each(iter, fence) {
-                            if (iter->context != fence->context) {
-                                    dma_fence_put(iter);
-                                    /* It is most likely that timeline has
-                                     * unorder points. */
-                                    break;
+                    struct dma_fence *iter, *last_signaled =
+                            dma_fence_get(fence);
+
+                    if (args->flags &
+                        DRM_SYNCOBJ_QUERY_FLAGS_LAST_SUBMITTED) {
+                            point = fence->seqno;
+                    } else {
+                            dma_fence_chain_for_each(iter, fence) {
+                                    if (iter->context != fence->context) {
+                                            dma_fence_put(iter);
+                                            /* It is most likely that timeline has
+                                            * unorder points. */
+                                            break;
+                                    }
+                                    dma_fence_put(last_signaled);
+                                    last_signaled = dma_fence_get(iter);
                             }
-                            dma_fence_put(last_signaled);
-                            last_signaled = dma_fence_get(iter);
+                            point = dma_fence_is_signaled(last_signaled) ?
+                                    last_signaled->seqno :
+                                    to_dma_fence_chain(last_signaled)->prev_seqno;
                     }
-                    point = dma_fence_is_signaled(last_signaled) ?
-                            last_signaled->seqno :
-                            to_dma_fence_chain(last_signaled)->prev_seqno;
                     dma_fence_put(last_signaled);
             } else {
                     point = 0;
             }
+            dma_fence_put(fence);
             ret = copy_to_user(&points[i], &point, sizeof(uint64_t));
             ret = ret ? -EFAULT : 0;
             if (ret)
include/uapi/drm/drm.h +0 -0
index 661d73f9a919..fd987ce24d9f 100644
@@ -777,11 +777,12 @@ struct drm_syncobj_array {
     __u32 pad;
   };
 
Quoted 14 lines
Quoted 10 lines

include/uapi/drm/drm.h struct drm_syncobj_array { · line 788

Quoted 10 lines
include/uapi/drm/drm.h +2 -1
+#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;
   };
 
 

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#4 lore raw
Quoted 20 lines · Sean Paul
Quoted 18 lines · Chunming Zhou
Quoted 15 lines · Christian

Am 30.07.19 um 15:02 schrieb Chunming Zhou:

Quoted 7 lines

user space needs a flexiable query ability. So that umd can get last signaled or submitted point. v2:
add sanitizer checking.
v3:
rebase

Quoted 5 lines
Change-Id I6512b430524ebabe715e602a2bf5abb0a7e780ea
Cc Lionel Landwerlin <[email protected]>
Cc Christian König <[email protected]>
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

Lionel is the Intel code using this already public? Or David any chance that we can get a public amdvlk release using this?

In latest public amdvlk, We should be able to see how timeline syncobj is used in it.

I couldn't find this anywhere, could you please provide a link?

I thought there was also a radv implementation somewhere ... adding some of the usual suspects for that.
-Daniel

Quoted 108 lines

Sean

Quoted 87 lines

-David

Quoted 84 lines

Christian.

Quoted 81 lines
---
   drivers/gpu/drm/drm_syncobj.c | 37 +++++++++++++++++++++--------------
   include/uapi/drm/drm.h        |  3 ++-
   2 files changed, 24 insertions(+), 16 deletions(-)
drivers/gpu/drm/drm_syncobj.c +22 -15
index cecff2e447b1..d4432f1513ac 100644
@@ -1197,7 +1197,7 @@ drm_syncobj_timeline_signal_ioctl(struct drm_device *dev, void *data,
     if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ_TIMELINE))
             return -EOPNOTSUPP;
 
-    if (args->pad != 0)
+    if (args->flags != 0)
             return -EINVAL;
 
     if (args->count_handles == 0)
@@ -1268,7 +1268,7 @@ int drm_syncobj_query_ioctl(struct drm_device *dev, void *data,
     if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ_TIMELINE))
             return -EOPNOTSUPP;
 
-    if (args->pad != 0)
+    if (args->flags & ~DRM_SYNCOBJ_QUERY_FLAGS_LAST_SUBMITTED)
             return -EINVAL;
 
     if (args->count_handles == 0)
@@ -1289,25 +1289,32 @@ int drm_syncobj_query_ioctl(struct drm_device *dev, void *data,
             fence = drm_syncobj_fence_get(syncobjs[i]);
             chain = to_dma_fence_chain(fence);
             if (chain) {
-                    struct dma_fence *iter, *last_signaled = NULL;
-
-                    dma_fence_chain_for_each(iter, fence) {
-                            if (iter->context != fence->context) {
-                                    dma_fence_put(iter);
-                                    /* It is most likely that timeline has
-                                     * unorder points. */
-                                    break;
+                    struct dma_fence *iter, *last_signaled =
+                            dma_fence_get(fence);
+
+                    if (args->flags &
+                        DRM_SYNCOBJ_QUERY_FLAGS_LAST_SUBMITTED) {
+                            point = fence->seqno;
+                    } else {
+                            dma_fence_chain_for_each(iter, fence) {
+                                    if (iter->context != fence->context) {
+                                            dma_fence_put(iter);
+                                            /* It is most likely that timeline has
+                                            * unorder points. */
+                                            break;
+                                    }
+                                    dma_fence_put(last_signaled);
+                                    last_signaled = dma_fence_get(iter);
                             }
-                            dma_fence_put(last_signaled);
-                            last_signaled = dma_fence_get(iter);
+                            point = dma_fence_is_signaled(last_signaled) ?
+                                    last_signaled->seqno :
+                                    to_dma_fence_chain(last_signaled)->prev_seqno;
                     }
-                    point = dma_fence_is_signaled(last_signaled) ?
-                            last_signaled->seqno :
-                            to_dma_fence_chain(last_signaled)->prev_seqno;
                     dma_fence_put(last_signaled);
             } else {
                     point = 0;
             }
+            dma_fence_put(fence);
             ret = copy_to_user(&points[i], &point, sizeof(uint64_t));
             ret = ret ? -EFAULT : 0;
             if (ret)
include/uapi/drm/drm.h +0 -0
index 661d73f9a919..fd987ce24d9f 100644
@@ -777,11 +777,12 @@ struct drm_syncobj_array {
     __u32 pad;
   };
 
Quoted 14 lines
Quoted 10 lines

include/uapi/drm/drm.h struct drm_syncobj_array { · line 788

Quoted 10 lines
include/uapi/drm/drm.h +2 -1
+#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;
   };
 
 

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#5 lore raw
In reply to Sean Paul
Quoted 16 lines · Sean Paul
Quoted 15 lines · Chunming Zhou
Quoted 13 lines · Christian

Am 30.07.19 um 15:02 schrieb Chunming Zhou:

Quoted 12 lines

user space needs a flexiable query ability. So that umd can get last signaled or submitted point. v2:
add sanitizer checking.
v3:
rebase

Change-Id I6512b430524ebabe715e602a2bf5abb0a7e780ea
Cc Lionel Landwerlin <[email protected]>
Cc Christian König <[email protected]>
Quoted 8 lines
Quoted 7 lines
Quoted 4 lines

Lionel is the Intel code using this already public? Or David any chance that we can get a public amdvlk release using this?

In latest public amdvlk, We should be able to see how timeline syncobj is used in it.

I couldn't find this anywhere, could you please provide a link?

https://github.com/GPUOpen-Drivers/xgl/blob/dev/icd/api/vk_semaphore.cpp

You can check the source here.

Cheers,

-David

Quoted 102 lines

Sean

Quoted 99 lines

-David

Quoted 83 lines

Christian.

Quoted 81 lines
---
    drivers/gpu/drm/drm_syncobj.c | 37 +++++++++++++++++++++--------------
    include/uapi/drm/drm.h        |  3 ++-
    2 files changed, 24 insertions(+), 16 deletions(-)
drivers/gpu/drm/drm_syncobj.c +22 -15
index cecff2e447b1..d4432f1513ac 100644
@@ -1197,7 +1197,7 @@ drm_syncobj_timeline_signal_ioctl(struct drm_device *dev, void *data,
      if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ_TIMELINE))
              return -EOPNOTSUPP;
 
-    if (args->pad != 0)
+    if (args->flags != 0)
              return -EINVAL;
 
      if (args->count_handles == 0)
@@ -1268,7 +1268,7 @@ int drm_syncobj_query_ioctl(struct drm_device *dev, void *data,
      if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ_TIMELINE))
              return -EOPNOTSUPP;
 
-    if (args->pad != 0)
+    if (args->flags & ~DRM_SYNCOBJ_QUERY_FLAGS_LAST_SUBMITTED)
              return -EINVAL;
 
      if (args->count_handles == 0)
@@ -1289,25 +1289,32 @@ int drm_syncobj_query_ioctl(struct drm_device *dev, void *data,
              fence = drm_syncobj_fence_get(syncobjs[i]);
              chain = to_dma_fence_chain(fence);
              if (chain) {
-                    struct dma_fence *iter, *last_signaled = NULL;
-
-                    dma_fence_chain_for_each(iter, fence) {
-                            if (iter->context != fence->context) {
-                                    dma_fence_put(iter);
-                                    /* It is most likely that timeline has
-                                     * unorder points. */
-                                    break;
+                    struct dma_fence *iter, *last_signaled =
+                            dma_fence_get(fence);
+
+                    if (args->flags &
+                        DRM_SYNCOBJ_QUERY_FLAGS_LAST_SUBMITTED) {
+                            point = fence->seqno;
+                    } else {
+                            dma_fence_chain_for_each(iter, fence) {
+                                    if (iter->context != fence->context) {
+                                            dma_fence_put(iter);
+                                            /* It is most likely that timeline has
+                                            * unorder points. */
+                                            break;
+                                    }
+                                    dma_fence_put(last_signaled);
+                                    last_signaled = dma_fence_get(iter);
                              }
-                            dma_fence_put(last_signaled);
-                            last_signaled = dma_fence_get(iter);
+                            point = dma_fence_is_signaled(last_signaled) ?
+                                    last_signaled->seqno :
+                                    to_dma_fence_chain(last_signaled)->prev_seqno;
                      }
-                    point = dma_fence_is_signaled(last_signaled) ?
-                            last_signaled->seqno :
-                            to_dma_fence_chain(last_signaled)->prev_seqno;
                      dma_fence_put(last_signaled);
              } else {
                      point = 0;
              }
+            dma_fence_put(fence);
              ret = copy_to_user(&points[i], &point, sizeof(uint64_t));
              ret = ret ? -EFAULT : 0;
              if (ret)
include/uapi/drm/drm.h +0 -0
index 661d73f9a919..fd987ce24d9f 100644
@@ -777,11 +777,12 @@ struct drm_syncobj_array {
      __u32 pad;
    };
 
Quoted 10 lines

include/uapi/drm/drm.h struct drm_syncobj_array { · line 788

Quoted 10 lines
include/uapi/drm/drm.h +2 -1
+#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;
    };
 
 

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#6 lore raw
In reply to Koenig, Christian
Quoted 13 lines · Christian

Am 30.07.19 um 15:02 schrieb Chunming Zhou:

Quoted 7 lines

user space needs a flexiable query ability. So that umd can get last signaled or submitted point. v2:
add sanitizer checking.
v3:
rebase

Quoted 5 lines
Change-Id I6512b430524ebabe715e602a2bf5abb0a7e780ea
Cc Lionel Landwerlin <[email protected]>
Cc Christian König <[email protected]>
Quoted 6 lines

Lionel is the Intel code using this already public? Or David any chance that we can get a public amdvlk release using this?

Christian.

The Khronos specification for timeline semaphore isn't public yet unfortunately, which is blocking the release of code associated with the whole timeline stuff.

We also have no use for this feature currently in the Anv driver.

-Lionel

Quoted 82 lines
Quoted 82 lines
---
   drivers/gpu/drm/drm_syncobj.c | 37 +++++++++++++++++++++--------------
   include/uapi/drm/drm.h        |  3 ++-
   2 files changed, 24 insertions(+), 16 deletions(-)
drivers/gpu/drm/drm_syncobj.c +22 -15
index cecff2e447b1..d4432f1513ac 100644
@@ -1197,7 +1197,7 @@ drm_syncobj_timeline_signal_ioctl(struct drm_device *dev, void *data,
   	if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ_TIMELINE))
   		return -EOPNOTSUPP;
 
-	if (args->pad != 0)
+	if (args->flags != 0)
   		return -EINVAL;
 
   	if (args->count_handles == 0)
@@ -1268,7 +1268,7 @@ int drm_syncobj_query_ioctl(struct drm_device *dev, void *data,
   	if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ_TIMELINE))
   		return -EOPNOTSUPP;
 
-	if (args->pad != 0)
+	if (args->flags & ~DRM_SYNCOBJ_QUERY_FLAGS_LAST_SUBMITTED)
   		return -EINVAL;
 
   	if (args->count_handles == 0)
@@ -1289,25 +1289,32 @@ int drm_syncobj_query_ioctl(struct drm_device *dev, void *data,
   		fence = drm_syncobj_fence_get(syncobjs[i]);
   		chain = to_dma_fence_chain(fence);
   		if (chain) {
-			struct dma_fence *iter, *last_signaled = NULL;
-
-			dma_fence_chain_for_each(iter, fence) {
-				if (iter->context != fence->context) {
-					dma_fence_put(iter);
-					/* It is most likely that timeline has
-					 * unorder points. */
-					break;
+			struct dma_fence *iter, *last_signaled =
+				dma_fence_get(fence);
+
+			if (args->flags &
+			    DRM_SYNCOBJ_QUERY_FLAGS_LAST_SUBMITTED) {
+				point = fence->seqno;
+			} else {
+				dma_fence_chain_for_each(iter, fence) {
+					if (iter->context != fence->context) {
+						dma_fence_put(iter);
+						/* It is most likely that timeline has
+						* unorder points. */
+						break;
+					}
+					dma_fence_put(last_signaled);
+					last_signaled = dma_fence_get(iter);
   				}
-				dma_fence_put(last_signaled);
-				last_signaled = dma_fence_get(iter);
+				point = dma_fence_is_signaled(last_signaled) ?
+					last_signaled->seqno :
+					to_dma_fence_chain(last_signaled)->prev_seqno;
   			}
-			point = dma_fence_is_signaled(last_signaled) ?
-				last_signaled->seqno :
-				to_dma_fence_chain(last_signaled)->prev_seqno;
   			dma_fence_put(last_signaled);
   		} else {
   			point = 0;
   		}
+		dma_fence_put(fence);
   		ret = copy_to_user(&points[i], &point, sizeof(uint64_t));
   		ret = ret ? -EFAULT : 0;
   		if (ret)
include/uapi/drm/drm.h +0 -0
index 661d73f9a919..fd987ce24d9f 100644
@@ -777,11 +777,12 @@ struct drm_syncobj_array {
   	__u32 pad;
   };
 
Quoted 10 lines

include/uapi/drm/drm.h struct drm_syncobj_array { · line 788

Quoted 10 lines
include/uapi/drm/drm.h +2 -1
+#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;
   };
 
 

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel