diff options
author | Yilong Li <liyl@google.com> | 2021-11-11 07:15:19 -0800 |
---|---|---|
committer | Yilong Li <liyl@google.com> | 2021-11-11 07:20:19 -0800 |
commit | f4cc9c4b0107dc82c80d726875fa8e22b011fe3d (patch) | |
tree | ad04d8ecd6a863700626e7b3418d0be34af1dc15 | |
parent | 568e15184f315e1beb85f04e7457554f83b5ff48 (diff) | |
download | gfxstream-protocols-f4cc9c4b0107dc82c80d726875fa8e22b011fe3d.tar.gz |
vulkan-cereal: Remove marshaling/decoding code for WSI extensions.
WSI extension structs and methods may refer to system native
opaque structs (e.g. in VK_KHR_xcb_surface some structs refer
to xcb_connection_t of which the definition is not available
for library users). These structs and API calls should never
be used by guests, so we remove the marshaling / decoding code
for them.
Bug: 179477624
Change-Id: If07d76a4cff7348a19fa0f8c17402f9713794680
-rw-r--r-- | registry/vulkan/xml/cereal/decoder.py | 9 | ||||
-rw-r--r-- | registry/vulkan/xml/cereal/marshalingdefs.py | 10 |
2 files changed, 19 insertions, 0 deletions
diff --git a/registry/vulkan/xml/cereal/decoder.py b/registry/vulkan/xml/cereal/decoder.py index 1de4fd5e..f83a3876 100644 --- a/registry/vulkan/xml/cereal/decoder.py +++ b/registry/vulkan/xml/cereal/decoder.py @@ -567,6 +567,11 @@ def decode_vkInvalidateMappedMemoryRanges(typeInfo, api, cgen): emit_pool_free(cgen) emit_seqno_incr(api, cgen) +def decode_unsupported_api(typeInfo, api, cgen): + cgen.line(f"// Decoding {api.name} is not supported. This should not run.") + cgen.stmt(f"fprintf(stderr, \"stream %p: fatal: decoding unsupported API {api.name}\\n\", ioStream)"); + cgen.stmt("__builtin_trap()") + custom_decodes = { "vkEnumerateInstanceVersion" : emit_global_state_wrapped_decoding, "vkCreateInstance" : emit_global_state_wrapped_decoding, @@ -702,6 +707,10 @@ custom_decodes = { "vkQueueSignalReleaseImageANDROIDAsyncGOOGLE" : emit_global_state_wrapped_decoding, "vkQueueBindSparse" : emit_global_state_wrapped_decoding, + + # VK_KHR_xcb_surface + "vkCreateXcbSurfaceKHR": decode_unsupported_api, + "vkGetPhysicalDeviceXcbPresentationSupportKHR": decode_unsupported_api, } class VulkanDecoder(VulkanWrapperGenerator): diff --git a/registry/vulkan/xml/cereal/marshalingdefs.py b/registry/vulkan/xml/cereal/marshalingdefs.py index a5aefebd..83a03ab0 100644 --- a/registry/vulkan/xml/cereal/marshalingdefs.py +++ b/registry/vulkan/xml/cereal/marshalingdefs.py @@ -404,4 +404,14 @@ memcpy((uint64_t*)&{newInputVarName}->accelerationStructureReference, *ptr, size *ptr += sizeof(uint64_t); """, }, + "VkXcbSurfaceCreateInfoKHR": { + "common": """ +// This struct should never be marshaled / unmarshaled. +__builtin_trap(); +""", + "marshaling": "", + "unmarshaling": "", + "reservedmarshaling": "", + "reservedunmarshaling": "", + }, } |