anv: Add a trivial implementation of VK_KHR_deferred_host_operation

This isn't actually capable of deferring anything; it just trivially
returns success.

Acked-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7735>
This commit is contained in:
Jason Ekstrand 2020-06-22 11:57:32 -05:00 committed by Jason Ekstrand
parent af1aef10f9
commit 63a431b81c
6 changed files with 198 additions and 0 deletions

View File

@ -43,6 +43,7 @@
#include "util/driconf.h"
#include "git_sha1.h"
#include "vk_util.h"
#include "vk_deferred_operation.h"
#include "common/gen_aux_map.h"
#include "common/gen_defines.h"
#include "common/gen_uuid.h"
@ -4697,3 +4698,46 @@ void anv_GetPrivateDataEXT(
objectType, objectHandle,
privateDataSlot, pData);
}
VkResult anv_CreateDeferredOperationKHR(
VkDevice _device,
const VkAllocationCallbacks* pAllocator,
VkDeferredOperationKHR* pDeferredOperation)
{
ANV_FROM_HANDLE(anv_device, device, _device);
return vk_create_deferred_operation(&device->vk, pAllocator,
pDeferredOperation);
}
void anv_DestroyDeferredOperationKHR(
VkDevice _device,
VkDeferredOperationKHR operation,
const VkAllocationCallbacks* pAllocator)
{
ANV_FROM_HANDLE(anv_device, device, _device);
vk_destroy_deferred_operation(&device->vk, operation, pAllocator);
}
uint32_t anv_GetDeferredOperationMaxConcurrencyKHR(
VkDevice _device,
VkDeferredOperationKHR operation)
{
ANV_FROM_HANDLE(anv_device, device, _device);
return vk_get_deferred_operation_max_concurrency(&device->vk, operation);
}
VkResult anv_GetDeferredOperationResultKHR(
VkDevice _device,
VkDeferredOperationKHR operation)
{
ANV_FROM_HANDLE(anv_device, device, _device);
return vk_get_deferred_operation_result(&device->vk, operation);
}
VkResult anv_DeferredOperationJoinKHR(
VkDevice _device,
VkDeferredOperationKHR operation)
{
ANV_FROM_HANDLE(anv_device, device, _device);
return vk_deferred_operation_join(&device->vk, operation);
}

View File

@ -59,6 +59,7 @@ EXTENSIONS = [
Extension('VK_KHR_copy_commands2', 1, True),
Extension('VK_KHR_create_renderpass2', 1, True),
Extension('VK_KHR_dedicated_allocation', 3, True),
Extension('VK_KHR_deferred_host_operations', 1, True),
Extension('VK_KHR_depth_stencil_resolve', 1, True),
Extension('VK_KHR_descriptor_update_template', 1, True),
Extension('VK_KHR_device_group', 4, True),

View File

@ -27,6 +27,8 @@ VULKAN_UTIL_FILES := \
util/vk_alloc.h \
util/vk_debug_report.c \
util/vk_debug_report.h \
util/vk_deferred_operation.c \
util/vk_deferred_operation.h \
util/vk_format.c \
util/vk_object.c \
util/vk_object.h \

View File

@ -22,6 +22,8 @@ files_vulkan_util = files(
'vk_alloc.h',
'vk_debug_report.c',
'vk_debug_report.h',
'vk_deferred_operation.c',
'vk_deferred_operation.h',
'vk_format.c',
'vk_object.c',
'vk_object.h',

View File

@ -0,0 +1,80 @@
/*
* Copyright © 2020 Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/
#include "vk_deferred_operation.h"
#include "vk_alloc.h"
VkResult
vk_create_deferred_operation(struct vk_device *device,
const VkAllocationCallbacks *pAllocator,
VkDeferredOperationKHR *pDeferredOperation)
{
struct vk_deferred_operation *op =
vk_alloc2(&device->alloc, pAllocator, sizeof(*op), 8,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (op == NULL)
return VK_ERROR_OUT_OF_HOST_MEMORY;
vk_object_base_init(device, &op->base,
VK_OBJECT_TYPE_DEFERRED_OPERATION_KHR);
*pDeferredOperation = vk_deferred_operation_to_handle(op);
return VK_SUCCESS;
}
void
vk_destroy_deferred_operation(struct vk_device *device,
VkDeferredOperationKHR operation,
const VkAllocationCallbacks *pAllocator)
{
if (operation == VK_NULL_HANDLE)
return;
VK_FROM_HANDLE(vk_deferred_operation, op, operation);
vk_object_base_finish(&op->base);
vk_free2(&device->alloc, pAllocator, op);
}
uint32_t
vk_get_deferred_operation_max_concurrency(UNUSED struct vk_device *device,
UNUSED VkDeferredOperationKHR operation)
{
return 1;
}
VkResult
vk_get_deferred_operation_result(UNUSED struct vk_device *device,
UNUSED VkDeferredOperationKHR operation)
{
return VK_SUCCESS;
}
VkResult
vk_deferred_operation_join(UNUSED struct vk_device *device,
UNUSED VkDeferredOperationKHR operation)
{
return VK_SUCCESS;
}

View File

@ -0,0 +1,69 @@
/*
* Copyright © 2020 Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/
#ifndef VK_DEFERRED_OPERATION_H
#define VK_DEFERRED_OPERATION_H
#include "vk_object.h"
#include "c11/threads.h"
#include "util/list.h"
#ifdef __cplusplus
extern "C" {
#endif
struct vk_deferred_operation {
struct vk_object_base base;
};
VK_DEFINE_NONDISP_HANDLE_CASTS(vk_deferred_operation, base,
VkDeferredOperationKHR,
VK_OBJECT_TYPE_DEFERRED_OPERATION_KHR)
VkResult
vk_create_deferred_operation(struct vk_device *device,
const VkAllocationCallbacks *pAllocator,
VkDeferredOperationKHR *pDeferredOperation);
void
vk_destroy_deferred_operation(struct vk_device *device,
VkDeferredOperationKHR operation,
const VkAllocationCallbacks *pAllocator);
uint32_t
vk_get_deferred_operation_max_concurrency(struct vk_device *device,
VkDeferredOperationKHR operation);
VkResult
vk_get_deferred_operation_result(struct vk_device *device,
VkDeferredOperationKHR operation);
VkResult
vk_deferred_operation_join(struct vk_device *device,
VkDeferredOperationKHR operation);
#ifdef __cplusplus
}
#endif
#endif /* VK_DEFERRED_OPERATION_H */