anv: Implement vk_device::create_sync_for_memory
Fixes: 36ea90a361
("anv: Convert to the common sync and submit framework")
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14237>
This commit is contained in:

committed by
Marge Bot

parent
2188829d29
commit
9ae1e621e5
@@ -212,10 +212,11 @@ const struct vk_sync_type anv_bo_sync_type = {
|
|||||||
.wait_many = anv_bo_sync_wait,
|
.wait_many = anv_bo_sync_wait,
|
||||||
};
|
};
|
||||||
|
|
||||||
VkResult
|
static VkResult
|
||||||
anv_sync_create_for_bo(struct anv_device *device,
|
_anv_sync_create_for_bo(struct anv_device *device,
|
||||||
struct anv_bo *bo,
|
struct anv_bo *bo,
|
||||||
struct vk_sync **sync_out)
|
enum anv_bo_sync_state state,
|
||||||
|
struct vk_sync **sync_out)
|
||||||
{
|
{
|
||||||
struct anv_bo_sync *bo_sync;
|
struct anv_bo_sync *bo_sync;
|
||||||
|
|
||||||
@@ -225,10 +226,35 @@ anv_sync_create_for_bo(struct anv_device *device,
|
|||||||
return vk_error(device, VK_ERROR_OUT_OF_HOST_MEMORY);
|
return vk_error(device, VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||||
|
|
||||||
bo_sync->sync.type = &anv_bo_sync_type;
|
bo_sync->sync.type = &anv_bo_sync_type;
|
||||||
bo_sync->state = ANV_BO_SYNC_STATE_SUBMITTED;
|
bo_sync->state = state;
|
||||||
bo_sync->bo = anv_bo_ref(bo);
|
bo_sync->bo = anv_bo_ref(bo);
|
||||||
|
|
||||||
*sync_out = &bo_sync->sync;
|
*sync_out = &bo_sync->sync;
|
||||||
|
|
||||||
return VK_SUCCESS;
|
return VK_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VkResult
|
||||||
|
anv_sync_create_for_bo(struct anv_device *device,
|
||||||
|
struct anv_bo *bo,
|
||||||
|
struct vk_sync **sync_out)
|
||||||
|
{
|
||||||
|
return _anv_sync_create_for_bo(device, bo, ANV_BO_SYNC_STATE_SUBMITTED,
|
||||||
|
sync_out);
|
||||||
|
}
|
||||||
|
|
||||||
|
VkResult
|
||||||
|
anv_create_sync_for_memory(struct vk_device *vk_device,
|
||||||
|
VkDeviceMemory memory,
|
||||||
|
bool signal_memory,
|
||||||
|
struct vk_sync **sync_out)
|
||||||
|
{
|
||||||
|
ANV_FROM_HANDLE(anv_device_memory, mem, memory);
|
||||||
|
struct anv_device *device =
|
||||||
|
container_of(vk_device, struct anv_device, vk);
|
||||||
|
|
||||||
|
enum anv_bo_sync_state state = signal_memory ?
|
||||||
|
ANV_BO_SYNC_STATE_RESET : ANV_BO_SYNC_STATE_SUBMITTED;
|
||||||
|
|
||||||
|
return _anv_sync_create_for_bo(device, mem->bo, state, sync_out);
|
||||||
|
}
|
||||||
|
@@ -3025,6 +3025,7 @@ VkResult anv_CreateDevice(
|
|||||||
}
|
}
|
||||||
|
|
||||||
device->vk.check_status = anv_device_check_status;
|
device->vk.check_status = anv_device_check_status;
|
||||||
|
device->vk.create_sync_for_memory = anv_create_sync_for_memory;
|
||||||
vk_device_set_drm_fd(&device->vk, device->fd);
|
vk_device_set_drm_fd(&device->vk, device->fd);
|
||||||
|
|
||||||
uint32_t num_queues = 0;
|
uint32_t num_queues = 0;
|
||||||
|
@@ -3176,6 +3176,11 @@ VkResult anv_sync_create_for_bo(struct anv_device *device,
|
|||||||
struct anv_bo *bo,
|
struct anv_bo *bo,
|
||||||
struct vk_sync **sync_out);
|
struct vk_sync **sync_out);
|
||||||
|
|
||||||
|
VkResult anv_create_sync_for_memory(struct vk_device *device,
|
||||||
|
VkDeviceMemory memory,
|
||||||
|
bool signal_memory,
|
||||||
|
struct vk_sync **sync_out);
|
||||||
|
|
||||||
struct anv_event {
|
struct anv_event {
|
||||||
struct vk_object_base base;
|
struct vk_object_base base;
|
||||||
uint64_t semaphore;
|
uint64_t semaphore;
|
||||||
|
Reference in New Issue
Block a user