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:
@@ -27,6 +27,8 @@
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include <xf86drm.h>
|
||||
|
||||
#include "anv_private.h"
|
||||
#include "anv_measure.h"
|
||||
|
||||
@@ -2266,6 +2268,7 @@ anv_queue_submit_simple_batch(struct anv_queue *queue,
|
||||
{
|
||||
struct anv_device *device = queue->device;
|
||||
VkResult result = VK_SUCCESS;
|
||||
int err;
|
||||
|
||||
if (queue->device->info.no_hw)
|
||||
return VK_SUCCESS;
|
||||
@@ -2307,9 +2310,10 @@ anv_queue_submit_simple_batch(struct anv_queue *queue,
|
||||
|
||||
struct drm_i915_gem_exec_fence fence = {};
|
||||
if (device->physical->has_syncobj_wait) {
|
||||
fence.handle = anv_gem_syncobj_create(device, 0);
|
||||
if (fence.handle == 0) {
|
||||
result = vk_error(queue, VK_ERROR_OUT_OF_DEVICE_MEMORY);
|
||||
err = drmSyncobjCreate(device->fd, 0, &fence.handle);
|
||||
if (err != 0) {
|
||||
result = vk_errorf(queue, VK_ERROR_OUT_OF_DEVICE_MEMORY,
|
||||
"drmSyncobjCreate failed: %m");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
@@ -2320,17 +2324,17 @@ anv_queue_submit_simple_batch(struct anv_queue *queue,
|
||||
execbuf.execbuf.cliprects_ptr = (uintptr_t)&fence;
|
||||
}
|
||||
|
||||
int err = anv_gem_execbuffer(device, &execbuf.execbuf);
|
||||
err = anv_gem_execbuffer(device, &execbuf.execbuf);
|
||||
if (err) {
|
||||
result = vk_device_set_lost(&device->vk, "anv_gem_execbuffer failed: %m");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (fence.handle) {
|
||||
err = anv_gem_syncobj_wait(device, &fence.handle, 1, INT64_MAX, true);
|
||||
err = drmSyncobjWait(device->fd, &fence.handle, 1, INT64_MAX, 0, NULL);
|
||||
if (err) {
|
||||
result = vk_device_set_lost(&device->vk,
|
||||
"anv_gem_syncobj_wait failed: %m");
|
||||
"drmSyncobjWait failed: %m");
|
||||
goto fail;
|
||||
}
|
||||
} else {
|
||||
@@ -2345,7 +2349,7 @@ anv_queue_submit_simple_batch(struct anv_queue *queue,
|
||||
fail:
|
||||
anv_execbuf_finish(&execbuf);
|
||||
if (fence.handle)
|
||||
anv_gem_syncobj_destroy(device, fence.handle);
|
||||
drmSyncobjDestroy(device->fd, fence.handle);
|
||||
anv_bo_pool_free(&device->batch_bo_pool, batch_bo);
|
||||
|
||||
return result;
|
||||
|
@@ -871,7 +871,7 @@ anv_physical_device_try_create(struct anv_instance *instance,
|
||||
|
||||
device->has_exec_async = anv_gem_get_param(fd, I915_PARAM_HAS_EXEC_ASYNC);
|
||||
device->has_exec_capture = anv_gem_get_param(fd, I915_PARAM_HAS_EXEC_CAPTURE);
|
||||
device->has_syncobj_wait = anv_gem_supports_syncobj_wait(fd);
|
||||
device->has_syncobj_wait = intel_gem_supports_syncobj_wait(fd);
|
||||
device->has_syncobj_wait_available =
|
||||
anv_gem_get_drm_cap(fd, DRM_CAP_SYNCOBJ_TIMELINE) != 0;
|
||||
|
||||
|
@@ -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)
|
||||
{
|
||||
|
@@ -192,61 +192,6 @@ anv_gem_fd_to_handle(struct anv_device *device, int fd)
|
||||
unreachable("Unused");
|
||||
}
|
||||
|
||||
int
|
||||
anv_gem_sync_file_merge(struct anv_device *device, int fd1, int fd2)
|
||||
{
|
||||
unreachable("Unused");
|
||||
}
|
||||
|
||||
int
|
||||
anv_gem_syncobj_export_sync_file(struct anv_device *device, uint32_t handle)
|
||||
{
|
||||
unreachable("Unused");
|
||||
}
|
||||
|
||||
int
|
||||
anv_gem_syncobj_import_sync_file(struct anv_device *device,
|
||||
uint32_t handle, int fd)
|
||||
{
|
||||
unreachable("Unused");
|
||||
}
|
||||
|
||||
uint32_t
|
||||
anv_gem_syncobj_create(struct anv_device *device, uint32_t flags)
|
||||
{
|
||||
unreachable("Unused");
|
||||
}
|
||||
|
||||
void
|
||||
anv_gem_syncobj_destroy(struct anv_device *device, uint32_t handle)
|
||||
{
|
||||
unreachable("Unused");
|
||||
}
|
||||
|
||||
int
|
||||
anv_gem_syncobj_handle_to_fd(struct anv_device *device, uint32_t handle)
|
||||
{
|
||||
unreachable("Unused");
|
||||
}
|
||||
|
||||
uint32_t
|
||||
anv_gem_syncobj_fd_to_handle(struct anv_device *device, int fd)
|
||||
{
|
||||
unreachable("Unused");
|
||||
}
|
||||
|
||||
void
|
||||
anv_gem_syncobj_reset(struct anv_device *device, uint32_t handle)
|
||||
{
|
||||
unreachable("Unused");
|
||||
}
|
||||
|
||||
bool
|
||||
anv_gem_supports_syncobj_wait(int fd)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int
|
||||
anv_i915_query(int fd, uint64_t query_id, void *buffer,
|
||||
int32_t *buffer_len)
|
||||
@@ -276,41 +221,8 @@ anv_gem_count_engines(const struct drm_i915_query_engine_info *info,
|
||||
unreachable("Unused");
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
unreachable("Unused");
|
||||
}
|
||||
|
||||
int
|
||||
anv_gem_reg_read(int fd, uint32_t offset, uint64_t *result)
|
||||
{
|
||||
unreachable("Unused");
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
unreachable("Unused");
|
||||
}
|
||||
|
||||
int
|
||||
anv_gem_syncobj_timeline_signal(struct anv_device *device,
|
||||
const uint32_t *handles, const uint64_t *points,
|
||||
uint32_t num_items)
|
||||
{
|
||||
unreachable("Unused");
|
||||
}
|
||||
|
||||
int
|
||||
anv_gem_syncobj_timeline_query(struct anv_device *device,
|
||||
const uint32_t *handles, uint64_t *points,
|
||||
uint32_t num_items)
|
||||
{
|
||||
unreachable("Unused");
|
||||
}
|
||||
|
@@ -1387,30 +1387,6 @@ uint32_t anv_gem_fd_to_handle(struct anv_device *device, int fd);
|
||||
int anv_gem_set_caching(struct anv_device *device, uint32_t gem_handle, uint32_t caching);
|
||||
int anv_gem_set_domain(struct anv_device *device, uint32_t gem_handle,
|
||||
uint32_t read_domains, uint32_t write_domain);
|
||||
int anv_gem_sync_file_merge(struct anv_device *device, int fd1, int fd2);
|
||||
uint32_t anv_gem_syncobj_create(struct anv_device *device, uint32_t flags);
|
||||
void anv_gem_syncobj_destroy(struct anv_device *device, uint32_t handle);
|
||||
int anv_gem_syncobj_handle_to_fd(struct anv_device *device, uint32_t handle);
|
||||
uint32_t anv_gem_syncobj_fd_to_handle(struct anv_device *device, int fd);
|
||||
int anv_gem_syncobj_export_sync_file(struct anv_device *device,
|
||||
uint32_t handle);
|
||||
int anv_gem_syncobj_import_sync_file(struct anv_device *device,
|
||||
uint32_t handle, int fd);
|
||||
void anv_gem_syncobj_reset(struct anv_device *device, uint32_t handle);
|
||||
bool anv_gem_supports_syncobj_wait(int 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);
|
||||
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);
|
||||
int anv_gem_syncobj_timeline_signal(struct anv_device *device,
|
||||
const uint32_t *handles, const uint64_t *points,
|
||||
uint32_t num_items);
|
||||
int anv_gem_syncobj_timeline_query(struct anv_device *device,
|
||||
const uint32_t *handles, uint64_t *points,
|
||||
uint32_t num_items);
|
||||
int anv_i915_query(int fd, uint64_t query_id, void *buffer,
|
||||
int32_t *buffer_len);
|
||||
struct drm_i915_query_engine_info *anv_gem_get_engine_info(int fd);
|
||||
|
Reference in New Issue
Block a user