diff --git a/src/virtio/venus-protocol/vn_protocol_driver.h b/src/virtio/venus-protocol/vn_protocol_driver.h index a738959ffb0..27fb89b1c53 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-e60093dc. */ +/* This file is generated by venus-protocol git-335af8e9. */ /* * 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 0c00b5f9ed7..ebb62414a33 100644 --- a/src/virtio/venus-protocol/vn_protocol_driver_defines.h +++ b/src/virtio/venus-protocol/vn_protocol_driver_defines.h @@ -20,6 +20,7 @@ #define VK_STRUCTURE_TYPE_RING_CREATE_INFO_MESA ((VkStructureType)1000384000) #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) typedef enum VkCommandTypeEXT { VK_COMMAND_TYPE_vkCreateInstance_EXT = 0, @@ -259,6 +260,7 @@ typedef enum VkCommandTypeEXT { VK_COMMAND_TYPE_vkNotifyRingMESA_EXT = 190, VK_COMMAND_TYPE_vkWriteRingExtraMESA_EXT = 191, VK_COMMAND_TYPE_vkGetMemoryResourcePropertiesMESA_EXT = 192, + VK_COMMAND_TYPE_vkGetVenusExperimentalFeatureData100000MESA_EXT = 195, } VkCommandTypeEXT; typedef enum VkCommandFlagBitsEXT { @@ -313,4 +315,14 @@ typedef struct VkImportMemoryResourceInfoMESA { uint32_t resourceId; } VkImportMemoryResourceInfoMESA; +typedef struct VkVenusExperimentalFeatures100000MESA { + VkBool32 memoryResourceAllocationSize; +} VkVenusExperimentalFeatures100000MESA; + +typedef struct VkMemoryResourceAllocationSizeProperties100000MESA { + VkStructureType sType; + void* pNext; + uint64_t allocationSize; +} VkMemoryResourceAllocationSizeProperties100000MESA; + #endif /* VN_PROTOCOL_DRIVER_DEFINES_H */ diff --git a/src/virtio/venus-protocol/vn_protocol_driver_info.h b/src/virtio/venus-protocol/vn_protocol_driver_info.h index 4fa9087b7b7..f535a181579 100644 --- a/src/virtio/venus-protocol/vn_protocol_driver_info.h +++ b/src/virtio/venus-protocol/vn_protocol_driver_info.h @@ -142,7 +142,7 @@ vn_info_extension_spec_version(const char *name) 1, 1, 3, - 0, + 100000, }; const char **found; diff --git a/src/virtio/venus-protocol/vn_protocol_driver_transport.h b/src/virtio/venus-protocol/vn_protocol_driver_transport.h index a90e1b2d87c..a319a04a01f 100644 --- a/src/virtio/venus-protocol/vn_protocol_driver_transport.h +++ b/src/virtio/venus-protocol/vn_protocol_driver_transport.h @@ -131,12 +131,137 @@ 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) { - /* no known/supported struct */ + 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); } @@ -164,9 +289,28 @@ vn_sizeof_VkMemoryResourcePropertiesMESA(const VkMemoryResourcePropertiesMESA *v static inline void vn_decode_VkMemoryResourcePropertiesMESA_pnext(struct vn_cs_decoder *dec, const void *val) { - /* no known/supported struct */ - if (vn_decode_simple_pointer(dec)) + 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; + } + + 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 @@ -191,7 +335,24 @@ vn_decode_VkMemoryResourcePropertiesMESA(struct vn_cs_decoder *dec, VkMemoryReso static inline size_t vn_sizeof_VkMemoryResourcePropertiesMESA_pnext_partial(const void *val) { - /* no known/supported struct */ + 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); } @@ -219,7 +380,23 @@ vn_sizeof_VkMemoryResourcePropertiesMESA_partial(const VkMemoryResourcePropertie static inline void vn_encode_VkMemoryResourcePropertiesMESA_pnext_partial(struct vn_cs_encoder *enc, const void *val) { - /* no known/supported struct */ + 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); } @@ -662,6 +839,70 @@ static inline VkResult vn_decode_vkGetMemoryResourcePropertiesMESA_reply(struct return ret; } +static inline size_t vn_sizeof_vkGetVenusExperimentalFeatureData100000MESA(size_t* pDataSize, void* pData) +{ + const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkGetVenusExperimentalFeatureData100000MESA_EXT; + const VkFlags cmd_flags = 0; + size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags); + + cmd_size += vn_sizeof_simple_pointer(pDataSize); + if (pDataSize) + cmd_size += vn_sizeof_size_t(pDataSize); + cmd_size += vn_sizeof_simple_pointer(pData); /* out */ + + return cmd_size; +} + +static inline void vn_encode_vkGetVenusExperimentalFeatureData100000MESA(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, size_t* pDataSize, void* pData) +{ + const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkGetVenusExperimentalFeatureData100000MESA_EXT; + + vn_encode_VkCommandTypeEXT(enc, &cmd_type); + vn_encode_VkFlags(enc, &cmd_flags); + + if (vn_encode_simple_pointer(enc, pDataSize)) + vn_encode_size_t(enc, pDataSize); + vn_encode_array_size(enc, pData ? *pDataSize : 0); /* out */ +} + +static inline size_t vn_sizeof_vkGetVenusExperimentalFeatureData100000MESA_reply(size_t* pDataSize, void* pData) +{ + const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkGetVenusExperimentalFeatureData100000MESA_EXT; + size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type); + + cmd_size += vn_sizeof_simple_pointer(pDataSize); + if (pDataSize) + cmd_size += vn_sizeof_size_t(pDataSize); + if (pData) { + cmd_size += vn_sizeof_array_size(*pDataSize); + cmd_size += vn_sizeof_blob_array(pData, *pDataSize); + } else { + cmd_size += vn_sizeof_array_size(0); + } + + return cmd_size; +} + +static inline void vn_decode_vkGetVenusExperimentalFeatureData100000MESA_reply(struct vn_cs_decoder *dec, size_t* pDataSize, void* pData) +{ + VkCommandTypeEXT command_type; + vn_decode_VkCommandTypeEXT(dec, &command_type); + assert(command_type == VK_COMMAND_TYPE_vkGetVenusExperimentalFeatureData100000MESA_EXT); + + if (vn_decode_simple_pointer(dec)) { + vn_decode_size_t(dec, pDataSize); + } else { + pDataSize = NULL; + } + if (vn_peek_array_size(dec)) { + const size_t array_size = vn_decode_array_size(dec, *pDataSize); + vn_decode_blob_array(dec, pData, array_size); + } else { + vn_decode_array_size(dec, 0); + pData = NULL; + } +} + static inline void vn_submit_vkSetReplyCommandStreamMESA(struct vn_instance *vn_instance, VkCommandFlagsEXT cmd_flags, const VkCommandStreamDescriptionMESA* pStream, struct vn_instance_submit_command *submit) { uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE]; @@ -830,6 +1071,27 @@ static inline void vn_submit_vkGetMemoryResourcePropertiesMESA(struct vn_instanc } } +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]; + void *cmd_data = local_cmd_data; + size_t cmd_size = vn_sizeof_vkGetVenusExperimentalFeatureData100000MESA(pDataSize, pData); + 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_vkGetVenusExperimentalFeatureData100000MESA_reply(pDataSize, pData) : 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_vkGetVenusExperimentalFeatureData100000MESA(enc, cmd_flags, pDataSize, pData); + vn_instance_submit_command(vn_instance, submit); + if (cmd_data != local_cmd_data) + free(cmd_data); + } +} + static inline void vn_call_vkSetReplyCommandStreamMESA(struct vn_instance *vn_instance, const VkCommandStreamDescriptionMESA* pStream) { struct vn_instance_submit_command submit; @@ -969,4 +1231,21 @@ static inline void vn_async_vkGetMemoryResourcePropertiesMESA(struct vn_instance 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) +{ + struct vn_instance_submit_command submit; + vn_submit_vkGetVenusExperimentalFeatureData100000MESA(vn_instance, VK_COMMAND_GENERATE_REPLY_BIT_EXT, pDataSize, pData, &submit); + struct vn_cs_decoder *dec = vn_instance_get_command_reply(vn_instance, &submit); + if (dec) { + vn_decode_vkGetVenusExperimentalFeatureData100000MESA_reply(dec, pDataSize, pData); + vn_instance_free_command_reply(vn_instance, &submit); + } +} + +static inline void vn_async_vkGetVenusExperimentalFeatureData100000MESA(struct vn_instance *vn_instance, size_t* pDataSize, void* pData) +{ + struct vn_instance_submit_command submit; + vn_submit_vkGetVenusExperimentalFeatureData100000MESA(vn_instance, 0, pDataSize, pData, &submit); +} + #endif /* VN_PROTOCOL_DRIVER_TRANSPORT_H */