anv: split events from anv_device.c
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Acked-by: Ivan Briano <ivan.briano@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30285>
This commit is contained in:
committed by
Marge Bot
parent
ca51a02e7b
commit
c59e8e814a
@@ -1936,88 +1936,6 @@ VkResult anv_BindBufferMemory2(
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
// Event functions
|
||||
|
||||
VkResult anv_CreateEvent(
|
||||
VkDevice _device,
|
||||
const VkEventCreateInfo* pCreateInfo,
|
||||
const VkAllocationCallbacks* pAllocator,
|
||||
VkEvent* pEvent)
|
||||
{
|
||||
ANV_FROM_HANDLE(anv_device, device, _device);
|
||||
struct anv_event *event;
|
||||
|
||||
assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_EVENT_CREATE_INFO);
|
||||
|
||||
event = vk_object_alloc(&device->vk, pAllocator, sizeof(*event),
|
||||
VK_OBJECT_TYPE_EVENT);
|
||||
if (event == NULL)
|
||||
return vk_error(device, VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||
|
||||
event->state = anv_state_pool_alloc(&device->dynamic_state_pool,
|
||||
sizeof(uint64_t), 8);
|
||||
*(uint64_t *)event->state.map = VK_EVENT_RESET;
|
||||
|
||||
ANV_RMV(event_create, device, event, pCreateInfo->flags, false);
|
||||
|
||||
*pEvent = anv_event_to_handle(event);
|
||||
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
void anv_DestroyEvent(
|
||||
VkDevice _device,
|
||||
VkEvent _event,
|
||||
const VkAllocationCallbacks* pAllocator)
|
||||
{
|
||||
ANV_FROM_HANDLE(anv_device, device, _device);
|
||||
ANV_FROM_HANDLE(anv_event, event, _event);
|
||||
|
||||
if (!event)
|
||||
return;
|
||||
|
||||
ANV_RMV(resource_destroy, device, event);
|
||||
|
||||
anv_state_pool_free(&device->dynamic_state_pool, event->state);
|
||||
|
||||
vk_object_free(&device->vk, pAllocator, event);
|
||||
}
|
||||
|
||||
VkResult anv_GetEventStatus(
|
||||
VkDevice _device,
|
||||
VkEvent _event)
|
||||
{
|
||||
ANV_FROM_HANDLE(anv_device, device, _device);
|
||||
ANV_FROM_HANDLE(anv_event, event, _event);
|
||||
|
||||
if (vk_device_is_lost(&device->vk))
|
||||
return VK_ERROR_DEVICE_LOST;
|
||||
|
||||
return *(uint64_t *)event->state.map;
|
||||
}
|
||||
|
||||
VkResult anv_SetEvent(
|
||||
VkDevice _device,
|
||||
VkEvent _event)
|
||||
{
|
||||
ANV_FROM_HANDLE(anv_event, event, _event);
|
||||
|
||||
*(uint64_t *)event->state.map = VK_EVENT_SET;
|
||||
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
VkResult anv_ResetEvent(
|
||||
VkDevice _device,
|
||||
VkEvent _event)
|
||||
{
|
||||
ANV_FROM_HANDLE(anv_event, event, _event);
|
||||
|
||||
*(uint64_t *)event->state.map = VK_EVENT_RESET;
|
||||
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
// Buffer functions
|
||||
|
||||
static void
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
/* Copyright © 2024 Intel Corporation
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#include "anv_private.h"
|
||||
|
||||
VkResult anv_CreateEvent(
|
||||
VkDevice _device,
|
||||
const VkEventCreateInfo* pCreateInfo,
|
||||
const VkAllocationCallbacks* pAllocator,
|
||||
VkEvent* pEvent)
|
||||
{
|
||||
ANV_FROM_HANDLE(anv_device, device, _device);
|
||||
struct anv_event *event;
|
||||
|
||||
assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_EVENT_CREATE_INFO);
|
||||
|
||||
event = vk_object_alloc(&device->vk, pAllocator, sizeof(*event),
|
||||
VK_OBJECT_TYPE_EVENT);
|
||||
if (event == NULL)
|
||||
return vk_error(device, VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||
|
||||
event->state = anv_state_pool_alloc(&device->dynamic_state_pool,
|
||||
sizeof(uint64_t), 8);
|
||||
*(uint64_t *)event->state.map = VK_EVENT_RESET;
|
||||
|
||||
ANV_RMV(event_create, device, event, pCreateInfo->flags, false);
|
||||
|
||||
*pEvent = anv_event_to_handle(event);
|
||||
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
void anv_DestroyEvent(
|
||||
VkDevice _device,
|
||||
VkEvent _event,
|
||||
const VkAllocationCallbacks* pAllocator)
|
||||
{
|
||||
ANV_FROM_HANDLE(anv_device, device, _device);
|
||||
ANV_FROM_HANDLE(anv_event, event, _event);
|
||||
|
||||
if (!event)
|
||||
return;
|
||||
|
||||
ANV_RMV(resource_destroy, device, event);
|
||||
|
||||
anv_state_pool_free(&device->dynamic_state_pool, event->state);
|
||||
|
||||
vk_object_free(&device->vk, pAllocator, event);
|
||||
}
|
||||
|
||||
VkResult anv_GetEventStatus(
|
||||
VkDevice _device,
|
||||
VkEvent _event)
|
||||
{
|
||||
ANV_FROM_HANDLE(anv_device, device, _device);
|
||||
ANV_FROM_HANDLE(anv_event, event, _event);
|
||||
|
||||
if (vk_device_is_lost(&device->vk))
|
||||
return VK_ERROR_DEVICE_LOST;
|
||||
|
||||
return *(uint64_t *)event->state.map;
|
||||
}
|
||||
|
||||
VkResult anv_SetEvent(
|
||||
VkDevice _device,
|
||||
VkEvent _event)
|
||||
{
|
||||
ANV_FROM_HANDLE(anv_event, event, _event);
|
||||
|
||||
*(uint64_t *)event->state.map = VK_EVENT_SET;
|
||||
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
VkResult anv_ResetEvent(
|
||||
VkDevice _device,
|
||||
VkEvent _event)
|
||||
{
|
||||
ANV_FROM_HANDLE(anv_event, event, _event);
|
||||
|
||||
*(uint64_t *)event->state.map = VK_EVENT_RESET;
|
||||
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
@@ -151,6 +151,7 @@ libanv_files = files(
|
||||
'anv_cmd_buffer.c',
|
||||
'anv_descriptor_set.c',
|
||||
'anv_device.c',
|
||||
'anv_event.c',
|
||||
'anv_formats.c',
|
||||
'anv_genX.h',
|
||||
'anv_image.c',
|
||||
|
||||
Reference in New Issue
Block a user