drm/syncobj: extend syncobj query ability
Subsystems (2)
PATCH 1/1 drm/syncobj: extend syncobj query ability
user space needs a flexiable query ability. So that umd can get last signaled or submitted point.
--- drivers/gpu/drm/drm_syncobj.c | 36 +++++++++++++++++------------------ include/uapi/drm/drm.h | 3 ++- 2 files changed, 20 insertions(+), 19 deletions(-)
drivers/gpu/drm/drm_syncobj.c +18 -18
@@ -1197,9 +1197,6 @@ 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 ) -return -EINVAL ; -if (args->count_handles ==0 )return -EINVAL ;
@@ -1268,9 +1265,6 @@ 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 ) -return -EINVAL ; -if (args->count_handles ==0 )return -EINVAL ;
@@ -1291,23 +1285,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
@@ -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
Am 23.07.19 um 07:22 schrieb Chunming Zhou:
Quoted 7 lines
user space needs a flexiable query ability. So that umd can get last signaled or submitted point.
Change-Id I6512b430524ebabe715e602a2bf5abb0a7e780eaSigned-off-by Chunming Zhou <[email protected]>Cc Lionel Landwerlin <[email protected]>Cc Christian König <[email protected]>
I've recently found a bug in drm_syncobj_query_ioctl() which I'm going to commit tomorrow.
Apart from that it looks good to me, but I think we should cleanup a bit and move the dma_fence_chain_for_each()... into a helper function in dma-fence-chain.c
Christian.
Quoted 79 lines
--- drivers/gpu/drm/drm_syncobj.c | 36 +++++++++++++++++------------------ include/uapi/drm/drm.h | 3 ++- 2 files changed, 20 insertions(+), 19 deletions(-)drivers/gpu/drm/drm_syncobj.c +18
-18@@ -1197,9 +1197,6 @@ 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 ) -return -EINVAL ; -if (args->count_handles ==0 )return -EINVAL ;@@ -1268,9 +1265,6 @@ 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 ) -return -EINVAL ; -if (args->count_handles ==0 )return -EINVAL ;@@ -1291,23 +1285,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@@ -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
Quoted 10 lines · Christian
Am 23.07.19 um 07:22 schrieb Chunming Zhou:
Quoted 7 lines
user space needs a flexiable query ability. So that umd can get last signaled or submitted point.
Change-Id I6512b430524ebabe715e602a2bf5abb0a7e780eaSigned-off-by Chunming Zhou <[email protected]>Cc Lionel Landwerlin <[email protected]>Cc Christian König <[email protected]>I've recently found a bug in
drm_syncobj_query_ioctl()which I'm going to commit tomorrow.
Yes, I've realized. Loinel has put RB on it.
Quoted 2 lines
Apart from that it looks good to me,
Thanks,
Quoted 3 lines
but I think we should cleanup a bit
and move thedma_fence_chain_for_each()... into a helper function indma-fence-chain.c
Do you mind a saperate cleanup patch for that? I don't want to touch kernel directory in this patch, so that we can cherry-pick it easily.
-David
Quoted 82 lines
Christian.
Quoted 79 lines
--- drivers/gpu/drm/drm_syncobj.c | 36 +++++++++++++++++------------------ include/uapi/drm/drm.h | 3 ++- 2 files changed, 20 insertions(+), 19 deletions(-)drivers/gpu/drm/drm_syncobj.c +18
-18@@ -1197,9 +1197,6 @@ 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 ) -return -EINVAL ; -if (args->count_handles ==0 )return -EINVAL ;@@ -1268,9 +1265,6 @@ 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 ) -return -EINVAL ; -if (args->count_handles ==0 )return -EINVAL ;@@ -1291,23 +1285,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@@ -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
Am 23.07.19 um 16:07 schrieb Zhou, David(ChunMing):
Quoted 15 lines · Christian
Quoted 10 lines
Am 23.07.19 um 07:22 schrieb Chunming Zhou:
Quoted 7 lines
user space needs a flexiable query ability. So that umd can get last signaled or submitted point.
Change-Id I6512b430524ebabe715e602a2bf5abb0a7e780eaSigned-off-by Chunming Zhou <[email protected]>Cc Lionel Landwerlin <[email protected]>Cc Christian König <[email protected]>I've recently found a bug in
drm_syncobj_query_ioctl()which I'm going to commit tomorrow.Yes, I've realized. Loinel has put RB on it.
Quoted 1 line
Apart from that it looks good to me,
Quoted 8 lines
Thanks,
Quoted 3 lines
but I think we should cleanup a bit
and move thedma_fence_chain_for_each()... into a helper function indma-fence-chain.cDo you mind a saperate cleanup patch for that? I don't want to touch kernel directory in this patch, so that we can cherry-pick it easily.
Yeah, works for me as well.
Christian.
Quoted 85 lines
-David
Quoted 81 lines
Christian.
Quoted 79 lines
--- drivers/gpu/drm/drm_syncobj.c | 36 +++++++++++++++++------------------ include/uapi/drm/drm.h | 3 ++- 2 files changed, 20 insertions(+), 19 deletions(-)drivers/gpu/drm/drm_syncobj.c +18
-18@@ -1197,9 +1197,6 @@ 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 ) -return -EINVAL ; -if (args->count_handles ==0 )return -EINVAL ;@@ -1268,9 +1265,6 @@ 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 ) -return -EINVAL ; -if (args->count_handles ==0 )return -EINVAL ;@@ -1291,23 +1285,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@@ -777,11 +777,12 @@ struct drm_syncobj_array {__u32 pad; };
Quoted 10 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
Am 23.07.19 um 16:08 schrieb Christian König:
Quoted 19 lines
Am 23.07.19 um 16:07 schrieb Zhou, David(ChunMing):
Quoted 18 lines · Christian
Quoted 10 lines
Am 23.07.19 um 07:22 schrieb Chunming Zhou:
Quoted 7 lines
user space needs a flexiable query ability. So that umd can get last signaled or submitted point.
Change-Id I6512b430524ebabe715e602a2bf5abb0a7e780eaSigned-off-by Chunming Zhou <[email protected]>Cc Lionel Landwerlin <[email protected]>Cc Christian König <[email protected]>I've recently found a bug in
drm_syncobj_query_ioctl()which I'm going to commit tomorrow.Yes, I've realized. Loinel has put RB on it.
Quoted 1 line
Apart from that it looks good to me,
Thanks,
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
but I think we should cleanup a bit
and move thedma_fence_chain_for_each()... into a helper function indma-fence-chain.cDo you mind a saperate cleanup patch for that? I don't want to touch kernel directory in this patch, so that we can cherry-pick it easily.
Yeah, works for me as well.
Sorry this got delayed a bit. I've just pushed my fix to drm-misc-next and amd-staging-drm-next.
Can you rebase and send this one out again? Going to push it to drm-misc-next then.
Christian.
Quoted 89 lines
Christian.
Quoted 86 lines
-David
Quoted 82 lines
Christian.
Quoted 80 lines
---
drivers/gpu/drm/drm_syncobj.c| 36
+++++++++++++++++------------------
include/uapi/drm/drm.h | 3 ++-2 files changed, 20 insertions(+), 19 deletions(-)drivers/gpu/drm/drm_syncobj.c +0
-2@@ -1197,9 +1197,6 @@ 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) - return -EINVAL; - if (args->count_handles == 0) return -EINVAL;@@ -1268,9 +1265,6 @@ 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)
- return-EINVAL;
-
if (args->count_handles== 0)
return-EINVAL;
@@ -1291,23 +1285,29 @@ int drm_syncobj_query_ioctl(structdrm_device*dev, void *data,
if (chain) {
structdma_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@@ -777,11 +777,12 @@ struct drm_syncobj_array { __u32 pad; };+#define
DRM_SYNCOBJ_QUERY_FLAGS_LAST_SUBMITTED(1 << 0) /*
Quoted 9 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
last available point on timeline syncobj */ struct
drm_syncobj_timeline_array{
__u64handles;
__u64points;
__u32count_handles;
-__u32pad;
+__u32flags;
};
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 17 lines · Chunming Zhou
user space needs a flexiable query ability. So that umd can get last signaled or submitted point.
Change-Id I6512b430524ebabe715e602a2bf5abb0a7e780eaSigned-off-by Chunming Zhou <[email protected]>Cc Lionel Landwerlin <[email protected]>Cc Christian König <[email protected]>--- drivers/gpu/drm/drm_syncobj.c | 36 +++++++++++++++++------------------ include/uapi/drm/drm.h | 3 ++- 2 files changed, 20 insertions(+), 19 deletions(-)drivers/gpu/drm/drm_syncobj.c +0
-0
drivers/gpu/drm/drm_syncobj.c drm_syncobj_timeline_signal_ioctl(struct drm_device *dev, void *data, · line 1201
Quoted 5 lines
drivers/gpu/drm/drm_syncobj.c +0
-2@@ -1197,9 +1197,6 @@ 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 ) -return -EINVAL ;
I think args->flags should still be 0 for this ioctl.
drivers/gpu/drm/drm_syncobj.c int drm_syncobj_query_ioctl(struct drm_device *dev, void *data, · line 1272
Quoted 10 lines
drivers/gpu/drm/drm_syncobj.c +0
-3-if (args->count_handles ==0 )return -EINVAL ;@@ -1268,9 +1265,6 @@ 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 ) -return -EINVAL ;
You probably want to verify that (args->flags & ~DRM_SYNCOBJ_QUERY_FLAGS_LAST_SUBMITTED) == 0.
Quoted 54 lines
drivers/gpu/drm/drm_syncobj.c +18
-13-if (args->count_handles ==0 )return -EINVAL ;@@ -1291,23 +1285,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@@ -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