1bf215546Sopenharmony_ci/* This file is generated by venus-protocol.  See vn_protocol_driver.h. */
2bf215546Sopenharmony_ci
3bf215546Sopenharmony_ci/*
4bf215546Sopenharmony_ci * Copyright 2020 Google LLC
5bf215546Sopenharmony_ci * SPDX-License-Identifier: MIT
6bf215546Sopenharmony_ci */
7bf215546Sopenharmony_ci
8bf215546Sopenharmony_ci#ifndef VN_PROTOCOL_DRIVER_INFO_H
9bf215546Sopenharmony_ci#define VN_PROTOCOL_DRIVER_INFO_H
10bf215546Sopenharmony_ci
11bf215546Sopenharmony_ci#include "vn_protocol_driver_defines.h"
12bf215546Sopenharmony_ci
13bf215546Sopenharmony_ci#define VN_INFO_EXTENSION_MAX_NUMBER (414)
14bf215546Sopenharmony_ci
15bf215546Sopenharmony_cistruct vn_info_extension {
16bf215546Sopenharmony_ci   const char *name;
17bf215546Sopenharmony_ci   uint32_t number;
18bf215546Sopenharmony_ci   uint32_t spec_version;
19bf215546Sopenharmony_ci};
20bf215546Sopenharmony_ci
21bf215546Sopenharmony_ci/* sorted by extension names for bsearch */
22bf215546Sopenharmony_cistatic const uint32_t _vn_info_extension_count = 90;
23bf215546Sopenharmony_cistatic const struct vn_info_extension _vn_info_extensions[90] = {
24bf215546Sopenharmony_ci   { "VK_EXT_4444_formats", 341, 1 },
25bf215546Sopenharmony_ci   { "VK_EXT_calibrated_timestamps", 185, 2 },
26bf215546Sopenharmony_ci   { "VK_EXT_command_serialization", 384, 0 },
27bf215546Sopenharmony_ci   { "VK_EXT_conditional_rendering", 82, 2 },
28bf215546Sopenharmony_ci   { "VK_EXT_conservative_rasterization", 102, 1 },
29bf215546Sopenharmony_ci   { "VK_EXT_custom_border_color", 288, 12 },
30bf215546Sopenharmony_ci   { "VK_EXT_depth_clip_enable", 103, 1 },
31bf215546Sopenharmony_ci   { "VK_EXT_descriptor_indexing", 162, 2 },
32bf215546Sopenharmony_ci   { "VK_EXT_extended_dynamic_state", 268, 1 },
33bf215546Sopenharmony_ci   { "VK_EXT_extended_dynamic_state2", 378, 1 },
34bf215546Sopenharmony_ci   { "VK_EXT_external_memory_dma_buf", 126, 1 },
35bf215546Sopenharmony_ci   { "VK_EXT_host_query_reset", 262, 1 },
36bf215546Sopenharmony_ci   { "VK_EXT_image_drm_format_modifier", 159, 2 },
37bf215546Sopenharmony_ci   { "VK_EXT_image_robustness", 336, 1 },
38bf215546Sopenharmony_ci   { "VK_EXT_image_view_min_lod", 392, 1 },
39bf215546Sopenharmony_ci   { "VK_EXT_index_type_uint8", 266, 1 },
40bf215546Sopenharmony_ci   { "VK_EXT_inline_uniform_block", 139, 1 },
41bf215546Sopenharmony_ci   { "VK_EXT_line_rasterization", 260, 1 },
42bf215546Sopenharmony_ci   { "VK_EXT_pipeline_creation_cache_control", 298, 3 },
43bf215546Sopenharmony_ci   { "VK_EXT_pipeline_creation_feedback", 193, 1 },
44bf215546Sopenharmony_ci   { "VK_EXT_private_data", 296, 1 },
45bf215546Sopenharmony_ci   { "VK_EXT_provoking_vertex", 255, 1 },
46bf215546Sopenharmony_ci   { "VK_EXT_queue_family_foreign", 127, 1 },
47bf215546Sopenharmony_ci   { "VK_EXT_robustness2", 287, 1 },
48bf215546Sopenharmony_ci   { "VK_EXT_sampler_filter_minmax", 131, 2 },
49bf215546Sopenharmony_ci   { "VK_EXT_scalar_block_layout", 222, 1 },
50bf215546Sopenharmony_ci   { "VK_EXT_separate_stencil_usage", 247, 1 },
51bf215546Sopenharmony_ci   { "VK_EXT_shader_demote_to_helper_invocation", 277, 1 },
52bf215546Sopenharmony_ci   { "VK_EXT_shader_stencil_export", 141, 1 },
53bf215546Sopenharmony_ci   { "VK_EXT_shader_viewport_index_layer", 163, 1 },
54bf215546Sopenharmony_ci   { "VK_EXT_subgroup_size_control", 226, 2 },
55bf215546Sopenharmony_ci   { "VK_EXT_texel_buffer_alignment", 282, 1 },
56bf215546Sopenharmony_ci   { "VK_EXT_texture_compression_astc_hdr", 67, 1 },
57bf215546Sopenharmony_ci   { "VK_EXT_tooling_info", 246, 1 },
58bf215546Sopenharmony_ci   { "VK_EXT_transform_feedback", 29, 1 },
59bf215546Sopenharmony_ci   { "VK_EXT_vertex_attribute_divisor", 191, 3 },
60bf215546Sopenharmony_ci   { "VK_EXT_ycbcr_2plane_444_formats", 331, 1 },
61bf215546Sopenharmony_ci   { "VK_KHR_16bit_storage", 84, 1 },
62bf215546Sopenharmony_ci   { "VK_KHR_8bit_storage", 178, 1 },
63bf215546Sopenharmony_ci   { "VK_KHR_bind_memory2", 158, 1 },
64bf215546Sopenharmony_ci   { "VK_KHR_buffer_device_address", 258, 1 },
65bf215546Sopenharmony_ci   { "VK_KHR_copy_commands2", 338, 1 },
66bf215546Sopenharmony_ci   { "VK_KHR_create_renderpass2", 110, 1 },
67bf215546Sopenharmony_ci   { "VK_KHR_dedicated_allocation", 128, 3 },
68bf215546Sopenharmony_ci   { "VK_KHR_depth_stencil_resolve", 200, 1 },
69bf215546Sopenharmony_ci   { "VK_KHR_descriptor_update_template", 86, 1 },
70bf215546Sopenharmony_ci   { "VK_KHR_device_group", 61, 4 },
71bf215546Sopenharmony_ci   { "VK_KHR_device_group_creation", 71, 1 },
72bf215546Sopenharmony_ci   { "VK_KHR_draw_indirect_count", 170, 1 },
73bf215546Sopenharmony_ci   { "VK_KHR_driver_properties", 197, 1 },
74bf215546Sopenharmony_ci   { "VK_KHR_dynamic_rendering", 45, 1 },
75bf215546Sopenharmony_ci   { "VK_KHR_external_fence", 114, 1 },
76bf215546Sopenharmony_ci   { "VK_KHR_external_fence_capabilities", 113, 1 },
77bf215546Sopenharmony_ci   { "VK_KHR_external_fence_fd", 116, 1 },
78bf215546Sopenharmony_ci   { "VK_KHR_external_memory", 73, 1 },
79bf215546Sopenharmony_ci   { "VK_KHR_external_memory_capabilities", 72, 1 },
80bf215546Sopenharmony_ci   { "VK_KHR_external_memory_fd", 75, 1 },
81bf215546Sopenharmony_ci   { "VK_KHR_external_semaphore", 78, 1 },
82bf215546Sopenharmony_ci   { "VK_KHR_external_semaphore_capabilities", 77, 1 },
83bf215546Sopenharmony_ci   { "VK_KHR_format_feature_flags2", 361, 1 },
84bf215546Sopenharmony_ci   { "VK_KHR_get_memory_requirements2", 147, 1 },
85bf215546Sopenharmony_ci   { "VK_KHR_get_physical_device_properties2", 60, 2 },
86bf215546Sopenharmony_ci   { "VK_KHR_image_format_list", 148, 1 },
87bf215546Sopenharmony_ci   { "VK_KHR_imageless_framebuffer", 109, 1 },
88bf215546Sopenharmony_ci   { "VK_KHR_maintenance1", 70, 2 },
89bf215546Sopenharmony_ci   { "VK_KHR_maintenance2", 118, 1 },
90bf215546Sopenharmony_ci   { "VK_KHR_maintenance3", 169, 1 },
91bf215546Sopenharmony_ci   { "VK_KHR_maintenance4", 414, 2 },
92bf215546Sopenharmony_ci   { "VK_KHR_multiview", 54, 1 },
93bf215546Sopenharmony_ci   { "VK_KHR_relaxed_block_layout", 145, 1 },
94bf215546Sopenharmony_ci   { "VK_KHR_sampler_mirror_clamp_to_edge", 15, 3 },
95bf215546Sopenharmony_ci   { "VK_KHR_sampler_ycbcr_conversion", 157, 14 },
96bf215546Sopenharmony_ci   { "VK_KHR_separate_depth_stencil_layouts", 242, 1 },
97bf215546Sopenharmony_ci   { "VK_KHR_shader_atomic_int64", 181, 1 },
98bf215546Sopenharmony_ci   { "VK_KHR_shader_draw_parameters", 64, 1 },
99bf215546Sopenharmony_ci   { "VK_KHR_shader_float16_int8", 83, 1 },
100bf215546Sopenharmony_ci   { "VK_KHR_shader_float_controls", 198, 4 },
101bf215546Sopenharmony_ci   { "VK_KHR_shader_integer_dot_product", 281, 1 },
102bf215546Sopenharmony_ci   { "VK_KHR_shader_non_semantic_info", 294, 1 },
103bf215546Sopenharmony_ci   { "VK_KHR_shader_subgroup_extended_types", 176, 1 },
104bf215546Sopenharmony_ci   { "VK_KHR_shader_terminate_invocation", 216, 1 },
105bf215546Sopenharmony_ci   { "VK_KHR_spirv_1_4", 237, 1 },
106bf215546Sopenharmony_ci   { "VK_KHR_storage_buffer_storage_class", 132, 1 },
107bf215546Sopenharmony_ci   { "VK_KHR_synchronization2", 315, 1 },
108bf215546Sopenharmony_ci   { "VK_KHR_timeline_semaphore", 208, 2 },
109bf215546Sopenharmony_ci   { "VK_KHR_uniform_buffer_standard_layout", 254, 1 },
110bf215546Sopenharmony_ci   { "VK_KHR_variable_pointers", 121, 1 },
111bf215546Sopenharmony_ci   { "VK_KHR_vulkan_memory_model", 212, 3 },
112bf215546Sopenharmony_ci   { "VK_KHR_zero_initialize_workgroup_memory", 326, 1 },
113bf215546Sopenharmony_ci   { "VK_MESA_venus_protocol", 385, 100000 },
114bf215546Sopenharmony_ci};
115bf215546Sopenharmony_ci
116bf215546Sopenharmony_cistatic inline uint32_t
117bf215546Sopenharmony_civn_info_wire_format_version(void)
118bf215546Sopenharmony_ci{
119bf215546Sopenharmony_ci    return 0;
120bf215546Sopenharmony_ci}
121bf215546Sopenharmony_ci
122bf215546Sopenharmony_cistatic inline uint32_t
123bf215546Sopenharmony_civn_info_vk_xml_version(void)
124bf215546Sopenharmony_ci{
125bf215546Sopenharmony_ci    return VK_MAKE_API_VERSION(0, 1, 3, 204);
126bf215546Sopenharmony_ci}
127bf215546Sopenharmony_ci
128bf215546Sopenharmony_cistatic inline int
129bf215546Sopenharmony_civn_info_extension_compare(const void *name, const void *ext)
130bf215546Sopenharmony_ci{
131bf215546Sopenharmony_ci   return strcmp(name, ((const struct vn_info_extension *)ext)->name);
132bf215546Sopenharmony_ci}
133bf215546Sopenharmony_ci
134bf215546Sopenharmony_cistatic inline int32_t
135bf215546Sopenharmony_civn_info_extension_index(const char *name)
136bf215546Sopenharmony_ci{
137bf215546Sopenharmony_ci   const struct vn_info_extension *ext = bsearch(name, _vn_info_extensions,
138bf215546Sopenharmony_ci      _vn_info_extension_count, sizeof(*_vn_info_extensions),
139bf215546Sopenharmony_ci      vn_info_extension_compare);
140bf215546Sopenharmony_ci   return ext ? ext - _vn_info_extensions : -1;
141bf215546Sopenharmony_ci}
142bf215546Sopenharmony_ci
143bf215546Sopenharmony_cistatic inline const struct vn_info_extension *
144bf215546Sopenharmony_civn_info_extension_get(int32_t index)
145bf215546Sopenharmony_ci{
146bf215546Sopenharmony_ci   assert(index >= 0 && (uint32_t)index < _vn_info_extension_count);
147bf215546Sopenharmony_ci   return &_vn_info_extensions[index];
148bf215546Sopenharmony_ci}
149bf215546Sopenharmony_ci
150bf215546Sopenharmony_cistatic inline bool
151bf215546Sopenharmony_civn_info_extension_mask_test(const uint32_t *mask, uint32_t ext_number)
152bf215546Sopenharmony_ci{
153bf215546Sopenharmony_ci   return mask[ext_number / 32] & (1 << (ext_number % 32));
154bf215546Sopenharmony_ci}
155bf215546Sopenharmony_ci
156bf215546Sopenharmony_ci#endif /* VN_PROTOCOL_DRIVER_INFO_H */
157