From e5429817272d5ef8cc2aaa94f74f52c59bf8df40 Mon Sep 17 00:00:00 2001 From: Yiwei Zhang Date: Wed, 23 Mar 2022 22:32:11 +0000 Subject: [PATCH] venus: update protocol to remove redundant decoders Signed-off-by: Yiwei Zhang Part-of: --- .../venus-protocol/vn_protocol_driver.h | 2 +- .../vn_protocol_driver_buffer.h | 224 ------------- .../vn_protocol_driver_command_buffer.h | 168 ---------- .../vn_protocol_driver_device_memory.h | 56 ---- .../venus-protocol/vn_protocol_driver_image.h | 299 ------------------ .../vn_protocol_driver_semaphore.h | 28 -- .../vn_protocol_driver_structs.h | 72 ----- 7 files changed, 1 insertion(+), 848 deletions(-) diff --git a/src/virtio/venus-protocol/vn_protocol_driver.h b/src/virtio/venus-protocol/vn_protocol_driver.h index e94decf5fe4..0c3e06586e9 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-3f642c37. */ +/* This file is generated by venus-protocol git-0dc93bc4. */ /* * Copyright 2020 Google LLC diff --git a/src/virtio/venus-protocol/vn_protocol_driver_buffer.h b/src/virtio/venus-protocol/vn_protocol_driver_buffer.h index 58a1e29257d..3a577a188e3 100644 --- a/src/virtio/venus-protocol/vn_protocol_driver_buffer.h +++ b/src/virtio/venus-protocol/vn_protocol_driver_buffer.h @@ -64,33 +64,6 @@ vn_encode_VkExternalMemoryBufferCreateInfo(struct vn_cs_encoder *enc, const VkEx vn_encode_VkExternalMemoryBufferCreateInfo_self(enc, val); } -static inline void -vn_decode_VkExternalMemoryBufferCreateInfo_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_VkExternalMemoryBufferCreateInfo_self(struct vn_cs_decoder *dec, VkExternalMemoryBufferCreateInfo *val) -{ - /* skip val->{sType,pNext} */ - vn_decode_VkFlags(dec, &val->handleTypes); -} - -static inline void -vn_decode_VkExternalMemoryBufferCreateInfo(struct vn_cs_decoder *dec, VkExternalMemoryBufferCreateInfo *val) -{ - VkStructureType stype; - vn_decode_VkStructureType(dec, &stype); - assert(stype == VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_BUFFER_CREATE_INFO); - - assert(val->sType == stype); - vn_decode_VkExternalMemoryBufferCreateInfo_pnext(dec, val->pNext); - vn_decode_VkExternalMemoryBufferCreateInfo_self(dec, val); -} - /* struct VkBufferOpaqueCaptureAddressCreateInfo chain */ static inline size_t @@ -144,33 +117,6 @@ vn_encode_VkBufferOpaqueCaptureAddressCreateInfo(struct vn_cs_encoder *enc, cons vn_encode_VkBufferOpaqueCaptureAddressCreateInfo_self(enc, val); } -static inline void -vn_decode_VkBufferOpaqueCaptureAddressCreateInfo_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_VkBufferOpaqueCaptureAddressCreateInfo_self(struct vn_cs_decoder *dec, VkBufferOpaqueCaptureAddressCreateInfo *val) -{ - /* skip val->{sType,pNext} */ - vn_decode_uint64_t(dec, &val->opaqueCaptureAddress); -} - -static inline void -vn_decode_VkBufferOpaqueCaptureAddressCreateInfo(struct vn_cs_decoder *dec, VkBufferOpaqueCaptureAddressCreateInfo *val) -{ - VkStructureType stype; - vn_decode_VkStructureType(dec, &stype); - assert(stype == VK_STRUCTURE_TYPE_BUFFER_OPAQUE_CAPTURE_ADDRESS_CREATE_INFO); - - assert(val->sType == stype); - vn_decode_VkBufferOpaqueCaptureAddressCreateInfo_pnext(dec, val->pNext); - vn_decode_VkBufferOpaqueCaptureAddressCreateInfo_self(dec, val); -} - /* struct VkBufferCreateInfo chain */ static inline size_t @@ -289,67 +235,6 @@ vn_encode_VkBufferCreateInfo(struct vn_cs_encoder *enc, const VkBufferCreateInfo vn_encode_VkBufferCreateInfo_self(enc, val); } -static inline void -vn_decode_VkBufferCreateInfo_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; - } - - switch ((int32_t)pnext->sType) { - case VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_BUFFER_CREATE_INFO: - vn_decode_VkBufferCreateInfo_pnext(dec, pnext->pNext); - vn_decode_VkExternalMemoryBufferCreateInfo_self(dec, (VkExternalMemoryBufferCreateInfo *)pnext); - break; - case VK_STRUCTURE_TYPE_BUFFER_OPAQUE_CAPTURE_ADDRESS_CREATE_INFO: - vn_decode_VkBufferCreateInfo_pnext(dec, pnext->pNext); - vn_decode_VkBufferOpaqueCaptureAddressCreateInfo_self(dec, (VkBufferOpaqueCaptureAddressCreateInfo *)pnext); - break; - default: - assert(false); - break; - } -} - -static inline void -vn_decode_VkBufferCreateInfo_self(struct vn_cs_decoder *dec, VkBufferCreateInfo *val) -{ - /* skip val->{sType,pNext} */ - vn_decode_VkFlags(dec, &val->flags); - vn_decode_VkDeviceSize(dec, &val->size); - vn_decode_VkFlags(dec, &val->usage); - vn_decode_VkSharingMode(dec, &val->sharingMode); - vn_decode_uint32_t(dec, &val->queueFamilyIndexCount); - if (vn_peek_array_size(dec)) { - const size_t array_size = vn_decode_array_size(dec, val->queueFamilyIndexCount); - vn_decode_uint32_t_array(dec, (uint32_t *)val->pQueueFamilyIndices, array_size); - } else { - vn_decode_array_size_unchecked(dec); - val->pQueueFamilyIndices = NULL; - } -} - -static inline void -vn_decode_VkBufferCreateInfo(struct vn_cs_decoder *dec, VkBufferCreateInfo *val) -{ - VkStructureType stype; - vn_decode_VkStructureType(dec, &stype); - assert(stype == VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO); - - assert(val->sType == stype); - vn_decode_VkBufferCreateInfo_pnext(dec, val->pNext); - vn_decode_VkBufferCreateInfo_self(dec, val); -} - /* struct VkBindBufferMemoryDeviceGroupInfo chain */ static inline size_t @@ -415,40 +300,6 @@ vn_encode_VkBindBufferMemoryDeviceGroupInfo(struct vn_cs_encoder *enc, const VkB vn_encode_VkBindBufferMemoryDeviceGroupInfo_self(enc, val); } -static inline void -vn_decode_VkBindBufferMemoryDeviceGroupInfo_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_VkBindBufferMemoryDeviceGroupInfo_self(struct vn_cs_decoder *dec, VkBindBufferMemoryDeviceGroupInfo *val) -{ - /* skip val->{sType,pNext} */ - vn_decode_uint32_t(dec, &val->deviceIndexCount); - if (vn_peek_array_size(dec)) { - const size_t array_size = vn_decode_array_size(dec, val->deviceIndexCount); - vn_decode_uint32_t_array(dec, (uint32_t *)val->pDeviceIndices, array_size); - } else { - vn_decode_array_size_unchecked(dec); - val->pDeviceIndices = NULL; - } -} - -static inline void -vn_decode_VkBindBufferMemoryDeviceGroupInfo(struct vn_cs_decoder *dec, VkBindBufferMemoryDeviceGroupInfo *val) -{ - VkStructureType stype; - vn_decode_VkStructureType(dec, &stype); - assert(stype == VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_DEVICE_GROUP_INFO); - - assert(val->sType == stype); - vn_decode_VkBindBufferMemoryDeviceGroupInfo_pnext(dec, val->pNext); - vn_decode_VkBindBufferMemoryDeviceGroupInfo_self(dec, val); -} - /* struct VkBindBufferMemoryInfo chain */ static inline size_t @@ -539,54 +390,6 @@ vn_encode_VkBindBufferMemoryInfo(struct vn_cs_encoder *enc, const VkBindBufferMe vn_encode_VkBindBufferMemoryInfo_self(enc, val); } -static inline void -vn_decode_VkBindBufferMemoryInfo_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; - } - - switch ((int32_t)pnext->sType) { - case VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_DEVICE_GROUP_INFO: - vn_decode_VkBindBufferMemoryInfo_pnext(dec, pnext->pNext); - vn_decode_VkBindBufferMemoryDeviceGroupInfo_self(dec, (VkBindBufferMemoryDeviceGroupInfo *)pnext); - break; - default: - assert(false); - break; - } -} - -static inline void -vn_decode_VkBindBufferMemoryInfo_self(struct vn_cs_decoder *dec, VkBindBufferMemoryInfo *val) -{ - /* skip val->{sType,pNext} */ - vn_decode_VkBuffer(dec, &val->buffer); - vn_decode_VkDeviceMemory(dec, &val->memory); - vn_decode_VkDeviceSize(dec, &val->memoryOffset); -} - -static inline void -vn_decode_VkBindBufferMemoryInfo(struct vn_cs_decoder *dec, VkBindBufferMemoryInfo *val) -{ - VkStructureType stype; - vn_decode_VkStructureType(dec, &stype); - assert(stype == VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_INFO); - - assert(val->sType == stype); - vn_decode_VkBindBufferMemoryInfo_pnext(dec, val->pNext); - vn_decode_VkBindBufferMemoryInfo_self(dec, val); -} - /* struct VkBufferMemoryRequirementsInfo2 chain */ static inline size_t @@ -749,33 +552,6 @@ vn_encode_VkBufferDeviceAddressInfo(struct vn_cs_encoder *enc, const VkBufferDev vn_encode_VkBufferDeviceAddressInfo_self(enc, val); } -static inline void -vn_decode_VkBufferDeviceAddressInfo_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_VkBufferDeviceAddressInfo_self(struct vn_cs_decoder *dec, VkBufferDeviceAddressInfo *val) -{ - /* skip val->{sType,pNext} */ - vn_decode_VkBuffer(dec, &val->buffer); -} - -static inline void -vn_decode_VkBufferDeviceAddressInfo(struct vn_cs_decoder *dec, VkBufferDeviceAddressInfo *val) -{ - VkStructureType stype; - vn_decode_VkStructureType(dec, &stype); - assert(stype == VK_STRUCTURE_TYPE_BUFFER_DEVICE_ADDRESS_INFO); - - assert(val->sType == stype); - vn_decode_VkBufferDeviceAddressInfo_pnext(dec, val->pNext); - vn_decode_VkBufferDeviceAddressInfo_self(dec, val); -} - static inline size_t vn_sizeof_vkGetBufferMemoryRequirements(VkDevice device, VkBuffer buffer, VkMemoryRequirements* pMemoryRequirements) { const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkGetBufferMemoryRequirements_EXT; diff --git a/src/virtio/venus-protocol/vn_protocol_driver_command_buffer.h b/src/virtio/venus-protocol/vn_protocol_driver_command_buffer.h index 6f37738faf1..411774e72f1 100644 --- a/src/virtio/venus-protocol/vn_protocol_driver_command_buffer.h +++ b/src/virtio/venus-protocol/vn_protocol_driver_command_buffer.h @@ -143,45 +143,6 @@ vn_encode_VkCommandBufferInheritanceRenderingInfo(struct vn_cs_encoder *enc, con vn_encode_VkCommandBufferInheritanceRenderingInfo_self(enc, val); } -static inline void -vn_decode_VkCommandBufferInheritanceRenderingInfo_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_VkCommandBufferInheritanceRenderingInfo_self(struct vn_cs_decoder *dec, VkCommandBufferInheritanceRenderingInfo *val) -{ - /* skip val->{sType,pNext} */ - vn_decode_VkFlags(dec, &val->flags); - vn_decode_uint32_t(dec, &val->viewMask); - vn_decode_uint32_t(dec, &val->colorAttachmentCount); - if (vn_peek_array_size(dec)) { - const size_t array_size = vn_decode_array_size(dec, val->colorAttachmentCount); - vn_decode_VkFormat_array(dec, (VkFormat *)val->pColorAttachmentFormats, array_size); - } else { - vn_decode_array_size_unchecked(dec); - val->pColorAttachmentFormats = NULL; - } - vn_decode_VkFormat(dec, &val->depthAttachmentFormat); - vn_decode_VkFormat(dec, &val->stencilAttachmentFormat); - vn_decode_VkSampleCountFlagBits(dec, &val->rasterizationSamples); -} - -static inline void -vn_decode_VkCommandBufferInheritanceRenderingInfo(struct vn_cs_decoder *dec, VkCommandBufferInheritanceRenderingInfo *val) -{ - VkStructureType stype; - vn_decode_VkStructureType(dec, &stype); - assert(stype == VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_RENDERING_INFO); - - assert(val->sType == stype); - vn_decode_VkCommandBufferInheritanceRenderingInfo_pnext(dec, val->pNext); - vn_decode_VkCommandBufferInheritanceRenderingInfo_self(dec, val); -} - /* struct VkCommandBufferInheritanceInfo chain */ static inline size_t @@ -278,57 +239,6 @@ vn_encode_VkCommandBufferInheritanceInfo(struct vn_cs_encoder *enc, const VkComm vn_encode_VkCommandBufferInheritanceInfo_self(enc, val); } -static inline void -vn_decode_VkCommandBufferInheritanceInfo_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; - } - - switch ((int32_t)pnext->sType) { - case VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_RENDERING_INFO: - vn_decode_VkCommandBufferInheritanceInfo_pnext(dec, pnext->pNext); - vn_decode_VkCommandBufferInheritanceRenderingInfo_self(dec, (VkCommandBufferInheritanceRenderingInfo *)pnext); - break; - default: - assert(false); - break; - } -} - -static inline void -vn_decode_VkCommandBufferInheritanceInfo_self(struct vn_cs_decoder *dec, VkCommandBufferInheritanceInfo *val) -{ - /* skip val->{sType,pNext} */ - vn_decode_VkRenderPass(dec, &val->renderPass); - vn_decode_uint32_t(dec, &val->subpass); - vn_decode_VkFramebuffer(dec, &val->framebuffer); - vn_decode_VkBool32(dec, &val->occlusionQueryEnable); - vn_decode_VkFlags(dec, &val->queryFlags); - vn_decode_VkFlags(dec, &val->pipelineStatistics); -} - -static inline void -vn_decode_VkCommandBufferInheritanceInfo(struct vn_cs_decoder *dec, VkCommandBufferInheritanceInfo *val) -{ - VkStructureType stype; - vn_decode_VkStructureType(dec, &stype); - assert(stype == VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_INFO); - - assert(val->sType == stype); - vn_decode_VkCommandBufferInheritanceInfo_pnext(dec, val->pNext); - vn_decode_VkCommandBufferInheritanceInfo_self(dec, val); -} - /* struct VkDeviceGroupCommandBufferBeginInfo chain */ static inline size_t @@ -382,33 +292,6 @@ vn_encode_VkDeviceGroupCommandBufferBeginInfo(struct vn_cs_encoder *enc, const V vn_encode_VkDeviceGroupCommandBufferBeginInfo_self(enc, val); } -static inline void -vn_decode_VkDeviceGroupCommandBufferBeginInfo_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_VkDeviceGroupCommandBufferBeginInfo_self(struct vn_cs_decoder *dec, VkDeviceGroupCommandBufferBeginInfo *val) -{ - /* skip val->{sType,pNext} */ - vn_decode_uint32_t(dec, &val->deviceMask); -} - -static inline void -vn_decode_VkDeviceGroupCommandBufferBeginInfo(struct vn_cs_decoder *dec, VkDeviceGroupCommandBufferBeginInfo *val) -{ - VkStructureType stype; - vn_decode_VkStructureType(dec, &stype); - assert(stype == VK_STRUCTURE_TYPE_DEVICE_GROUP_COMMAND_BUFFER_BEGIN_INFO); - - assert(val->sType == stype); - vn_decode_VkDeviceGroupCommandBufferBeginInfo_pnext(dec, val->pNext); - vn_decode_VkDeviceGroupCommandBufferBeginInfo_self(dec, val); -} - /* struct VkCommandBufferBeginInfo chain */ static inline size_t @@ -500,57 +383,6 @@ vn_encode_VkCommandBufferBeginInfo(struct vn_cs_encoder *enc, const VkCommandBuf vn_encode_VkCommandBufferBeginInfo_self(enc, val); } -static inline void -vn_decode_VkCommandBufferBeginInfo_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; - } - - switch ((int32_t)pnext->sType) { - case VK_STRUCTURE_TYPE_DEVICE_GROUP_COMMAND_BUFFER_BEGIN_INFO: - vn_decode_VkCommandBufferBeginInfo_pnext(dec, pnext->pNext); - vn_decode_VkDeviceGroupCommandBufferBeginInfo_self(dec, (VkDeviceGroupCommandBufferBeginInfo *)pnext); - break; - default: - assert(false); - break; - } -} - -static inline void -vn_decode_VkCommandBufferBeginInfo_self(struct vn_cs_decoder *dec, VkCommandBufferBeginInfo *val) -{ - /* skip val->{sType,pNext} */ - vn_decode_VkFlags(dec, &val->flags); - if (vn_decode_simple_pointer(dec)) { - vn_decode_VkCommandBufferInheritanceInfo(dec, (VkCommandBufferInheritanceInfo *)val->pInheritanceInfo); - } else { - val->pInheritanceInfo = NULL; - } -} - -static inline void -vn_decode_VkCommandBufferBeginInfo(struct vn_cs_decoder *dec, VkCommandBufferBeginInfo *val) -{ - VkStructureType stype; - vn_decode_VkStructureType(dec, &stype); - assert(stype == VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO); - - assert(val->sType == stype); - vn_decode_VkCommandBufferBeginInfo_pnext(dec, val->pNext); - vn_decode_VkCommandBufferBeginInfo_self(dec, val); -} - /* struct VkBufferCopy */ static inline size_t 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 7fb41f3b938..dbdaccbc716 100644 --- a/src/virtio/venus-protocol/vn_protocol_driver_device_memory.h +++ b/src/virtio/venus-protocol/vn_protocol_driver_device_memory.h @@ -482,35 +482,6 @@ vn_encode_VkMappedMemoryRange(struct vn_cs_encoder *enc, const VkMappedMemoryRan vn_encode_VkMappedMemoryRange_self(enc, val); } -static inline void -vn_decode_VkMappedMemoryRange_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_VkMappedMemoryRange_self(struct vn_cs_decoder *dec, VkMappedMemoryRange *val) -{ - /* skip val->{sType,pNext} */ - vn_decode_VkDeviceMemory(dec, &val->memory); - vn_decode_VkDeviceSize(dec, &val->offset); - vn_decode_VkDeviceSize(dec, &val->size); -} - -static inline void -vn_decode_VkMappedMemoryRange(struct vn_cs_decoder *dec, VkMappedMemoryRange *val) -{ - VkStructureType stype; - vn_decode_VkStructureType(dec, &stype); - assert(stype == VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE); - - assert(val->sType == stype); - vn_decode_VkMappedMemoryRange_pnext(dec, val->pNext); - vn_decode_VkMappedMemoryRange_self(dec, val); -} - /* struct VkDeviceMemoryOpaqueCaptureAddressInfo chain */ static inline size_t @@ -564,33 +535,6 @@ vn_encode_VkDeviceMemoryOpaqueCaptureAddressInfo(struct vn_cs_encoder *enc, cons vn_encode_VkDeviceMemoryOpaqueCaptureAddressInfo_self(enc, val); } -static inline void -vn_decode_VkDeviceMemoryOpaqueCaptureAddressInfo_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_VkDeviceMemoryOpaqueCaptureAddressInfo_self(struct vn_cs_decoder *dec, VkDeviceMemoryOpaqueCaptureAddressInfo *val) -{ - /* skip val->{sType,pNext} */ - vn_decode_VkDeviceMemory(dec, &val->memory); -} - -static inline void -vn_decode_VkDeviceMemoryOpaqueCaptureAddressInfo(struct vn_cs_decoder *dec, VkDeviceMemoryOpaqueCaptureAddressInfo *val) -{ - VkStructureType stype; - vn_decode_VkStructureType(dec, &stype); - assert(stype == VK_STRUCTURE_TYPE_DEVICE_MEMORY_OPAQUE_CAPTURE_ADDRESS_INFO); - - assert(val->sType == stype); - vn_decode_VkDeviceMemoryOpaqueCaptureAddressInfo_pnext(dec, val->pNext); - vn_decode_VkDeviceMemoryOpaqueCaptureAddressInfo_self(dec, 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; diff --git a/src/virtio/venus-protocol/vn_protocol_driver_image.h b/src/virtio/venus-protocol/vn_protocol_driver_image.h index dcca3b2422d..aedcc85d91c 100644 --- a/src/virtio/venus-protocol/vn_protocol_driver_image.h +++ b/src/virtio/venus-protocol/vn_protocol_driver_image.h @@ -110,33 +110,6 @@ vn_encode_VkExternalMemoryImageCreateInfo(struct vn_cs_encoder *enc, const VkExt vn_encode_VkExternalMemoryImageCreateInfo_self(enc, val); } -static inline void -vn_decode_VkExternalMemoryImageCreateInfo_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_VkExternalMemoryImageCreateInfo_self(struct vn_cs_decoder *dec, VkExternalMemoryImageCreateInfo *val) -{ - /* skip val->{sType,pNext} */ - vn_decode_VkFlags(dec, &val->handleTypes); -} - -static inline void -vn_decode_VkExternalMemoryImageCreateInfo(struct vn_cs_decoder *dec, VkExternalMemoryImageCreateInfo *val) -{ - VkStructureType stype; - vn_decode_VkStructureType(dec, &stype); - assert(stype == VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO); - - assert(val->sType == stype); - vn_decode_VkExternalMemoryImageCreateInfo_pnext(dec, val->pNext); - vn_decode_VkExternalMemoryImageCreateInfo_self(dec, val); -} - /* struct VkImageDrmFormatModifierListCreateInfoEXT chain */ static inline size_t @@ -202,40 +175,6 @@ vn_encode_VkImageDrmFormatModifierListCreateInfoEXT(struct vn_cs_encoder *enc, c vn_encode_VkImageDrmFormatModifierListCreateInfoEXT_self(enc, val); } -static inline void -vn_decode_VkImageDrmFormatModifierListCreateInfoEXT_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_VkImageDrmFormatModifierListCreateInfoEXT_self(struct vn_cs_decoder *dec, VkImageDrmFormatModifierListCreateInfoEXT *val) -{ - /* skip val->{sType,pNext} */ - vn_decode_uint32_t(dec, &val->drmFormatModifierCount); - if (vn_peek_array_size(dec)) { - const size_t array_size = vn_decode_array_size(dec, val->drmFormatModifierCount); - vn_decode_uint64_t_array(dec, (uint64_t *)val->pDrmFormatModifiers, array_size); - } else { - vn_decode_array_size_unchecked(dec); - val->pDrmFormatModifiers = NULL; - } -} - -static inline void -vn_decode_VkImageDrmFormatModifierListCreateInfoEXT(struct vn_cs_decoder *dec, VkImageDrmFormatModifierListCreateInfoEXT *val) -{ - VkStructureType stype; - vn_decode_VkStructureType(dec, &stype); - assert(stype == VK_STRUCTURE_TYPE_IMAGE_DRM_FORMAT_MODIFIER_LIST_CREATE_INFO_EXT); - - assert(val->sType == stype); - vn_decode_VkImageDrmFormatModifierListCreateInfoEXT_pnext(dec, val->pNext); - vn_decode_VkImageDrmFormatModifierListCreateInfoEXT_self(dec, val); -} - /* struct VkSubresourceLayout */ static inline size_t @@ -361,42 +300,6 @@ vn_encode_VkImageDrmFormatModifierExplicitCreateInfoEXT(struct vn_cs_encoder *en vn_encode_VkImageDrmFormatModifierExplicitCreateInfoEXT_self(enc, val); } -static inline void -vn_decode_VkImageDrmFormatModifierExplicitCreateInfoEXT_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_VkImageDrmFormatModifierExplicitCreateInfoEXT_self(struct vn_cs_decoder *dec, VkImageDrmFormatModifierExplicitCreateInfoEXT *val) -{ - /* skip val->{sType,pNext} */ - vn_decode_uint64_t(dec, &val->drmFormatModifier); - vn_decode_uint32_t(dec, &val->drmFormatModifierPlaneCount); - if (vn_peek_array_size(dec)) { - const uint32_t iter_count = vn_decode_array_size(dec, val->drmFormatModifierPlaneCount); - for (uint32_t i = 0; i < iter_count; i++) - vn_decode_VkSubresourceLayout(dec, &((VkSubresourceLayout *)val->pPlaneLayouts)[i]); - } else { - vn_decode_array_size_unchecked(dec); - val->pPlaneLayouts = NULL; - } -} - -static inline void -vn_decode_VkImageDrmFormatModifierExplicitCreateInfoEXT(struct vn_cs_decoder *dec, VkImageDrmFormatModifierExplicitCreateInfoEXT *val) -{ - VkStructureType stype; - vn_decode_VkStructureType(dec, &stype); - assert(stype == VK_STRUCTURE_TYPE_IMAGE_DRM_FORMAT_MODIFIER_EXPLICIT_CREATE_INFO_EXT); - - assert(val->sType == stype); - vn_decode_VkImageDrmFormatModifierExplicitCreateInfoEXT_pnext(dec, val->pNext); - vn_decode_VkImageDrmFormatModifierExplicitCreateInfoEXT_self(dec, val); -} - /* struct VkImageCreateInfo chain */ static inline size_t @@ -565,86 +468,6 @@ vn_encode_VkImageCreateInfo(struct vn_cs_encoder *enc, const VkImageCreateInfo * vn_encode_VkImageCreateInfo_self(enc, val); } -static inline void -vn_decode_VkImageCreateInfo_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; - } - - switch ((int32_t)pnext->sType) { - case VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO: - vn_decode_VkImageCreateInfo_pnext(dec, pnext->pNext); - vn_decode_VkExternalMemoryImageCreateInfo_self(dec, (VkExternalMemoryImageCreateInfo *)pnext); - break; - case VK_STRUCTURE_TYPE_IMAGE_FORMAT_LIST_CREATE_INFO: - vn_decode_VkImageCreateInfo_pnext(dec, pnext->pNext); - vn_decode_VkImageFormatListCreateInfo_self(dec, (VkImageFormatListCreateInfo *)pnext); - break; - case VK_STRUCTURE_TYPE_IMAGE_DRM_FORMAT_MODIFIER_LIST_CREATE_INFO_EXT: - vn_decode_VkImageCreateInfo_pnext(dec, pnext->pNext); - vn_decode_VkImageDrmFormatModifierListCreateInfoEXT_self(dec, (VkImageDrmFormatModifierListCreateInfoEXT *)pnext); - break; - case VK_STRUCTURE_TYPE_IMAGE_DRM_FORMAT_MODIFIER_EXPLICIT_CREATE_INFO_EXT: - vn_decode_VkImageCreateInfo_pnext(dec, pnext->pNext); - vn_decode_VkImageDrmFormatModifierExplicitCreateInfoEXT_self(dec, (VkImageDrmFormatModifierExplicitCreateInfoEXT *)pnext); - break; - case VK_STRUCTURE_TYPE_IMAGE_STENCIL_USAGE_CREATE_INFO: - vn_decode_VkImageCreateInfo_pnext(dec, pnext->pNext); - vn_decode_VkImageStencilUsageCreateInfo_self(dec, (VkImageStencilUsageCreateInfo *)pnext); - break; - default: - assert(false); - break; - } -} - -static inline void -vn_decode_VkImageCreateInfo_self(struct vn_cs_decoder *dec, VkImageCreateInfo *val) -{ - /* skip val->{sType,pNext} */ - vn_decode_VkFlags(dec, &val->flags); - vn_decode_VkImageType(dec, &val->imageType); - vn_decode_VkFormat(dec, &val->format); - vn_decode_VkExtent3D(dec, &val->extent); - vn_decode_uint32_t(dec, &val->mipLevels); - vn_decode_uint32_t(dec, &val->arrayLayers); - vn_decode_VkSampleCountFlagBits(dec, &val->samples); - vn_decode_VkImageTiling(dec, &val->tiling); - vn_decode_VkFlags(dec, &val->usage); - vn_decode_VkSharingMode(dec, &val->sharingMode); - vn_decode_uint32_t(dec, &val->queueFamilyIndexCount); - if (vn_peek_array_size(dec)) { - const size_t array_size = vn_decode_array_size(dec, val->queueFamilyIndexCount); - vn_decode_uint32_t_array(dec, (uint32_t *)val->pQueueFamilyIndices, array_size); - } else { - vn_decode_array_size_unchecked(dec); - val->pQueueFamilyIndices = NULL; - } - vn_decode_VkImageLayout(dec, &val->initialLayout); -} - -static inline void -vn_decode_VkImageCreateInfo(struct vn_cs_decoder *dec, VkImageCreateInfo *val) -{ - VkStructureType stype; - vn_decode_VkStructureType(dec, &stype); - assert(stype == VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO); - - assert(val->sType == stype); - vn_decode_VkImageCreateInfo_pnext(dec, val->pNext); - vn_decode_VkImageCreateInfo_self(dec, val); -} - /* struct VkBindImageMemoryDeviceGroupInfo chain */ static inline size_t @@ -726,49 +549,6 @@ vn_encode_VkBindImageMemoryDeviceGroupInfo(struct vn_cs_encoder *enc, const VkBi vn_encode_VkBindImageMemoryDeviceGroupInfo_self(enc, val); } -static inline void -vn_decode_VkBindImageMemoryDeviceGroupInfo_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_VkBindImageMemoryDeviceGroupInfo_self(struct vn_cs_decoder *dec, VkBindImageMemoryDeviceGroupInfo *val) -{ - /* skip val->{sType,pNext} */ - vn_decode_uint32_t(dec, &val->deviceIndexCount); - if (vn_peek_array_size(dec)) { - const size_t array_size = vn_decode_array_size(dec, val->deviceIndexCount); - vn_decode_uint32_t_array(dec, (uint32_t *)val->pDeviceIndices, array_size); - } else { - vn_decode_array_size_unchecked(dec); - val->pDeviceIndices = NULL; - } - vn_decode_uint32_t(dec, &val->splitInstanceBindRegionCount); - if (vn_peek_array_size(dec)) { - const uint32_t iter_count = vn_decode_array_size(dec, val->splitInstanceBindRegionCount); - for (uint32_t i = 0; i < iter_count; i++) - vn_decode_VkRect2D(dec, &((VkRect2D *)val->pSplitInstanceBindRegions)[i]); - } else { - vn_decode_array_size_unchecked(dec); - val->pSplitInstanceBindRegions = NULL; - } -} - -static inline void -vn_decode_VkBindImageMemoryDeviceGroupInfo(struct vn_cs_decoder *dec, VkBindImageMemoryDeviceGroupInfo *val) -{ - VkStructureType stype; - vn_decode_VkStructureType(dec, &stype); - assert(stype == VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_DEVICE_GROUP_INFO); - - assert(val->sType == stype); - vn_decode_VkBindImageMemoryDeviceGroupInfo_pnext(dec, val->pNext); - vn_decode_VkBindImageMemoryDeviceGroupInfo_self(dec, val); -} - /* struct VkBindImagePlaneMemoryInfo chain */ static inline size_t @@ -822,33 +602,6 @@ vn_encode_VkBindImagePlaneMemoryInfo(struct vn_cs_encoder *enc, const VkBindImag vn_encode_VkBindImagePlaneMemoryInfo_self(enc, val); } -static inline void -vn_decode_VkBindImagePlaneMemoryInfo_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_VkBindImagePlaneMemoryInfo_self(struct vn_cs_decoder *dec, VkBindImagePlaneMemoryInfo *val) -{ - /* skip val->{sType,pNext} */ - vn_decode_VkImageAspectFlagBits(dec, &val->planeAspect); -} - -static inline void -vn_decode_VkBindImagePlaneMemoryInfo(struct vn_cs_decoder *dec, VkBindImagePlaneMemoryInfo *val) -{ - VkStructureType stype; - vn_decode_VkStructureType(dec, &stype); - assert(stype == VK_STRUCTURE_TYPE_BIND_IMAGE_PLANE_MEMORY_INFO); - - assert(val->sType == stype); - vn_decode_VkBindImagePlaneMemoryInfo_pnext(dec, val->pNext); - vn_decode_VkBindImagePlaneMemoryInfo_self(dec, val); -} - /* struct VkBindImageMemoryInfo chain */ static inline size_t @@ -951,58 +704,6 @@ vn_encode_VkBindImageMemoryInfo(struct vn_cs_encoder *enc, const VkBindImageMemo vn_encode_VkBindImageMemoryInfo_self(enc, val); } -static inline void -vn_decode_VkBindImageMemoryInfo_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; - } - - switch ((int32_t)pnext->sType) { - case VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_DEVICE_GROUP_INFO: - vn_decode_VkBindImageMemoryInfo_pnext(dec, pnext->pNext); - vn_decode_VkBindImageMemoryDeviceGroupInfo_self(dec, (VkBindImageMemoryDeviceGroupInfo *)pnext); - break; - case VK_STRUCTURE_TYPE_BIND_IMAGE_PLANE_MEMORY_INFO: - vn_decode_VkBindImageMemoryInfo_pnext(dec, pnext->pNext); - vn_decode_VkBindImagePlaneMemoryInfo_self(dec, (VkBindImagePlaneMemoryInfo *)pnext); - break; - default: - assert(false); - break; - } -} - -static inline void -vn_decode_VkBindImageMemoryInfo_self(struct vn_cs_decoder *dec, VkBindImageMemoryInfo *val) -{ - /* skip val->{sType,pNext} */ - vn_decode_VkImage(dec, &val->image); - vn_decode_VkDeviceMemory(dec, &val->memory); - vn_decode_VkDeviceSize(dec, &val->memoryOffset); -} - -static inline void -vn_decode_VkBindImageMemoryInfo(struct vn_cs_decoder *dec, VkBindImageMemoryInfo *val) -{ - VkStructureType stype; - vn_decode_VkStructureType(dec, &stype); - assert(stype == VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_INFO); - - assert(val->sType == stype); - vn_decode_VkBindImageMemoryInfo_pnext(dec, val->pNext); - vn_decode_VkBindImageMemoryInfo_self(dec, val); -} - /* struct VkImagePlaneMemoryRequirementsInfo chain */ static inline size_t diff --git a/src/virtio/venus-protocol/vn_protocol_driver_semaphore.h b/src/virtio/venus-protocol/vn_protocol_driver_semaphore.h index 0f55424e70c..e17f61c4f3b 100644 --- a/src/virtio/venus-protocol/vn_protocol_driver_semaphore.h +++ b/src/virtio/venus-protocol/vn_protocol_driver_semaphore.h @@ -298,34 +298,6 @@ vn_encode_VkSemaphoreSignalInfo(struct vn_cs_encoder *enc, const VkSemaphoreSign vn_encode_VkSemaphoreSignalInfo_self(enc, val); } -static inline void -vn_decode_VkSemaphoreSignalInfo_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_VkSemaphoreSignalInfo_self(struct vn_cs_decoder *dec, VkSemaphoreSignalInfo *val) -{ - /* skip val->{sType,pNext} */ - vn_decode_VkSemaphore(dec, &val->semaphore); - vn_decode_uint64_t(dec, &val->value); -} - -static inline void -vn_decode_VkSemaphoreSignalInfo(struct vn_cs_decoder *dec, VkSemaphoreSignalInfo *val) -{ - VkStructureType stype; - vn_decode_VkStructureType(dec, &stype); - assert(stype == VK_STRUCTURE_TYPE_SEMAPHORE_SIGNAL_INFO); - - assert(val->sType == stype); - vn_decode_VkSemaphoreSignalInfo_pnext(dec, val->pNext); - vn_decode_VkSemaphoreSignalInfo_self(dec, 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; diff --git a/src/virtio/venus-protocol/vn_protocol_driver_structs.h b/src/virtio/venus-protocol/vn_protocol_driver_structs.h index 74edb3fc7f0..632437f017d 100644 --- a/src/virtio/venus-protocol/vn_protocol_driver_structs.h +++ b/src/virtio/venus-protocol/vn_protocol_driver_structs.h @@ -394,40 +394,6 @@ vn_encode_VkImageFormatListCreateInfo(struct vn_cs_encoder *enc, const VkImageFo vn_encode_VkImageFormatListCreateInfo_self(enc, val); } -static inline void -vn_decode_VkImageFormatListCreateInfo_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_VkImageFormatListCreateInfo_self(struct vn_cs_decoder *dec, VkImageFormatListCreateInfo *val) -{ - /* skip val->{sType,pNext} */ - vn_decode_uint32_t(dec, &val->viewFormatCount); - if (vn_peek_array_size(dec)) { - const size_t array_size = vn_decode_array_size(dec, val->viewFormatCount); - vn_decode_VkFormat_array(dec, (VkFormat *)val->pViewFormats, array_size); - } else { - vn_decode_array_size_unchecked(dec); - val->pViewFormats = NULL; - } -} - -static inline void -vn_decode_VkImageFormatListCreateInfo(struct vn_cs_decoder *dec, VkImageFormatListCreateInfo *val) -{ - VkStructureType stype; - vn_decode_VkStructureType(dec, &stype); - assert(stype == VK_STRUCTURE_TYPE_IMAGE_FORMAT_LIST_CREATE_INFO); - - assert(val->sType == stype); - vn_decode_VkImageFormatListCreateInfo_pnext(dec, val->pNext); - vn_decode_VkImageFormatListCreateInfo_self(dec, val); -} - /* struct VkImageStencilUsageCreateInfo chain */ static inline size_t @@ -481,33 +447,6 @@ vn_encode_VkImageStencilUsageCreateInfo(struct vn_cs_encoder *enc, const VkImage vn_encode_VkImageStencilUsageCreateInfo_self(enc, val); } -static inline void -vn_decode_VkImageStencilUsageCreateInfo_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_VkImageStencilUsageCreateInfo_self(struct vn_cs_decoder *dec, VkImageStencilUsageCreateInfo *val) -{ - /* skip val->{sType,pNext} */ - vn_decode_VkFlags(dec, &val->stencilUsage); -} - -static inline void -vn_decode_VkImageStencilUsageCreateInfo(struct vn_cs_decoder *dec, VkImageStencilUsageCreateInfo *val) -{ - VkStructureType stype; - vn_decode_VkStructureType(dec, &stype); - assert(stype == VK_STRUCTURE_TYPE_IMAGE_STENCIL_USAGE_CREATE_INFO); - - assert(val->sType == stype); - vn_decode_VkImageStencilUsageCreateInfo_pnext(dec, val->pNext); - vn_decode_VkImageStencilUsageCreateInfo_self(dec, val); -} - /* struct VkComponentMapping */ static inline size_t @@ -662,17 +601,6 @@ vn_encode_VkViewport(struct vn_cs_encoder *enc, const VkViewport *val) vn_encode_float(enc, &val->maxDepth); } -static inline void -vn_decode_VkViewport(struct vn_cs_decoder *dec, VkViewport *val) -{ - vn_decode_float(dec, &val->x); - vn_decode_float(dec, &val->y); - vn_decode_float(dec, &val->width); - vn_decode_float(dec, &val->height); - vn_decode_float(dec, &val->minDepth); - vn_decode_float(dec, &val->maxDepth); -} - /* struct VkOffset2D */ static inline size_t