aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Ekstrand <jason@jlekstrand.net>2017-08-28 17:10:27 -0400
committerDave Airlie <airlied@redhat.com>2017-08-28 20:16:19 -0400
commitaa4035d2c7683d2f2fb0ffe8087abd9eabf6d54a (patch)
tree77167db05d67212faa9d9ac03b368a83badfc752
parent3e6fb72d6cef6a46f8531a01ed290785952fe25b (diff)
drm/syncobj: Add a reset ioctl (v3)
This just resets the dma_fence to NULL so it looks like it's never been signaled. This will be useful once we add the new wait API for allowing wait on "submit and signal" behavior. v2: - Take an array of sync objects (Dave Airlie) v3: - Throw -EINVAL if pad != 0 Signed-off-by: Jason Ekstrand <jason@jlekstrand.net> Reviewed-by: Christian König <christian.koenig@amd.com> (v1) Signed-off-by: Dave Airlie <airlied@redhat.com>
-rw-r--r--drivers/gpu/drm/drm_internal.h2
-rw-r--r--drivers/gpu/drm/drm_ioctl.c2
-rw-r--r--drivers/gpu/drm/drm_syncobj.c33
-rw-r--r--include/uapi/drm/drm.h7
4 files changed, 44 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_internal.h b/drivers/gpu/drm/drm_internal.h
index 534e5ac43bf8..83f1615eb1ec 100644
--- a/drivers/gpu/drm/drm_internal.h
+++ b/drivers/gpu/drm/drm_internal.h
@@ -169,3 +169,5 @@ int drm_syncobj_fd_to_handle_ioctl(struct drm_device *dev, void *data,
169 struct drm_file *file_private); 169 struct drm_file *file_private);
170int drm_syncobj_wait_ioctl(struct drm_device *dev, void *data, 170int drm_syncobj_wait_ioctl(struct drm_device *dev, void *data,
171 struct drm_file *file_private); 171 struct drm_file *file_private);
172int drm_syncobj_reset_ioctl(struct drm_device *dev, void *data,
173 struct drm_file *file_private);
diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
index b4f443417a28..16c5d51a43aa 100644
--- a/drivers/gpu/drm/drm_ioctl.c
+++ b/drivers/gpu/drm/drm_ioctl.c
@@ -659,6 +659,8 @@ static const struct drm_ioctl_desc drm_ioctls[] = {
659 DRM_UNLOCKED|DRM_RENDER_ALLOW), 659 DRM_UNLOCKED|DRM_RENDER_ALLOW),
660 DRM_IOCTL_DEF(DRM_IOCTL_SYNCOBJ_WAIT, drm_syncobj_wait_ioctl, 660 DRM_IOCTL_DEF(DRM_IOCTL_SYNCOBJ_WAIT, drm_syncobj_wait_ioctl,
661 DRM_UNLOCKED|DRM_RENDER_ALLOW), 661 DRM_UNLOCKED|DRM_RENDER_ALLOW),
662 DRM_IOCTL_DEF(DRM_IOCTL_SYNCOBJ_RESET, drm_syncobj_reset_ioctl,
663 DRM_UNLOCKED|DRM_RENDER_ALLOW),
662}; 664};
663 665
664#define DRM_CORE_IOCTL_COUNT ARRAY_SIZE( drm_ioctls ) 666#define DRM_CORE_IOCTL_COUNT ARRAY_SIZE( drm_ioctls )
diff --git a/drivers/gpu/drm/drm_syncobj.c b/drivers/gpu/drm/drm_syncobj.c
index 15e74ca61760..40d2ad293661 100644
--- a/drivers/gpu/drm/drm_syncobj.c
+++ b/drivers/gpu/drm/drm_syncobj.c
@@ -885,3 +885,36 @@ drm_syncobj_wait_ioctl(struct drm_device *dev, void *data,
885 885
886 return ret; 886 return ret;
887} 887}
888
889int
890drm_syncobj_reset_ioctl(struct drm_device *dev, void *data,
891 struct drm_file *file_private)
892{
893 struct drm_syncobj_array *args = data;
894 struct drm_syncobj **syncobjs;
895 uint32_t i;
896 int ret;
897
898 if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ))
899 return -ENODEV;
900
901 if (args->pad != 0)
902 return -EINVAL;
903
904 if (args->count_handles == 0)
905 return -EINVAL;
906
907 ret = drm_syncobj_array_find(file_private,
908 u64_to_user_ptr(args->handles),
909 args->count_handles,
910 &syncobjs);
911 if (ret < 0)
912 return ret;
913
914 for (i = 0; i < args->count_handles; i++)
915 drm_syncobj_replace_fence(syncobjs[i], NULL);
916
917 drm_syncobj_array_free(syncobjs, args->count_handles);
918
919 return 0;
920}
diff --git a/include/uapi/drm/drm.h b/include/uapi/drm/drm.h
index 4c746597225e..b037fdf9e43b 100644
--- a/include/uapi/drm/drm.h
+++ b/include/uapi/drm/drm.h
@@ -731,6 +731,12 @@ struct drm_syncobj_wait {
731 __u32 pad; 731 __u32 pad;
732}; 732};
733 733
734struct drm_syncobj_array {
735 __u64 handles;
736 __u32 count_handles;
737 __u32 pad;
738};
739
734#if defined(__cplusplus) 740#if defined(__cplusplus)
735} 741}
736#endif 742#endif
@@ -854,6 +860,7 @@ extern "C" {
854#define DRM_IOCTL_SYNCOBJ_HANDLE_TO_FD DRM_IOWR(0xC1, struct drm_syncobj_handle) 860#define DRM_IOCTL_SYNCOBJ_HANDLE_TO_FD DRM_IOWR(0xC1, struct drm_syncobj_handle)
855#define DRM_IOCTL_SYNCOBJ_FD_TO_HANDLE DRM_IOWR(0xC2, struct drm_syncobj_handle) 861#define DRM_IOCTL_SYNCOBJ_FD_TO_HANDLE DRM_IOWR(0xC2, struct drm_syncobj_handle)
856#define DRM_IOCTL_SYNCOBJ_WAIT DRM_IOWR(0xC3, struct drm_syncobj_wait) 862#define DRM_IOCTL_SYNCOBJ_WAIT DRM_IOWR(0xC3, struct drm_syncobj_wait)
863#define DRM_IOCTL_SYNCOBJ_RESET DRM_IOWR(0xC4, struct drm_syncobj_array)
857 864
858/** 865/**
859 * Device specific ioctls should only be in their respective headers 866 * Device specific ioctls should only be in their respective headers