summaryrefslogtreecommitdiffstats
path: root/src/intel/vulkan/anv_gem.c
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2017-08-08 15:17:31 -0700
committerJason Ekstrand <[email protected]>2017-08-28 19:33:43 -0700
commit43e8808b82b9ebaecde4a30984fef897c1a1a030 (patch)
tree19c61a27998bd27686e05ee003d1f5f00c463451 /src/intel/vulkan/anv_gem.c
parent49c59c88eb725cba113ea51307ba66223e411e9a (diff)
anv: Add support for the SYNC_FD handle type for fences
Reviewed-by: Lionel Landwerlin <[email protected]>
Diffstat (limited to 'src/intel/vulkan/anv_gem.c')
-rw-r--r--src/intel/vulkan/anv_gem.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/intel/vulkan/anv_gem.c b/src/intel/vulkan/anv_gem.c
index 8283117cd0e..3994c6b66c2 100644
--- a/src/intel/vulkan/anv_gem.c
+++ b/src/intel/vulkan/anv_gem.c
@@ -489,6 +489,34 @@ anv_gem_syncobj_fd_to_handle(struct anv_device *device, int fd)
return args.handle;
}
+int
+anv_gem_syncobj_export_sync_file(struct anv_device *device, uint32_t handle)
+{
+ struct drm_syncobj_handle args = {
+ .handle = handle,
+ .flags = DRM_SYNCOBJ_HANDLE_TO_FD_FLAGS_EXPORT_SYNC_FILE,
+ };
+
+ int ret = anv_ioctl(device->fd, DRM_IOCTL_SYNCOBJ_HANDLE_TO_FD, &args);
+ if (ret)
+ return -1;
+
+ return args.fd;
+}
+
+int
+anv_gem_syncobj_import_sync_file(struct anv_device *device,
+ uint32_t handle, int fd)
+{
+ struct drm_syncobj_handle args = {
+ .handle = handle,
+ .fd = fd,
+ .flags = DRM_SYNCOBJ_FD_TO_HANDLE_FLAGS_IMPORT_SYNC_FILE,
+ };
+
+ return anv_ioctl(device->fd, DRM_IOCTL_SYNCOBJ_FD_TO_HANDLE, &args);
+}
+
void
anv_gem_syncobj_reset(struct anv_device *device, uint32_t handle)
{