Skip to contentSkip to conversation

drm/syncobj: extend syncobj query ability v2

PATCH In review Chunming Zhou 5 participants 6 messages Jul 23, 2019 – Jul 25, 2019 1 message not in the archive

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

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

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

Change-Id I6512b430524ebabe715e602a2bf5abb0a7e780ea
Cc Lionel Landwerlin <[email protected]>
Cc Christian König <[email protected]>
---
 drivers/gpu/drm/drm_syncobj.c | 34 ++++++++++++++++++++--------------
 include/uapi/drm/drm.h        |  3 ++-
 2 files changed, 22 insertions(+), 15 deletions(-)
drivers/gpu/drm/drm_syncobj.c +20 -14
index 3d400905100b..3fc8f66ada68 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)
@@ -1291,23 +1291,29 @@ int drm_syncobj_query_ioctl(struct drm_device *dev, void *data,
 		if (chain) {
 			struct dma_fence *iter, *last_signaled = NULL;
 
-			dma_fence_chain_for_each(iter, fence) {
-				if (!iter)
-					break;
-				dma_fence_put(last_signaled);
-				last_signaled = dma_fence_get(iter);
-				if (!to_dma_fence_chain(last_signaled)->prev_seqno)
-					/* It is most likely that timeline has
-					 * unorder points. */
-					break;
+			if (args->flags &
+			    DRM_SYNCOBJ_QUERY_FLAGS_LAST_SUBMITTED) {
+				point = fence->seqno;
+			} else {
+				dma_fence_chain_for_each(iter, fence) {
+					if (!iter)
+						break;
+					dma_fence_put(last_signaled);
+					last_signaled = dma_fence_get(iter);
+					if (!to_dma_fence_chain(last_signaled)->prev_seqno)
+						/* It is most likely that timeline has
+						* unorder points. */
+						break;
+				}
+				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 on v1 1/1
#1 lore raw
Quoted 9 lines · Chunming Zhou

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

Change-Id I6512b430524ebabe715e602a2bf5abb0a7e780ea
Cc Lionel Landwerlin <[email protected]>
Cc Christian König <[email protected]>
Quoted 77 lines
---
  drivers/gpu/drm/drm_syncobj.c | 34 ++++++++++++++++++++--------------
  include/uapi/drm/drm.h        |  3 ++-
  2 files changed, 22 insertions(+), 15 deletions(-)
drivers/gpu/drm/drm_syncobj.c +20 -14
index 3d400905100b..3fc8f66ada68 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)
@@ -1291,23 +1291,29 @@ int drm_syncobj_query_ioctl(struct drm_device *dev, void *data,
  		if (chain) {
  			struct dma_fence *iter, *last_signaled = NULL;
 
-			dma_fence_chain_for_each(iter, fence) {
-				if (!iter)
-					break;
-				dma_fence_put(last_signaled);
-				last_signaled = dma_fence_get(iter);
-				if (!to_dma_fence_chain(last_signaled)->prev_seqno)
-					/* It is most likely that timeline has
-					 * unorder points. */
-					break;
+			if (args->flags &
+			    DRM_SYNCOBJ_QUERY_FLAGS_LAST_SUBMITTED) {
+				point = fence->seqno;
+			} else {
+				dma_fence_chain_for_each(iter, fence) {
+					if (!iter)
+						break;
+					dma_fence_put(last_signaled);
+					last_signaled = dma_fence_get(iter);
+					if (!to_dma_fence_chain(last_signaled)->prev_seqno)
+						/* It is most likely that timeline has
+						* unorder points. */
+						break;
+				}
+				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

A message that is not in the archive (sent off-list or not yet received): [email protected]

#3 lore raw

Am 24.07.19 um 08:32 schrieb zhoucm1:

Quoted 14 lines · Lionel Landwerlin
Quoted 11 lines · Chunming Zhou
Quoted 9 lines

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

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

Thanks.
Which branch should this patch go to?
Is it OK to push to amd-staging-drm-next?
Or should it go to drm-misc?
If drm-misc, I need your help to push it since I have no permission to write.

drm-misc-next is probably more appropriated.

I'm going to take of that, but first let me push my fix now.

Christian.

Quoted 91 lines

-David

Quoted 88 lines
Quoted 86 lines

---
  drivers/gpu/drm/drm_syncobj.c | 34 ++++++++++++++++++++-------------- include/uapi/drm/drm.h        |  3 ++-

  2 files changed, 22 insertions(+), 15 deletions(-)
drivers/gpu/drm/drm_syncobj.c +20 -11
index 3d400905100b..3fc8f66ada68 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)
@@ -1291,23 +1291,29 @@ int drm_syncobj_query_ioctl(struct 
 drm_device *dev, void *data,
           if (chain) {
               struct dma_fence *iter, *last_signaled = NULL;
   -            dma_fence_chain_for_each(iter, fence) {
-                if (!iter)
-                    break;
-                dma_fence_put(last_signaled);
-                last_signaled = dma_fence_get(iter);
-                if (!to_dma_fence_chain(last_signaled)->prev_seqno)
-                    /* It is most likely that timeline has
-                     * unorder points. */
-                    break;
+            if (args->flags &
+                DRM_SYNCOBJ_QUERY_FLAGS_LAST_SUBMITTED) {
+                point = fence->seqno;
+            } else {
+                dma_fence_chain_for_each(iter, fence) {
+                    if (!iter)
+                        break;
+                    dma_fence_put(last_signaled);
+                    last_signaled = dma_fence_get(iter);
+                    if 
 (!to_dma_fence_chain(last_signaled)->prev_seqno)
+                        /* It is most likely that timeline has
+                        * unorder points. */
+                        break;
+                }
+                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;
   };

  +#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

#4 lore raw
Quoted 24 lines · Christian

Am 24.07.19 um 08:32 schrieb zhoucm1:

Quoted 14 lines · Lionel Landwerlin
Quoted 11 lines · Chunming Zhou
Quoted 9 lines

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

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

Thanks.
Which branch should this patch go to?
Is it OK to push to amd-staging-drm-next?
Or should it go to drm-misc?
If drm-misc, I need your help to push it since I have no permission to write.

Quoted 3 lines

drm-misc-next is probably more appropriated.

I'm going to take of that, but first let me push my fix now.

btw we once discussed to hide the syncobj stuff until the userspace side is public too. Not seeing that merged anywhere. Can you pls take care of this?

I'm not against developing new uapi in upstream, that's occasionally just the most reasonable thing to do here. But we are quite badly flaunting the entire "needs open source consumer in userspace" rule here ... -Daniel

Quoted 99 lines

Christian.

Quoted 91 lines

-David

Quoted 88 lines
Quoted 86 lines

---
  drivers/gpu/drm/drm_syncobj.c | 34 ++++++++++++++++++++-------------- include/uapi/drm/drm.h        |  3 ++-

  2 files changed, 22 insertions(+), 15 deletions(-)
drivers/gpu/drm/drm_syncobj.c +20 -11
index 3d400905100b..3fc8f66ada68 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)
@@ -1291,23 +1291,29 @@ int drm_syncobj_query_ioctl(struct 
 drm_device *dev, void *data,
           if (chain) {
               struct dma_fence *iter, *last_signaled = NULL;
   -            dma_fence_chain_for_each(iter, fence) {
-                if (!iter)
-                    break;
-                dma_fence_put(last_signaled);
-                last_signaled = dma_fence_get(iter);
-                if (!to_dma_fence_chain(last_signaled)->prev_seqno)
-                    /* It is most likely that timeline has
-                     * unorder points. */
-                    break;
+            if (args->flags &
+                DRM_SYNCOBJ_QUERY_FLAGS_LAST_SUBMITTED) {
+                point = fence->seqno;
+            } else {
+                dma_fence_chain_for_each(iter, fence) {
+                    if (!iter)
+                        break;
+                    dma_fence_put(last_signaled);
+                    last_signaled = dma_fence_get(iter);
+                    if 
 (!to_dma_fence_chain(last_signaled)->prev_seqno)
+                        /* It is most likely that timeline has
+                        * unorder points. */
+                        break;
+                }
+                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;
   };

  +#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

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#5 lore raw
Quoted 23 lines · Daniel Vetter
Quoted 22 lines · Christian

Am 24.07.19 um 08:32 schrieb zhoucm1:

Quoted 12 lines · Lionel Landwerlin
Quoted 10 lines · Chunming Zhou
Quoted 9 lines

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

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

Thanks.
Which branch should this patch go to?
Is it OK to push to amd-staging-drm-next?
Or should it go to drm-misc?
If drm-misc, I need your help to push it since I have no permission to write.

drm-misc-next is probably more appropriated.

Quoted 8 lines
Quoted 1 line

I'm going to take of that, but first let me push my fix now.

btw we once discussed to hide the syncobj stuff until the userspace side is public too. Not seeing that merged anywhere. Can you pls take care of this?

I'm not against developing new uapi in upstream, that's occasionally just the most reasonable thing to do here. But we are quite badly flaunting the entire "needs open source consumer in userspace" rule here ...

Hi Daniel,

I got your means. The enablement feature flag is already removed from drm-misc, so it shouldn't have other effect.

If only amd driver stuff and only amd uses that, we can flexiblely deal with that.

Since syncobj is moved to drm level, we are working here. I think you should already see that timeline syncobj is also used by Intel ANV, and Lionel is co-working with us. If we hide these stuff, how do we know who is working on that? How do we share one same implementation? Where should we discuss? everyone implements own's desgin behind?

-David

Quoted 95 lines

-Daniel

Quoted 93 lines

Christian.

Quoted 87 lines

-David

Quoted 86 lines
Quoted 85 lines
---
   drivers/gpu/drm/drm_syncobj.c | 34 ++++++++++++++++++++--------------
   include/uapi/drm/drm.h        |  3 ++-
   2 files changed, 22 insertions(+), 15 deletions(-)
drivers/gpu/drm/drm_syncobj.c +20 -11
index 3d400905100b..3fc8f66ada68 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)
@@ -1291,23 +1291,29 @@ int drm_syncobj_query_ioctl(struct
 drm_device *dev, void *data,
           if (chain) {
               struct dma_fence *iter, *last_signaled = NULL;
   -            dma_fence_chain_for_each(iter, fence) {
-                if (!iter)
-                    break;
-                dma_fence_put(last_signaled);
-                last_signaled = dma_fence_get(iter);
-                if (!to_dma_fence_chain(last_signaled)->prev_seqno)
-                    /* It is most likely that timeline has
-                     * unorder points. */
-                    break;
+            if (args->flags &
+                DRM_SYNCOBJ_QUERY_FLAGS_LAST_SUBMITTED) {
+                point = fence->seqno;
+            } else {
+                dma_fence_chain_for_each(iter, fence) {
+                    if (!iter)
+                        break;
+                    dma_fence_put(last_signaled);
+                    last_signaled = dma_fence_get(iter);
+                    if
 (!to_dma_fence_chain(last_signaled)->prev_seqno)
+                        /* It is most likely that timeline has
+                        * unorder points. */
+                        break;
+                }
+                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;
   };
   +#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
Quoted 31 lines · Chunming Zhou
Quoted 28 lines · Daniel Vetter
Quoted 20 lines · Christian

Am 24.07.19 um 08:32 schrieb zhoucm1:

Quoted 12 lines · Lionel Landwerlin
Quoted 10 lines · Chunming Zhou
Quoted 9 lines

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

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

Thanks.
Which branch should this patch go to?
Is it OK to push to amd-staging-drm-next?
Or should it go to drm-misc?
If drm-misc, I need your help to push it since I have no permission to write.

Quoted 3 lines

drm-misc-next is probably more appropriated.

I'm going to take of that, but first let me push my fix now.

btw we once discussed to hide the syncobj stuff until the userspace side is public too. Not seeing that merged anywhere. Can you pls take care of this?

Quoted 8 lines
Quoted 3 lines

I'm not against developing new uapi in upstream, that's occasionally just the most reasonable thing to do here. But we are quite badly flaunting the entire "needs open source consumer in userspace" rule here ...

Hi Daniel,

I got your means. The enablement feature flag is already removed from drm-misc, so it shouldn't have other effect.

Ah I totally missed the patch from Alex which just reverts it. I thought the plan was to have a module options that taints the kernel when you enable this code. That's what we've done for atomic (or any of the other hidden uapi). With the current approach we're essentially merging dead code, which doesn't sound like a good idea really. Iirc there was a patch from Lionel to add that module option, but I didn't see it land. That's why I asked.

Quoted 8 lines

If only amd driver stuff and only amd uses that, we can flexiblely deal with that.

Since syncobj is moved to drm level, we are working here. I think you should already see that timeline syncobj is also used by Intel ANV, and Lionel is co-working with us. If we hide these stuff, how do we know who is working on that? How do we share one same implementation? Where should we discuss? everyone implements own's desgin behind?

Uh ... what are you talking about? Nowhere did I propose to hide stuff and not work together ... how did you come up with that idea? I'm confused.
-Daniel

Quoted 98 lines

-David

Quoted 95 lines

-Daniel

Quoted 93 lines

Christian.

Quoted 87 lines

-David

Quoted 86 lines
Quoted 85 lines
---
   drivers/gpu/drm/drm_syncobj.c | 34 ++++++++++++++++++++--------------
   include/uapi/drm/drm.h        |  3 ++-
   2 files changed, 22 insertions(+), 15 deletions(-)
drivers/gpu/drm/drm_syncobj.c +20 -11
index 3d400905100b..3fc8f66ada68 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)
@@ -1291,23 +1291,29 @@ int drm_syncobj_query_ioctl(struct
 drm_device *dev, void *data,
           if (chain) {
               struct dma_fence *iter, *last_signaled = NULL;
   -            dma_fence_chain_for_each(iter, fence) {
-                if (!iter)
-                    break;
-                dma_fence_put(last_signaled);
-                last_signaled = dma_fence_get(iter);
-                if (!to_dma_fence_chain(last_signaled)->prev_seqno)
-                    /* It is most likely that timeline has
-                     * unorder points. */
-                    break;
+            if (args->flags &
+                DRM_SYNCOBJ_QUERY_FLAGS_LAST_SUBMITTED) {
+                point = fence->seqno;
+            } else {
+                dma_fence_chain_for_each(iter, fence) {
+                    if (!iter)
+                        break;
+                    dma_fence_put(last_signaled);
+                    last_signaled = dma_fence_get(iter);
+                    if
 (!to_dma_fence_chain(last_signaled)->prev_seqno)
+                        /* It is most likely that timeline has
+                        * unorder points. */
+                        break;
+                }
+                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;
   };
   +#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;
include/uapi/drm/drm.h +1 -1
-    __u32 pad;
+    __u32 flags;
   };

_______________________________________________
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