From 1498b0877b419eb0f99e678fac2c9fe23100ecae Mon Sep 17 00:00:00 2001 From: Yiwei Zhang Date: Fri, 12 Aug 2022 05:45:44 +0000 Subject: [PATCH] venus: sync to latest venus protocol headers for syncFdFencing Signed-off-by: Yiwei Zhang Part-of: --- .../venus-protocol/vn_protocol_driver.h | 2 +- .../vn_protocol_driver_defines.h | 22 +- .../vn_protocol_driver_device_memory.h | 395 +++++++++++++++++ .../venus-protocol/vn_protocol_driver_fence.h | 85 ++++ .../venus-protocol/vn_protocol_driver_info.h | 5 +- .../vn_protocol_driver_semaphore.h | 233 ++++++++++ .../vn_protocol_driver_transport.h | 401 ------------------ 7 files changed, 735 insertions(+), 408 deletions(-) diff --git a/src/virtio/venus-protocol/vn_protocol_driver.h b/src/virtio/venus-protocol/vn_protocol_driver.h index 644cea963cc..2a9f4b4cf57 100644 --- a/src/virtio/venus-protocol/vn_protocol_driver.h +++ b/src/virtio/venus-protocol/vn_protocol_driver.h @@ -1,4 +1,4 @@ -/* This file is generated by venus-protocol git-78c39b98. */ +/* This file is generated by venus-protocol git-51c05d11. */ /* * Copyright 2020 Google LLC diff --git a/src/virtio/venus-protocol/vn_protocol_driver_defines.h b/src/virtio/venus-protocol/vn_protocol_driver_defines.h index e09c1121df4..f72e934bd7d 100644 --- a/src/virtio/venus-protocol/vn_protocol_driver_defines.h +++ b/src/virtio/venus-protocol/vn_protocol_driver_defines.h @@ -19,6 +19,7 @@ #define VK_STRUCTURE_TYPE_MEMORY_RESOURCE_PROPERTIES_MESA ((VkStructureType)1000384001) #define VK_STRUCTURE_TYPE_IMPORT_MEMORY_RESOURCE_INFO_MESA ((VkStructureType)1000384002) #define VK_STRUCTURE_TYPE_MEMORY_RESOURCE_ALLOCATION_SIZE_PROPERTIES_100000_MESA ((VkStructureType)1000384003) +#define VK_STRUCTURE_TYPE_IMPORT_SEMAPHORE_RESOURCE_INFO_100000_MESA ((VkStructureType)1000384004) typedef enum VkCommandTypeEXT { VK_COMMAND_TYPE_vkCreateInstance_EXT = 0, @@ -323,16 +324,18 @@ typedef enum VkCommandTypeEXT { VK_COMMAND_TYPE_vkCmdDrawIndirectByteCountEXT_EXT = 186, VK_COMMAND_TYPE_vkGetMemoryFdKHR_EXT = 193, VK_COMMAND_TYPE_vkGetMemoryFdPropertiesKHR_EXT = 194, - VK_COMMAND_TYPE_vkImportFenceFdKHR_EXT = 238, - VK_COMMAND_TYPE_vkGetFenceFdKHR_EXT = 239, + VK_COMMAND_TYPE_vkImportSemaphoreFdKHR_EXT = 242, + VK_COMMAND_TYPE_vkGetSemaphoreFdKHR_EXT = 243, VK_COMMAND_TYPE_vkCmdBeginConditionalRenderingEXT_EXT = 240, VK_COMMAND_TYPE_vkCmdEndConditionalRenderingEXT_EXT = 241, + VK_COMMAND_TYPE_vkImportFenceFdKHR_EXT = 238, + VK_COMMAND_TYPE_vkGetFenceFdKHR_EXT = 239, VK_COMMAND_TYPE_vkGetImageDrmFormatModifierPropertiesEXT_EXT = 187, - VK_COMMAND_TYPE_vkCmdSetPatchControlPointsEXT_EXT = 233, - VK_COMMAND_TYPE_vkCmdSetLogicOpEXT_EXT = 234, VK_COMMAND_TYPE_vkGetPhysicalDeviceCalibrateableTimeDomainsEXT_EXT = 235, VK_COMMAND_TYPE_vkGetCalibratedTimestampsEXT_EXT = 236, VK_COMMAND_TYPE_vkCmdSetLineStippleEXT_EXT = 237, + VK_COMMAND_TYPE_vkCmdSetPatchControlPointsEXT_EXT = 233, + VK_COMMAND_TYPE_vkCmdSetLogicOpEXT_EXT = 234, VK_COMMAND_TYPE_vkSetReplyCommandStreamMESA_EXT = 178, VK_COMMAND_TYPE_vkSeekReplyCommandStreamMESA_EXT = 179, VK_COMMAND_TYPE_vkExecuteCommandStreamsMESA_EXT = 180, @@ -341,6 +344,9 @@ typedef enum VkCommandTypeEXT { VK_COMMAND_TYPE_vkNotifyRingMESA_EXT = 190, VK_COMMAND_TYPE_vkWriteRingExtraMESA_EXT = 191, VK_COMMAND_TYPE_vkGetMemoryResourcePropertiesMESA_EXT = 192, + VK_COMMAND_TYPE_vkResetFenceResource100000MESA_EXT = 244, + VK_COMMAND_TYPE_vkWaitSemaphoreResource100000MESA_EXT = 245, + VK_COMMAND_TYPE_vkImportSemaphoreResource100000MESA_EXT = 246, VK_COMMAND_TYPE_vkGetVenusExperimentalFeatureData100000MESA_EXT = 195, } VkCommandTypeEXT; @@ -400,6 +406,7 @@ typedef struct VkVenusExperimentalFeatures100000MESA { VkBool32 memoryResourceAllocationSize; VkBool32 globalFencing; VkBool32 largeRing; + VkBool32 syncFdFencing; } VkVenusExperimentalFeatures100000MESA; typedef struct VkMemoryResourceAllocationSizeProperties100000MESA { @@ -408,4 +415,11 @@ typedef struct VkMemoryResourceAllocationSizeProperties100000MESA { uint64_t allocationSize; } VkMemoryResourceAllocationSizeProperties100000MESA; +typedef struct VkImportSemaphoreResourceInfo100000MESA { + VkStructureType sType; + const void* pNext; + VkSemaphore semaphore; + uint32_t resourceId; +} VkImportSemaphoreResourceInfo100000MESA; + #endif /* VN_PROTOCOL_DRIVER_DEFINES_H */ diff --git a/src/virtio/venus-protocol/vn_protocol_driver_device_memory.h b/src/virtio/venus-protocol/vn_protocol_driver_device_memory.h index dbdaccbc716..83b2ca08637 100644 --- a/src/virtio/venus-protocol/vn_protocol_driver_device_memory.h +++ b/src/virtio/venus-protocol/vn_protocol_driver_device_memory.h @@ -16,6 +16,8 @@ * * VkImportMemoryFdInfoKHR * vkMapMemory + * vkGetMemoryFdKHR + * vkGetMemoryFdPropertiesKHR */ /* struct VkExportMemoryAllocateInfo chain */ @@ -535,6 +537,293 @@ vn_encode_VkDeviceMemoryOpaqueCaptureAddressInfo(struct vn_cs_encoder *enc, cons vn_encode_VkDeviceMemoryOpaqueCaptureAddressInfo_self(enc, val); } +/* struct VkMemoryResourceAllocationSizeProperties100000MESA chain */ + +static inline size_t +vn_sizeof_VkMemoryResourceAllocationSizeProperties100000MESA_pnext(const void *val) +{ + /* no known/supported struct */ + return vn_sizeof_simple_pointer(NULL); +} + +static inline size_t +vn_sizeof_VkMemoryResourceAllocationSizeProperties100000MESA_self(const VkMemoryResourceAllocationSizeProperties100000MESA *val) +{ + size_t size = 0; + /* skip val->{sType,pNext} */ + size += vn_sizeof_uint64_t(&val->allocationSize); + return size; +} + +static inline size_t +vn_sizeof_VkMemoryResourceAllocationSizeProperties100000MESA(const VkMemoryResourceAllocationSizeProperties100000MESA *val) +{ + size_t size = 0; + + size += vn_sizeof_VkStructureType(&val->sType); + size += vn_sizeof_VkMemoryResourceAllocationSizeProperties100000MESA_pnext(val->pNext); + size += vn_sizeof_VkMemoryResourceAllocationSizeProperties100000MESA_self(val); + + return size; +} + +static inline void +vn_decode_VkMemoryResourceAllocationSizeProperties100000MESA_pnext(struct vn_cs_decoder *dec, const void *val) +{ + /* no known/supported struct */ + if (vn_decode_simple_pointer(dec)) + assert(false); +} + +static inline void +vn_decode_VkMemoryResourceAllocationSizeProperties100000MESA_self(struct vn_cs_decoder *dec, VkMemoryResourceAllocationSizeProperties100000MESA *val) +{ + /* skip val->{sType,pNext} */ + vn_decode_uint64_t(dec, &val->allocationSize); +} + +static inline void +vn_decode_VkMemoryResourceAllocationSizeProperties100000MESA(struct vn_cs_decoder *dec, VkMemoryResourceAllocationSizeProperties100000MESA *val) +{ + VkStructureType stype; + vn_decode_VkStructureType(dec, &stype); + assert(stype == VK_STRUCTURE_TYPE_MEMORY_RESOURCE_ALLOCATION_SIZE_PROPERTIES_100000_MESA); + + assert(val->sType == stype); + vn_decode_VkMemoryResourceAllocationSizeProperties100000MESA_pnext(dec, val->pNext); + vn_decode_VkMemoryResourceAllocationSizeProperties100000MESA_self(dec, val); +} + +static inline size_t +vn_sizeof_VkMemoryResourceAllocationSizeProperties100000MESA_pnext_partial(const void *val) +{ + /* no known/supported struct */ + return vn_sizeof_simple_pointer(NULL); +} + +static inline size_t +vn_sizeof_VkMemoryResourceAllocationSizeProperties100000MESA_self_partial(const VkMemoryResourceAllocationSizeProperties100000MESA *val) +{ + size_t size = 0; + /* skip val->{sType,pNext} */ + /* skip val->allocationSize */ + return size; +} + +static inline size_t +vn_sizeof_VkMemoryResourceAllocationSizeProperties100000MESA_partial(const VkMemoryResourceAllocationSizeProperties100000MESA *val) +{ + size_t size = 0; + + size += vn_sizeof_VkStructureType(&val->sType); + size += vn_sizeof_VkMemoryResourceAllocationSizeProperties100000MESA_pnext_partial(val->pNext); + size += vn_sizeof_VkMemoryResourceAllocationSizeProperties100000MESA_self_partial(val); + + return size; +} + +static inline void +vn_encode_VkMemoryResourceAllocationSizeProperties100000MESA_pnext_partial(struct vn_cs_encoder *enc, const void *val) +{ + /* no known/supported struct */ + vn_encode_simple_pointer(enc, NULL); +} + +static inline void +vn_encode_VkMemoryResourceAllocationSizeProperties100000MESA_self_partial(struct vn_cs_encoder *enc, const VkMemoryResourceAllocationSizeProperties100000MESA *val) +{ + /* skip val->{sType,pNext} */ + /* skip val->allocationSize */ +} + +static inline void +vn_encode_VkMemoryResourceAllocationSizeProperties100000MESA_partial(struct vn_cs_encoder *enc, const VkMemoryResourceAllocationSizeProperties100000MESA *val) +{ + assert(val->sType == VK_STRUCTURE_TYPE_MEMORY_RESOURCE_ALLOCATION_SIZE_PROPERTIES_100000_MESA); + vn_encode_VkStructureType(enc, &(VkStructureType){ VK_STRUCTURE_TYPE_MEMORY_RESOURCE_ALLOCATION_SIZE_PROPERTIES_100000_MESA }); + vn_encode_VkMemoryResourceAllocationSizeProperties100000MESA_pnext_partial(enc, val->pNext); + vn_encode_VkMemoryResourceAllocationSizeProperties100000MESA_self_partial(enc, val); +} + +/* struct VkMemoryResourcePropertiesMESA chain */ + +static inline size_t +vn_sizeof_VkMemoryResourcePropertiesMESA_pnext(const void *val) +{ + const VkBaseInStructure *pnext = val; + size_t size = 0; + + while (pnext) { + switch ((int32_t)pnext->sType) { + case VK_STRUCTURE_TYPE_MEMORY_RESOURCE_ALLOCATION_SIZE_PROPERTIES_100000_MESA: + size += vn_sizeof_simple_pointer(pnext); + size += vn_sizeof_VkStructureType(&pnext->sType); + size += vn_sizeof_VkMemoryResourcePropertiesMESA_pnext(pnext->pNext); + size += vn_sizeof_VkMemoryResourceAllocationSizeProperties100000MESA_self((const VkMemoryResourceAllocationSizeProperties100000MESA *)pnext); + return size; + default: + /* ignore unknown/unsupported struct */ + break; + } + pnext = pnext->pNext; + } + + return vn_sizeof_simple_pointer(NULL); +} + +static inline size_t +vn_sizeof_VkMemoryResourcePropertiesMESA_self(const VkMemoryResourcePropertiesMESA *val) +{ + size_t size = 0; + /* skip val->{sType,pNext} */ + size += vn_sizeof_uint32_t(&val->memoryTypeBits); + return size; +} + +static inline size_t +vn_sizeof_VkMemoryResourcePropertiesMESA(const VkMemoryResourcePropertiesMESA *val) +{ + size_t size = 0; + + size += vn_sizeof_VkStructureType(&val->sType); + size += vn_sizeof_VkMemoryResourcePropertiesMESA_pnext(val->pNext); + size += vn_sizeof_VkMemoryResourcePropertiesMESA_self(val); + + return size; +} + +static inline void +vn_decode_VkMemoryResourcePropertiesMESA_pnext(struct vn_cs_decoder *dec, const void *val) +{ + VkBaseOutStructure *pnext = (VkBaseOutStructure *)val; + VkStructureType stype; + + if (!vn_decode_simple_pointer(dec)) + return; + + vn_decode_VkStructureType(dec, &stype); + while (true) { + assert(pnext); + if (pnext->sType == stype) + break; + + pnext = pnext->pNext; + } + + switch ((int32_t)pnext->sType) { + case VK_STRUCTURE_TYPE_MEMORY_RESOURCE_ALLOCATION_SIZE_PROPERTIES_100000_MESA: + vn_decode_VkMemoryResourcePropertiesMESA_pnext(dec, pnext->pNext); + vn_decode_VkMemoryResourceAllocationSizeProperties100000MESA_self(dec, (VkMemoryResourceAllocationSizeProperties100000MESA *)pnext); + break; + default: + assert(false); + break; + } +} + +static inline void +vn_decode_VkMemoryResourcePropertiesMESA_self(struct vn_cs_decoder *dec, VkMemoryResourcePropertiesMESA *val) +{ + /* skip val->{sType,pNext} */ + vn_decode_uint32_t(dec, &val->memoryTypeBits); +} + +static inline void +vn_decode_VkMemoryResourcePropertiesMESA(struct vn_cs_decoder *dec, VkMemoryResourcePropertiesMESA *val) +{ + VkStructureType stype; + vn_decode_VkStructureType(dec, &stype); + assert(stype == VK_STRUCTURE_TYPE_MEMORY_RESOURCE_PROPERTIES_MESA); + + assert(val->sType == stype); + vn_decode_VkMemoryResourcePropertiesMESA_pnext(dec, val->pNext); + vn_decode_VkMemoryResourcePropertiesMESA_self(dec, val); +} + +static inline size_t +vn_sizeof_VkMemoryResourcePropertiesMESA_pnext_partial(const void *val) +{ + const VkBaseInStructure *pnext = val; + size_t size = 0; + + while (pnext) { + switch ((int32_t)pnext->sType) { + case VK_STRUCTURE_TYPE_MEMORY_RESOURCE_ALLOCATION_SIZE_PROPERTIES_100000_MESA: + size += vn_sizeof_simple_pointer(pnext); + size += vn_sizeof_VkStructureType(&pnext->sType); + size += vn_sizeof_VkMemoryResourcePropertiesMESA_pnext_partial(pnext->pNext); + size += vn_sizeof_VkMemoryResourceAllocationSizeProperties100000MESA_self_partial((const VkMemoryResourceAllocationSizeProperties100000MESA *)pnext); + return size; + default: + /* ignore unknown/unsupported struct */ + break; + } + pnext = pnext->pNext; + } + + return vn_sizeof_simple_pointer(NULL); +} + +static inline size_t +vn_sizeof_VkMemoryResourcePropertiesMESA_self_partial(const VkMemoryResourcePropertiesMESA *val) +{ + size_t size = 0; + /* skip val->{sType,pNext} */ + /* skip val->memoryTypeBits */ + return size; +} + +static inline size_t +vn_sizeof_VkMemoryResourcePropertiesMESA_partial(const VkMemoryResourcePropertiesMESA *val) +{ + size_t size = 0; + + size += vn_sizeof_VkStructureType(&val->sType); + size += vn_sizeof_VkMemoryResourcePropertiesMESA_pnext_partial(val->pNext); + size += vn_sizeof_VkMemoryResourcePropertiesMESA_self_partial(val); + + return size; +} + +static inline void +vn_encode_VkMemoryResourcePropertiesMESA_pnext_partial(struct vn_cs_encoder *enc, const void *val) +{ + const VkBaseInStructure *pnext = val; + + while (pnext) { + switch ((int32_t)pnext->sType) { + case VK_STRUCTURE_TYPE_MEMORY_RESOURCE_ALLOCATION_SIZE_PROPERTIES_100000_MESA: + vn_encode_simple_pointer(enc, pnext); + vn_encode_VkStructureType(enc, &pnext->sType); + vn_encode_VkMemoryResourcePropertiesMESA_pnext_partial(enc, pnext->pNext); + vn_encode_VkMemoryResourceAllocationSizeProperties100000MESA_self_partial(enc, (const VkMemoryResourceAllocationSizeProperties100000MESA *)pnext); + return; + default: + /* ignore unknown/unsupported struct */ + break; + } + pnext = pnext->pNext; + } + + vn_encode_simple_pointer(enc, NULL); +} + +static inline void +vn_encode_VkMemoryResourcePropertiesMESA_self_partial(struct vn_cs_encoder *enc, const VkMemoryResourcePropertiesMESA *val) +{ + /* skip val->{sType,pNext} */ + /* skip val->memoryTypeBits */ +} + +static inline void +vn_encode_VkMemoryResourcePropertiesMESA_partial(struct vn_cs_encoder *enc, const VkMemoryResourcePropertiesMESA *val) +{ + assert(val->sType == VK_STRUCTURE_TYPE_MEMORY_RESOURCE_PROPERTIES_MESA); + vn_encode_VkStructureType(enc, &(VkStructureType){ VK_STRUCTURE_TYPE_MEMORY_RESOURCE_PROPERTIES_MESA }); + vn_encode_VkMemoryResourcePropertiesMESA_pnext_partial(enc, val->pNext); + vn_encode_VkMemoryResourcePropertiesMESA_self_partial(enc, val); +} + static inline size_t vn_sizeof_vkAllocateMemory(VkDevice device, const VkMemoryAllocateInfo* pAllocateInfo, const VkAllocationCallbacks* pAllocator, VkDeviceMemory* pMemory) { const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkAllocateMemory_EXT; @@ -942,6 +1231,69 @@ static inline uint64_t vn_decode_vkGetDeviceMemoryOpaqueCaptureAddress_reply(str return ret; } +static inline size_t vn_sizeof_vkGetMemoryResourcePropertiesMESA(VkDevice device, uint32_t resourceId, VkMemoryResourcePropertiesMESA* pMemoryResourceProperties) +{ + const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkGetMemoryResourcePropertiesMESA_EXT; + const VkFlags cmd_flags = 0; + size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags); + + cmd_size += vn_sizeof_VkDevice(&device); + cmd_size += vn_sizeof_uint32_t(&resourceId); + cmd_size += vn_sizeof_simple_pointer(pMemoryResourceProperties); + if (pMemoryResourceProperties) + cmd_size += vn_sizeof_VkMemoryResourcePropertiesMESA_partial(pMemoryResourceProperties); + + return cmd_size; +} + +static inline void vn_encode_vkGetMemoryResourcePropertiesMESA(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, uint32_t resourceId, VkMemoryResourcePropertiesMESA* pMemoryResourceProperties) +{ + const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkGetMemoryResourcePropertiesMESA_EXT; + + vn_encode_VkCommandTypeEXT(enc, &cmd_type); + vn_encode_VkFlags(enc, &cmd_flags); + + vn_encode_VkDevice(enc, &device); + vn_encode_uint32_t(enc, &resourceId); + if (vn_encode_simple_pointer(enc, pMemoryResourceProperties)) + vn_encode_VkMemoryResourcePropertiesMESA_partial(enc, pMemoryResourceProperties); +} + +static inline size_t vn_sizeof_vkGetMemoryResourcePropertiesMESA_reply(VkDevice device, uint32_t resourceId, VkMemoryResourcePropertiesMESA* pMemoryResourceProperties) +{ + const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkGetMemoryResourcePropertiesMESA_EXT; + size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type); + + VkResult ret; + cmd_size += vn_sizeof_VkResult(&ret); + /* skip device */ + /* skip resourceId */ + cmd_size += vn_sizeof_simple_pointer(pMemoryResourceProperties); + if (pMemoryResourceProperties) + cmd_size += vn_sizeof_VkMemoryResourcePropertiesMESA(pMemoryResourceProperties); + + return cmd_size; +} + +static inline VkResult vn_decode_vkGetMemoryResourcePropertiesMESA_reply(struct vn_cs_decoder *dec, VkDevice device, uint32_t resourceId, VkMemoryResourcePropertiesMESA* pMemoryResourceProperties) +{ + VkCommandTypeEXT command_type; + vn_decode_VkCommandTypeEXT(dec, &command_type); + assert(command_type == VK_COMMAND_TYPE_vkGetMemoryResourcePropertiesMESA_EXT); + + VkResult ret; + vn_decode_VkResult(dec, &ret); + /* skip device */ + /* skip resourceId */ + if (vn_decode_simple_pointer(dec)) { + vn_decode_VkMemoryResourcePropertiesMESA(dec, pMemoryResourceProperties); + } else { + pMemoryResourceProperties = NULL; + } + + return ret; +} + static inline void vn_submit_vkAllocateMemory(struct vn_instance *vn_instance, VkCommandFlagsEXT cmd_flags, VkDevice device, const VkMemoryAllocateInfo* pAllocateInfo, const VkAllocationCallbacks* pAllocator, VkDeviceMemory* pMemory, struct vn_instance_submit_command *submit) { uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE]; @@ -1089,6 +1441,27 @@ static inline void vn_submit_vkGetDeviceMemoryOpaqueCaptureAddress(struct vn_ins } } +static inline void vn_submit_vkGetMemoryResourcePropertiesMESA(struct vn_instance *vn_instance, VkCommandFlagsEXT cmd_flags, VkDevice device, uint32_t resourceId, VkMemoryResourcePropertiesMESA* pMemoryResourceProperties, struct vn_instance_submit_command *submit) +{ + uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE]; + void *cmd_data = local_cmd_data; + size_t cmd_size = vn_sizeof_vkGetMemoryResourcePropertiesMESA(device, resourceId, pMemoryResourceProperties); + if (cmd_size > sizeof(local_cmd_data)) { + cmd_data = malloc(cmd_size); + if (!cmd_data) + cmd_size = 0; + } + const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkGetMemoryResourcePropertiesMESA_reply(device, resourceId, pMemoryResourceProperties) : 0; + + struct vn_cs_encoder *enc = vn_instance_submit_command_init(vn_instance, submit, cmd_data, cmd_size, reply_size); + if (cmd_size) { + vn_encode_vkGetMemoryResourcePropertiesMESA(enc, cmd_flags, device, resourceId, pMemoryResourceProperties); + vn_instance_submit_command(vn_instance, submit); + if (cmd_data != local_cmd_data) + free(cmd_data); + } +} + static inline VkResult vn_call_vkAllocateMemory(struct vn_instance *vn_instance, VkDevice device, const VkMemoryAllocateInfo* pAllocateInfo, const VkAllocationCallbacks* pAllocator, VkDeviceMemory* pMemory) { VN_TRACE_FUNC(); @@ -1234,4 +1607,26 @@ static inline void vn_async_vkGetDeviceMemoryOpaqueCaptureAddress(struct vn_inst vn_submit_vkGetDeviceMemoryOpaqueCaptureAddress(vn_instance, 0, device, pInfo, &submit); } +static inline VkResult vn_call_vkGetMemoryResourcePropertiesMESA(struct vn_instance *vn_instance, VkDevice device, uint32_t resourceId, VkMemoryResourcePropertiesMESA* pMemoryResourceProperties) +{ + VN_TRACE_FUNC(); + + struct vn_instance_submit_command submit; + vn_submit_vkGetMemoryResourcePropertiesMESA(vn_instance, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, resourceId, pMemoryResourceProperties, &submit); + struct vn_cs_decoder *dec = vn_instance_get_command_reply(vn_instance, &submit); + if (dec) { + const VkResult ret = vn_decode_vkGetMemoryResourcePropertiesMESA_reply(dec, device, resourceId, pMemoryResourceProperties); + vn_instance_free_command_reply(vn_instance, &submit); + return ret; + } else { + return VK_ERROR_OUT_OF_HOST_MEMORY; + } +} + +static inline void vn_async_vkGetMemoryResourcePropertiesMESA(struct vn_instance *vn_instance, VkDevice device, uint32_t resourceId, VkMemoryResourcePropertiesMESA* pMemoryResourceProperties) +{ + struct vn_instance_submit_command submit; + vn_submit_vkGetMemoryResourcePropertiesMESA(vn_instance, 0, device, resourceId, pMemoryResourceProperties, &submit); +} + #endif /* VN_PROTOCOL_DRIVER_DEVICE_MEMORY_H */ diff --git a/src/virtio/venus-protocol/vn_protocol_driver_fence.h b/src/virtio/venus-protocol/vn_protocol_driver_fence.h index 05ed89863b0..92a9342d973 100644 --- a/src/virtio/venus-protocol/vn_protocol_driver_fence.h +++ b/src/virtio/venus-protocol/vn_protocol_driver_fence.h @@ -15,6 +15,7 @@ * These structs/unions/commands are not included * * vkGetFenceFdKHR + * vkImportFenceFdKHR */ /* struct VkExportFenceCreateInfo chain */ @@ -470,6 +471,50 @@ static inline VkResult vn_decode_vkWaitForFences_reply(struct vn_cs_decoder *dec return ret; } +static inline size_t vn_sizeof_vkResetFenceResource100000MESA(VkDevice device, VkFence fence) +{ + const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkResetFenceResource100000MESA_EXT; + const VkFlags cmd_flags = 0; + size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags); + + cmd_size += vn_sizeof_VkDevice(&device); + cmd_size += vn_sizeof_VkFence(&fence); + + return cmd_size; +} + +static inline void vn_encode_vkResetFenceResource100000MESA(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, VkFence fence) +{ + const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkResetFenceResource100000MESA_EXT; + + vn_encode_VkCommandTypeEXT(enc, &cmd_type); + vn_encode_VkFlags(enc, &cmd_flags); + + vn_encode_VkDevice(enc, &device); + vn_encode_VkFence(enc, &fence); +} + +static inline size_t vn_sizeof_vkResetFenceResource100000MESA_reply(VkDevice device, VkFence fence) +{ + const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkResetFenceResource100000MESA_EXT; + size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type); + + /* skip device */ + /* skip fence */ + + return cmd_size; +} + +static inline void vn_decode_vkResetFenceResource100000MESA_reply(struct vn_cs_decoder *dec, VkDevice device, VkFence fence) +{ + VkCommandTypeEXT command_type; + vn_decode_VkCommandTypeEXT(dec, &command_type); + assert(command_type == VK_COMMAND_TYPE_vkResetFenceResource100000MESA_EXT); + + /* skip device */ + /* skip fence */ +} + static inline void vn_submit_vkCreateFence(struct vn_instance *vn_instance, VkCommandFlagsEXT cmd_flags, VkDevice device, const VkFenceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkFence* pFence, struct vn_instance_submit_command *submit) { uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE]; @@ -575,6 +620,27 @@ static inline void vn_submit_vkWaitForFences(struct vn_instance *vn_instance, Vk } } +static inline void vn_submit_vkResetFenceResource100000MESA(struct vn_instance *vn_instance, VkCommandFlagsEXT cmd_flags, VkDevice device, VkFence fence, struct vn_instance_submit_command *submit) +{ + uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE]; + void *cmd_data = local_cmd_data; + size_t cmd_size = vn_sizeof_vkResetFenceResource100000MESA(device, fence); + if (cmd_size > sizeof(local_cmd_data)) { + cmd_data = malloc(cmd_size); + if (!cmd_data) + cmd_size = 0; + } + const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkResetFenceResource100000MESA_reply(device, fence) : 0; + + struct vn_cs_encoder *enc = vn_instance_submit_command_init(vn_instance, submit, cmd_data, cmd_size, reply_size); + if (cmd_size) { + vn_encode_vkResetFenceResource100000MESA(enc, cmd_flags, device, fence); + vn_instance_submit_command(vn_instance, submit); + if (cmd_data != local_cmd_data) + free(cmd_data); + } +} + static inline VkResult vn_call_vkCreateFence(struct vn_instance *vn_instance, VkDevice device, const VkFenceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkFence* pFence) { VN_TRACE_FUNC(); @@ -682,4 +748,23 @@ static inline void vn_async_vkWaitForFences(struct vn_instance *vn_instance, VkD vn_submit_vkWaitForFences(vn_instance, 0, device, fenceCount, pFences, waitAll, timeout, &submit); } +static inline void vn_call_vkResetFenceResource100000MESA(struct vn_instance *vn_instance, VkDevice device, VkFence fence) +{ + VN_TRACE_FUNC(); + + struct vn_instance_submit_command submit; + vn_submit_vkResetFenceResource100000MESA(vn_instance, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, fence, &submit); + struct vn_cs_decoder *dec = vn_instance_get_command_reply(vn_instance, &submit); + if (dec) { + vn_decode_vkResetFenceResource100000MESA_reply(dec, device, fence); + vn_instance_free_command_reply(vn_instance, &submit); + } +} + +static inline void vn_async_vkResetFenceResource100000MESA(struct vn_instance *vn_instance, VkDevice device, VkFence fence) +{ + struct vn_instance_submit_command submit; + vn_submit_vkResetFenceResource100000MESA(vn_instance, 0, device, fence, &submit); +} + #endif /* VN_PROTOCOL_DRIVER_FENCE_H */ diff --git a/src/virtio/venus-protocol/vn_protocol_driver_info.h b/src/virtio/venus-protocol/vn_protocol_driver_info.h index 52e8df8cbaa..d4b62ed9b93 100644 --- a/src/virtio/venus-protocol/vn_protocol_driver_info.h +++ b/src/virtio/venus-protocol/vn_protocol_driver_info.h @@ -19,8 +19,8 @@ struct vn_info_extension { }; /* sorted by extension names for bsearch */ -static const uint32_t _vn_info_extension_count = 91; -static const struct vn_info_extension _vn_info_extensions[91] = { +static const uint32_t _vn_info_extension_count = 92; +static const struct vn_info_extension _vn_info_extensions[92] = { { "VK_EXT_4444_formats", 341, 1 }, { "VK_EXT_calibrated_timestamps", 185, 2 }, { "VK_EXT_command_serialization", 384, 0 }, @@ -80,6 +80,7 @@ static const struct vn_info_extension _vn_info_extensions[91] = { { "VK_KHR_external_memory_fd", 75, 1 }, { "VK_KHR_external_semaphore", 78, 1 }, { "VK_KHR_external_semaphore_capabilities", 77, 1 }, + { "VK_KHR_external_semaphore_fd", 80, 1 }, { "VK_KHR_format_feature_flags2", 361, 1 }, { "VK_KHR_get_memory_requirements2", 147, 1 }, { "VK_KHR_get_physical_device_properties2", 60, 2 }, diff --git a/src/virtio/venus-protocol/vn_protocol_driver_semaphore.h b/src/virtio/venus-protocol/vn_protocol_driver_semaphore.h index e17f61c4f3b..0108d3aca76 100644 --- a/src/virtio/venus-protocol/vn_protocol_driver_semaphore.h +++ b/src/virtio/venus-protocol/vn_protocol_driver_semaphore.h @@ -11,6 +11,13 @@ #include "vn_instance.h" #include "vn_protocol_driver_structs.h" +/* + * These structs/unions/commands are not included + * + * vkGetSemaphoreFdKHR + * vkImportSemaphoreFdKHR + */ + /* struct VkExportSemaphoreCreateInfo chain */ static inline size_t @@ -298,6 +305,61 @@ vn_encode_VkSemaphoreSignalInfo(struct vn_cs_encoder *enc, const VkSemaphoreSign vn_encode_VkSemaphoreSignalInfo_self(enc, val); } +/* struct VkImportSemaphoreResourceInfo100000MESA chain */ + +static inline size_t +vn_sizeof_VkImportSemaphoreResourceInfo100000MESA_pnext(const void *val) +{ + /* no known/supported struct */ + return vn_sizeof_simple_pointer(NULL); +} + +static inline size_t +vn_sizeof_VkImportSemaphoreResourceInfo100000MESA_self(const VkImportSemaphoreResourceInfo100000MESA *val) +{ + size_t size = 0; + /* skip val->{sType,pNext} */ + size += vn_sizeof_VkSemaphore(&val->semaphore); + size += vn_sizeof_uint32_t(&val->resourceId); + return size; +} + +static inline size_t +vn_sizeof_VkImportSemaphoreResourceInfo100000MESA(const VkImportSemaphoreResourceInfo100000MESA *val) +{ + size_t size = 0; + + size += vn_sizeof_VkStructureType(&val->sType); + size += vn_sizeof_VkImportSemaphoreResourceInfo100000MESA_pnext(val->pNext); + size += vn_sizeof_VkImportSemaphoreResourceInfo100000MESA_self(val); + + return size; +} + +static inline void +vn_encode_VkImportSemaphoreResourceInfo100000MESA_pnext(struct vn_cs_encoder *enc, const void *val) +{ + /* no known/supported struct */ + vn_encode_simple_pointer(enc, NULL); +} + +static inline void +vn_encode_VkImportSemaphoreResourceInfo100000MESA_self(struct vn_cs_encoder *enc, const VkImportSemaphoreResourceInfo100000MESA *val) +{ + /* skip val->{sType,pNext} */ + vn_encode_VkSemaphore(enc, &val->semaphore); + vn_encode_uint32_t(enc, &val->resourceId); +} + +static inline void +vn_encode_VkImportSemaphoreResourceInfo100000MESA(struct vn_cs_encoder *enc, const VkImportSemaphoreResourceInfo100000MESA *val) +{ + assert(val->sType == VK_STRUCTURE_TYPE_IMPORT_SEMAPHORE_RESOURCE_INFO_100000_MESA); + vn_encode_VkStructureType(enc, &(VkStructureType){ VK_STRUCTURE_TYPE_IMPORT_SEMAPHORE_RESOURCE_INFO_100000_MESA }); + vn_encode_VkImportSemaphoreResourceInfo100000MESA_pnext(enc, val->pNext); + vn_encode_VkImportSemaphoreResourceInfo100000MESA_self(enc, val); +} + static inline size_t vn_sizeof_vkCreateSemaphore(VkDevice device, const VkSemaphoreCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSemaphore* pSemaphore) { const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCreateSemaphore_EXT; @@ -592,6 +654,97 @@ static inline VkResult vn_decode_vkSignalSemaphore_reply(struct vn_cs_decoder *d return ret; } +static inline size_t vn_sizeof_vkWaitSemaphoreResource100000MESA(VkDevice device, VkSemaphore semaphore) +{ + const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkWaitSemaphoreResource100000MESA_EXT; + const VkFlags cmd_flags = 0; + size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags); + + cmd_size += vn_sizeof_VkDevice(&device); + cmd_size += vn_sizeof_VkSemaphore(&semaphore); + + return cmd_size; +} + +static inline void vn_encode_vkWaitSemaphoreResource100000MESA(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, VkSemaphore semaphore) +{ + const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkWaitSemaphoreResource100000MESA_EXT; + + vn_encode_VkCommandTypeEXT(enc, &cmd_type); + vn_encode_VkFlags(enc, &cmd_flags); + + vn_encode_VkDevice(enc, &device); + vn_encode_VkSemaphore(enc, &semaphore); +} + +static inline size_t vn_sizeof_vkWaitSemaphoreResource100000MESA_reply(VkDevice device, VkSemaphore semaphore) +{ + const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkWaitSemaphoreResource100000MESA_EXT; + size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type); + + /* skip device */ + /* skip semaphore */ + + return cmd_size; +} + +static inline void vn_decode_vkWaitSemaphoreResource100000MESA_reply(struct vn_cs_decoder *dec, VkDevice device, VkSemaphore semaphore) +{ + VkCommandTypeEXT command_type; + vn_decode_VkCommandTypeEXT(dec, &command_type); + assert(command_type == VK_COMMAND_TYPE_vkWaitSemaphoreResource100000MESA_EXT); + + /* skip device */ + /* skip semaphore */ +} + +static inline size_t vn_sizeof_vkImportSemaphoreResource100000MESA(VkDevice device, const VkImportSemaphoreResourceInfo100000MESA* pImportSemaphoreResourceInfo) +{ + const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkImportSemaphoreResource100000MESA_EXT; + const VkFlags cmd_flags = 0; + size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags); + + cmd_size += vn_sizeof_VkDevice(&device); + cmd_size += vn_sizeof_simple_pointer(pImportSemaphoreResourceInfo); + if (pImportSemaphoreResourceInfo) + cmd_size += vn_sizeof_VkImportSemaphoreResourceInfo100000MESA(pImportSemaphoreResourceInfo); + + return cmd_size; +} + +static inline void vn_encode_vkImportSemaphoreResource100000MESA(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, const VkImportSemaphoreResourceInfo100000MESA* pImportSemaphoreResourceInfo) +{ + const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkImportSemaphoreResource100000MESA_EXT; + + vn_encode_VkCommandTypeEXT(enc, &cmd_type); + vn_encode_VkFlags(enc, &cmd_flags); + + vn_encode_VkDevice(enc, &device); + if (vn_encode_simple_pointer(enc, pImportSemaphoreResourceInfo)) + vn_encode_VkImportSemaphoreResourceInfo100000MESA(enc, pImportSemaphoreResourceInfo); +} + +static inline size_t vn_sizeof_vkImportSemaphoreResource100000MESA_reply(VkDevice device, const VkImportSemaphoreResourceInfo100000MESA* pImportSemaphoreResourceInfo) +{ + const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkImportSemaphoreResource100000MESA_EXT; + size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type); + + /* skip device */ + /* skip pImportSemaphoreResourceInfo */ + + return cmd_size; +} + +static inline void vn_decode_vkImportSemaphoreResource100000MESA_reply(struct vn_cs_decoder *dec, VkDevice device, const VkImportSemaphoreResourceInfo100000MESA* pImportSemaphoreResourceInfo) +{ + VkCommandTypeEXT command_type; + vn_decode_VkCommandTypeEXT(dec, &command_type); + assert(command_type == VK_COMMAND_TYPE_vkImportSemaphoreResource100000MESA_EXT); + + /* skip device */ + /* skip pImportSemaphoreResourceInfo */ +} + static inline void vn_submit_vkCreateSemaphore(struct vn_instance *vn_instance, VkCommandFlagsEXT cmd_flags, VkDevice device, const VkSemaphoreCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSemaphore* pSemaphore, struct vn_instance_submit_command *submit) { uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE]; @@ -697,6 +850,48 @@ static inline void vn_submit_vkSignalSemaphore(struct vn_instance *vn_instance, } } +static inline void vn_submit_vkWaitSemaphoreResource100000MESA(struct vn_instance *vn_instance, VkCommandFlagsEXT cmd_flags, VkDevice device, VkSemaphore semaphore, struct vn_instance_submit_command *submit) +{ + uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE]; + void *cmd_data = local_cmd_data; + size_t cmd_size = vn_sizeof_vkWaitSemaphoreResource100000MESA(device, semaphore); + if (cmd_size > sizeof(local_cmd_data)) { + cmd_data = malloc(cmd_size); + if (!cmd_data) + cmd_size = 0; + } + const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkWaitSemaphoreResource100000MESA_reply(device, semaphore) : 0; + + struct vn_cs_encoder *enc = vn_instance_submit_command_init(vn_instance, submit, cmd_data, cmd_size, reply_size); + if (cmd_size) { + vn_encode_vkWaitSemaphoreResource100000MESA(enc, cmd_flags, device, semaphore); + vn_instance_submit_command(vn_instance, submit); + if (cmd_data != local_cmd_data) + free(cmd_data); + } +} + +static inline void vn_submit_vkImportSemaphoreResource100000MESA(struct vn_instance *vn_instance, VkCommandFlagsEXT cmd_flags, VkDevice device, const VkImportSemaphoreResourceInfo100000MESA* pImportSemaphoreResourceInfo, struct vn_instance_submit_command *submit) +{ + uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE]; + void *cmd_data = local_cmd_data; + size_t cmd_size = vn_sizeof_vkImportSemaphoreResource100000MESA(device, pImportSemaphoreResourceInfo); + if (cmd_size > sizeof(local_cmd_data)) { + cmd_data = malloc(cmd_size); + if (!cmd_data) + cmd_size = 0; + } + const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkImportSemaphoreResource100000MESA_reply(device, pImportSemaphoreResourceInfo) : 0; + + struct vn_cs_encoder *enc = vn_instance_submit_command_init(vn_instance, submit, cmd_data, cmd_size, reply_size); + if (cmd_size) { + vn_encode_vkImportSemaphoreResource100000MESA(enc, cmd_flags, device, pImportSemaphoreResourceInfo); + vn_instance_submit_command(vn_instance, submit); + if (cmd_data != local_cmd_data) + free(cmd_data); + } +} + static inline VkResult vn_call_vkCreateSemaphore(struct vn_instance *vn_instance, VkDevice device, const VkSemaphoreCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSemaphore* pSemaphore) { VN_TRACE_FUNC(); @@ -804,4 +999,42 @@ static inline void vn_async_vkSignalSemaphore(struct vn_instance *vn_instance, V vn_submit_vkSignalSemaphore(vn_instance, 0, device, pSignalInfo, &submit); } +static inline void vn_call_vkWaitSemaphoreResource100000MESA(struct vn_instance *vn_instance, VkDevice device, VkSemaphore semaphore) +{ + VN_TRACE_FUNC(); + + struct vn_instance_submit_command submit; + vn_submit_vkWaitSemaphoreResource100000MESA(vn_instance, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, semaphore, &submit); + struct vn_cs_decoder *dec = vn_instance_get_command_reply(vn_instance, &submit); + if (dec) { + vn_decode_vkWaitSemaphoreResource100000MESA_reply(dec, device, semaphore); + vn_instance_free_command_reply(vn_instance, &submit); + } +} + +static inline void vn_async_vkWaitSemaphoreResource100000MESA(struct vn_instance *vn_instance, VkDevice device, VkSemaphore semaphore) +{ + struct vn_instance_submit_command submit; + vn_submit_vkWaitSemaphoreResource100000MESA(vn_instance, 0, device, semaphore, &submit); +} + +static inline void vn_call_vkImportSemaphoreResource100000MESA(struct vn_instance *vn_instance, VkDevice device, const VkImportSemaphoreResourceInfo100000MESA* pImportSemaphoreResourceInfo) +{ + VN_TRACE_FUNC(); + + struct vn_instance_submit_command submit; + vn_submit_vkImportSemaphoreResource100000MESA(vn_instance, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, pImportSemaphoreResourceInfo, &submit); + struct vn_cs_decoder *dec = vn_instance_get_command_reply(vn_instance, &submit); + if (dec) { + vn_decode_vkImportSemaphoreResource100000MESA_reply(dec, device, pImportSemaphoreResourceInfo); + vn_instance_free_command_reply(vn_instance, &submit); + } +} + +static inline void vn_async_vkImportSemaphoreResource100000MESA(struct vn_instance *vn_instance, VkDevice device, const VkImportSemaphoreResourceInfo100000MESA* pImportSemaphoreResourceInfo) +{ + struct vn_instance_submit_command submit; + vn_submit_vkImportSemaphoreResource100000MESA(vn_instance, 0, device, pImportSemaphoreResourceInfo, &submit); +} + #endif /* VN_PROTOCOL_DRIVER_SEMAPHORE_H */ diff --git a/src/virtio/venus-protocol/vn_protocol_driver_transport.h b/src/virtio/venus-protocol/vn_protocol_driver_transport.h index ca412693101..4275603848e 100644 --- a/src/virtio/venus-protocol/vn_protocol_driver_transport.h +++ b/src/virtio/venus-protocol/vn_protocol_driver_transport.h @@ -11,14 +11,6 @@ #include "vn_instance.h" #include "vn_protocol_driver_structs.h" -/* - * These structs/unions/commands are not included - * - * vkGetMemoryFdKHR - * vkGetMemoryFdPropertiesKHR - * vkImportFenceFdKHR - */ - /* struct VkCommandStreamDescriptionMESA */ static inline size_t @@ -132,293 +124,6 @@ vn_encode_VkRingCreateInfoMESA(struct vn_cs_encoder *enc, const VkRingCreateInfo vn_encode_VkRingCreateInfoMESA_self(enc, val); } -/* struct VkMemoryResourceAllocationSizeProperties100000MESA chain */ - -static inline size_t -vn_sizeof_VkMemoryResourceAllocationSizeProperties100000MESA_pnext(const void *val) -{ - /* no known/supported struct */ - return vn_sizeof_simple_pointer(NULL); -} - -static inline size_t -vn_sizeof_VkMemoryResourceAllocationSizeProperties100000MESA_self(const VkMemoryResourceAllocationSizeProperties100000MESA *val) -{ - size_t size = 0; - /* skip val->{sType,pNext} */ - size += vn_sizeof_uint64_t(&val->allocationSize); - return size; -} - -static inline size_t -vn_sizeof_VkMemoryResourceAllocationSizeProperties100000MESA(const VkMemoryResourceAllocationSizeProperties100000MESA *val) -{ - size_t size = 0; - - size += vn_sizeof_VkStructureType(&val->sType); - size += vn_sizeof_VkMemoryResourceAllocationSizeProperties100000MESA_pnext(val->pNext); - size += vn_sizeof_VkMemoryResourceAllocationSizeProperties100000MESA_self(val); - - return size; -} - -static inline void -vn_decode_VkMemoryResourceAllocationSizeProperties100000MESA_pnext(struct vn_cs_decoder *dec, const void *val) -{ - /* no known/supported struct */ - if (vn_decode_simple_pointer(dec)) - assert(false); -} - -static inline void -vn_decode_VkMemoryResourceAllocationSizeProperties100000MESA_self(struct vn_cs_decoder *dec, VkMemoryResourceAllocationSizeProperties100000MESA *val) -{ - /* skip val->{sType,pNext} */ - vn_decode_uint64_t(dec, &val->allocationSize); -} - -static inline void -vn_decode_VkMemoryResourceAllocationSizeProperties100000MESA(struct vn_cs_decoder *dec, VkMemoryResourceAllocationSizeProperties100000MESA *val) -{ - VkStructureType stype; - vn_decode_VkStructureType(dec, &stype); - assert(stype == VK_STRUCTURE_TYPE_MEMORY_RESOURCE_ALLOCATION_SIZE_PROPERTIES_100000_MESA); - - assert(val->sType == stype); - vn_decode_VkMemoryResourceAllocationSizeProperties100000MESA_pnext(dec, val->pNext); - vn_decode_VkMemoryResourceAllocationSizeProperties100000MESA_self(dec, val); -} - -static inline size_t -vn_sizeof_VkMemoryResourceAllocationSizeProperties100000MESA_pnext_partial(const void *val) -{ - /* no known/supported struct */ - return vn_sizeof_simple_pointer(NULL); -} - -static inline size_t -vn_sizeof_VkMemoryResourceAllocationSizeProperties100000MESA_self_partial(const VkMemoryResourceAllocationSizeProperties100000MESA *val) -{ - size_t size = 0; - /* skip val->{sType,pNext} */ - /* skip val->allocationSize */ - return size; -} - -static inline size_t -vn_sizeof_VkMemoryResourceAllocationSizeProperties100000MESA_partial(const VkMemoryResourceAllocationSizeProperties100000MESA *val) -{ - size_t size = 0; - - size += vn_sizeof_VkStructureType(&val->sType); - size += vn_sizeof_VkMemoryResourceAllocationSizeProperties100000MESA_pnext_partial(val->pNext); - size += vn_sizeof_VkMemoryResourceAllocationSizeProperties100000MESA_self_partial(val); - - return size; -} - -static inline void -vn_encode_VkMemoryResourceAllocationSizeProperties100000MESA_pnext_partial(struct vn_cs_encoder *enc, const void *val) -{ - /* no known/supported struct */ - vn_encode_simple_pointer(enc, NULL); -} - -static inline void -vn_encode_VkMemoryResourceAllocationSizeProperties100000MESA_self_partial(struct vn_cs_encoder *enc, const VkMemoryResourceAllocationSizeProperties100000MESA *val) -{ - /* skip val->{sType,pNext} */ - /* skip val->allocationSize */ -} - -static inline void -vn_encode_VkMemoryResourceAllocationSizeProperties100000MESA_partial(struct vn_cs_encoder *enc, const VkMemoryResourceAllocationSizeProperties100000MESA *val) -{ - assert(val->sType == VK_STRUCTURE_TYPE_MEMORY_RESOURCE_ALLOCATION_SIZE_PROPERTIES_100000_MESA); - vn_encode_VkStructureType(enc, &(VkStructureType){ VK_STRUCTURE_TYPE_MEMORY_RESOURCE_ALLOCATION_SIZE_PROPERTIES_100000_MESA }); - vn_encode_VkMemoryResourceAllocationSizeProperties100000MESA_pnext_partial(enc, val->pNext); - vn_encode_VkMemoryResourceAllocationSizeProperties100000MESA_self_partial(enc, val); -} - -/* struct VkMemoryResourcePropertiesMESA chain */ - -static inline size_t -vn_sizeof_VkMemoryResourcePropertiesMESA_pnext(const void *val) -{ - const VkBaseInStructure *pnext = val; - size_t size = 0; - - while (pnext) { - switch ((int32_t)pnext->sType) { - case VK_STRUCTURE_TYPE_MEMORY_RESOURCE_ALLOCATION_SIZE_PROPERTIES_100000_MESA: - size += vn_sizeof_simple_pointer(pnext); - size += vn_sizeof_VkStructureType(&pnext->sType); - size += vn_sizeof_VkMemoryResourcePropertiesMESA_pnext(pnext->pNext); - size += vn_sizeof_VkMemoryResourceAllocationSizeProperties100000MESA_self((const VkMemoryResourceAllocationSizeProperties100000MESA *)pnext); - return size; - default: - /* ignore unknown/unsupported struct */ - break; - } - pnext = pnext->pNext; - } - - return vn_sizeof_simple_pointer(NULL); -} - -static inline size_t -vn_sizeof_VkMemoryResourcePropertiesMESA_self(const VkMemoryResourcePropertiesMESA *val) -{ - size_t size = 0; - /* skip val->{sType,pNext} */ - size += vn_sizeof_uint32_t(&val->memoryTypeBits); - return size; -} - -static inline size_t -vn_sizeof_VkMemoryResourcePropertiesMESA(const VkMemoryResourcePropertiesMESA *val) -{ - size_t size = 0; - - size += vn_sizeof_VkStructureType(&val->sType); - size += vn_sizeof_VkMemoryResourcePropertiesMESA_pnext(val->pNext); - size += vn_sizeof_VkMemoryResourcePropertiesMESA_self(val); - - return size; -} - -static inline void -vn_decode_VkMemoryResourcePropertiesMESA_pnext(struct vn_cs_decoder *dec, const void *val) -{ - VkBaseOutStructure *pnext = (VkBaseOutStructure *)val; - VkStructureType stype; - - if (!vn_decode_simple_pointer(dec)) - return; - - vn_decode_VkStructureType(dec, &stype); - while (true) { - assert(pnext); - if (pnext->sType == stype) - break; - - pnext = pnext->pNext; - } - - switch ((int32_t)pnext->sType) { - case VK_STRUCTURE_TYPE_MEMORY_RESOURCE_ALLOCATION_SIZE_PROPERTIES_100000_MESA: - vn_decode_VkMemoryResourcePropertiesMESA_pnext(dec, pnext->pNext); - vn_decode_VkMemoryResourceAllocationSizeProperties100000MESA_self(dec, (VkMemoryResourceAllocationSizeProperties100000MESA *)pnext); - break; - default: - assert(false); - break; - } -} - -static inline void -vn_decode_VkMemoryResourcePropertiesMESA_self(struct vn_cs_decoder *dec, VkMemoryResourcePropertiesMESA *val) -{ - /* skip val->{sType,pNext} */ - vn_decode_uint32_t(dec, &val->memoryTypeBits); -} - -static inline void -vn_decode_VkMemoryResourcePropertiesMESA(struct vn_cs_decoder *dec, VkMemoryResourcePropertiesMESA *val) -{ - VkStructureType stype; - vn_decode_VkStructureType(dec, &stype); - assert(stype == VK_STRUCTURE_TYPE_MEMORY_RESOURCE_PROPERTIES_MESA); - - assert(val->sType == stype); - vn_decode_VkMemoryResourcePropertiesMESA_pnext(dec, val->pNext); - vn_decode_VkMemoryResourcePropertiesMESA_self(dec, val); -} - -static inline size_t -vn_sizeof_VkMemoryResourcePropertiesMESA_pnext_partial(const void *val) -{ - const VkBaseInStructure *pnext = val; - size_t size = 0; - - while (pnext) { - switch ((int32_t)pnext->sType) { - case VK_STRUCTURE_TYPE_MEMORY_RESOURCE_ALLOCATION_SIZE_PROPERTIES_100000_MESA: - size += vn_sizeof_simple_pointer(pnext); - size += vn_sizeof_VkStructureType(&pnext->sType); - size += vn_sizeof_VkMemoryResourcePropertiesMESA_pnext_partial(pnext->pNext); - size += vn_sizeof_VkMemoryResourceAllocationSizeProperties100000MESA_self_partial((const VkMemoryResourceAllocationSizeProperties100000MESA *)pnext); - return size; - default: - /* ignore unknown/unsupported struct */ - break; - } - pnext = pnext->pNext; - } - - return vn_sizeof_simple_pointer(NULL); -} - -static inline size_t -vn_sizeof_VkMemoryResourcePropertiesMESA_self_partial(const VkMemoryResourcePropertiesMESA *val) -{ - size_t size = 0; - /* skip val->{sType,pNext} */ - /* skip val->memoryTypeBits */ - return size; -} - -static inline size_t -vn_sizeof_VkMemoryResourcePropertiesMESA_partial(const VkMemoryResourcePropertiesMESA *val) -{ - size_t size = 0; - - size += vn_sizeof_VkStructureType(&val->sType); - size += vn_sizeof_VkMemoryResourcePropertiesMESA_pnext_partial(val->pNext); - size += vn_sizeof_VkMemoryResourcePropertiesMESA_self_partial(val); - - return size; -} - -static inline void -vn_encode_VkMemoryResourcePropertiesMESA_pnext_partial(struct vn_cs_encoder *enc, const void *val) -{ - const VkBaseInStructure *pnext = val; - - while (pnext) { - switch ((int32_t)pnext->sType) { - case VK_STRUCTURE_TYPE_MEMORY_RESOURCE_ALLOCATION_SIZE_PROPERTIES_100000_MESA: - vn_encode_simple_pointer(enc, pnext); - vn_encode_VkStructureType(enc, &pnext->sType); - vn_encode_VkMemoryResourcePropertiesMESA_pnext_partial(enc, pnext->pNext); - vn_encode_VkMemoryResourceAllocationSizeProperties100000MESA_self_partial(enc, (const VkMemoryResourceAllocationSizeProperties100000MESA *)pnext); - return; - default: - /* ignore unknown/unsupported struct */ - break; - } - pnext = pnext->pNext; - } - - vn_encode_simple_pointer(enc, NULL); -} - -static inline void -vn_encode_VkMemoryResourcePropertiesMESA_self_partial(struct vn_cs_encoder *enc, const VkMemoryResourcePropertiesMESA *val) -{ - /* skip val->{sType,pNext} */ - /* skip val->memoryTypeBits */ -} - -static inline void -vn_encode_VkMemoryResourcePropertiesMESA_partial(struct vn_cs_encoder *enc, const VkMemoryResourcePropertiesMESA *val) -{ - assert(val->sType == VK_STRUCTURE_TYPE_MEMORY_RESOURCE_PROPERTIES_MESA); - vn_encode_VkStructureType(enc, &(VkStructureType){ VK_STRUCTURE_TYPE_MEMORY_RESOURCE_PROPERTIES_MESA }); - vn_encode_VkMemoryResourcePropertiesMESA_pnext_partial(enc, val->pNext); - vn_encode_VkMemoryResourcePropertiesMESA_self_partial(enc, val); -} - static inline size_t vn_sizeof_vkSetReplyCommandStreamMESA(const VkCommandStreamDescriptionMESA* pStream) { const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkSetReplyCommandStreamMESA_EXT; @@ -779,69 +484,6 @@ static inline void vn_decode_vkWriteRingExtraMESA_reply(struct vn_cs_decoder *de /* skip value */ } -static inline size_t vn_sizeof_vkGetMemoryResourcePropertiesMESA(VkDevice device, uint32_t resourceId, VkMemoryResourcePropertiesMESA* pMemoryResourceProperties) -{ - const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkGetMemoryResourcePropertiesMESA_EXT; - const VkFlags cmd_flags = 0; - size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags); - - cmd_size += vn_sizeof_VkDevice(&device); - cmd_size += vn_sizeof_uint32_t(&resourceId); - cmd_size += vn_sizeof_simple_pointer(pMemoryResourceProperties); - if (pMemoryResourceProperties) - cmd_size += vn_sizeof_VkMemoryResourcePropertiesMESA_partial(pMemoryResourceProperties); - - return cmd_size; -} - -static inline void vn_encode_vkGetMemoryResourcePropertiesMESA(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, uint32_t resourceId, VkMemoryResourcePropertiesMESA* pMemoryResourceProperties) -{ - const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkGetMemoryResourcePropertiesMESA_EXT; - - vn_encode_VkCommandTypeEXT(enc, &cmd_type); - vn_encode_VkFlags(enc, &cmd_flags); - - vn_encode_VkDevice(enc, &device); - vn_encode_uint32_t(enc, &resourceId); - if (vn_encode_simple_pointer(enc, pMemoryResourceProperties)) - vn_encode_VkMemoryResourcePropertiesMESA_partial(enc, pMemoryResourceProperties); -} - -static inline size_t vn_sizeof_vkGetMemoryResourcePropertiesMESA_reply(VkDevice device, uint32_t resourceId, VkMemoryResourcePropertiesMESA* pMemoryResourceProperties) -{ - const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkGetMemoryResourcePropertiesMESA_EXT; - size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type); - - VkResult ret; - cmd_size += vn_sizeof_VkResult(&ret); - /* skip device */ - /* skip resourceId */ - cmd_size += vn_sizeof_simple_pointer(pMemoryResourceProperties); - if (pMemoryResourceProperties) - cmd_size += vn_sizeof_VkMemoryResourcePropertiesMESA(pMemoryResourceProperties); - - return cmd_size; -} - -static inline VkResult vn_decode_vkGetMemoryResourcePropertiesMESA_reply(struct vn_cs_decoder *dec, VkDevice device, uint32_t resourceId, VkMemoryResourcePropertiesMESA* pMemoryResourceProperties) -{ - VkCommandTypeEXT command_type; - vn_decode_VkCommandTypeEXT(dec, &command_type); - assert(command_type == VK_COMMAND_TYPE_vkGetMemoryResourcePropertiesMESA_EXT); - - VkResult ret; - vn_decode_VkResult(dec, &ret); - /* skip device */ - /* skip resourceId */ - if (vn_decode_simple_pointer(dec)) { - vn_decode_VkMemoryResourcePropertiesMESA(dec, pMemoryResourceProperties); - } else { - pMemoryResourceProperties = NULL; - } - - return ret; -} - static inline size_t vn_sizeof_vkGetVenusExperimentalFeatureData100000MESA(size_t* pDataSize, void* pData) { const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkGetVenusExperimentalFeatureData100000MESA_EXT; @@ -1053,27 +695,6 @@ static inline void vn_submit_vkWriteRingExtraMESA(struct vn_instance *vn_instanc } } -static inline void vn_submit_vkGetMemoryResourcePropertiesMESA(struct vn_instance *vn_instance, VkCommandFlagsEXT cmd_flags, VkDevice device, uint32_t resourceId, VkMemoryResourcePropertiesMESA* pMemoryResourceProperties, struct vn_instance_submit_command *submit) -{ - uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE]; - void *cmd_data = local_cmd_data; - size_t cmd_size = vn_sizeof_vkGetMemoryResourcePropertiesMESA(device, resourceId, pMemoryResourceProperties); - if (cmd_size > sizeof(local_cmd_data)) { - cmd_data = malloc(cmd_size); - if (!cmd_data) - cmd_size = 0; - } - const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkGetMemoryResourcePropertiesMESA_reply(device, resourceId, pMemoryResourceProperties) : 0; - - struct vn_cs_encoder *enc = vn_instance_submit_command_init(vn_instance, submit, cmd_data, cmd_size, reply_size); - if (cmd_size) { - vn_encode_vkGetMemoryResourcePropertiesMESA(enc, cmd_flags, device, resourceId, pMemoryResourceProperties); - vn_instance_submit_command(vn_instance, submit); - if (cmd_data != local_cmd_data) - free(cmd_data); - } -} - static inline void vn_submit_vkGetVenusExperimentalFeatureData100000MESA(struct vn_instance *vn_instance, VkCommandFlagsEXT cmd_flags, size_t* pDataSize, void* pData, struct vn_instance_submit_command *submit) { uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE]; @@ -1228,28 +849,6 @@ static inline void vn_async_vkWriteRingExtraMESA(struct vn_instance *vn_instance vn_submit_vkWriteRingExtraMESA(vn_instance, 0, ring, offset, value, &submit); } -static inline VkResult vn_call_vkGetMemoryResourcePropertiesMESA(struct vn_instance *vn_instance, VkDevice device, uint32_t resourceId, VkMemoryResourcePropertiesMESA* pMemoryResourceProperties) -{ - VN_TRACE_FUNC(); - - struct vn_instance_submit_command submit; - vn_submit_vkGetMemoryResourcePropertiesMESA(vn_instance, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, resourceId, pMemoryResourceProperties, &submit); - struct vn_cs_decoder *dec = vn_instance_get_command_reply(vn_instance, &submit); - if (dec) { - const VkResult ret = vn_decode_vkGetMemoryResourcePropertiesMESA_reply(dec, device, resourceId, pMemoryResourceProperties); - vn_instance_free_command_reply(vn_instance, &submit); - return ret; - } else { - return VK_ERROR_OUT_OF_HOST_MEMORY; - } -} - -static inline void vn_async_vkGetMemoryResourcePropertiesMESA(struct vn_instance *vn_instance, VkDevice device, uint32_t resourceId, VkMemoryResourcePropertiesMESA* pMemoryResourceProperties) -{ - struct vn_instance_submit_command submit; - vn_submit_vkGetMemoryResourcePropertiesMESA(vn_instance, 0, device, resourceId, pMemoryResourceProperties, &submit); -} - static inline void vn_call_vkGetVenusExperimentalFeatureData100000MESA(struct vn_instance *vn_instance, size_t* pDataSize, void* pData) { VN_TRACE_FUNC();