anv: Remove unnecessary syncobj wrappers
These are entirely unused except for the syncobj in submit_simple_batch. We can use the libdrm wrappers for that as they're basically equivalent and the core Vulkan sync code already depends on them. Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13427>
This commit is contained in:
@@ -32,7 +32,6 @@
|
||||
#include "anv_private.h"
|
||||
#include "common/intel_defines.h"
|
||||
#include "common/intel_gem.h"
|
||||
#include "drm-uapi/sync_file.h"
|
||||
|
||||
/**
|
||||
* Wrapper around DRM_IOCTL_I915_GEM_CREATE.
|
||||
@@ -533,193 +532,6 @@ anv_gem_reg_read(int fd, uint32_t offset, uint64_t *result)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
anv_gem_sync_file_merge(struct anv_device *device, int fd1, int fd2)
|
||||
{
|
||||
struct sync_merge_data args = {
|
||||
.name = "anv merge fence",
|
||||
.fd2 = fd2,
|
||||
.fence = -1,
|
||||
};
|
||||
|
||||
int ret = intel_ioctl(fd1, SYNC_IOC_MERGE, &args);
|
||||
if (ret == -1)
|
||||
return -1;
|
||||
|
||||
return args.fence;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
anv_gem_syncobj_create(struct anv_device *device, uint32_t flags)
|
||||
{
|
||||
struct drm_syncobj_create args = {
|
||||
.flags = flags,
|
||||
};
|
||||
|
||||
int ret = intel_ioctl(device->fd, DRM_IOCTL_SYNCOBJ_CREATE, &args);
|
||||
if (ret)
|
||||
return 0;
|
||||
|
||||
return args.handle;
|
||||
}
|
||||
|
||||
void
|
||||
anv_gem_syncobj_destroy(struct anv_device *device, uint32_t handle)
|
||||
{
|
||||
struct drm_syncobj_destroy args = {
|
||||
.handle = handle,
|
||||
};
|
||||
|
||||
intel_ioctl(device->fd, DRM_IOCTL_SYNCOBJ_DESTROY, &args);
|
||||
}
|
||||
|
||||
int
|
||||
anv_gem_syncobj_handle_to_fd(struct anv_device *device, uint32_t handle)
|
||||
{
|
||||
struct drm_syncobj_handle args = {
|
||||
.handle = handle,
|
||||
};
|
||||
|
||||
int ret = intel_ioctl(device->fd, DRM_IOCTL_SYNCOBJ_HANDLE_TO_FD, &args);
|
||||
if (ret)
|
||||
return -1;
|
||||
|
||||
return args.fd;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
anv_gem_syncobj_fd_to_handle(struct anv_device *device, int fd)
|
||||
{
|
||||
struct drm_syncobj_handle args = {
|
||||
.fd = fd,
|
||||
};
|
||||
|
||||
int ret = intel_ioctl(device->fd, DRM_IOCTL_SYNCOBJ_FD_TO_HANDLE, &args);
|
||||
if (ret)
|
||||
return 0;
|
||||
|
||||
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 = intel_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 intel_ioctl(device->fd, DRM_IOCTL_SYNCOBJ_FD_TO_HANDLE, &args);
|
||||
}
|
||||
|
||||
void
|
||||
anv_gem_syncobj_reset(struct anv_device *device, uint32_t handle)
|
||||
{
|
||||
struct drm_syncobj_array args = {
|
||||
.handles = (uint64_t)(uintptr_t)&handle,
|
||||
.count_handles = 1,
|
||||
};
|
||||
|
||||
intel_ioctl(device->fd, DRM_IOCTL_SYNCOBJ_RESET, &args);
|
||||
}
|
||||
|
||||
bool
|
||||
anv_gem_supports_syncobj_wait(int fd)
|
||||
{
|
||||
return intel_gem_supports_syncobj_wait(fd);
|
||||
}
|
||||
|
||||
int
|
||||
anv_gem_syncobj_wait(struct anv_device *device,
|
||||
const uint32_t *handles, uint32_t num_handles,
|
||||
int64_t abs_timeout_ns, bool wait_all)
|
||||
{
|
||||
struct drm_syncobj_wait args = {
|
||||
.handles = (uint64_t)(uintptr_t)handles,
|
||||
.count_handles = num_handles,
|
||||
.timeout_nsec = abs_timeout_ns,
|
||||
.flags = DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT,
|
||||
};
|
||||
|
||||
if (wait_all)
|
||||
args.flags |= DRM_SYNCOBJ_WAIT_FLAGS_WAIT_ALL;
|
||||
|
||||
return intel_ioctl(device->fd, DRM_IOCTL_SYNCOBJ_WAIT, &args);
|
||||
}
|
||||
|
||||
int
|
||||
anv_gem_syncobj_timeline_wait(struct anv_device *device,
|
||||
const uint32_t *handles, const uint64_t *points,
|
||||
uint32_t num_items, int64_t abs_timeout_ns,
|
||||
bool wait_all, bool wait_materialize)
|
||||
{
|
||||
assert(device->physical->has_syncobj_wait_available);
|
||||
|
||||
struct drm_syncobj_timeline_wait args = {
|
||||
.handles = (uint64_t)(uintptr_t)handles,
|
||||
.points = (uint64_t)(uintptr_t)points,
|
||||
.count_handles = num_items,
|
||||
.timeout_nsec = abs_timeout_ns,
|
||||
.flags = DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT,
|
||||
};
|
||||
|
||||
if (wait_all)
|
||||
args.flags |= DRM_SYNCOBJ_WAIT_FLAGS_WAIT_ALL;
|
||||
if (wait_materialize)
|
||||
args.flags |= DRM_SYNCOBJ_WAIT_FLAGS_WAIT_AVAILABLE;
|
||||
|
||||
return intel_ioctl(device->fd, DRM_IOCTL_SYNCOBJ_TIMELINE_WAIT, &args);
|
||||
}
|
||||
|
||||
int
|
||||
anv_gem_syncobj_timeline_signal(struct anv_device *device,
|
||||
const uint32_t *handles, const uint64_t *points,
|
||||
uint32_t num_items)
|
||||
{
|
||||
assert(device->physical->has_syncobj_wait_available);
|
||||
|
||||
struct drm_syncobj_timeline_array args = {
|
||||
.handles = (uint64_t)(uintptr_t)handles,
|
||||
.points = (uint64_t)(uintptr_t)points,
|
||||
.count_handles = num_items,
|
||||
};
|
||||
|
||||
return intel_ioctl(device->fd, DRM_IOCTL_SYNCOBJ_TIMELINE_SIGNAL, &args);
|
||||
}
|
||||
|
||||
int
|
||||
anv_gem_syncobj_timeline_query(struct anv_device *device,
|
||||
const uint32_t *handles, uint64_t *points,
|
||||
uint32_t num_items)
|
||||
{
|
||||
assert(device->physical->has_syncobj_wait_available);
|
||||
|
||||
struct drm_syncobj_timeline_array args = {
|
||||
.handles = (uint64_t)(uintptr_t)handles,
|
||||
.points = (uint64_t)(uintptr_t)points,
|
||||
.count_handles = num_items,
|
||||
};
|
||||
|
||||
return intel_ioctl(device->fd, DRM_IOCTL_SYNCOBJ_QUERY, &args);
|
||||
}
|
||||
|
||||
struct drm_i915_query_engine_info *
|
||||
anv_gem_get_engine_info(int fd)
|
||||
{
|
||||
|
Reference in New Issue
Block a user