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>
This commit is contained in:
parent
3e6fb72d6c
commit
aa4035d2c7
|
@ -169,3 +169,5 @@ int drm_syncobj_fd_to_handle_ioctl(struct drm_device *dev, void *data,
|
|||
struct drm_file *file_private);
|
||||
int drm_syncobj_wait_ioctl(struct drm_device *dev, void *data,
|
||||
struct drm_file *file_private);
|
||||
int drm_syncobj_reset_ioctl(struct drm_device *dev, void *data,
|
||||
struct drm_file *file_private);
|
||||
|
|
|
@ -659,6 +659,8 @@ static const struct drm_ioctl_desc drm_ioctls[] = {
|
|||
DRM_UNLOCKED|DRM_RENDER_ALLOW),
|
||||
DRM_IOCTL_DEF(DRM_IOCTL_SYNCOBJ_WAIT, drm_syncobj_wait_ioctl,
|
||||
DRM_UNLOCKED|DRM_RENDER_ALLOW),
|
||||
DRM_IOCTL_DEF(DRM_IOCTL_SYNCOBJ_RESET, drm_syncobj_reset_ioctl,
|
||||
DRM_UNLOCKED|DRM_RENDER_ALLOW),
|
||||
};
|
||||
|
||||
#define DRM_CORE_IOCTL_COUNT ARRAY_SIZE( drm_ioctls )
|
||||
|
|
|
@ -885,3 +885,36 @@ drm_syncobj_wait_ioctl(struct drm_device *dev, void *data,
|
|||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
drm_syncobj_reset_ioctl(struct drm_device *dev, void *data,
|
||||
struct drm_file *file_private)
|
||||
{
|
||||
struct drm_syncobj_array *args = data;
|
||||
struct drm_syncobj **syncobjs;
|
||||
uint32_t i;
|
||||
int ret;
|
||||
|
||||
if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ))
|
||||
return -ENODEV;
|
||||
|
||||
if (args->pad != 0)
|
||||
return -EINVAL;
|
||||
|
||||
if (args->count_handles == 0)
|
||||
return -EINVAL;
|
||||
|
||||
ret = drm_syncobj_array_find(file_private,
|
||||
u64_to_user_ptr(args->handles),
|
||||
args->count_handles,
|
||||
&syncobjs);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
for (i = 0; i < args->count_handles; i++)
|
||||
drm_syncobj_replace_fence(syncobjs[i], NULL);
|
||||
|
||||
drm_syncobj_array_free(syncobjs, args->count_handles);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -731,6 +731,12 @@ struct drm_syncobj_wait {
|
|||
__u32 pad;
|
||||
};
|
||||
|
||||
struct drm_syncobj_array {
|
||||
__u64 handles;
|
||||
__u32 count_handles;
|
||||
__u32 pad;
|
||||
};
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
@ -854,6 +860,7 @@ extern "C" {
|
|||
#define DRM_IOCTL_SYNCOBJ_HANDLE_TO_FD DRM_IOWR(0xC1, struct drm_syncobj_handle)
|
||||
#define DRM_IOCTL_SYNCOBJ_FD_TO_HANDLE DRM_IOWR(0xC2, struct drm_syncobj_handle)
|
||||
#define DRM_IOCTL_SYNCOBJ_WAIT DRM_IOWR(0xC3, struct drm_syncobj_wait)
|
||||
#define DRM_IOCTL_SYNCOBJ_RESET DRM_IOWR(0xC4, struct drm_syncobj_array)
|
||||
|
||||
/**
|
||||
* Device specific ioctls should only be in their respective headers
|
||||
|
|
Loading…
Reference in New Issue