| 1 |
/* |
| 2 |
* Copyright © 2021 Collabora Ltd. |
| 3 |
* |
| 4 |
* Derived from tu_device.c which is: |
| 5 |
* Copyright © 2016 Red Hat. |
| 6 |
* Copyright © 2016 Bas Nieuwenhuizen |
| 7 |
* Copyright © 2015 Intel Corporation |
| 8 |
* |
| 9 |
* SPDX-License-Identifier: MIT |
| 10 |
*/ |
| 11 |
|
| 12 |
#include <sys/sysmacros.h> |
| 13 |
|
| 14 |
#include "git_sha1.h" |
| 15 |
|
| 16 |
#include "vk_android.h" |
| 17 |
#include "vk_device.h" |
| 18 |
#include "vk_limits.h" |
| 19 |
#include "vk_shader_module.h" |
| 20 |
|
| 21 |
#include "panvk_instance.h" |
| 22 |
#include "panvk_buffer.h" |
| 23 |
#include "panvk_cmd_draw.h" |
| 24 |
#include "panvk_descriptor_set_layout.h" |
| 25 |
#include "panvk_physical_device.h" |
| 26 |
#include "panvk_wsi.h" |
| 27 |
|
| 28 |
#include "pan_format.h" |
| 29 |
#include "pan_props.h" |
| 30 |
|
| 31 |
/* We reserve one ubo for push constant, one for sysvals and one per-set for the |
| 32 |
* descriptor metadata */ |
| 33 |
#define RESERVED_UBO_COUNT 6 |
| 34 |
#define MAX_INLINE_UNIFORM_BLOCK_DESCRIPTORS (32 - RESERVED_UBO_COUNT) |
| 35 |
|
| 36 |
void |
| 37 |
panvk_per_arch(get_physical_device_extensions)( |
| 38 |
const struct panvk_physical_device *device, |
| 39 |
struct vk_device_extension_table *ext) |
| 40 |
{ |
| 41 |
bool has_vk1_1 = PAN_ARCH >= 10; |
| 42 |
bool has_vk1_2 = PAN_ARCH >= 10; |
| 43 |
bool has_gralloc = vk_android_get_ugralloc() != NULL; |
| 44 |
|
| 45 |
*ext = (struct vk_device_extension_table){ |
| 46 |
.KHR_8bit_storage = true, |
| 47 |
.KHR_16bit_storage = true, |
| 48 |
.KHR_shader_atomic_int64 = PAN_ARCH >= 9, |
| 49 |
.KHR_bind_memory2 = true, |
| 50 |
.KHR_buffer_device_address = true, |
| 51 |
.KHR_calibrated_timestamps = |
| 52 |
device->kmod.dev->props.gpu_can_query_timestamp, |
| 53 |
.KHR_copy_commands2 = true, |
| 54 |
.KHR_create_renderpass2 = true, |
| 55 |
.KHR_dedicated_allocation = true, |
| 56 |
.KHR_descriptor_update_template = true, |
| 57 |
.KHR_depth_clamp_zero_one = true, |
| 58 |
.KHR_depth_stencil_resolve = true, |
| 59 |
.KHR_device_group = true, |
| 60 |
.KHR_draw_indirect_count = PAN_ARCH >= 10, |
| 61 |
.KHR_driver_properties = true, |
| 62 |
.KHR_dynamic_rendering = true, |
| 63 |
.KHR_dynamic_rendering_local_read = true, |
| 64 |
.KHR_external_fence = true, |
| 65 |
.KHR_external_fence_fd = true, |
| 66 |
.KHR_external_memory = true, |
| 67 |
.KHR_external_memory_fd = true, |
| 68 |
.KHR_external_semaphore = true, |
| 69 |
.KHR_external_semaphore_fd = true, |
| 70 |
.KHR_format_feature_flags2 = true, |
| 71 |
.KHR_get_memory_requirements2 = true, |
| 72 |
.KHR_global_priority = true, |
| 73 |
.KHR_image_format_list = true, |
| 74 |
.KHR_imageless_framebuffer = true, |
| 75 |
.KHR_index_type_uint8 = true, |
| 76 |
.KHR_line_rasterization = true, |
| 77 |
.KHR_load_store_op_none = true, |
| 78 |
.KHR_maintenance1 = true, |
| 79 |
.KHR_maintenance2 = true, |
| 80 |
.KHR_maintenance3 = true, |
| 81 |
.KHR_maintenance4 = has_vk1_1, |
| 82 |
.KHR_maintenance5 = has_vk1_1, |
| 83 |
.KHR_maintenance6 = has_vk1_1, |
| 84 |
.KHR_maintenance7 = has_vk1_1, |
| 85 |
.KHR_maintenance8 = has_vk1_1, |
| 86 |
.KHR_maintenance9 = true, |
| 87 |
.KHR_map_memory2 = true, |
| 88 |
.KHR_multiview = true, |
| 89 |
.KHR_pipeline_binary = true, |
| 90 |
.KHR_pipeline_executable_properties = true, |
| 91 |
.KHR_pipeline_library = true, |
| 92 |
.KHR_push_descriptor = true, |
| 93 |
.KHR_relaxed_block_layout = true, |
| 94 |
.KHR_robustness2 = PAN_ARCH >= 10, |
| 95 |
.KHR_sampler_mirror_clamp_to_edge = true, |
| 96 |
.KHR_sampler_ycbcr_conversion = true, |
| 97 |
.KHR_separate_depth_stencil_layouts = true, |
| 98 |
.KHR_shader_clock = device->kmod.dev->props.gpu_can_query_timestamp, |
| 99 |
.KHR_shader_draw_parameters = true, |
| 100 |
.KHR_shader_expect_assume = true, |
| 101 |
.KHR_shader_float_controls = true, |
| 102 |
.KHR_shader_float_controls2 = has_vk1_1, |
| 103 |
.KHR_shader_float16_int8 = true, |
| 104 |
.KHR_shader_integer_dot_product = true, |
| 105 |
.KHR_shader_maximal_reconvergence = has_vk1_1, |
| 106 |
.KHR_shader_non_semantic_info = true, |
| 107 |
.KHR_shader_quad_control = has_vk1_2, |
| 108 |
.KHR_shader_relaxed_extended_instruction = true, |
| 109 |
.KHR_shader_subgroup_extended_types = has_vk1_1, |
| 110 |
.KHR_shader_subgroup_rotate = true, |
| 111 |
.KHR_shader_subgroup_uniform_control_flow = has_vk1_1, |
| 112 |
.KHR_shader_terminate_invocation = true, |
| 113 |
.KHR_shader_untyped_pointers = PAN_ARCH >= 9, |
| 114 |
.KHR_spirv_1_4 = PAN_ARCH >= 10, |
| 115 |
.KHR_storage_buffer_storage_class = true, |
| 116 |
#ifdef PANVK_USE_WSI_PLATFORM |
| 117 |
.KHR_present_id = true, |
| 118 |
.KHR_present_id2 = true, |
| 119 |
.KHR_present_wait = true, |
| 120 |
.KHR_present_wait2 = true, |
| 121 |
.KHR_swapchain = true, |
| 122 |
.KHR_swapchain_mutable_format = true, |
| 123 |
.KHR_swapchain_maintenance1 = true, |
| 124 |
#endif |
| 125 |
.KHR_synchronization2 = true, |
| 126 |
.KHR_timeline_semaphore = true, |
| 127 |
.KHR_unified_image_layouts = true, |
| 128 |
.KHR_uniform_buffer_standard_layout = true, |
| 129 |
.KHR_variable_pointers = true, |
| 130 |
.KHR_vertex_attribute_divisor = true, |
| 131 |
.KHR_vulkan_memory_model = true, |
| 132 |
.KHR_zero_initialize_workgroup_memory = true, |
| 133 |
.EXT_4444_formats = true, |
| 134 |
.EXT_attachment_feedback_loop_dynamic_state = true, |
| 135 |
.EXT_attachment_feedback_loop_layout = true, |
| 136 |
.EXT_border_color_swizzle = true, |
| 137 |
.EXT_buffer_device_address = true, |
| 138 |
.EXT_calibrated_timestamps = |
| 139 |
device->kmod.dev->props.gpu_can_query_timestamp, |
| 140 |
.EXT_conditional_rendering = PAN_ARCH >= 10, |
| 141 |
.EXT_color_write_enable = true, |
| 142 |
.EXT_custom_border_color = true, |
| 143 |
.EXT_depth_bias_control = true, |
| 144 |
.EXT_depth_clamp_control = true, |
| 145 |
.EXT_depth_clamp_zero_one = true, |
| 146 |
.EXT_depth_clip_enable = true, |
| 147 |
.EXT_depth_clip_control = true, |
| 148 |
.EXT_device_memory_report = true, |
| 149 |
#ifdef VK_USE_PLATFORM_DISPLAY_KHR |
| 150 |
.EXT_display_control = true, |
| 151 |
#endif |
| 152 |
.EXT_descriptor_indexing = PAN_ARCH >= 9, |
| 153 |
.EXT_extended_dynamic_state = true, |
| 154 |
.EXT_extended_dynamic_state2 = true, |
| 155 |
.EXT_external_memory_acquire_unmodified = true, |
| 156 |
.EXT_external_memory_dma_buf = true, |
| 157 |
.EXT_global_priority = true, |
| 158 |
.EXT_global_priority_query = true, |
| 159 |
.EXT_graphics_pipeline_library = true, |
| 160 |
.EXT_hdr_metadata = true, |
| 161 |
.EXT_host_image_copy = true, |
| 162 |
.EXT_host_query_reset = true, |
| 163 |
.EXT_image_2d_view_of_3d = true, |
| 164 |
/* EXT_image_drm_format_modifier depends on KHR_sampler_ycbcr_conversion */ |
| 165 |
.EXT_image_drm_format_modifier = true, |
| 166 |
.EXT_image_robustness = true, |
| 167 |
.EXT_image_view_min_lod = true, |
| 168 |
.EXT_index_type_uint8 = true, |
| 169 |
.EXT_legacy_dithering = true, |
| 170 |
.EXT_line_rasterization = true, |
| 171 |
.EXT_load_store_op_none = true, |
| 172 |
.EXT_map_memory_placed = true, |
| 173 |
.EXT_nested_command_buffer = PAN_ARCH >= 10, |
| 174 |
.EXT_memory_budget = true, |
| 175 |
.EXT_non_seamless_cube_map = true, |
| 176 |
.EXT_mutable_descriptor_type = PAN_ARCH >= 9, |
| 177 |
.EXT_multisampled_render_to_single_sampled = true, |
| 178 |
.EXT_physical_device_drm = true, |
| 179 |
.EXT_pipeline_creation_cache_control = true, |
| 180 |
.EXT_pipeline_creation_feedback = true, |
| 181 |
.EXT_pipeline_robustness = true, |
| 182 |
#ifdef PANVK_USE_WSI_PLATFORM |
| 183 |
.EXT_present_timing = |
| 184 |
device->kmod.dev->props.gpu_can_query_timestamp, |
| 185 |
#endif |
| 186 |
.EXT_private_data = true, |
| 187 |
.EXT_primitive_topology_list_restart = true, |
| 188 |
.EXT_provoking_vertex = true, |
| 189 |
.EXT_queue_family_foreign = true, |
| 190 |
.EXT_rgba10x6_formats = PAN_ARCH >= 11, |
| 191 |
.EXT_robustness2 = PAN_ARCH >= 10, |
| 192 |
.EXT_sampler_filter_minmax = PAN_ARCH >= 10, |
| 193 |
.EXT_scalar_block_layout = true, |
| 194 |
.EXT_separate_stencil_usage = true, |
| 195 |
.EXT_shader_atomic_float = true, |
| 196 |
.EXT_shader_demote_to_helper_invocation = true, |
| 197 |
.EXT_shader_module_identifier = true, |
| 198 |
.EXT_shader_replicated_composites = true, |
| 199 |
.EXT_shader_stencil_export = true, |
| 200 |
.EXT_shader_subgroup_ballot = true, |
| 201 |
.EXT_shader_subgroup_vote = true, |
| 202 |
.EXT_subgroup_size_control = has_vk1_1, |
| 203 |
#ifdef PANVK_USE_WSI_PLATFORM |
| 204 |
.EXT_swapchain_maintenance1 = true, |
| 205 |
#endif |
| 206 |
.EXT_texel_buffer_alignment = true, |
| 207 |
.EXT_astc_decode_mode = PAN_ARCH >= 9, |
| 208 |
.EXT_texture_compression_astc_hdr = true, |
| 209 |
.EXT_tooling_info = true, |
| 210 |
.EXT_vertex_attribute_divisor = true, |
| 211 |
.EXT_vertex_input_dynamic_state = true, |
| 212 |
.EXT_ycbcr_2plane_444_formats = PAN_ARCH >= 10, |
| 213 |
.EXT_ycbcr_image_arrays = PAN_ARCH >= 10, |
| 214 |
.EXT_zero_initialize_device_memory = true, |
| 215 |
.EXT_inline_uniform_block = true, |
| 216 |
.ANDROID_external_memory_android_hardware_buffer = has_gralloc, |
| 217 |
.ANDROID_native_buffer = has_gralloc, |
| 218 |
.GOOGLE_decorate_string = true, |
| 219 |
.GOOGLE_hlsl_functionality1 = true, |
| 220 |
.GOOGLE_user_type = true, |
| 221 |
|
| 222 |
.VALVE_mutable_descriptor_type = PAN_ARCH >= 9, |
| 223 |
|
| 224 |
.ARM_shader_core_builtins = PAN_ARCH >= 9, |
| 225 |
.ARM_shader_core_properties = has_vk1_1, |
| 226 |
.ARM_scheduling_controls = PAN_ARCH >= 10, |
| 227 |
}; |
| 228 |
} |
| 229 |
|
| 230 |
static bool |
| 231 |
has_compressed_formats(const struct panvk_physical_device *physical_device, |
| 232 |
const uint32_t required_formats) |
| 233 |
{ |
| 234 |
uint32_t supported_compr_fmts = |
| 235 |
pan_query_compressed_formats(&physical_device->kmod.dev->props); |
| 236 |
|
| 237 |
return (supported_compr_fmts & required_formats) == required_formats; |
| 238 |
} |
| 239 |
|
| 240 |
static bool |
| 241 |
has_texture_compression_etc2(const struct panvk_physical_device *physical_device) |
| 242 |
{ |
| 243 |
return has_compressed_formats(physical_device, |
| 244 |
BITFIELD_BIT(MALI_ETC2_RGB8) | |
| 245 |
BITFIELD_BIT(MALI_ETC2_RGB8A1) | BITFIELD_BIT(MALI_ETC2_RGBA8) | |
| 246 |
BITFIELD_BIT(MALI_ETC2_R11_UNORM) | BITFIELD_BIT(MALI_ETC2_R11_SNORM) | |
| 247 |
BITFIELD_BIT(MALI_ETC2_RG11_UNORM) | BITFIELD_BIT(MALI_ETC2_RG11_SNORM)); |
| 248 |
} |
| 249 |
|
| 250 |
static bool |
| 251 |
has_texture_compression_astc_ldr(const struct panvk_physical_device *physical_device) |
| 252 |
{ |
| 253 |
return has_compressed_formats(physical_device, BITFIELD_BIT(MALI_ASTC_2D_LDR)); |
| 254 |
} |
| 255 |
|
| 256 |
static bool |
| 257 |
has_texture_compression_astc_hdr(const struct panvk_physical_device *physical_device) |
| 258 |
{ |
| 259 |
return has_compressed_formats(physical_device, BITFIELD_BIT(MALI_ASTC_2D_HDR)); |
| 260 |
} |
| 261 |
|
| 262 |
static bool |
| 263 |
has_texture_compression_bc(const struct panvk_physical_device *physical_device) |
| 264 |
{ |
| 265 |
return has_compressed_formats(physical_device, |
| 266 |
BITFIELD_BIT(MALI_BC1_UNORM) | BITFIELD_BIT(MALI_BC2_UNORM) | |
| 267 |
BITFIELD_BIT(MALI_BC3_UNORM) | BITFIELD_BIT(MALI_BC4_UNORM) | |
| 268 |
BITFIELD_BIT(MALI_BC4_SNORM) | BITFIELD_BIT(MALI_BC5_UNORM) | |
| 269 |
BITFIELD_BIT(MALI_BC5_SNORM) | BITFIELD_BIT(MALI_BC6H_SF16) | |
| 270 |
BITFIELD_BIT(MALI_BC6H_UF16) | BITFIELD_BIT(MALI_BC7_UNORM)); |
| 271 |
} |
| 272 |
|
| 273 |
void |
| 274 |
panvk_per_arch(get_physical_device_features)( |
| 275 |
const struct panvk_instance *instance, |
| 276 |
const struct panvk_physical_device *device, struct vk_features *features) |
| 277 |
{ |
| 278 |
bool has_sparse = PAN_ARCH >= 10; |
| 279 |
|
| 280 |
*features = (struct vk_features){ |
| 281 |
/* Vulkan 1.0 */ |
| 282 |
.robustBufferAccess = true, |
| 283 |
.fullDrawIndexUint32 = true, |
| 284 |
.imageCubeArray = true, |
| 285 |
.independentBlend = true, |
| 286 |
.geometryShader = false, |
| 287 |
.tessellationShader = false, |
| 288 |
.sampleRateShading = true, |
| 289 |
.dualSrcBlend = true, |
| 290 |
.logicOp = true, |
| 291 |
.multiDrawIndirect = PAN_ARCH >= 10, |
| 292 |
.drawIndirectFirstInstance = true, |
| 293 |
.depthClamp = true, |
| 294 |
.depthBiasClamp = true, |
| 295 |
.fillModeNonSolid = false, |
| 296 |
.depthBounds = false, |
| 297 |
.wideLines = true, |
| 298 |
.largePoints = true, |
| 299 |
.alphaToOne = false, |
| 300 |
.multiViewport = false, |
| 301 |
.samplerAnisotropy = true, |
| 302 |
.textureCompressionETC2 = has_texture_compression_etc2(device), |
| 303 |
.textureCompressionASTC_LDR = has_texture_compression_astc_ldr(device), |
| 304 |
.textureCompressionBC = has_texture_compression_bc(device), |
| 305 |
.occlusionQueryPrecise = true, |
| 306 |
.pipelineStatisticsQuery = false, |
| 307 |
/* On v13+, the hardware isn't speculatively referencing to invalid |
| 308 |
indices anymore. */ |
| 309 |
.vertexPipelineStoresAndAtomics = |
| 310 |
(PAN_ARCH >= 13 && instance->enable_vertex_pipeline_stores_atomics) || |
| 311 |
instance->force_enable_shader_atomics, |
| 312 |
.fragmentStoresAndAtomics = true, |
| 313 |
.shaderTessellationAndGeometryPointSize = false, |
| 314 |
.shaderImageGatherExtended = true, |
| 315 |
.shaderStorageImageExtendedFormats = true, |
| 316 |
.shaderStorageImageMultisample = false, |
| 317 |
.shaderStorageImageReadWithoutFormat = true, |
| 318 |
.shaderStorageImageWriteWithoutFormat = true, |
| 319 |
.shaderUniformBufferArrayDynamicIndexing = true, |
| 320 |
.shaderSampledImageArrayDynamicIndexing = true, |
| 321 |
.shaderStorageBufferArrayDynamicIndexing = true, |
| 322 |
.shaderStorageImageArrayDynamicIndexing = true, |
| 323 |
.shaderClipDistance = false, |
| 324 |
.shaderCullDistance = false, |
| 325 |
.shaderFloat64 = false, |
| 326 |
.shaderInt64 = true, |
| 327 |
.shaderInt16 = true, |
| 328 |
.shaderResourceResidency = false, |
| 329 |
.shaderResourceMinLod = false, |
| 330 |
.sparseBinding = has_sparse, |
| 331 |
.sparseResidencyBuffer = has_sparse, |
| 332 |
.sparseResidencyImage2D = has_sparse, |
| 333 |
.sparseResidencyImage3D = has_sparse, |
| 334 |
.sparseResidency2Samples = false, |
| 335 |
.sparseResidency4Samples = false, |
| 336 |
.sparseResidency8Samples = false, |
| 337 |
.sparseResidency16Samples = false, |
| 338 |
.sparseResidencyAliased = false, /* https://gitlab.freedesktop.org/panfrost/mesa/-/issues/237 */ |
| 339 |
.variableMultisampleRate = false, |
| 340 |
.inheritedQueries = false, |
| 341 |
|
| 342 |
/* Vulkan 1.1 */ |
| 343 |
.storageBuffer16BitAccess = true, |
| 344 |
.uniformAndStorageBuffer16BitAccess = true, |
| 345 |
.storagePushConstant16 = true, |
| 346 |
.storageInputOutput16 = true, |
| 347 |
.multiview = true, |
| 348 |
.multiviewGeometryShader = false, |
| 349 |
.multiviewTessellationShader = false, |
| 350 |
.variablePointersStorageBuffer = true, |
| 351 |
.variablePointers = true, |
| 352 |
.protectedMemory = false, |
| 353 |
.samplerYcbcrConversion = true, |
| 354 |
.shaderDrawParameters = true, |
| 355 |
|
| 356 |
/* Vulkan 1.2 */ |
| 357 |
.samplerMirrorClampToEdge = true, |
| 358 |
.drawIndirectCount = PAN_ARCH >= 10, |
| 359 |
.storageBuffer8BitAccess = true, |
| 360 |
.uniformAndStorageBuffer8BitAccess = true, |
| 361 |
.storagePushConstant8 = true, |
| 362 |
.shaderBufferInt64Atomics = PAN_ARCH >= 9, |
| 363 |
.shaderSharedInt64Atomics = PAN_ARCH >= 9, |
| 364 |
.shaderFloat16 = PAN_ARCH >= 10, |
| 365 |
.shaderInt8 = true, |
| 366 |
/* In theory, update-after-bind is supported on bifrost, but the |
| 367 |
* descriptor limits would be too low for the descriptorIndexing feature. |
| 368 |
*/ |
| 369 |
.descriptorIndexing = PAN_ARCH >= 9, |
| 370 |
.shaderInputAttachmentArrayDynamicIndexing = true, |
| 371 |
.shaderUniformTexelBufferArrayDynamicIndexing = true, |
| 372 |
.shaderStorageTexelBufferArrayDynamicIndexing = true, |
| 373 |
.shaderUniformBufferArrayNonUniformIndexing = true, |
| 374 |
.shaderSampledImageArrayNonUniformIndexing = true, |
| 375 |
.shaderStorageBufferArrayNonUniformIndexing = true, |
| 376 |
.shaderStorageImageArrayNonUniformIndexing = true, |
| 377 |
.shaderInputAttachmentArrayNonUniformIndexing = true, |
| 378 |
.shaderUniformTexelBufferArrayNonUniformIndexing = true, |
| 379 |
.shaderStorageTexelBufferArrayNonUniformIndexing = true, |
| 380 |
.descriptorBindingUniformBufferUpdateAfterBind = PAN_ARCH >= 9, |
| 381 |
.descriptorBindingSampledImageUpdateAfterBind = PAN_ARCH >= 9, |
| 382 |
.descriptorBindingStorageImageUpdateAfterBind = PAN_ARCH >= 9, |
| 383 |
.descriptorBindingStorageBufferUpdateAfterBind = PAN_ARCH >= 9, |
| 384 |
.descriptorBindingUniformTexelBufferUpdateAfterBind = PAN_ARCH >= 9, |
| 385 |
.descriptorBindingStorageTexelBufferUpdateAfterBind = PAN_ARCH >= 9, |
| 386 |
.descriptorBindingUpdateUnusedWhilePending = PAN_ARCH >= 9, |
| 387 |
.descriptorBindingPartiallyBound = PAN_ARCH >= 9, |
| 388 |
.descriptorBindingVariableDescriptorCount = true, |
| 389 |
.runtimeDescriptorArray = true, |
| 390 |
.samplerFilterMinmax = PAN_ARCH >= 10, |
| 391 |
.scalarBlockLayout = true, |
| 392 |
.imagelessFramebuffer = true, |
| 393 |
.uniformBufferStandardLayout = true, |
| 394 |
.shaderSubgroupExtendedTypes = true, |
| 395 |
.separateDepthStencilLayouts = true, |
| 396 |
.hostQueryReset = true, |
| 397 |
.timelineSemaphore = true, |
| 398 |
.bufferDeviceAddress = true, |
| 399 |
/* only expose for CSF/panthor, and if we have extended VA ranges */ |
| 400 |
.bufferDeviceAddressCaptureReplay = |
| 401 |
(PAN_ARCH >= 10) && (device->memory.max_supported_va > (1ull << 32)), |
| 402 |
.bufferDeviceAddressMultiDevice = false, |
| 403 |
.vulkanMemoryModel = true, |
| 404 |
.vulkanMemoryModelDeviceScope = true, |
| 405 |
.vulkanMemoryModelAvailabilityVisibilityChains = true, |
| 406 |
.shaderOutputViewportIndex = false, |
| 407 |
.shaderOutputLayer = false, |
| 408 |
.subgroupBroadcastDynamicId = true, |
| 409 |
|
| 410 |
/* Vulkan 1.3 */ |
| 411 |
.robustImageAccess = true, |
| 412 |
.inlineUniformBlock = true, |
| 413 |
.descriptorBindingInlineUniformBlockUpdateAfterBind = true, |
| 414 |
.pipelineCreationCacheControl = true, |
| 415 |
.privateData = true, |
| 416 |
.shaderDemoteToHelperInvocation = true, |
| 417 |
.shaderTerminateInvocation = true, |
| 418 |
.subgroupSizeControl = true, |
| 419 |
.computeFullSubgroups = true, |
| 420 |
.synchronization2 = true, |
| 421 |
.textureCompressionASTC_HDR = has_texture_compression_astc_hdr(device), |
| 422 |
.shaderZeroInitializeWorkgroupMemory = true, |
| 423 |
|
| 424 |
/* VK_EXT_astc_decode_mode */ |
| 425 |
.decodeModeSharedExponent = false, |
| 426 |
|
| 427 |
.dynamicRendering = true, |
| 428 |
.shaderIntegerDotProduct = true, |
| 429 |
.maintenance4 = true, |
| 430 |
|
| 431 |
/* Vulkan 1.4 */ |
| 432 |
.globalPriorityQuery = true, |
| 433 |
.shaderSubgroupRotate = true, |
| 434 |
.shaderSubgroupRotateClustered = true, |
| 435 |
.shaderFloatControls2 = true, |
| 436 |
.shaderExpectAssume = true, |
| 437 |
.rectangularLines = true, |
| 438 |
.bresenhamLines = true, |
| 439 |
.smoothLines = false, |
| 440 |
.stippledRectangularLines = false, |
| 441 |
.stippledBresenhamLines = false, |
| 442 |
.stippledSmoothLines = false, |
| 443 |
.vertexAttributeInstanceRateDivisor = true, |
| 444 |
.vertexAttributeInstanceRateZeroDivisor = true, |
| 445 |
.indexTypeUint8 = true, |
| 446 |
.dynamicRenderingLocalRead = true, |
| 447 |
.maintenance5 = true, |
| 448 |
.maintenance6 = true, |
| 449 |
.pipelineProtectedAccess = false, |
| 450 |
.pipelineRobustness = true, |
| 451 |
.hostImageCopy = true, |
| 452 |
.pushDescriptor = true, |
| 453 |
|
| 454 |
/* VK_KHR_depth_clamp_zero_one */ |
| 455 |
.depthClampZeroOne = true, |
| 456 |
|
| 457 |
/* VK_KHR_maintenance7 */ |
| 458 |
.maintenance7 = true, |
| 459 |
|
| 460 |
/* VK_KHR_maintenance8 */ |
| 461 |
.maintenance8 = true, |
| 462 |
|
| 463 |
/* VK_KHR_maintenance9 */ |
| 464 |
.maintenance9 = true, |
| 465 |
|
| 466 |
/* VK_EXT_graphics_pipeline_library */ |
| 467 |
.graphicsPipelineLibrary = true, |
| 468 |
|
| 469 |
/* VK_EXT_vertex_input_dynamic_state */ |
| 470 |
.vertexInputDynamicState = true, |
| 471 |
|
| 472 |
/* VK_EXT_depth_bias_control */ |
| 473 |
.depthBiasControl = true, |
| 474 |
.leastRepresentableValueForceUnormRepresentation = false, |
| 475 |
.floatRepresentation = false, |
| 476 |
.depthBiasExact = true, |
| 477 |
|
| 478 |
/* VK_EXT_depth_clamp_control */ |
| 479 |
.depthClampControl = true, |
| 480 |
|
| 481 |
/* VK_EXT_depth_clip_control */ |
| 482 |
.depthClipControl = true, |
| 483 |
|
| 484 |
/* VK_EXT_depth_clip_enable */ |
| 485 |
.depthClipEnable = true, |
| 486 |
|
| 487 |
/* VK_EXT_extended_dynamic_state */ |
| 488 |
.extendedDynamicState = true, |
| 489 |
|
| 490 |
/* VK_EXT_extended_dynamic_state2 */ |
| 491 |
.extendedDynamicState2 = true, |
| 492 |
.extendedDynamicState2LogicOp = true, |
| 493 |
.extendedDynamicState2PatchControlPoints = false, |
| 494 |
|
| 495 |
/* VK_EXT_attachment_feedback_loop_dynamic_state */ |
| 496 |
.attachmentFeedbackLoopDynamicState = true, |
| 497 |
|
| 498 |
/* VK_EXT_attachment_feedback_loop_layout */ |
| 499 |
.attachmentFeedbackLoopLayout = true, |
| 500 |
|
| 501 |
/* VK_EXT_4444_formats */ |
| 502 |
.formatA4R4G4B4 = true, |
| 503 |
.formatA4B4G4R4 = true, |
| 504 |
|
| 505 |
/* VK_EXT_color_write_enable */ |
| 506 |
.colorWriteEnable = true, |
| 507 |
|
| 508 |
/* VK_EXT_conditional_rendering */ |
| 509 |
.conditionalRendering = PAN_ARCH >= 10, |
| 510 |
.inheritedConditionalRendering = PAN_ARCH >= 10, |
| 511 |
|
| 512 |
/* VK_EXT_custom_border_color */ |
| 513 |
.customBorderColors = true, |
| 514 |
|
| 515 |
/* VK_EXT_border_color_swizzle */ |
| 516 |
.borderColorSwizzle = true, |
| 517 |
.borderColorSwizzleFromImage = true, |
| 518 |
|
| 519 |
/* VK_EXT_image_2d_view_of_3d */ |
| 520 |
.image2DViewOf3D = true, |
| 521 |
.sampler2DViewOf3D = true, |
| 522 |
|
| 523 |
/* VK_EXT_image_view_min_lod */ |
| 524 |
.minLod = true, |
| 525 |
|
| 526 |
/* VK_EXT_primitive_topology_list_restart */ |
| 527 |
.primitiveTopologyListRestart = true, |
| 528 |
.primitiveTopologyPatchListRestart = false, |
| 529 |
|
| 530 |
/* VK_EXT_provoking_vertex */ |
| 531 |
.provokingVertexLast = true, |
| 532 |
.transformFeedbackPreservesProvokingVertex = false, |
| 533 |
|
| 534 |
/* v7 doesn't support AFBC(BGR). We need to tweak the texture swizzle to |
| 535 |
* make it work, which forces us to apply the same swizzle on the border |
| 536 |
* color, meaning we need to know the format when preparing the border |
| 537 |
* color. |
| 538 |
*/ |
| 539 |
.customBorderColorWithoutFormat = PAN_ARCH != 7, |
| 540 |
|
| 541 |
/* VK_KHR_pipeline_binary */ |
| 542 |
.pipelineBinaries = true, |
| 543 |
|
| 544 |
/* VK_KHR_pipeline_executable_properties */ |
| 545 |
.pipelineExecutableInfo = true, |
| 546 |
|
| 547 |
/* VK_KHR_robustness2 */ |
| 548 |
.robustBufferAccess2 = PAN_ARCH >= 11, |
| 549 |
.robustImageAccess2 = false, |
| 550 |
.nullDescriptor = PAN_ARCH >= 10, |
| 551 |
|
| 552 |
/* VK_KHR_shader_clock */ |
| 553 |
.shaderSubgroupClock = device->kmod.dev->props.gpu_can_query_timestamp, |
| 554 |
.shaderDeviceClock = device->kmod.dev->props.timestamp_device_coherent, |
| 555 |
|
| 556 |
/* VK_KHR_shader_quad_control */ |
| 557 |
.shaderQuadControl = true, |
| 558 |
|
| 559 |
/* VK_KHR_shader_relaxed_extended_instruction */ |
| 560 |
.shaderRelaxedExtendedInstruction = true, |
| 561 |
|
| 562 |
/* VK_KHR_shader_maximal_reconvergence */ |
| 563 |
.shaderMaximalReconvergence = true, |
| 564 |
|
| 565 |
/* VK_KHR_shader_subgroup_uniform_control_flow */ |
| 566 |
.shaderSubgroupUniformControlFlow = true, |
| 567 |
|
| 568 |
/* VK_KHR_shader_untyped_pointers */ |
| 569 |
.shaderUntypedPointers = PAN_ARCH >= 9, |
| 570 |
|
| 571 |
/* VK_EXT_shader_module_identifier */ |
| 572 |
.shaderModuleIdentifier = true, |
| 573 |
|
| 574 |
/* VK_EXT_shader_replicated_composites */ |
| 575 |
.shaderReplicatedComposites = true, |
| 576 |
|
| 577 |
/* VK_EXT_shader_atomic_float */ |
| 578 |
.shaderBufferFloat32Atomics = true, |
| 579 |
.shaderBufferFloat32AtomicAdd = false, |
| 580 |
.shaderBufferFloat64Atomics = false, |
| 581 |
.shaderBufferFloat64AtomicAdd = false, |
| 582 |
.shaderSharedFloat32Atomics = true, |
| 583 |
.shaderSharedFloat32AtomicAdd = false, |
| 584 |
.shaderSharedFloat64Atomics = false, |
| 585 |
.shaderSharedFloat64AtomicAdd = false, |
| 586 |
.shaderImageFloat32Atomics = true, |
| 587 |
.shaderImageFloat32AtomicAdd = false, |
| 588 |
.sparseImageFloat32Atomics = has_sparse, |
| 589 |
.sparseImageFloat32AtomicAdd = false, |
| 590 |
|
| 591 |
/* VK_EXT_texel_buffer_alignment */ |
| 592 |
.texelBufferAlignment = true, |
| 593 |
|
| 594 |
/* VK_EXT_rgba10x6_formats */ |
| 595 |
.formatRgba10x6WithoutYCbCrSampler = PAN_ARCH >= 11, |
| 596 |
|
| 597 |
/* VK_EXT_ycbcr_2plane_444_formats */ |
| 598 |
.ycbcr2plane444Formats = PAN_ARCH >= 10, |
| 599 |
|
| 600 |
/* VK_EXT_ycbcr_image_arrays */ |
| 601 |
.ycbcrImageArrays = PAN_ARCH >= 10, |
| 602 |
|
| 603 |
/* VK_EXT_legacy_dithering */ |
| 604 |
.legacyDithering = true, |
| 605 |
|
| 606 |
/* VK_EXT_nested_command_buffer */ |
| 607 |
.nestedCommandBuffer = PAN_ARCH >= 10, |
| 608 |
.nestedCommandBufferRendering = PAN_ARCH >= 10, |
| 609 |
.nestedCommandBufferSimultaneousUse = PAN_ARCH >= 10, |
| 610 |
|
| 611 |
/* VK_EXT_map_memory_placed */ |
| 612 |
.memoryMapPlaced = true, |
| 613 |
.memoryMapRangePlaced = false, |
| 614 |
.memoryUnmapReserve = true, |
| 615 |
|
| 616 |
/* VK_EXT_non_seamless_cube_map */ |
| 617 |
.nonSeamlessCubeMap = true, |
| 618 |
|
| 619 |
/* VK_KHR_unified_image_layouts */ |
| 620 |
.unifiedImageLayouts = true, |
| 621 |
/* Video is not currently supported, so set to false */ |
| 622 |
.unifiedImageLayoutsVideo = false, |
| 623 |
|
| 624 |
/* VK_EXT_zero_initialize_device_memory */ |
| 625 |
.zeroInitializeDeviceMemory = true, |
| 626 |
|
| 627 |
/* VK_EXT_mutable_descriptor_type */ |
| 628 |
.mutableDescriptorType = PAN_ARCH >= 9, |
| 629 |
|
| 630 |
#ifdef PANVK_USE_WSI_PLATFORM |
| 631 |
/* VK_KHR_present_id */ |
| 632 |
.presentId = true, |
| 633 |
|
| 634 |
/* VK_KHR_present_id2 */ |
| 635 |
.presentId2 = true, |
| 636 |
|
| 637 |
/* VK_KHR_present_wait */ |
| 638 |
.presentWait = true, |
| 639 |
|
| 640 |
/* VK_KHR_present_wait2 */ |
| 641 |
.presentWait2 = true, |
| 642 |
#endif |
| 643 |
|
| 644 |
/* VK_EXT_device_memory_report */ |
| 645 |
.deviceMemoryReport = true, |
| 646 |
|
| 647 |
/* VK_ARM_shader_core_builtins */ |
| 648 |
.shaderCoreBuiltins = PAN_ARCH >= 9, |
| 649 |
|
| 650 |
/* VK_ARM_scheduling_controls */ |
| 651 |
.schedulingControls = PAN_ARCH >= 10, |
| 652 |
|
| 653 |
#ifdef PANVK_USE_WSI_PLATFORM |
| 654 |
/* KHR_swapchain_maintenance1 */ |
| 655 |
.swapchainMaintenance1 = true, |
| 656 |
#endif |
| 657 |
|
| 658 |
/* VK_EXT_multisampled_render_to_single_sampled */ |
| 659 |
.multisampledRenderToSingleSampled = true, |
| 660 |
|
| 661 |
#ifdef PANVK_USE_WSI_PLATFORM |
| 662 |
/* VK_EXT_present_timing */ |
| 663 |
.presentTiming = true, |
| 664 |
.presentAtRelativeTime = true, |
| 665 |
.presentAtAbsoluteTime = true, |
| 666 |
#endif |
| 667 |
}; |
| 668 |
} |
| 669 |
|
| 670 |
static uint32_t |
| 671 |
get_api_version() |
| 672 |
{ |
| 673 |
const uint32_t version_override = vk_get_version_override(); |
| 674 |
if (version_override) |
| 675 |
return version_override; |
| 676 |
|
| 677 |
if (PAN_ARCH >= 10) |
| 678 |
return VK_MAKE_API_VERSION(0, 1, 4, VK_HEADER_VERSION); |
| 679 |
|
| 680 |
return VK_MAKE_API_VERSION(0, 1, 0, VK_HEADER_VERSION); |
| 681 |
} |
| 682 |
|
| 683 |
static VkConformanceVersion |
| 684 |
get_conformance_version() |
| 685 |
{ |
| 686 |
if (PAN_ARCH == 10) |
| 687 |
return (VkConformanceVersion){1, 4, 1, 2}; |
| 688 |
|
| 689 |
return (VkConformanceVersion){0, 0, 0, 0}; |
| 690 |
} |
| 691 |
|
| 692 |
void |
| 693 |
panvk_per_arch(get_physical_device_properties)( |
| 694 |
const struct panvk_instance *instance, |
| 695 |
const struct panvk_physical_device *device, struct vk_properties *properties) |
| 696 |
{ |
| 697 |
unsigned max_tib_size = pan_query_tib_size(device->model); |
| 698 |
const unsigned max_cbuf_format = 16; /* R32G32B32A32 */ |
| 699 |
|
| 700 |
unsigned max_cbuf_atts = pan_get_max_cbufs(PAN_ARCH, max_tib_size); |
| 701 |
VkSampleCountFlags sample_counts = |
| 702 |
panvk_get_sample_counts(PAN_ARCH, max_tib_size, max_cbuf_atts, |
| 703 |
max_cbuf_format); |
| 704 |
|
| 705 |
uint64_t os_page_size = 4096; |
| 706 |
os_get_page_size(&os_page_size); |
| 707 |
|
| 708 |
const bool has_disk_cache = device->vk.disk_cache != NULL; |
| 709 |
|
| 710 |
/* Ensure that the max threads count per workgroup is valid for Bifrost */ |
| 711 |
assert(PAN_ARCH > 8 || device->kmod.dev->props.max_threads_per_wg <= 1024); |
| 712 |
|
| 713 |
float pointSizeRangeMin; |
| 714 |
float pointSizeRangeMax; |
| 715 |
|
| 716 |
/* On v13+, point size handling changed entirely */ |
| 717 |
if (PAN_ARCH >= 13) { |
| 718 |
pointSizeRangeMin = 1.0; |
| 719 |
pointSizeRangeMax = 1024.0; |
| 720 |
} else { |
| 721 |
pointSizeRangeMin = 0.125; |
| 722 |
pointSizeRangeMax = 4095.9375; |
| 723 |
} |
| 724 |
|
| 725 |
*properties = (struct vk_properties){ |
| 726 |
.apiVersion = get_api_version(), |
| 727 |
.driverVersion = vk_get_driver_version(), |
| 728 |
.vendorID = |
| 729 |
instance->force_vk_vendor ? instance->force_vk_vendor : ARM_VENDOR_ID, |
| 730 |
.deviceID = device->kmod.dev->props.gpu_id, |
| 731 |
.deviceType = VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU, |
| 732 |
|
| 733 |
/* Vulkan 1.0 limits */ |
| 734 |
/* Maximum texture dimension is 2^16, but we're limited by the |
| 735 |
* size/surface-stride fields. The size/surface_stride field is 32-bit |
| 736 |
* on v10-, so let's take that as a reference for now. |
| 737 |
* The following limits are chosen so we don't overflow these |
| 738 |
* size/surface_stride fields. We choose them so they are a power-of-two, |
| 739 |
* except for 2D/Cube dimensions where taking a power-of-two would be |
| 740 |
* too limiting, so we pick power-of-two-minus-one, which makes things |
| 741 |
* fit exactly in our 32-bit budget. |
| 742 |
*/ |
| 743 |
.maxImageDimension1D = (1 << 16), |
| 744 |
.maxImageDimension2D = PAN_ARCH <= 10 ? (1 << 14) - 1 : (1 << 16), |
| 745 |
.maxImageDimension3D = PAN_ARCH <= 10 ? (1 << 9) : (1 << 14), |
| 746 |
.maxImageDimensionCube = PAN_ARCH <= 10 ? (1 << 14) - 1 : (1 << 16), |
| 747 |
.maxImageArrayLayers = (1 << 16), |
| 748 |
/* Pre-v11 is limited to 2^27 elements of 16 byte formats due to |
| 749 |
size fields of 32 bits. */ |
| 750 |
.maxTexelBufferElements = |
| 751 |
PAN_ARCH >= 11 ? PANVK_MAX_BUFFER_SIZE : (1 << 27), |
| 752 |
/* Each uniform entry is 16-byte and the number of entries is encoded in a |
| 753 |
* 12-bit field, with the minus(1) modifier, which gives 2^20. |
| 754 |
*/ |
| 755 |
.maxUniformBufferRange = 1 << 20, |
| 756 |
/* Storage buffer access is lowered to globals, so there's no limit here, |
| 757 |
* except for the SW-descriptor we use to encode storage buffer |
| 758 |
* descriptors, where the size is a 32-bit field. |
| 759 |
*/ |
| 760 |
.maxStorageBufferRange = UINT32_MAX, |
| 761 |
/* Vulkan 1.4 minimum. We currently implement push constants in terms of |
| 762 |
* FAUs so we're limited by how many user-defined FAUs the hardware |
| 763 |
* offers, minus driver-internal needs. If we ever need go to higher, |
| 764 |
* we'll have to implement push constants in terms of both FAUs and global |
| 765 |
* loads. |
| 766 |
*/ |
| 767 |
.maxPushConstantsSize = 256, |
| 768 |
/* On our kernel drivers we're limited by the available memory rather |
| 769 |
* than available allocations. This is better expressed through memory |
| 770 |
* properties and budget queries, and by returning |
| 771 |
* VK_ERROR_OUT_OF_DEVICE_MEMORY when applicable, rather than |
| 772 |
* this limit. |
| 773 |
*/ |
| 774 |
.maxMemoryAllocationCount = UINT32_MAX, |
| 775 |
/* On Mali, VkSampler objects do not use any resources other than host |
| 776 |
* memory and host address space, availability of which can change |
| 777 |
* significantly over time. |
| 778 |
*/ |
| 779 |
.maxSamplerAllocationCount = UINT32_MAX, |
| 780 |
/* A cache line. */ |
| 781 |
.bufferImageGranularity = 64, |
| 782 |
/* The entire user-allocatable VA range. */ |
| 783 |
.sparseAddressSpaceSize = |
| 784 |
pan_kmod_dev_query_user_va_range(device->kmod.dev).size, |
| 785 |
.maxBoundDescriptorSets = MAX_SETS, |
| 786 |
.maxPerStageDescriptorSamplers = MAX_PER_STAGE_SAMPLERS, |
| 787 |
.maxPerStageDescriptorUniformBuffers = MAX_PER_STAGE_UNIFORM_BUFFERS, |
| 788 |
.maxPerStageDescriptorStorageBuffers = MAX_PER_STAGE_STORAGE_BUFFERS, |
| 789 |
.maxPerStageDescriptorSampledImages = MAX_PER_STAGE_SAMPLED_IMAGES, |
| 790 |
.maxPerStageDescriptorStorageImages = MAX_PER_STAGE_STORAGE_IMAGES, |
| 791 |
.maxPerStageDescriptorInputAttachments = MAX_PER_STAGE_INPUT_ATTACHMENTS, |
| 792 |
.maxPerStageResources = MAX_PER_STAGE_RESOURCES, |
| 793 |
.maxDescriptorSetSamplers = MAX_PER_SET_SAMPLERS, |
| 794 |
.maxDescriptorSetUniformBuffers = MAX_PER_SET_UNIFORM_BUFFERS, |
| 795 |
/* Software limit to keep VkCommandBuffer tracking sane. */ |
| 796 |
.maxDescriptorSetUniformBuffersDynamic = MAX_DYNAMIC_UNIFORM_BUFFERS, |
| 797 |
.maxDescriptorSetStorageBuffers = MAX_PER_SET_STORAGE_BUFFERS, |
| 798 |
/* Software limit to keep VkCommandBuffer tracking sane. */ |
| 799 |
.maxDescriptorSetStorageBuffersDynamic = MAX_DYNAMIC_STORAGE_BUFFERS, |
| 800 |
.maxDescriptorSetSampledImages = MAX_PER_SET_SAMPLED_IMAGES, |
| 801 |
.maxDescriptorSetStorageImages = MAX_PER_SET_STORAGE_IMAGES, |
| 802 |
.maxDescriptorSetInputAttachments = MAX_PER_SET_INPUT_ATTACHMENTS, |
| 803 |
/* Software limit to keep VkCommandBuffer tracking sane. The HW supports |
| 804 |
* up to 2^9 vertex attributes. |
| 805 |
*/ |
| 806 |
.maxVertexInputAttributes = MAX_VBS, |
| 807 |
.maxVertexInputBindings = MAX_VBS, |
| 808 |
/* MALI_ATTRIBUTE::offset is 32-bit. */ |
| 809 |
.maxVertexInputAttributeOffset = UINT32_MAX, |
| 810 |
/* MALI_ATTRIBUTE_BUFFER::stride is 32-bit. */ |
| 811 |
.maxVertexInputBindingStride = MESA_VK_MAX_VERTEX_BINDING_STRIDE, |
| 812 |
/* 32 vec4 varyings. */ |
| 813 |
.maxVertexOutputComponents = 128, |
| 814 |
/* Tesselation shaders not supported. */ |
| 815 |
.maxTessellationGenerationLevel = 0, |
| 816 |
.maxTessellationPatchSize = 0, |
| 817 |
.maxTessellationControlPerVertexInputComponents = 0, |
| 818 |
.maxTessellationControlPerVertexOutputComponents = 0, |
| 819 |
.maxTessellationControlPerPatchOutputComponents = 0, |
| 820 |
.maxTessellationControlTotalOutputComponents = 0, |
| 821 |
.maxTessellationEvaluationInputComponents = 0, |
| 822 |
.maxTessellationEvaluationOutputComponents = 0, |
| 823 |
/* Geometry shaders not supported. */ |
| 824 |
.maxGeometryShaderInvocations = 0, |
| 825 |
.maxGeometryInputComponents = 0, |
| 826 |
.maxGeometryOutputComponents = 0, |
| 827 |
.maxGeometryOutputVertices = 0, |
| 828 |
.maxGeometryTotalOutputComponents = 0, |
| 829 |
/* 32 vec4 varyings. */ |
| 830 |
.maxFragmentInputComponents = 128, |
| 831 |
/* 8 render targets. */ |
| 832 |
.maxFragmentOutputAttachments = MAX_RTS, |
| 833 |
.maxFragmentDualSrcAttachments = max_cbuf_atts, |
| 834 |
/* 8 render targets, 2^12 storage buffers and 2^8 storage images (see |
| 835 |
* above). |
| 836 |
*/ |
| 837 |
.maxFragmentCombinedOutputResources = MAX_RTS + (1 << 12) + (1 << 8), |
| 838 |
/* MALI_LOCAL_STORAGE::wls_size_{base,scale} allows us to have up to |
| 839 |
* (7 << 30) bytes of shared memory, but we cap it to 32K as it doesn't |
| 840 |
* really make sense to expose this amount of memory, especially since |
| 841 |
* it's backed by global memory anyway. |
| 842 |
*/ |
| 843 |
.maxComputeSharedMemorySize = 32768, |
| 844 |
/* Software limit to meet Vulkan 1.0 requirements. We split the |
| 845 |
* dispatch in several jobs if it's too big. |
| 846 |
*/ |
| 847 |
.maxComputeWorkGroupCount = {65535, 65535, 65535}, |
| 848 |
/* We could also split into serveral jobs but this has many limitations. |
| 849 |
* As such we limit to the max threads per workgroup supported by the GPU. |
| 850 |
*/ |
| 851 |
.maxComputeWorkGroupInvocations = |
| 852 |
device->kmod.dev->props.max_threads_per_wg, |
| 853 |
.maxComputeWorkGroupSize = {device->kmod.dev->props.max_threads_per_wg, |
| 854 |
device->kmod.dev->props.max_threads_per_wg, |
| 855 |
device->kmod.dev->props.max_threads_per_wg}, |
| 856 |
/* 8-bit subpixel precision. */ |
| 857 |
.subPixelPrecisionBits = 8, |
| 858 |
.subTexelPrecisionBits = 8, |
| 859 |
.mipmapPrecisionBits = 8, |
| 860 |
/* Software limit. */ |
| 861 |
.maxDrawIndexedIndexValue = UINT32_MAX, |
| 862 |
.maxDrawIndirectCount = PAN_ARCH >= 10 ? UINT32_MAX : 1, |
| 863 |
.maxSamplerLodBias = (float)INT16_MAX / 256.0f, |
| 864 |
.maxSamplerAnisotropy = 16, |
| 865 |
.maxViewports = 1, |
| 866 |
/* Same as the framebuffer limit. */ |
| 867 |
.maxViewportDimensions = {(1 << 14), (1 << 14)}, |
| 868 |
/* Encoded in a 16-bit signed integer. */ |
| 869 |
.viewportBoundsRange = {INT16_MIN, INT16_MAX}, |
| 870 |
.viewportSubPixelBits = 0, |
| 871 |
/* Align on a page. */ |
| 872 |
.minMemoryMapAlignment = os_page_size, |
| 873 |
/* The largest buffer texture format is 16B */ |
| 874 |
.minTexelBufferOffsetAlignment = 16, |
| 875 |
/* Always aligned on a uniform slot (vec4). */ |
| 876 |
.minUniformBufferOffsetAlignment = 16, |
| 877 |
/* LOAD.i128 and LD_PKA.i128 which require 16B alignment */ |
| 878 |
.minStorageBufferOffsetAlignment = 16, |
| 879 |
/* Signed 4-bit value. */ |
| 880 |
.minTexelOffset = -8, |
| 881 |
.maxTexelOffset = 7, |
| 882 |
.minTexelGatherOffset = -8, |
| 883 |
.maxTexelGatherOffset = 7, |
| 884 |
.minInterpolationOffset = -0.5, |
| 885 |
.maxInterpolationOffset = 0.5, |
| 886 |
.subPixelInterpolationOffsetBits = 8, |
| 887 |
.maxFramebufferWidth = (1 << 14), |
| 888 |
.maxFramebufferHeight = (1 << 14), |
| 889 |
.maxFramebufferLayers = 256, |
| 890 |
.framebufferColorSampleCounts = sample_counts, |
| 891 |
.framebufferDepthSampleCounts = sample_counts, |
| 892 |
.framebufferStencilSampleCounts = sample_counts, |
| 893 |
.framebufferNoAttachmentsSampleCounts = sample_counts, |
| 894 |
.maxColorAttachments = max_cbuf_atts, |
| 895 |
.sampledImageColorSampleCounts = sample_counts, |
| 896 |
.sampledImageIntegerSampleCounts = sample_counts, |
| 897 |
.sampledImageDepthSampleCounts = sample_counts, |
| 898 |
.sampledImageStencilSampleCounts = sample_counts, |
| 899 |
.storageImageSampleCounts = VK_SAMPLE_COUNT_1_BIT, |
| 900 |
.maxSampleMaskWords = 1, |
| 901 |
.timestampComputeAndGraphics = |
| 902 |
PAN_ARCH >= 10 && device->kmod.dev->props.gpu_can_query_timestamp, |
| 903 |
.timestampPeriod = |
| 904 |
PAN_ARCH >= 10 ? panvk_get_gpu_system_timestamp_period(device) : 0, |
| 905 |
.maxClipDistances = 0, |
| 906 |
.maxCullDistances = 0, |
| 907 |
.maxCombinedClipAndCullDistances = 0, |
| 908 |
.discreteQueuePriorities = 2, |
| 909 |
.pointSizeRange = {pointSizeRangeMin, pointSizeRangeMax}, |
| 910 |
.lineWidthRange = {0.0, 7.9921875}, |
| 911 |
.pointSizeGranularity = (1.0 / 16.0), |
| 912 |
.lineWidthGranularity = (1.0 / 128.0), |
| 913 |
.strictLines = true, |
| 914 |
.standardSampleLocations = true, |
| 915 |
.optimalBufferCopyOffsetAlignment = 64, |
| 916 |
.optimalBufferCopyRowPitchAlignment = 64, |
| 917 |
|
| 918 |
/* If we can't detect the cacheline size, assume 64 bytes cachelines. */ |
| 919 |
.nonCoherentAtomSize = util_has_cache_ops() ? util_cache_granularity() : 64, |
| 920 |
|
| 921 |
/* Vulkan 1.0 sparse properties */ |
| 922 |
.sparseResidencyNonResidentStrict = false, |
| 923 |
.sparseResidencyAlignedMipSize = false, |
| 924 |
.sparseResidencyStandard2DBlockShape = true, |
| 925 |
.sparseResidencyStandard2DMultisampleBlockShape = false, |
| 926 |
.sparseResidencyStandard3DBlockShape = false, |
| 927 |
|
| 928 |
/* Vulkan 1.1 properties */ |
| 929 |
.subgroupSize = pan_subgroup_size(PAN_ARCH), |
| 930 |
/* We only support VS, FS, and CS. |
| 931 |
* |
| 932 |
* The HW may spawn VS invocations for non-existing indices, which could |
| 933 |
* be observed through subgroup ops (though the user can observe them |
| 934 |
* through infinte loops anyway), so subgroup ops can't be supported in |
| 935 |
* VS. |
| 936 |
*/ |
| 937 |
.subgroupSupportedStages = |
| 938 |
VK_SHADER_STAGE_FRAGMENT_BIT | VK_SHADER_STAGE_COMPUTE_BIT, |
| 939 |
.subgroupSupportedOperations = |
| 940 |
VK_SUBGROUP_FEATURE_BASIC_BIT | VK_SUBGROUP_FEATURE_VOTE_BIT | |
| 941 |
VK_SUBGROUP_FEATURE_ARITHMETIC_BIT | VK_SUBGROUP_FEATURE_BALLOT_BIT | |
| 942 |
VK_SUBGROUP_FEATURE_SHUFFLE_BIT | |
| 943 |
VK_SUBGROUP_FEATURE_SHUFFLE_RELATIVE_BIT | |
| 944 |
VK_SUBGROUP_FEATURE_CLUSTERED_BIT | VK_SUBGROUP_FEATURE_QUAD_BIT | |
| 945 |
VK_SUBGROUP_FEATURE_ROTATE_BIT | |
| 946 |
VK_SUBGROUP_FEATURE_ROTATE_CLUSTERED_BIT, |
| 947 |
.subgroupQuadOperationsInAllStages = false, |
| 948 |
.pointClippingBehavior = VK_POINT_CLIPPING_BEHAVIOR_ALL_CLIP_PLANES, |
| 949 |
.maxMultiviewViewCount = PAN_MAX_MULTIVIEW_VIEW_COUNT, |
| 950 |
.maxMultiviewInstanceIndex = UINT32_MAX, |
| 951 |
.protectedNoFault = false, |
| 952 |
.maxPerSetDescriptors = UINT16_MAX, |
| 953 |
/* Our buffer size fields allow only this much */ |
| 954 |
.maxMemoryAllocationSize = UINT32_MAX, |
| 955 |
|
| 956 |
/* Vulkan 1.2 properties */ |
| 957 |
.supportedDepthResolveModes = |
| 958 |
VK_RESOLVE_MODE_SAMPLE_ZERO_BIT | VK_RESOLVE_MODE_AVERAGE_BIT | |
| 959 |
VK_RESOLVE_MODE_MIN_BIT | VK_RESOLVE_MODE_MAX_BIT, |
| 960 |
.supportedStencilResolveModes = VK_RESOLVE_MODE_SAMPLE_ZERO_BIT | |
| 961 |
VK_RESOLVE_MODE_MIN_BIT | |
| 962 |
VK_RESOLVE_MODE_MAX_BIT, |
| 963 |
.independentResolveNone = true, |
| 964 |
.independentResolve = true, |
| 965 |
/* VK_KHR_driver_properties */ |
| 966 |
.driverID = VK_DRIVER_ID_MESA_PANVK, |
| 967 |
.conformanceVersion = get_conformance_version(), |
| 968 |
.denormBehaviorIndependence = |
| 969 |
PAN_ARCH >= 9 ? VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_NONE |
| 970 |
: VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_ALL, |
| 971 |
.roundingModeIndependence = VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_ALL, |
| 972 |
.shaderSignedZeroInfNanPreserveFloat16 = true, |
| 973 |
.shaderSignedZeroInfNanPreserveFloat32 = true, |
| 974 |
.shaderSignedZeroInfNanPreserveFloat64 = false, |
| 975 |
.shaderDenormPreserveFloat16 = true, |
| 976 |
.shaderDenormPreserveFloat32 = true, |
| 977 |
.shaderDenormPreserveFloat64 = true, |
| 978 |
.shaderDenormFlushToZeroFloat16 = true, |
| 979 |
.shaderDenormFlushToZeroFloat32 = true, |
| 980 |
.shaderDenormFlushToZeroFloat64 = true, |
| 981 |
.shaderRoundingModeRTEFloat16 = true, |
| 982 |
.shaderRoundingModeRTEFloat32 = true, |
| 983 |
.shaderRoundingModeRTEFloat64 = false, |
| 984 |
.shaderRoundingModeRTZFloat16 = true, |
| 985 |
.shaderRoundingModeRTZFloat32 = true, |
| 986 |
.shaderRoundingModeRTZFloat64 = false, |
| 987 |
.maxUpdateAfterBindDescriptorsInAllPools = |
| 988 |
PAN_ARCH >= 9 ? UINT32_MAX : 0, |
| 989 |
/* VK_EXT_descriptor_indexing */ |
| 990 |
.maxUpdateAfterBindDescriptorsInAllPools = PAN_ARCH >= 9 ? UINT32_MAX : 0, |
| 991 |
.shaderUniformBufferArrayNonUniformIndexingNative = false, |
| 992 |
.shaderSampledImageArrayNonUniformIndexingNative = false, |
| 993 |
.shaderStorageBufferArrayNonUniformIndexingNative = false, |
| 994 |
.shaderStorageImageArrayNonUniformIndexingNative = false, |
| 995 |
.shaderInputAttachmentArrayNonUniformIndexingNative = false, |
| 996 |
.robustBufferAccessUpdateAfterBind = PAN_ARCH >= 9, |
| 997 |
.quadDivergentImplicitLod = false, |
| 998 |
.maxPerStageDescriptorUpdateAfterBindSamplers = |
| 999 |
PAN_ARCH >= 9 ? MAX_PER_STAGE_SAMPLERS : 0, |
| 1000 |
.maxPerStageDescriptorUpdateAfterBindUniformBuffers = |
| 1001 |
PAN_ARCH >= 9 ? MAX_PER_STAGE_UNIFORM_BUFFERS : 0, |
| 1002 |
.maxPerStageDescriptorUpdateAfterBindStorageBuffers = |
| 1003 |
PAN_ARCH >= 9 ? MAX_PER_STAGE_STORAGE_BUFFERS : 0, |
| 1004 |
.maxPerStageDescriptorUpdateAfterBindSampledImages = |
| 1005 |
PAN_ARCH >= 9 ? MAX_PER_STAGE_SAMPLED_IMAGES : 0, |
| 1006 |
.maxPerStageDescriptorUpdateAfterBindStorageImages = |
| 1007 |
PAN_ARCH >= 9 ? MAX_PER_STAGE_STORAGE_IMAGES : 0, |
| 1008 |
.maxPerStageDescriptorUpdateAfterBindInputAttachments = |
| 1009 |
PAN_ARCH >= 9 ? MAX_PER_STAGE_INPUT_ATTACHMENTS : 0, |
| 1010 |
.maxPerStageUpdateAfterBindResources = |
| 1011 |
PAN_ARCH >= 9 ? MAX_PER_STAGE_RESOURCES : 0, |
| 1012 |
.maxDescriptorSetUpdateAfterBindSamplers = |
| 1013 |
PAN_ARCH >= 9 ? MAX_PER_SET_SAMPLERS : 0, |
| 1014 |
.maxDescriptorSetUpdateAfterBindUniformBuffers = |
| 1015 |
PAN_ARCH >= 9 ? MAX_PER_SET_UNIFORM_BUFFERS : 0, |
| 1016 |
.maxDescriptorSetUpdateAfterBindUniformBuffersDynamic = |
| 1017 |
PAN_ARCH >= 9 ? MAX_DYNAMIC_UNIFORM_BUFFERS : 0, |
| 1018 |
.maxDescriptorSetUpdateAfterBindStorageBuffers = |
| 1019 |
PAN_ARCH >= 9 ? MAX_PER_SET_STORAGE_BUFFERS : 0, |
| 1020 |
.maxDescriptorSetUpdateAfterBindStorageBuffersDynamic = |
| 1021 |
PAN_ARCH >= 9 ? MAX_DYNAMIC_STORAGE_BUFFERS : 0, |
| 1022 |
.maxDescriptorSetUpdateAfterBindSampledImages = |
| 1023 |
PAN_ARCH >= 9 ? MAX_PER_SET_SAMPLED_IMAGES : 0, |
| 1024 |
.maxDescriptorSetUpdateAfterBindStorageImages = |
| 1025 |
PAN_ARCH >= 9 ? MAX_PER_SET_STORAGE_IMAGES : 0, |
| 1026 |
.maxDescriptorSetUpdateAfterBindInputAttachments = |
| 1027 |
PAN_ARCH >= 9 ? MAX_PER_SET_INPUT_ATTACHMENTS : 0, |
| 1028 |
.supportedDepthResolveModes = VK_RESOLVE_MODE_SAMPLE_ZERO_BIT | |
| 1029 |
VK_RESOLVE_MODE_AVERAGE_BIT | |
| 1030 |
VK_RESOLVE_MODE_MIN_BIT | |
| 1031 |
VK_RESOLVE_MODE_MAX_BIT, |
| 1032 |
.supportedStencilResolveModes = VK_RESOLVE_MODE_SAMPLE_ZERO_BIT | |
| 1033 |
VK_RESOLVE_MODE_MIN_BIT | |
| 1034 |
VK_RESOLVE_MODE_MAX_BIT, |
| 1035 |
.independentResolveNone = true, |
| 1036 |
.independentResolve = true, |
| 1037 |
.filterMinmaxSingleComponentFormats = PAN_ARCH >= 10, |
| 1038 |
.filterMinmaxImageComponentMapping = PAN_ARCH >= 10, |
| 1039 |
.maxTimelineSemaphoreValueDifference = INT64_MAX, |
| 1040 |
.framebufferIntegerColorSampleCounts = sample_counts, |
| 1041 |
|
| 1042 |
/* Vulkan 1.3 properties */ |
| 1043 |
.minSubgroupSize = pan_subgroup_size(PAN_ARCH), |
| 1044 |
.maxSubgroupSize = pan_subgroup_size(PAN_ARCH), |
| 1045 |
.maxComputeWorkgroupSubgroups = |
| 1046 |
device->kmod.dev->props.max_threads_per_wg / |
| 1047 |
pan_subgroup_size(PAN_ARCH), |
| 1048 |
.requiredSubgroupSizeStages = VK_SHADER_STAGE_COMPUTE_BIT, |
| 1049 |
.maxInlineUniformBlockSize = MAX_INLINE_UNIFORM_BLOCK_SIZE, |
| 1050 |
.maxPerStageDescriptorInlineUniformBlocks = |
| 1051 |
MAX_INLINE_UNIFORM_BLOCK_DESCRIPTORS, |
| 1052 |
.maxPerStageDescriptorUpdateAfterBindInlineUniformBlocks = |
| 1053 |
MAX_INLINE_UNIFORM_BLOCK_DESCRIPTORS, |
| 1054 |
.maxDescriptorSetInlineUniformBlocks = |
| 1055 |
MAX_INLINE_UNIFORM_BLOCK_DESCRIPTORS, |
| 1056 |
.maxDescriptorSetUpdateAfterBindInlineUniformBlocks = |
| 1057 |
MAX_INLINE_UNIFORM_BLOCK_DESCRIPTORS, |
| 1058 |
.maxInlineUniformTotalSize = |
| 1059 |
MAX_INLINE_UNIFORM_BLOCK_DESCRIPTORS * MAX_INLINE_UNIFORM_BLOCK_SIZE, |
| 1060 |
.integerDotProduct8BitUnsignedAccelerated = false, |
| 1061 |
.integerDotProduct8BitSignedAccelerated = false, |
| 1062 |
.integerDotProduct8BitMixedSignednessAccelerated = false, |
| 1063 |
.integerDotProduct4x8BitPackedUnsignedAccelerated = PAN_ARCH >= 9, |
| 1064 |
.integerDotProduct4x8BitPackedSignedAccelerated = PAN_ARCH >= 9, |
| 1065 |
.integerDotProduct16BitUnsignedAccelerated = false, |
| 1066 |
.integerDotProduct16BitSignedAccelerated = false, |
| 1067 |
.integerDotProduct16BitMixedSignednessAccelerated = false, |
| 1068 |
.integerDotProduct32BitUnsignedAccelerated = false, |
| 1069 |
.integerDotProduct32BitSignedAccelerated = false, |
| 1070 |
.integerDotProduct32BitMixedSignednessAccelerated = false, |
| 1071 |
.integerDotProduct64BitUnsignedAccelerated = false, |
| 1072 |
.integerDotProduct64BitSignedAccelerated = false, |
| 1073 |
.integerDotProduct64BitMixedSignednessAccelerated = false, |
| 1074 |
.integerDotProductAccumulatingSaturating8BitUnsignedAccelerated = false, |
| 1075 |
.integerDotProductAccumulatingSaturating8BitSignedAccelerated = false, |
| 1076 |
.integerDotProductAccumulatingSaturating8BitMixedSignednessAccelerated = false, |
| 1077 |
.integerDotProductAccumulatingSaturating4x8BitPackedUnsignedAccelerated = PAN_ARCH >= 9, |
| 1078 |
.integerDotProductAccumulatingSaturating4x8BitPackedSignedAccelerated = PAN_ARCH >= 9, |
| 1079 |
.integerDotProductAccumulatingSaturating4x8BitPackedMixedSignednessAccelerated = false, |
| 1080 |
.integerDotProductAccumulatingSaturating16BitUnsignedAccelerated = false, |
| 1081 |
.integerDotProductAccumulatingSaturating16BitSignedAccelerated = false, |
| 1082 |
.integerDotProductAccumulatingSaturating16BitMixedSignednessAccelerated = false, |
| 1083 |
.integerDotProductAccumulatingSaturating32BitUnsignedAccelerated = false, |
| 1084 |
.integerDotProductAccumulatingSaturating32BitSignedAccelerated = false, |
| 1085 |
.integerDotProductAccumulatingSaturating32BitMixedSignednessAccelerated = false, |
| 1086 |
.integerDotProductAccumulatingSaturating64BitUnsignedAccelerated = false, |
| 1087 |
.integerDotProductAccumulatingSaturating64BitSignedAccelerated = false, |
| 1088 |
.integerDotProductAccumulatingSaturating64BitMixedSignednessAccelerated = false, |
| 1089 |
.storageTexelBufferOffsetAlignmentBytes = 16, |
| 1090 |
.storageTexelBufferOffsetSingleTexelAlignment = true, |
| 1091 |
.uniformTexelBufferOffsetAlignmentBytes = 4, |
| 1092 |
.uniformTexelBufferOffsetSingleTexelAlignment = true, |
| 1093 |
.maxBufferSize = PANVK_MAX_BUFFER_SIZE, |
| 1094 |
|
| 1095 |
/* Vulkan 1.4 properties */ |
| 1096 |
.lineSubPixelPrecisionBits = 8, |
| 1097 |
/* We will have to restrict this a bit for multiview */ |
| 1098 |
.maxVertexAttribDivisor = UINT32_MAX, |
| 1099 |
.supportsNonZeroFirstInstance = true, |
| 1100 |
.maxPushDescriptors = MAX_PUSH_DESCS, |
| 1101 |
.dynamicRenderingLocalReadDepthStencilAttachments = true, |
| 1102 |
.dynamicRenderingLocalReadMultisampledAttachments = true, |
| 1103 |
.earlyFragmentMultisampleCoverageAfterSampleCounting = true, |
| 1104 |
.earlyFragmentSampleMaskTestBeforeSampleCounting = true, |
| 1105 |
.depthStencilSwizzleOneSupport = true, |
| 1106 |
.polygonModePointSize = false, |
| 1107 |
.nonStrictSinglePixelWideLinesUseParallelogram = false, |
| 1108 |
.nonStrictWideLinesUseParallelogram = false, |
| 1109 |
.blockTexelViewCompatibleMultipleLayers = true, |
| 1110 |
.maxCombinedImageSamplerDescriptorCount = 1, |
| 1111 |
/* We don't implement VK_KHR_fragment_shading_rate */ |
| 1112 |
.fragmentShadingRateClampCombinerInputs = false, |
| 1113 |
.defaultRobustnessStorageBuffers = |
| 1114 |
VK_PIPELINE_ROBUSTNESS_BUFFER_BEHAVIOR_ROBUST_BUFFER_ACCESS_EXT, |
| 1115 |
.defaultRobustnessUniformBuffers = |
| 1116 |
VK_PIPELINE_ROBUSTNESS_BUFFER_BEHAVIOR_ROBUST_BUFFER_ACCESS_EXT, |
| 1117 |
.defaultRobustnessVertexInputs = |
| 1118 |
VK_PIPELINE_ROBUSTNESS_BUFFER_BEHAVIOR_ROBUST_BUFFER_ACCESS_EXT, |
| 1119 |
.defaultRobustnessImages = |
| 1120 |
VK_PIPELINE_ROBUSTNESS_IMAGE_BEHAVIOR_ROBUST_IMAGE_ACCESS_EXT, |
| 1121 |
.identicalMemoryTypeRequirements = true, |
| 1122 |
|
| 1123 |
/* VK_KHR_pipeline_binary */ |
| 1124 |
.pipelineBinaryInternalCache = has_disk_cache, |
| 1125 |
.pipelineBinaryInternalCacheControl = has_disk_cache, |
| 1126 |
.pipelineBinaryPrefersInternalCache = has_disk_cache, |
| 1127 |
.pipelineBinaryPrecompiledInternalCache = has_disk_cache, |
| 1128 |
.pipelineBinaryCompressedData = false, |
| 1129 |
|
| 1130 |
/* VK_KHR_robustness2 */ |
| 1131 |
.robustStorageBufferAccessSizeAlignment = 4, |
| 1132 |
.robustUniformBufferAccessSizeAlignment = 16, |
| 1133 |
|
| 1134 |
/* VK_EXT_shader_object */ |
| 1135 |
/* We do not currently support VK_EXT_shader_object but this is used |
| 1136 |
* internally by vk_shader |
| 1137 |
*/ |
| 1138 |
.shaderBinaryVersion = 0, |
| 1139 |
|
| 1140 |
/* VK_KHR_maintenance7 */ |
| 1141 |
/* We don't implement VK_KHR_fragment_shading_rate */ |
| 1142 |
.robustFragmentShadingRateAttachmentAccess = false, |
| 1143 |
.separateDepthStencilAttachmentAccess = false, |
| 1144 |
.maxDescriptorSetTotalUniformBuffersDynamic = MAX_DYNAMIC_UNIFORM_BUFFERS, |
| 1145 |
.maxDescriptorSetTotalStorageBuffersDynamic = MAX_DYNAMIC_STORAGE_BUFFERS, |
| 1146 |
.maxDescriptorSetTotalBuffersDynamic = MAX_DYNAMIC_BUFFERS, |
| 1147 |
.maxDescriptorSetUpdateAfterBindTotalUniformBuffersDynamic = |
| 1148 |
PAN_ARCH >= 9 ? MAX_DYNAMIC_UNIFORM_BUFFERS : 0, |
| 1149 |
.maxDescriptorSetUpdateAfterBindTotalStorageBuffersDynamic = |
| 1150 |
PAN_ARCH >= 9 ? MAX_DYNAMIC_STORAGE_BUFFERS : 0, |
| 1151 |
.maxDescriptorSetUpdateAfterBindTotalBuffersDynamic = |
| 1152 |
PAN_ARCH >= 9 ? MAX_DYNAMIC_BUFFERS : 0, |
| 1153 |
|
| 1154 |
/* VK_KHR_maintenance9 */ |
| 1155 |
/* Sparse binding not supported yet. */ |
| 1156 |
.image2DViewOf3DSparse = false, |
| 1157 |
.defaultVertexAttributeValue = VK_DEFAULT_VERTEX_ATTRIBUTE_VALUE_ZERO_ZERO_ZERO_ZERO_KHR, |
| 1158 |
|
| 1159 |
/* VK_EXT_custom_border_color */ |
| 1160 |
.maxCustomBorderColorSamplers = 32768, |
| 1161 |
|
| 1162 |
/* VK_EXT_graphics_pipeline_library */ |
| 1163 |
.graphicsPipelineLibraryFastLinking = true, |
| 1164 |
.graphicsPipelineLibraryIndependentInterpolationDecoration = true, |
| 1165 |
|
| 1166 |
/* VK_EXT_nested_command_buffer */ |
| 1167 |
.maxCommandBufferNestingLevel = 5, |
| 1168 |
|
| 1169 |
/* VK_EXT_map_memory_placed */ |
| 1170 |
.minPlacedMemoryMapAlignment = os_page_size, |
| 1171 |
|
| 1172 |
/* VK_EXT_provoking_vertex */ |
| 1173 |
.provokingVertexModePerPipeline = false, |
| 1174 |
.transformFeedbackPreservesTriangleFanProvokingVertex = false, |
| 1175 |
|
| 1176 |
/* VK_ANDROID_native_buffer */ |
| 1177 |
.sharedImage = vk_android_get_front_buffer_usage() != 0, |
| 1178 |
|
| 1179 |
/* VK_ARM_shader_core_properties */ |
| 1180 |
.pixelRate = device->model->rates.pixel, |
| 1181 |
.texelRate = device->model->rates.texel, |
| 1182 |
.fmaRate = device->model->rates.fma, |
| 1183 |
|
| 1184 |
/* VK_ARM_shader_core_builtins */ |
| 1185 |
.shaderCoreMask = device->kmod.dev->props.shader_present, |
| 1186 |
.shaderCoreCount = util_bitcount(device->kmod.dev->props.shader_present), |
| 1187 |
.shaderWarpsPerCore = device->kmod.dev->props.max_threads_per_core / |
| 1188 |
(pan_subgroup_size(PAN_ARCH) * 2), |
| 1189 |
|
| 1190 |
/* VK_ARM_scheduling_controls */ |
| 1191 |
.schedulingControlsFlags = |
| 1192 |
VK_PHYSICAL_DEVICE_SCHEDULING_CONTROLS_SHADER_CORE_COUNT_ARM, |
| 1193 |
}; |
| 1194 |
|
| 1195 |
snprintf(properties->deviceName, sizeof(properties->deviceName), "%s", |
| 1196 |
device->name); |
| 1197 |
|
| 1198 |
memcpy(properties->pipelineCacheUUID, device->cache_uuid, VK_UUID_SIZE); |
| 1199 |
memcpy(properties->shaderBinaryUUID, device->cache_uuid, VK_UUID_SIZE); |
| 1200 |
|
| 1201 |
const struct { |
| 1202 |
uint16_t vendor_id; |
| 1203 |
uint32_t device_id; |
| 1204 |
uint8_t pad[8]; |
| 1205 |
} dev_uuid = { |
| 1206 |
.vendor_id = ARM_VENDOR_ID, |
| 1207 |
.device_id = properties->deviceID, |
| 1208 |
}; |
| 1209 |
|
| 1210 |
STATIC_ASSERT(sizeof(dev_uuid) == VK_UUID_SIZE); |
| 1211 |
memcpy(properties->deviceUUID, &dev_uuid, VK_UUID_SIZE); |
| 1212 |
STATIC_ASSERT(sizeof(instance->driver_build_sha) >= VK_UUID_SIZE); |
| 1213 |
memcpy(properties->driverUUID, instance->driver_build_sha, VK_UUID_SIZE); |
| 1214 |
|
| 1215 |
snprintf(properties->driverName, VK_MAX_DRIVER_NAME_SIZE, "panvk"); |
| 1216 |
snprintf(properties->driverInfo, VK_MAX_DRIVER_INFO_SIZE, |
| 1217 |
"Mesa " PACKAGE_VERSION MESA_GIT_SHA1); |
| 1218 |
|
| 1219 |
/* VK_EXT_physical_device_drm */ |
| 1220 |
if (device->drm.primary_rdev) { |
| 1221 |
properties->drmHasPrimary = true; |
| 1222 |
properties->drmPrimaryMajor = major(device->drm.primary_rdev); |
| 1223 |
properties->drmPrimaryMinor = minor(device->drm.primary_rdev); |
| 1224 |
} |
| 1225 |
if (device->drm.render_rdev) { |
| 1226 |
properties->drmHasRender = true; |
| 1227 |
properties->drmRenderMajor = major(device->drm.render_rdev); |
| 1228 |
properties->drmRenderMinor = minor(device->drm.render_rdev); |
| 1229 |
} |
| 1230 |
|
| 1231 |
/* VK_EXT_shader_module_identifier */ |
| 1232 |
STATIC_ASSERT(sizeof(vk_shaderModuleIdentifierAlgorithmUUID) == |
| 1233 |
sizeof(properties->shaderModuleIdentifierAlgorithmUUID)); |
| 1234 |
memcpy(properties->shaderModuleIdentifierAlgorithmUUID, |
| 1235 |
vk_shaderModuleIdentifierAlgorithmUUID, |
| 1236 |
sizeof(properties->shaderModuleIdentifierAlgorithmUUID)); |
| 1237 |
|
| 1238 |
/* VK_EXT_host_image_copy */ |
| 1239 |
/* We don't use image layouts, advertise all of them */ |
| 1240 |
static VkImageLayout supported_host_copy_layouts[] = { |
| 1241 |
VK_IMAGE_LAYOUT_GENERAL, |
| 1242 |
VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, |
| 1243 |
VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL, |
| 1244 |
VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL, |
| 1245 |
VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, |
| 1246 |
VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, |
| 1247 |
VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, |
| 1248 |
VK_IMAGE_LAYOUT_PREINITIALIZED, |
| 1249 |
VK_IMAGE_LAYOUT_ZERO_INITIALIZED_EXT, |
| 1250 |
|
| 1251 |
/* Only if vk1.1+ is supported */ |
| 1252 |
#if PAN_ARCH >= 10 |
| 1253 |
/* Vulkan 1.1 */ |
| 1254 |
VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL, |
| 1255 |
VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL, |
| 1256 |
|
| 1257 |
/* Vulkan 1.2 */ |
| 1258 |
VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL, |
| 1259 |
VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL, |
| 1260 |
VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL, |
| 1261 |
VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL, |
| 1262 |
|
| 1263 |
/* Vulkan 1.3 */ |
| 1264 |
VK_IMAGE_LAYOUT_READ_ONLY_OPTIMAL, |
| 1265 |
VK_IMAGE_LAYOUT_ATTACHMENT_OPTIMAL, |
| 1266 |
|
| 1267 |
/* Vulkan 1.4 */ |
| 1268 |
VK_IMAGE_LAYOUT_RENDERING_LOCAL_READ, |
| 1269 |
|
| 1270 |
#endif |
| 1271 |
|
| 1272 |
/* VK_EXT_attachment_feedback_loop_layout */ |
| 1273 |
VK_IMAGE_LAYOUT_ATTACHMENT_FEEDBACK_LOOP_OPTIMAL_EXT, |
| 1274 |
}; |
| 1275 |
properties->pCopySrcLayouts = supported_host_copy_layouts; |
| 1276 |
properties->copySrcLayoutCount = ARRAY_SIZE(supported_host_copy_layouts); |
| 1277 |
properties->pCopyDstLayouts = supported_host_copy_layouts; |
| 1278 |
properties->copyDstLayoutCount = ARRAY_SIZE(supported_host_copy_layouts); |
| 1279 |
/* All HW has the same tiling layout, key off build hash only */ |
| 1280 |
STATIC_ASSERT(sizeof(instance->driver_build_sha) >= VK_UUID_SIZE); |
| 1281 |
memcpy(properties->optimalTilingLayoutUUID, instance->driver_build_sha, |
| 1282 |
VK_UUID_SIZE); |
| 1283 |
|
| 1284 |
if (PANVK_DEBUG(STARTUP)) { |
| 1285 |
mesa_logi("%s (%s) %s", properties->driverName, properties->deviceName, |
| 1286 |
properties->driverInfo); |
| 1287 |
} |
| 1288 |
} |