| 1 |
/* |
| 2 |
* Copyright © 2022 Imagination Technologies Ltd. |
| 3 |
* |
| 4 |
* based in part on anv driver which is: |
| 5 |
* Copyright © 2015 Intel Corporation |
| 6 |
* |
| 7 |
* based in part on v3dv driver which is: |
| 8 |
* Copyright © 2019 Raspberry Pi |
| 9 |
* |
| 10 |
* SPDX-License-Identifier: MIT |
| 11 |
*/ |
| 12 |
|
| 13 |
#include "pvr_physical_device.h" |
| 14 |
|
| 15 |
#include <sys/sysmacros.h> |
| 16 |
|
| 17 |
#include "git_sha1.h" |
| 18 |
|
| 19 |
#include "util/disk_cache.h" |
| 20 |
#include "util/ralloc.h" |
| 21 |
|
| 22 |
#include "vk_util.h" |
| 23 |
#include "vk_log.h" |
| 24 |
|
| 25 |
#include "hwdef/rogue_hw_utils.h" |
| 26 |
|
| 27 |
#include "pco/pco.h" |
| 28 |
#include "pco_uscgen_programs.h" |
| 29 |
|
| 30 |
#include "pvr_device.h" |
| 31 |
#include "pvr_dump_info.h" |
| 32 |
#include "pvr_entrypoints.h" |
| 33 |
#include "pvr_instance.h" |
| 34 |
#include "pvr_macros.h" |
| 35 |
#include "pvr_winsys.h" |
| 36 |
#include "pvr_wsi.h" |
| 37 |
|
| 38 |
#define VK_VENDOR_ID_IMAGINATION 0x1010 |
| 39 |
|
| 40 |
void pvr_physical_device_dump_info(const struct pvr_physical_device *pdevice, |
| 41 |
char *const *comp_display, |
| 42 |
char *const *comp_render) |
| 43 |
{ |
| 44 |
drmVersionPtr version_display = NULL, version_render; |
| 45 |
struct pvr_device_dump_info info = { 0 }; |
| 46 |
|
| 47 |
if (pdevice->ws->display_fd >= 0) |
| 48 |
version_display = drmGetVersion(pdevice->ws->display_fd); |
| 49 |
|
| 50 |
version_render = drmGetVersion(pdevice->ws->render_fd); |
| 51 |
if (!version_render) { |
| 52 |
drmFreeVersion(version_display); |
| 53 |
return; |
| 54 |
} |
| 55 |
|
| 56 |
info.device_info = &pdevice->dev_info; |
| 57 |
info.device_runtime_info = &pdevice->dev_runtime_info; |
| 58 |
if (version_display) { |
| 59 |
info.drm_display.patchlevel = version_display->version_patchlevel; |
| 60 |
info.drm_display.major = version_display->version_major; |
| 61 |
info.drm_display.minor = version_display->version_minor; |
| 62 |
info.drm_display.name = version_display->name; |
| 63 |
info.drm_display.date = version_display->date; |
| 64 |
info.drm_display.comp = comp_display; |
| 65 |
} |
| 66 |
info.drm_render.patchlevel = version_render->version_patchlevel; |
| 67 |
info.drm_render.major = version_render->version_major; |
| 68 |
info.drm_render.minor = version_render->version_minor; |
| 69 |
info.drm_render.name = version_render->name; |
| 70 |
info.drm_render.date = version_render->date; |
| 71 |
info.drm_render.comp = comp_render; |
| 72 |
|
| 73 |
pvr_dump_physical_device_info(&info); |
| 74 |
|
| 75 |
drmFreeVersion(version_display); |
| 76 |
drmFreeVersion(version_render); |
| 77 |
} |
| 78 |
|
| 79 |
void pvr_physical_device_destroy(struct vk_physical_device *vk_pdevice) |
| 80 |
{ |
| 81 |
struct pvr_physical_device *pdevice = |
| 82 |
container_of(vk_pdevice, struct pvr_physical_device, vk); |
| 83 |
|
| 84 |
/* Be careful here. The device might not have been initialized. This can |
| 85 |
* happen since initialization is done in vkEnumeratePhysicalDevices() but |
| 86 |
* finish is done in vkDestroyInstance(). Make sure that you check for NULL |
| 87 |
* before freeing or that the freeing functions accept NULL pointers. |
| 88 |
*/ |
| 89 |
|
| 90 |
ralloc_free(pdevice->pco_ctx); |
| 91 |
|
| 92 |
pvr_wsi_finish(pdevice); |
| 93 |
|
| 94 |
pvr_physical_device_free_pipeline_cache(pdevice); |
| 95 |
|
| 96 |
if (pdevice->ws) |
| 97 |
pvr_winsys_destroy(pdevice->ws); |
| 98 |
|
| 99 |
vk_free(&pdevice->vk.instance->alloc, pdevice->render_path); |
| 100 |
vk_free(&pdevice->vk.instance->alloc, pdevice->display_path); |
| 101 |
|
| 102 |
vk_physical_device_finish(&pdevice->vk); |
| 103 |
|
| 104 |
vk_free(&pdevice->vk.instance->alloc, pdevice); |
| 105 |
} |
| 106 |
|
| 107 |
void pvr_physical_device_free_pipeline_cache( |
| 108 |
struct pvr_physical_device *const pdevice) |
| 109 |
{ |
| 110 |
#ifdef ENABLE_SHADER_CACHE |
| 111 |
if (!pdevice->vk.disk_cache) |
| 112 |
return; |
| 113 |
|
| 114 |
disk_cache_destroy(pdevice->vk.disk_cache); |
| 115 |
pdevice->vk.disk_cache = NULL; |
| 116 |
#else |
| 117 |
assert(pdevice->vk.disk_cache); |
| 118 |
#endif /* ENABLE_SHADER_CACHE */ |
| 119 |
} |
| 120 |
|
| 121 |
static void pvr_physical_device_get_supported_extensions( |
| 122 |
struct vk_device_extension_table *extensions) |
| 123 |
{ |
| 124 |
*extensions = (struct vk_device_extension_table){ |
| 125 |
.KHR_bind_memory2 = true, |
| 126 |
.KHR_buffer_device_address = false, |
| 127 |
.KHR_copy_commands2 = true, |
| 128 |
.KHR_create_renderpass2 = true, |
| 129 |
.KHR_dedicated_allocation = true, |
| 130 |
.KHR_depth_stencil_resolve = true, |
| 131 |
.KHR_descriptor_update_template = true, |
| 132 |
.KHR_device_group = true, |
| 133 |
.KHR_driver_properties = true, |
| 134 |
.KHR_dynamic_rendering = true, |
| 135 |
.KHR_external_fence = true, |
| 136 |
.KHR_external_fence_fd = true, |
| 137 |
.KHR_external_memory = true, |
| 138 |
.KHR_external_memory_fd = true, |
| 139 |
.KHR_external_semaphore = PVR_USE_WSI_PLATFORM, |
| 140 |
.KHR_external_semaphore_fd = PVR_USE_WSI_PLATFORM, |
| 141 |
.KHR_format_feature_flags2 = false, |
| 142 |
.KHR_get_memory_requirements2 = true, |
| 143 |
.KHR_incremental_present = PVR_USE_WSI_PLATFORM, |
| 144 |
.KHR_image_format_list = true, |
| 145 |
.KHR_imageless_framebuffer = true, |
| 146 |
.KHR_index_type_uint8 = false, |
| 147 |
.KHR_line_rasterization = true, |
| 148 |
.KHR_maintenance1 = true, |
| 149 |
.KHR_maintenance2 = true, |
| 150 |
.KHR_maintenance3 = true, |
| 151 |
.KHR_maintenance4 = true, |
| 152 |
.KHR_map_memory2 = true, |
| 153 |
.KHR_multiview = true, |
| 154 |
.KHR_pipeline_executable_properties = true, |
| 155 |
.KHR_present_id2 = PVR_USE_WSI_PLATFORM, |
| 156 |
.KHR_present_wait2 = PVR_USE_WSI_PLATFORM, |
| 157 |
.KHR_relaxed_block_layout = true, |
| 158 |
.KHR_robustness2 = true, |
| 159 |
.KHR_sampler_mirror_clamp_to_edge = true, |
| 160 |
.KHR_sampler_ycbcr_conversion = true, |
| 161 |
.KHR_separate_depth_stencil_layouts = true, |
| 162 |
.KHR_shader_draw_parameters = true, |
| 163 |
.KHR_shader_expect_assume = false, |
| 164 |
.KHR_shader_float_controls = true, |
| 165 |
.KHR_shader_integer_dot_product = true, |
| 166 |
.KHR_shader_non_semantic_info = true, |
| 167 |
.KHR_shader_relaxed_extended_instruction = true, |
| 168 |
.KHR_shader_subgroup_extended_types = true, |
| 169 |
.KHR_shader_terminate_invocation = true, |
| 170 |
.KHR_spirv_1_4 = true, |
| 171 |
.KHR_storage_buffer_storage_class = true, |
| 172 |
.KHR_swapchain = PVR_USE_WSI_PLATFORM, |
| 173 |
.KHR_swapchain_mutable_format = PVR_USE_WSI_PLATFORM, |
| 174 |
.KHR_timeline_semaphore = true, |
| 175 |
.KHR_uniform_buffer_standard_layout = true, |
| 176 |
.KHR_vertex_attribute_divisor = true, |
| 177 |
.KHR_zero_initialize_workgroup_memory = false, |
| 178 |
.EXT_border_color_swizzle = true, |
| 179 |
.EXT_color_write_enable = true, |
| 180 |
.EXT_custom_border_color = true, |
| 181 |
.EXT_depth_clamp_zero_one = true, |
| 182 |
.EXT_depth_clip_enable = true, |
| 183 |
.EXT_image_drm_format_modifier = true, |
| 184 |
.EXT_extended_dynamic_state = true, |
| 185 |
.EXT_extended_dynamic_state2 = true, |
| 186 |
.EXT_extended_dynamic_state3 = true, |
| 187 |
.EXT_external_memory_dma_buf = true, |
| 188 |
.EXT_host_query_reset = true, |
| 189 |
.EXT_image_2d_view_of_3d = true, |
| 190 |
.EXT_index_type_uint8 = false, |
| 191 |
.EXT_line_rasterization = true, |
| 192 |
.EXT_map_memory_placed = true, |
| 193 |
.EXT_non_seamless_cube_map = true, |
| 194 |
.EXT_physical_device_drm = true, |
| 195 |
.EXT_private_data = true, |
| 196 |
.EXT_provoking_vertex = true, |
| 197 |
.EXT_queue_family_foreign = true, |
| 198 |
.EXT_robustness2 = true, |
| 199 |
.EXT_scalar_block_layout = true, |
| 200 |
.EXT_separate_stencil_usage = true, |
| 201 |
.EXT_shader_demote_to_helper_invocation = true, |
| 202 |
.EXT_shader_replicated_composites = true, |
| 203 |
.EXT_texel_buffer_alignment = false, |
| 204 |
.EXT_tooling_info = true, |
| 205 |
.EXT_vertex_attribute_divisor = true, |
| 206 |
.EXT_zero_initialize_device_memory = true, |
| 207 |
}; |
| 208 |
} |
| 209 |
|
| 210 |
static void pvr_physical_device_get_supported_features( |
| 211 |
const struct pvr_device_info *const dev_info, |
| 212 |
struct vk_features *const features) |
| 213 |
{ |
| 214 |
*features = (struct vk_features){ |
| 215 |
/* Vulkan 1.0 */ |
| 216 |
.robustBufferAccess = true, |
| 217 |
.fullDrawIndexUint32 = true, |
| 218 |
.imageCubeArray = true, |
| 219 |
.independentBlend = true, |
| 220 |
.geometryShader = false, |
| 221 |
.tessellationShader = false, |
| 222 |
.sampleRateShading = true, |
| 223 |
.dualSrcBlend = false, |
| 224 |
.logicOp = true, |
| 225 |
.multiDrawIndirect = true, |
| 226 |
.drawIndirectFirstInstance = true, |
| 227 |
.depthClamp = false, |
| 228 |
.depthBiasClamp = true, |
| 229 |
.fillModeNonSolid = false, |
| 230 |
.depthBounds = false, |
| 231 |
.wideLines = true, |
| 232 |
.largePoints = true, |
| 233 |
.alphaToOne = true, |
| 234 |
.multiViewport = false, |
| 235 |
.samplerAnisotropy = true, |
| 236 |
.textureCompressionETC2 = true, |
| 237 |
.textureCompressionASTC_LDR = false, |
| 238 |
.textureCompressionBC = false, |
| 239 |
.occlusionQueryPrecise = false, |
| 240 |
.pipelineStatisticsQuery = false, |
| 241 |
.vertexPipelineStoresAndAtomics = false, |
| 242 |
.fragmentStoresAndAtomics = false, |
| 243 |
.shaderTessellationAndGeometryPointSize = false, |
| 244 |
.shaderImageGatherExtended = false, |
| 245 |
.shaderStorageImageExtendedFormats = true, |
| 246 |
.shaderStorageImageMultisample = false, |
| 247 |
.shaderStorageImageReadWithoutFormat = true, |
| 248 |
.shaderStorageImageWriteWithoutFormat = true, |
| 249 |
.shaderUniformBufferArrayDynamicIndexing = false, |
| 250 |
.shaderSampledImageArrayDynamicIndexing = false, |
| 251 |
.shaderStorageBufferArrayDynamicIndexing = false, |
| 252 |
.shaderStorageImageArrayDynamicIndexing = false, |
| 253 |
.shaderClipDistance = true, |
| 254 |
.shaderCullDistance = true, |
| 255 |
.shaderFloat64 = false, |
| 256 |
.shaderInt64 = false, |
| 257 |
.shaderInt16 = false, |
| 258 |
.shaderResourceResidency = false, |
| 259 |
.shaderResourceMinLod = false, |
| 260 |
.sparseBinding = false, |
| 261 |
.sparseResidencyBuffer = false, |
| 262 |
.sparseResidencyImage2D = false, |
| 263 |
.sparseResidencyImage3D = false, |
| 264 |
.sparseResidency2Samples = false, |
| 265 |
.sparseResidency4Samples = false, |
| 266 |
.sparseResidency8Samples = false, |
| 267 |
.sparseResidency16Samples = false, |
| 268 |
.sparseResidencyAliased = false, |
| 269 |
.variableMultisampleRate = false, |
| 270 |
.inheritedQueries = false, |
| 271 |
|
| 272 |
/* Vulkan 1.1 */ |
| 273 |
.storageBuffer16BitAccess = false, |
| 274 |
.uniformAndStorageBuffer16BitAccess = false, |
| 275 |
.storagePushConstant16 = false, |
| 276 |
.storageInputOutput16 = false, |
| 277 |
.variablePointers = false, |
| 278 |
.protectedMemory = false, |
| 279 |
.samplerYcbcrConversion = true, |
| 280 |
|
| 281 |
/* Vulkan 1.2 */ |
| 282 |
.samplerMirrorClampToEdge = true, |
| 283 |
.drawIndirectCount = false, |
| 284 |
.storageBuffer8BitAccess = false, |
| 285 |
.uniformAndStorageBuffer8BitAccess = false, |
| 286 |
.storagePushConstant8 = false, |
| 287 |
.shaderBufferInt64Atomics = false, |
| 288 |
.shaderSharedInt64Atomics = false, |
| 289 |
.shaderFloat16 = false, |
| 290 |
.shaderInt8 = false, |
| 291 |
.descriptorIndexing = false, |
| 292 |
.shaderInputAttachmentArrayDynamicIndexing = false, |
| 293 |
.shaderUniformTexelBufferArrayDynamicIndexing = false, |
| 294 |
.shaderStorageTexelBufferArrayDynamicIndexing = false, |
| 295 |
.shaderUniformBufferArrayNonUniformIndexing = false, |
| 296 |
.shaderSampledImageArrayNonUniformIndexing = false, |
| 297 |
.shaderStorageBufferArrayNonUniformIndexing = false, |
| 298 |
.shaderStorageImageArrayNonUniformIndexing = false, |
| 299 |
.shaderInputAttachmentArrayNonUniformIndexing = false, |
| 300 |
.shaderUniformTexelBufferArrayNonUniformIndexing = false, |
| 301 |
.shaderStorageTexelBufferArrayNonUniformIndexing = false, |
| 302 |
.descriptorBindingUniformBufferUpdateAfterBind = false, |
| 303 |
.descriptorBindingSampledImageUpdateAfterBind = false, |
| 304 |
.descriptorBindingStorageImageUpdateAfterBind = false, |
| 305 |
.descriptorBindingStorageBufferUpdateAfterBind = false, |
| 306 |
.descriptorBindingUniformTexelBufferUpdateAfterBind = false, |
| 307 |
.descriptorBindingStorageTexelBufferUpdateAfterBind = false, |
| 308 |
.descriptorBindingUpdateUnusedWhilePending = false, |
| 309 |
.descriptorBindingPartiallyBound = false, |
| 310 |
.descriptorBindingVariableDescriptorCount = false, |
| 311 |
.runtimeDescriptorArray = false, |
| 312 |
.samplerFilterMinmax = false, |
| 313 |
.vulkanMemoryModel = false, |
| 314 |
.vulkanMemoryModelDeviceScope = false, |
| 315 |
.vulkanMemoryModelAvailabilityVisibilityChains = false, |
| 316 |
.shaderOutputViewportIndex = false, |
| 317 |
.shaderOutputLayer = false, |
| 318 |
.subgroupBroadcastDynamicId = true, |
| 319 |
|
| 320 |
/* VK_EXT_depth_clamp_zero_one */ |
| 321 |
.depthClampZeroOne = true, |
| 322 |
|
| 323 |
/* VK_KHR_index_type_uint8 */ |
| 324 |
.indexTypeUint8 = true, |
| 325 |
|
| 326 |
/* Vulkan 1.2 / VK_KHR_imageless_framebuffer */ |
| 327 |
.imagelessFramebuffer = true, |
| 328 |
|
| 329 |
/* Vulkan 1.1 / VK_KHR_multiview */ |
| 330 |
.multiview = true, |
| 331 |
.multiviewGeometryShader = false, |
| 332 |
.multiviewTessellationShader = false, |
| 333 |
|
| 334 |
/* Vulkan 1.3 / VK_KHR_maintenance4 */ |
| 335 |
.maintenance4 = true, |
| 336 |
|
| 337 |
/* Vulkan 1.1 / VK_KHR_shader_draw_parameters */ |
| 338 |
.shaderDrawParameters = true, |
| 339 |
|
| 340 |
/* Vulkan 1.3 / VK_KHR_shader_integer_dot_product */ |
| 341 |
.shaderIntegerDotProduct = true, |
| 342 |
|
| 343 |
/* Vulkan 1.2 / VK_KHR_timeline_semaphore */ |
| 344 |
.timelineSemaphore = true, |
| 345 |
|
| 346 |
/* Vulkan 1.2 / VK_KHR_separate_depth_stencil_layouts */ |
| 347 |
.separateDepthStencilLayouts = true, |
| 348 |
|
| 349 |
/* VK_KHR_shader_relaxed_extended_instruction */ |
| 350 |
.shaderRelaxedExtendedInstruction = true, |
| 351 |
|
| 352 |
/* Vulkan 1.2 / VK_KHR_shader_subgroup_extended_types */ |
| 353 |
.shaderSubgroupExtendedTypes = true, |
| 354 |
|
| 355 |
/* Vulkan 1.1 / VK_KHR_robustness2 */ |
| 356 |
.robustBufferAccess2 = false, |
| 357 |
.robustImageAccess2 = false, |
| 358 |
.nullDescriptor = true, |
| 359 |
|
| 360 |
/* Vulkan 1.2 / VK_KHR_uniform_buffer_standard_layout */ |
| 361 |
.uniformBufferStandardLayout = true, |
| 362 |
|
| 363 |
/* VK_EXT_color_write_enable */ |
| 364 |
.colorWriteEnable = true, |
| 365 |
|
| 366 |
/* Vulkan 1.3 / VK_EXT_extended_dynamic_state */ |
| 367 |
.extendedDynamicState = true, |
| 368 |
|
| 369 |
/* Vulkan 1.3 / VK_EXT_extended_dynamic_state2 */ |
| 370 |
.extendedDynamicState2 = true, |
| 371 |
.extendedDynamicState2LogicOp = false, |
| 372 |
.extendedDynamicState2PatchControlPoints = false, |
| 373 |
|
| 374 |
/* VK_EXT_extended_dynamic_state3 */ |
| 375 |
.extendedDynamicState3TessellationDomainOrigin = false, |
| 376 |
.extendedDynamicState3DepthClampEnable = false, |
| 377 |
.extendedDynamicState3PolygonMode = false, |
| 378 |
.extendedDynamicState3RasterizationSamples = true, |
| 379 |
.extendedDynamicState3SampleMask = true, |
| 380 |
.extendedDynamicState3AlphaToCoverageEnable = true, |
| 381 |
.extendedDynamicState3AlphaToOneEnable = true, |
| 382 |
.extendedDynamicState3LogicOpEnable = false, |
| 383 |
.extendedDynamicState3ColorBlendEnable = false, |
| 384 |
.extendedDynamicState3ColorBlendEquation = false, |
| 385 |
.extendedDynamicState3ColorWriteMask = false, |
| 386 |
.extendedDynamicState3RasterizationStream = false, |
| 387 |
.extendedDynamicState3ConservativeRasterizationMode = false, |
| 388 |
.extendedDynamicState3ExtraPrimitiveOverestimationSize = false, |
| 389 |
.extendedDynamicState3DepthClipEnable = false, |
| 390 |
.extendedDynamicState3SampleLocationsEnable = false, |
| 391 |
.extendedDynamicState3ColorBlendAdvanced = false, |
| 392 |
.extendedDynamicState3ProvokingVertexMode = false, |
| 393 |
.extendedDynamicState3LineRasterizationMode = false, |
| 394 |
.extendedDynamicState3LineStippleEnable = false, |
| 395 |
.extendedDynamicState3DepthClipNegativeOneToOne = false, |
| 396 |
.extendedDynamicState3ViewportWScalingEnable = false, |
| 397 |
.extendedDynamicState3ViewportSwizzle = false, |
| 398 |
.extendedDynamicState3CoverageToColorEnable = false, |
| 399 |
.extendedDynamicState3CoverageToColorLocation = false, |
| 400 |
.extendedDynamicState3CoverageModulationMode = false, |
| 401 |
.extendedDynamicState3CoverageModulationTableEnable = false, |
| 402 |
.extendedDynamicState3CoverageModulationTable = false, |
| 403 |
.extendedDynamicState3CoverageReductionMode = false, |
| 404 |
.extendedDynamicState3RepresentativeFragmentTestEnable = false, |
| 405 |
.extendedDynamicState3ShadingRateImageEnable = false, |
| 406 |
|
| 407 |
/* Vulkan 1.2 / VK_EXT_host_query_reset */ |
| 408 |
.hostQueryReset = true, |
| 409 |
|
| 410 |
/* VK_EXT_image_2d_view_of_3d */ |
| 411 |
.image2DViewOf3D = true, |
| 412 |
.sampler2DViewOf3D = true, |
| 413 |
|
| 414 |
/* VK_EXT_map_memory_placed */ |
| 415 |
.memoryMapPlaced = true, |
| 416 |
.memoryMapRangePlaced = false, |
| 417 |
.memoryUnmapReserve = true, |
| 418 |
|
| 419 |
/* VK_EXT_non_seamless_cube_map */ |
| 420 |
.nonSeamlessCubeMap = true, |
| 421 |
|
| 422 |
/* Vulkan 1.3 / VK_EXT_private_data */ |
| 423 |
.privateData = true, |
| 424 |
|
| 425 |
/* VK_EXT_provoking_vertex */ |
| 426 |
.provokingVertexLast = true, |
| 427 |
.transformFeedbackPreservesProvokingVertex = false, |
| 428 |
|
| 429 |
/* Vulkan 1.2 / VK_EXT_scalar_block_layout */ |
| 430 |
.scalarBlockLayout = true, |
| 431 |
|
| 432 |
/* Vulkan 1.3 / VK_EXT_texel_buffer_alignment */ |
| 433 |
.texelBufferAlignment = true, |
| 434 |
|
| 435 |
/* Vulkan 1.2 / VK_KHR_buffer_device_address */ |
| 436 |
.bufferDeviceAddress = false, |
| 437 |
.bufferDeviceAddressCaptureReplay = false, |
| 438 |
.bufferDeviceAddressMultiDevice = false, |
| 439 |
|
| 440 |
/* VK_KHR_shader_expect_assume */ |
| 441 |
.shaderExpectAssume = false, |
| 442 |
|
| 443 |
/* VK_EXT_shader_demote_to_helper_invocation */ |
| 444 |
.shaderDemoteToHelperInvocation = true, |
| 445 |
|
| 446 |
/* VK_EXT_shader_replicated_composites */ |
| 447 |
.shaderReplicatedComposites = true, |
| 448 |
|
| 449 |
/* VK_KHR_shader_terminate_invocation */ |
| 450 |
.shaderTerminateInvocation = true, |
| 451 |
|
| 452 |
/* VK_KHR_present_id2 */ |
| 453 |
.presentId2 = PVR_USE_WSI_PLATFORM, |
| 454 |
|
| 455 |
/* VK_KHR_present_wait2 */ |
| 456 |
.presentWait2 = PVR_USE_WSI_PLATFORM, |
| 457 |
|
| 458 |
/* Vulkan 1.4 / VK_EXT_vertex_attribute_divisor / |
| 459 |
VK_KHR_vertex_attribute_divisor */ |
| 460 |
.vertexAttributeInstanceRateDivisor = true, |
| 461 |
.vertexAttributeInstanceRateZeroDivisor = true, |
| 462 |
|
| 463 |
/* Vulkan 1.3 / VK_KHR_zero_initialize_workgroup_memory */ |
| 464 |
.shaderZeroInitializeWorkgroupMemory = false, |
| 465 |
|
| 466 |
/* VK_EXT_border_color_swizzle */ |
| 467 |
.borderColorSwizzle = true, |
| 468 |
.borderColorSwizzleFromImage = true, |
| 469 |
|
| 470 |
/* VK_EXT_custom_border_color */ |
| 471 |
.customBorderColors = true, |
| 472 |
|
| 473 |
/* VK_EXT_depth_clip_enable */ |
| 474 |
.depthClipEnable = true, |
| 475 |
|
| 476 |
/* VK_KHR_line_rasterization */ |
| 477 |
.bresenhamLines = true, |
| 478 |
|
| 479 |
/* VK_EXT_zero_initialize_device_memory */ |
| 480 |
.zeroInitializeDeviceMemory = true, |
| 481 |
|
| 482 |
/* Vulkan 1.2 / VK_KHR_dynamic_rendering */ |
| 483 |
.dynamicRendering = true, |
| 484 |
|
| 485 |
/* VK_KHR_pipeline_executable_properties */ |
| 486 |
.pipelineExecutableInfo = true, |
| 487 |
}; |
| 488 |
} |
| 489 |
|
| 490 |
static uint32_t get_api_version(void) |
| 491 |
{ |
| 492 |
const uint32_t version_override = vk_get_version_override(); |
| 493 |
if (version_override) |
| 494 |
return version_override; |
| 495 |
|
| 496 |
return VK_MAKE_API_VERSION(0, 1, 2, VK_HEADER_VERSION); |
| 497 |
} |
| 498 |
|
| 499 |
static unsigned |
| 500 |
get_custom_border_color_samplers(const struct pvr_device_info *dev_info); |
| 501 |
|
| 502 |
static bool pvr_physical_device_get_properties( |
| 503 |
const struct pvr_physical_device *const pdevice, |
| 504 |
struct vk_properties *const properties) |
| 505 |
{ |
| 506 |
const struct pvr_device_info *const dev_info = &pdevice->dev_info; |
| 507 |
const struct pvr_device_runtime_info *dev_runtime_info = |
| 508 |
&pdevice->dev_runtime_info; |
| 509 |
|
| 510 |
/* Default value based on the minimum value found in all existing cores. */ |
| 511 |
const uint32_t max_multisample = |
| 512 |
PVR_GET_FEATURE_VALUE(dev_info, max_multisample, 4); |
| 513 |
|
| 514 |
UNUSED const uint32_t sub_pixel_precision = |
| 515 |
PVR_HAS_FEATURE(dev_info, simple_internal_parameter_format) ? 4U : 8U; |
| 516 |
|
| 517 |
UNUSED const uint32_t max_render_size = rogue_get_render_size_max(dev_info); |
| 518 |
|
| 519 |
UNUSED const uint32_t max_sample_bits = ((max_multisample << 1) - 1); |
| 520 |
|
| 521 |
UNUSED const uint32_t max_user_vertex_components = |
| 522 |
pvr_get_max_user_vertex_output_components(dev_info); |
| 523 |
|
| 524 |
const bool usc_alu_roundingmode_rne = |
| 525 |
PVR_HAS_FEATURE(dev_info, usc_alu_roundingmode_rne); |
| 526 |
|
| 527 |
/* The workgroup invocations are limited by the case where we have a compute |
| 528 |
* barrier - each slot has a fixed number of invocations, the whole workgroup |
| 529 |
* may need to span multiple slots. As each slot will WAIT at the barrier |
| 530 |
* until the last invocation completes, all have to be schedulable at the |
| 531 |
* same time. |
| 532 |
* |
| 533 |
* Typically all Rogue cores have 16 slots. Some of the smallest cores are |
| 534 |
* reduced to 14. |
| 535 |
* |
| 536 |
* The compute barrier slot exhaustion scenario can be tested with: |
| 537 |
* dEQP-VK.memory_model.message_passing*u32.coherent.fence_fence |
| 538 |
* .atomicwrite*guard*comp |
| 539 |
*/ |
| 540 |
|
| 541 |
/* Default value based on the minimum value found in all existing cores. */ |
| 542 |
const uint32_t usc_slots = PVR_GET_FEATURE_VALUE(dev_info, usc_slots, 14); |
| 543 |
|
| 544 |
/* Default value based on the minimum value found in all existing cores. */ |
| 545 |
const uint32_t max_instances_per_pds_task = |
| 546 |
PVR_GET_FEATURE_VALUE(dev_info, max_instances_per_pds_task, 32U); |
| 547 |
|
| 548 |
UNUSED const uint32_t max_compute_work_group_invocations = |
| 549 |
(usc_slots * max_instances_per_pds_task >= 512U) ? 512U : 384U; |
| 550 |
|
| 551 |
assert(pdevice->memory.memoryHeapCount == 1); |
| 552 |
const VkDeviceSize max_memory_alloc_size = |
| 553 |
pdevice->memory.memoryHeaps[0].size; |
| 554 |
|
| 555 |
const uint32_t line_sub_pixel_precision_bits = |
| 556 |
PVR_HAS_FEATURE(dev_info, simple_internal_parameter_format) ? 4U : 8U; |
| 557 |
|
| 558 |
*properties = (struct vk_properties){ |
| 559 |
/* Vulkan 1.0 */ |
| 560 |
.apiVersion = get_api_version(), |
| 561 |
.driverVersion = vk_get_driver_version(), |
| 562 |
.vendorID = VK_VENDOR_ID_IMAGINATION, |
| 563 |
.deviceID = dev_info->ident.device_id, |
| 564 |
.deviceType = VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU, |
| 565 |
/* deviceName and pipelineCacheUUID are filled below .*/ |
| 566 |
|
| 567 |
.maxImageDimension1D = 4096U, |
| 568 |
.maxImageDimension2D = 4096U, |
| 569 |
.maxImageDimension3D = 256U, |
| 570 |
.maxImageDimensionCube = 4096U, |
| 571 |
.maxImageArrayLayers = 256U, |
| 572 |
.maxTexelBufferElements = 64U * 1024U, |
| 573 |
.maxUniformBufferRange = 16U * 1024U, |
| 574 |
.maxStorageBufferRange = 128U * 1024U * 1024U, |
| 575 |
.maxPushConstantsSize = 128U, |
| 576 |
.maxMemoryAllocationCount = 4096U, |
| 577 |
.maxSamplerAllocationCount = 4000U, |
| 578 |
.bufferImageGranularity = 1U, |
| 579 |
.sparseAddressSpaceSize = 0U, /* Requires sparseBinding */ |
| 580 |
.maxBoundDescriptorSets = 4U, |
| 581 |
.maxPerStageDescriptorSamplers = 16, |
| 582 |
.maxPerStageDescriptorUniformBuffers = 12, |
| 583 |
.maxPerStageDescriptorStorageBuffers = 8, |
| 584 |
.maxPerStageDescriptorSampledImages = 16, |
| 585 |
.maxPerStageDescriptorStorageImages = 4, |
| 586 |
.maxPerStageDescriptorInputAttachments = 4, |
| 587 |
.maxPerStageResources = 48, |
| 588 |
.maxDescriptorSetSamplers = 3U * 16U, |
| 589 |
.maxDescriptorSetUniformBuffers = 3U * 12U, |
| 590 |
.maxDescriptorSetUniformBuffersDynamic = 8U, |
| 591 |
.maxDescriptorSetStorageBuffers = 3U * 4U, |
| 592 |
.maxDescriptorSetStorageBuffersDynamic = 4U, |
| 593 |
.maxDescriptorSetSampledImages = 3U * 16U, |
| 594 |
.maxDescriptorSetStorageImages = 3U * 4U, |
| 595 |
.maxDescriptorSetInputAttachments = 4U, |
| 596 |
|
| 597 |
/* Vertex Shader Limits */ |
| 598 |
.maxVertexInputAttributes = 16U, |
| 599 |
.maxVertexInputBindings = 16U, |
| 600 |
.maxVertexInputAttributeOffset = 2048U - 1U, |
| 601 |
.maxVertexInputBindingStride = 2048U, |
| 602 |
.maxVertexOutputComponents = 64U, |
| 603 |
|
| 604 |
/* Tessellation Limits */ |
| 605 |
/* Requires tessellationShader */ |
| 606 |
.maxTessellationGenerationLevel = 0U, |
| 607 |
.maxTessellationPatchSize = 0U, |
| 608 |
.maxTessellationControlPerVertexInputComponents = 0U, |
| 609 |
.maxTessellationControlPerVertexOutputComponents = 0U, |
| 610 |
.maxTessellationControlPerPatchOutputComponents = 0U, |
| 611 |
.maxTessellationControlTotalOutputComponents = 0U, |
| 612 |
.maxTessellationEvaluationInputComponents = 0U, |
| 613 |
.maxTessellationEvaluationOutputComponents = 0U, |
| 614 |
|
| 615 |
/* Geometry Shader Limits */ |
| 616 |
/* Requires geometryShader */ |
| 617 |
.maxGeometryShaderInvocations = 0U, |
| 618 |
.maxGeometryInputComponents = 0U, |
| 619 |
.maxGeometryOutputComponents = 0U, |
| 620 |
.maxGeometryOutputVertices = 0U, |
| 621 |
.maxGeometryTotalOutputComponents = 0U, |
| 622 |
|
| 623 |
/* Fragment Shader Limits */ |
| 624 |
.maxFragmentInputComponents = 64U, |
| 625 |
.maxFragmentOutputAttachments = 4U, |
| 626 |
.maxFragmentDualSrcAttachments = 0U, /* Requires dualSrcBlend */ |
| 627 |
.maxFragmentCombinedOutputResources = 4U, |
| 628 |
|
| 629 |
/* Compute Shader Limits */ |
| 630 |
.maxComputeSharedMemorySize = 16U * 1024U, |
| 631 |
.maxComputeWorkGroupCount = { |
| 632 |
[0] = (64U * 1024U) - 1, |
| 633 |
[1] = (64U * 1024U) - 1, |
| 634 |
[2] = (64U * 1024U) - 1, |
| 635 |
}, |
| 636 |
.maxComputeWorkGroupInvocations = 128U, |
| 637 |
.maxComputeWorkGroupSize = { |
| 638 |
[0] = 128U, |
| 639 |
[1] = 128U, |
| 640 |
[2] = 64U, |
| 641 |
}, |
| 642 |
|
| 643 |
/* Rasterization Limits */ |
| 644 |
.subPixelPrecisionBits = 4U, |
| 645 |
.subTexelPrecisionBits = 8U, |
| 646 |
.mipmapPrecisionBits = 8U, |
| 647 |
|
| 648 |
.maxDrawIndexedIndexValue = UINT32_MAX, |
| 649 |
.maxDrawIndirectCount = 2U * 1024U * 1024U * 1024U, |
| 650 |
.maxSamplerLodBias = 16.0f, |
| 651 |
.maxSamplerAnisotropy = 16.0f, /* Requires samplerAnisotropy */ |
| 652 |
.maxViewports = 1U, /* Requires multiViewport */ |
| 653 |
|
| 654 |
.maxViewportDimensions[0] = 4096U, |
| 655 |
.maxViewportDimensions[1] = 4096U, |
| 656 |
.viewportBoundsRange[0] = -8192.0f, |
| 657 |
.viewportBoundsRange[1] = 8191.0f, |
| 658 |
|
| 659 |
.viewportSubPixelBits = 0U, |
| 660 |
.minMemoryMapAlignment = pdevice->ws->page_size, |
| 661 |
.minTexelBufferOffsetAlignment = PVR_TEXEL_BUFFER_OFFSET_ALIGNMENT, |
| 662 |
.minUniformBufferOffsetAlignment = PVR_UNIFORM_BUFFER_OFFSET_ALIGNMENT, |
| 663 |
.minStorageBufferOffsetAlignment = PVR_STORAGE_BUFFER_OFFSET_ALIGNMENT, |
| 664 |
|
| 665 |
.minTexelOffset = -8, |
| 666 |
.maxTexelOffset = 7U, |
| 667 |
|
| 668 |
/* Requires shaderImageGatherExtended */ |
| 669 |
.minTexelGatherOffset = 0, |
| 670 |
.maxTexelGatherOffset = 0U, |
| 671 |
|
| 672 |
/* Requires sampleRateShading */ |
| 673 |
.minInterpolationOffset = -0.5f, |
| 674 |
.maxInterpolationOffset = 0.5f, |
| 675 |
.subPixelInterpolationOffsetBits = 4U, |
| 676 |
|
| 677 |
.maxFramebufferWidth = 4096U, |
| 678 |
.maxFramebufferHeight = 4096U, |
| 679 |
.maxFramebufferLayers = 256U, |
| 680 |
|
| 681 |
/* Note: update nir_shader_compiler_options.max_samples when changing this. */ |
| 682 |
.framebufferColorSampleCounts = VK_SAMPLE_COUNT_1_BIT | VK_SAMPLE_COUNT_4_BIT, |
| 683 |
.framebufferDepthSampleCounts = VK_SAMPLE_COUNT_1_BIT | VK_SAMPLE_COUNT_4_BIT, |
| 684 |
.framebufferStencilSampleCounts = VK_SAMPLE_COUNT_1_BIT | VK_SAMPLE_COUNT_4_BIT, |
| 685 |
.framebufferNoAttachmentsSampleCounts = VK_SAMPLE_COUNT_1_BIT | VK_SAMPLE_COUNT_4_BIT, |
| 686 |
.maxColorAttachments = 4U, |
| 687 |
.sampledImageColorSampleCounts = VK_SAMPLE_COUNT_1_BIT | VK_SAMPLE_COUNT_4_BIT, |
| 688 |
.sampledImageIntegerSampleCounts = VK_SAMPLE_COUNT_1_BIT | VK_SAMPLE_COUNT_4_BIT, |
| 689 |
.sampledImageDepthSampleCounts = VK_SAMPLE_COUNT_1_BIT | VK_SAMPLE_COUNT_4_BIT, |
| 690 |
.sampledImageStencilSampleCounts = VK_SAMPLE_COUNT_1_BIT | VK_SAMPLE_COUNT_4_BIT, |
| 691 |
.storageImageSampleCounts = VK_SAMPLE_COUNT_1_BIT, /* Requires shaderStorageImageMultisample */ |
| 692 |
.maxSampleMaskWords = 1U, |
| 693 |
.timestampComputeAndGraphics = false, |
| 694 |
.timestampPeriod = 0.0f, |
| 695 |
|
| 696 |
.maxClipDistances = PVR_MAX_USER_PLANES, |
| 697 |
.maxCullDistances = PVR_MAX_USER_PLANES, |
| 698 |
.maxCombinedClipAndCullDistances = PVR_MAX_USER_PLANES, |
| 699 |
|
| 700 |
.discreteQueuePriorities = 2U, |
| 701 |
|
| 702 |
.pointSizeRange[0] = PVR_POINT_SIZE_RANGE_MIN, |
| 703 |
.pointSizeRange[1] = PVR_POINT_SIZE_RANGE_MAX, |
| 704 |
.pointSizeGranularity = PVR_POINT_SIZE_GRANULARITY, |
| 705 |
|
| 706 |
.lineWidthRange[0] = PVR_LINE_WIDTH_MIN, |
| 707 |
.lineWidthRange[1] = PVR_LINE_WIDTH_MAX, |
| 708 |
.lineWidthGranularity = PVR_LINE_WIDTH_GRANULARITY, |
| 709 |
|
| 710 |
.strictLines = false, |
| 711 |
.standardSampleLocations = true, |
| 712 |
.optimalBufferCopyOffsetAlignment = PVR_STORAGE_BUFFER_OFFSET_ALIGNMENT, |
| 713 |
.optimalBufferCopyRowPitchAlignment = PVR_STORAGE_BUFFER_OFFSET_ALIGNMENT, |
| 714 |
.nonCoherentAtomSize = 1U, |
| 715 |
|
| 716 |
/* Vulkan 1.1 */ |
| 717 |
.subgroupSize = 1, |
| 718 |
.subgroupSupportedStages = VK_SHADER_STAGE_COMPUTE_BIT, |
| 719 |
.subgroupSupportedOperations = VK_SUBGROUP_FEATURE_BASIC_BIT, |
| 720 |
.subgroupQuadOperationsInAllStages = false, |
| 721 |
.protectedNoFault = false, |
| 722 |
|
| 723 |
/* Vulkan 1.2 */ |
| 724 |
.maxUpdateAfterBindDescriptorsInAllPools = 0, |
| 725 |
.shaderUniformBufferArrayNonUniformIndexingNative = false, |
| 726 |
.shaderSampledImageArrayNonUniformIndexingNative = false, |
| 727 |
.shaderStorageBufferArrayNonUniformIndexingNative = false, |
| 728 |
.shaderStorageImageArrayNonUniformIndexingNative = false, |
| 729 |
.shaderInputAttachmentArrayNonUniformIndexingNative = false, |
| 730 |
.robustBufferAccessUpdateAfterBind = false, |
| 731 |
.quadDivergentImplicitLod = false, |
| 732 |
.maxPerStageDescriptorUpdateAfterBindSamplers = 0, |
| 733 |
.maxPerStageDescriptorUpdateAfterBindUniformBuffers = 0, |
| 734 |
.maxPerStageDescriptorUpdateAfterBindStorageBuffers = 0, |
| 735 |
.maxPerStageDescriptorUpdateAfterBindSampledImages = 0, |
| 736 |
.maxPerStageDescriptorUpdateAfterBindStorageImages = 0, |
| 737 |
.maxPerStageDescriptorUpdateAfterBindInputAttachments = 0, |
| 738 |
.maxPerStageUpdateAfterBindResources = 0, |
| 739 |
.maxDescriptorSetUpdateAfterBindSamplers = 0, |
| 740 |
.maxDescriptorSetUpdateAfterBindUniformBuffers = 0, |
| 741 |
.maxDescriptorSetUpdateAfterBindUniformBuffersDynamic = 0, |
| 742 |
.maxDescriptorSetUpdateAfterBindStorageBuffers = 0, |
| 743 |
.maxDescriptorSetUpdateAfterBindStorageBuffersDynamic = 0, |
| 744 |
.maxDescriptorSetUpdateAfterBindSampledImages = 0, |
| 745 |
.maxDescriptorSetUpdateAfterBindStorageImages = 0, |
| 746 |
.maxDescriptorSetUpdateAfterBindInputAttachments = 0, |
| 747 |
.filterMinmaxSingleComponentFormats = false, |
| 748 |
.filterMinmaxImageComponentMapping = false, |
| 749 |
.framebufferIntegerColorSampleCounts = |
| 750 |
VK_SAMPLE_COUNT_1_BIT | VK_SAMPLE_COUNT_4_BIT, |
| 751 |
|
| 752 |
/* Vulkan 1.0 / VK_KHR_maintenance2 */ |
| 753 |
.pointClippingBehavior = |
| 754 |
VK_POINT_CLIPPING_BEHAVIOR_USER_CLIP_PLANES_ONLY, |
| 755 |
|
| 756 |
/* Vulkan 1.1 / VK_KHR_maintenance3 */ |
| 757 |
.maxPerSetDescriptors = PVR_MAX_DESCRIPTORS_PER_SET, |
| 758 |
.maxMemoryAllocationSize = max_memory_alloc_size, |
| 759 |
|
| 760 |
/* Vulkan 1.1 / VK_KHR_multiview */ |
| 761 |
.maxMultiviewViewCount = PVR_MAX_MULTIVIEW, |
| 762 |
.maxMultiviewInstanceIndex = (1 << 27) - 1, |
| 763 |
|
| 764 |
/* Vulkan 1.2 / VK_KHR_driver_properties */ |
| 765 |
.driverID = VK_DRIVER_ID_IMAGINATION_OPEN_SOURCE_MESA, |
| 766 |
.driverName = "Imagination open-source Mesa driver", |
| 767 |
.driverInfo = "Mesa " PACKAGE_VERSION MESA_GIT_SHA1, |
| 768 |
.conformanceVersion = { |
| 769 |
.major = 1, |
| 770 |
.minor = 3, |
| 771 |
.subminor = 8, |
| 772 |
.patch = 4, |
| 773 |
}, |
| 774 |
|
| 775 |
/* VK_EXT_extended_dynamic_state3 */ |
| 776 |
.dynamicPrimitiveTopologyUnrestricted = false, |
| 777 |
|
| 778 |
/* VK_EXT_map_memory_placed */ |
| 779 |
.minPlacedMemoryMapAlignment = pdevice->ws->page_size, |
| 780 |
|
| 781 |
/* VK_EXT_provoking_vertex */ |
| 782 |
.provokingVertexModePerPipeline = true, |
| 783 |
.transformFeedbackPreservesTriangleFanProvokingVertex = false, |
| 784 |
|
| 785 |
/* Vulkan 1.1 / VK_KHR_robustness2 */ |
| 786 |
.robustStorageBufferAccessSizeAlignment = PVR_STORAGE_BUFFER_OFFSET_ALIGNMENT, |
| 787 |
.robustUniformBufferAccessSizeAlignment = PVR_STORAGE_BUFFER_OFFSET_ALIGNMENT, |
| 788 |
|
| 789 |
/* Vulkan 1.2 / VK_KHR_shader_float_controls */ |
| 790 |
.denormBehaviorIndependence = |
| 791 |
VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_32_BIT_ONLY, |
| 792 |
.roundingModeIndependence = VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_NONE, |
| 793 |
.shaderSignedZeroInfNanPreserveFloat16 = true, |
| 794 |
.shaderSignedZeroInfNanPreserveFloat32 = true, |
| 795 |
.shaderSignedZeroInfNanPreserveFloat64 = true, |
| 796 |
.shaderDenormPreserveFloat16 = true, |
| 797 |
.shaderDenormPreserveFloat32 = false, |
| 798 |
.shaderDenormPreserveFloat64 = true, |
| 799 |
.shaderDenormFlushToZeroFloat16 = false, |
| 800 |
.shaderDenormFlushToZeroFloat32 = false, |
| 801 |
.shaderDenormFlushToZeroFloat64 = false, |
| 802 |
.shaderRoundingModeRTEFloat16 = usc_alu_roundingmode_rne, |
| 803 |
.shaderRoundingModeRTEFloat32 = usc_alu_roundingmode_rne, |
| 804 |
.shaderRoundingModeRTEFloat64 = usc_alu_roundingmode_rne, |
| 805 |
.shaderRoundingModeRTZFloat16 = !usc_alu_roundingmode_rne, |
| 806 |
.shaderRoundingModeRTZFloat32 = !usc_alu_roundingmode_rne, |
| 807 |
.shaderRoundingModeRTZFloat64 = !usc_alu_roundingmode_rne, |
| 808 |
|
| 809 |
/* Vulkan 1.3 / VK_KHR_shader_integer_dot_product */ |
| 810 |
.integerDotProduct8BitUnsignedAccelerated = false, |
| 811 |
.integerDotProduct8BitSignedAccelerated = false, |
| 812 |
.integerDotProduct8BitMixedSignednessAccelerated = false, |
| 813 |
.integerDotProduct4x8BitPackedUnsignedAccelerated = false, |
| 814 |
.integerDotProduct4x8BitPackedSignedAccelerated = false, |
| 815 |
.integerDotProduct4x8BitPackedMixedSignednessAccelerated = false, |
| 816 |
.integerDotProduct16BitUnsignedAccelerated = false, |
| 817 |
.integerDotProduct16BitSignedAccelerated = false, |
| 818 |
.integerDotProduct16BitMixedSignednessAccelerated = false, |
| 819 |
.integerDotProduct32BitUnsignedAccelerated = false, |
| 820 |
.integerDotProduct32BitSignedAccelerated = false, |
| 821 |
.integerDotProduct32BitMixedSignednessAccelerated = false, |
| 822 |
.integerDotProduct64BitUnsignedAccelerated = false, |
| 823 |
.integerDotProduct64BitSignedAccelerated = false, |
| 824 |
.integerDotProduct64BitMixedSignednessAccelerated = false, |
| 825 |
.integerDotProductAccumulatingSaturating8BitUnsignedAccelerated = false, |
| 826 |
.integerDotProductAccumulatingSaturating8BitSignedAccelerated = false, |
| 827 |
.integerDotProductAccumulatingSaturating8BitMixedSignednessAccelerated = false, |
| 828 |
.integerDotProductAccumulatingSaturating4x8BitPackedUnsignedAccelerated = false, |
| 829 |
.integerDotProductAccumulatingSaturating4x8BitPackedSignedAccelerated = false, |
| 830 |
.integerDotProductAccumulatingSaturating4x8BitPackedMixedSignednessAccelerated = false, |
| 831 |
.integerDotProductAccumulatingSaturating16BitUnsignedAccelerated = false, |
| 832 |
.integerDotProductAccumulatingSaturating16BitSignedAccelerated = false, |
| 833 |
.integerDotProductAccumulatingSaturating16BitMixedSignednessAccelerated = false, |
| 834 |
.integerDotProductAccumulatingSaturating32BitUnsignedAccelerated = false, |
| 835 |
.integerDotProductAccumulatingSaturating32BitSignedAccelerated = false, |
| 836 |
.integerDotProductAccumulatingSaturating32BitMixedSignednessAccelerated = false, |
| 837 |
.integerDotProductAccumulatingSaturating64BitUnsignedAccelerated = false, |
| 838 |
.integerDotProductAccumulatingSaturating64BitSignedAccelerated = false, |
| 839 |
.integerDotProductAccumulatingSaturating64BitMixedSignednessAccelerated = false, |
| 840 |
|
| 841 |
/* Vulkan 1.2 / VK_KHR_timeline_semaphore */ |
| 842 |
.maxTimelineSemaphoreValueDifference = UINT64_MAX, |
| 843 |
|
| 844 |
/* Vulkan 1.3 / VK_EXT_texel_buffer_alignment */ |
| 845 |
.storageTexelBufferOffsetAlignmentBytes = PVR_TEXEL_BUFFER_OFFSET_ALIGNMENT, |
| 846 |
.storageTexelBufferOffsetSingleTexelAlignment = true, |
| 847 |
.uniformTexelBufferOffsetAlignmentBytes = PVR_TEXEL_BUFFER_OFFSET_ALIGNMENT, |
| 848 |
.uniformTexelBufferOffsetSingleTexelAlignment = false, |
| 849 |
|
| 850 |
/* Vulkan 1.3 / VK_KHR_maintenance4 */ |
| 851 |
.maxBufferSize = max_memory_alloc_size, |
| 852 |
|
| 853 |
/* Vulkan 1.4 / VK_EXT_vertex_attribute_divisor / VK_KHR_vertex_attribute_divisor */ |
| 854 |
.maxVertexAttribDivisor = UINT32_MAX, |
| 855 |
.supportsNonZeroFirstInstance = true, |
| 856 |
|
| 857 |
/* VK_EXT_custom_border_color */ |
| 858 |
.maxCustomBorderColorSamplers = |
| 859 |
get_custom_border_color_samplers(&pdevice->dev_info), |
| 860 |
|
| 861 |
/* VK_EXT_physical_device_drm */ |
| 862 |
.drmHasPrimary = pdevice->has_primary, |
| 863 |
.drmPrimaryMajor = (int64_t) major(pdevice->primary_devid), |
| 864 |
.drmPrimaryMinor = (int64_t) minor(pdevice->primary_devid), |
| 865 |
.drmHasRender = true, |
| 866 |
.drmRenderMajor = (int64_t) major(pdevice->render_devid), |
| 867 |
.drmRenderMinor = (int64_t) minor(pdevice->render_devid), |
| 868 |
|
| 869 |
/* Vulkan 1.2 / VK_KHR_depth_stencil_resolve */ |
| 870 |
.supportedDepthResolveModes = |
| 871 |
VK_RESOLVE_MODE_SAMPLE_ZERO_BIT, |
| 872 |
.supportedStencilResolveModes = |
| 873 |
VK_RESOLVE_MODE_SAMPLE_ZERO_BIT, |
| 874 |
.independentResolveNone = true, |
| 875 |
.independentResolve = true, |
| 876 |
|
| 877 |
/* VK_KHR_line_rasterization */ |
| 878 |
.lineSubPixelPrecisionBits = line_sub_pixel_precision_bits, |
| 879 |
}; |
| 880 |
|
| 881 |
if (PVR_HAS_FEATURE(dev_info, gpu_multicore_support)) { |
| 882 |
snprintf(properties->deviceName, |
| 883 |
sizeof(properties->deviceName), |
| 884 |
"PowerVR %s %s MC%u", |
| 885 |
dev_info->ident.series_name, |
| 886 |
dev_info->ident.public_name, |
| 887 |
dev_runtime_info->core_count); |
| 888 |
} else { |
| 889 |
snprintf(properties->deviceName, |
| 890 |
sizeof(properties->deviceName), |
| 891 |
"PowerVR %s %s", |
| 892 |
dev_info->ident.series_name, |
| 893 |
dev_info->ident.public_name); |
| 894 |
} |
| 895 |
|
| 896 |
return true; |
| 897 |
} |
| 898 |
|
| 899 |
static bool pvr_physical_device_setup_pipeline_cache( |
| 900 |
struct pvr_physical_device *const pdevice) |
| 901 |
{ |
| 902 |
#ifdef ENABLE_SHADER_CACHE |
| 903 |
const struct pvr_instance *instance = pdevice->instance; |
| 904 |
char device_id[BLAKE3_KEY_LEN * 2 + 1]; |
| 905 |
char driver_id[BLAKE3_KEY_LEN * 2 + 1]; |
| 906 |
|
| 907 |
_mesa_blake3_format(device_id, pdevice->device_uuid); |
| 908 |
_mesa_blake3_format(driver_id, instance->driver_build_sha); |
| 909 |
|
| 910 |
pdevice->vk.disk_cache = disk_cache_create(device_id, driver_id, 0U); |
| 911 |
return !!pdevice->vk.disk_cache; |
| 912 |
#else |
| 913 |
return true; |
| 914 |
#endif /* ENABLE_SHADER_CACHE */ |
| 915 |
} |
| 916 |
|
| 917 |
static void |
| 918 |
pvr_get_device_uuid(const struct pvr_device_info *dev_info, |
| 919 |
uint8_t uuid_out[const static BLAKE3_KEY_LEN]) |
| 920 |
{ |
| 921 |
uint64_t bvnc = pvr_get_packed_bvnc(dev_info); |
| 922 |
static const char *device_str = "pvr"; |
| 923 |
blake3_hasher blake3_ctx; |
| 924 |
|
| 925 |
_mesa_blake3_init(&blake3_ctx); |
| 926 |
_mesa_blake3_update(&blake3_ctx, device_str, strlen(device_str)); |
| 927 |
_mesa_blake3_update(&blake3_ctx, &bvnc, sizeof(bvnc)); |
| 928 |
_mesa_blake3_final(&blake3_ctx, uuid_out); |
| 929 |
} |
| 930 |
|
| 931 |
static void |
| 932 |
pvr_get_cache_uuid(const struct pvr_physical_device *const pdevice, |
| 933 |
uint8_t uuid_out[const static BLAKE3_KEY_LEN]) |
| 934 |
{ |
| 935 |
const struct pvr_instance *instance = pdevice->instance; |
| 936 |
static const char *cache_str = "cache"; |
| 937 |
blake3_hasher blake3_ctx; |
| 938 |
|
| 939 |
_mesa_blake3_init(&blake3_ctx); |
| 940 |
_mesa_blake3_update(&blake3_ctx, cache_str, strlen(cache_str)); |
| 941 |
_mesa_blake3_update(&blake3_ctx, |
| 942 |
pdevice->device_uuid, |
| 943 |
sizeof(pdevice->device_uuid)); |
| 944 |
_mesa_blake3_update(&blake3_ctx, |
| 945 |
instance->driver_build_sha, |
| 946 |
sizeof(instance->driver_build_sha)); |
| 947 |
_mesa_blake3_final(&blake3_ctx, uuid_out); |
| 948 |
} |
| 949 |
|
| 950 |
static void |
| 951 |
pvr_physical_device_setup_uuids(struct pvr_physical_device *const pdevice) |
| 952 |
{ |
| 953 |
const struct pvr_instance *instance = pdevice->instance; |
| 954 |
|
| 955 |
pvr_get_device_uuid(&pdevice->dev_info, pdevice->device_uuid); |
| 956 |
pvr_get_cache_uuid(pdevice, pdevice->cache_uuid); |
| 957 |
|
| 958 |
memcpy(pdevice->vk.properties.driverUUID, |
| 959 |
instance->driver_build_sha, |
| 960 |
sizeof(pdevice->vk.properties.driverUUID)); |
| 961 |
|
| 962 |
memcpy(pdevice->vk.properties.deviceUUID, |
| 963 |
pdevice->device_uuid, |
| 964 |
sizeof(pdevice->vk.properties.deviceUUID)); |
| 965 |
|
| 966 |
memcpy(pdevice->vk.properties.pipelineCacheUUID, |
| 967 |
pdevice->cache_uuid, |
| 968 |
sizeof(pdevice->vk.properties.pipelineCacheUUID)); |
| 969 |
|
| 970 |
memcpy(pdevice->vk.properties.shaderBinaryUUID, |
| 971 |
pdevice->cache_uuid, |
| 972 |
sizeof(pdevice->vk.properties.shaderBinaryUUID)); |
| 973 |
} |
| 974 |
|
| 975 |
static bool pvr_device_is_conformant(const struct pvr_device_info *info) |
| 976 |
{ |
| 977 |
const uint64_t bvnc = pvr_get_packed_bvnc(info); |
| 978 |
switch (bvnc) { |
| 979 |
case PVR_BVNC_PACK(36, 53, 104, 796): |
| 980 |
return true; |
| 981 |
|
| 982 |
default: |
| 983 |
break; |
| 984 |
} |
| 985 |
|
| 986 |
return false; |
| 987 |
} |
| 988 |
|
| 989 |
/* Minimum required by the Vulkan 1.1 spec (see Table 32. Required Limits) */ |
| 990 |
#define PVR_MAX_MEMORY_ALLOCATION_SIZE (1ull << 30) |
| 991 |
|
| 992 |
static uint64_t pvr_compute_heap_size(void) |
| 993 |
{ |
| 994 |
/* Query the total ram from the system */ |
| 995 |
uint64_t total_ram; |
| 996 |
if (!os_get_total_physical_memory(&total_ram)) |
| 997 |
return 0; |
| 998 |
|
| 999 |
if (total_ram < PVR_MAX_MEMORY_ALLOCATION_SIZE) { |
| 1000 |
mesa_logw( |
| 1001 |
"Warning: The available RAM is below the minimum required by the Vulkan specification!"); |
| 1002 |
} |
| 1003 |
|
| 1004 |
/* We don't want to burn too much ram with the GPU. If the user has 4GiB |
| 1005 |
* or less, we use at most half. If they have more than 4GiB, we use 3/4. |
| 1006 |
*/ |
| 1007 |
uint64_t available_ram; |
| 1008 |
if (total_ram <= 4ULL * 1024ULL * 1024ULL * 1024ULL) |
| 1009 |
available_ram = total_ram / 2U; |
| 1010 |
else |
| 1011 |
available_ram = total_ram * 3U / 4U; |
| 1012 |
|
| 1013 |
return MAX2(available_ram, PVR_MAX_MEMORY_ALLOCATION_SIZE); |
| 1014 |
} |
| 1015 |
|
| 1016 |
static void |
| 1017 |
pvr_physical_device_setup_formats(struct pvr_physical_device *const pdevice); |
| 1018 |
|
| 1019 |
VkResult pvr_physical_device_init(struct pvr_physical_device *pdevice, |
| 1020 |
struct pvr_instance *instance, |
| 1021 |
drmDevicePtr drm_render_device, |
| 1022 |
drmDevicePtr drm_display_device) |
| 1023 |
{ |
| 1024 |
struct vk_physical_device_dispatch_table dispatch_table; |
| 1025 |
struct vk_device_extension_table supported_extensions; |
| 1026 |
struct vk_properties supported_properties; |
| 1027 |
struct vk_features supported_features; |
| 1028 |
struct pvr_winsys *ws; |
| 1029 |
struct stat primary_stat = { 0 }, render_stat = { 0 }; |
| 1030 |
char *primary_path; |
| 1031 |
char *display_path; |
| 1032 |
char *render_path; |
| 1033 |
VkResult result; |
| 1034 |
|
| 1035 |
render_path = vk_strdup(&instance->vk.alloc, |
| 1036 |
drm_render_device->nodes[DRM_NODE_RENDER], |
| 1037 |
VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); |
| 1038 |
if (!render_path) { |
| 1039 |
result = VK_ERROR_OUT_OF_HOST_MEMORY; |
| 1040 |
goto err_out; |
| 1041 |
} |
| 1042 |
|
| 1043 |
if (instance->vk.enabled_extensions.KHR_display && drm_display_device) { |
| 1044 |
display_path = vk_strdup(&instance->vk.alloc, |
| 1045 |
drm_display_device->nodes[DRM_NODE_PRIMARY], |
| 1046 |
VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); |
| 1047 |
if (!display_path) { |
| 1048 |
result = VK_ERROR_OUT_OF_HOST_MEMORY; |
| 1049 |
goto err_vk_free_render_path; |
| 1050 |
} |
| 1051 |
} else { |
| 1052 |
display_path = NULL; |
| 1053 |
} |
| 1054 |
|
| 1055 |
primary_path = drm_render_device->nodes[DRM_NODE_PRIMARY]; |
| 1056 |
pdevice->has_primary = false; |
| 1057 |
pdevice->primary_devid = 0; |
| 1058 |
if (!stat(primary_path, &primary_stat)) { |
| 1059 |
pdevice->has_primary = true; |
| 1060 |
pdevice->primary_devid = primary_stat.st_rdev; |
| 1061 |
} |
| 1062 |
|
| 1063 |
if (stat(render_path, &render_stat) != 0) { |
| 1064 |
result = vk_errorf(instance, |
| 1065 |
VK_ERROR_INITIALIZATION_FAILED, |
| 1066 |
"failed to stat DRM render node %s", |
| 1067 |
render_path); |
| 1068 |
goto err_vk_free_display_path; |
| 1069 |
} |
| 1070 |
pdevice->render_devid = render_stat.st_rdev; |
| 1071 |
|
| 1072 |
result = |
| 1073 |
pvr_winsys_create(render_path, display_path, true, |
| 1074 |
&instance->vk.alloc, &ws); |
| 1075 |
if (result != VK_SUCCESS) |
| 1076 |
goto err_vk_free_display_path; |
| 1077 |
|
| 1078 |
pdevice->instance = instance; |
| 1079 |
pdevice->render_path = render_path; |
| 1080 |
pdevice->display_path = display_path; |
| 1081 |
pdevice->ws = ws; |
| 1082 |
|
| 1083 |
result = ws->ops->device_info_init(ws, |
| 1084 |
&pdevice->dev_info, |
| 1085 |
&pdevice->dev_runtime_info); |
| 1086 |
if (result != VK_SUCCESS) |
| 1087 |
goto err_pvr_winsys_destroy; |
| 1088 |
|
| 1089 |
if (!pvr_device_is_conformant(&pdevice->dev_info)) { |
| 1090 |
if (!os_get_option("PVR_I_WANT_A_BROKEN_VULKAN_DRIVER")) { |
| 1091 |
result = vk_errorf(instance, |
| 1092 |
VK_ERROR_INCOMPATIBLE_DRIVER, |
| 1093 |
"WARNING: powervr is not a conformant Vulkan " |
| 1094 |
"implementation for %s. Pass " |
| 1095 |
"PVR_I_WANT_A_BROKEN_VULKAN_DRIVER=1 if you know " |
| 1096 |
"what you're doing.", |
| 1097 |
pdevice->dev_info.ident.public_name); |
| 1098 |
goto err_pvr_winsys_destroy; |
| 1099 |
} |
| 1100 |
|
| 1101 |
vk_warn_non_conformant_implementation("powervr"); |
| 1102 |
} |
| 1103 |
|
| 1104 |
/* Setup available memory heaps and types */ |
| 1105 |
pdevice->memory.memoryHeapCount = 1; |
| 1106 |
pdevice->memory.memoryHeaps[0].size = pvr_compute_heap_size(); |
| 1107 |
pdevice->memory.memoryHeaps[0].flags = VK_MEMORY_HEAP_DEVICE_LOCAL_BIT; |
| 1108 |
|
| 1109 |
pdevice->memory.memoryTypeCount = 1; |
| 1110 |
pdevice->memory.memoryTypes[0].propertyFlags = |
| 1111 |
VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT | |
| 1112 |
VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | |
| 1113 |
VK_MEMORY_PROPERTY_HOST_COHERENT_BIT; |
| 1114 |
pdevice->memory.memoryTypes[0].heapIndex = 0; |
| 1115 |
|
| 1116 |
pvr_physical_device_get_supported_extensions(&supported_extensions); |
| 1117 |
pvr_physical_device_get_supported_features(&pdevice->dev_info, |
| 1118 |
&supported_features); |
| 1119 |
if (!pvr_physical_device_get_properties(pdevice, &supported_properties)) { |
| 1120 |
result = vk_errorf(instance, |
| 1121 |
VK_ERROR_INITIALIZATION_FAILED, |
| 1122 |
"Failed to collect physical device properties"); |
| 1123 |
goto err_pvr_winsys_destroy; |
| 1124 |
} |
| 1125 |
|
| 1126 |
vk_physical_device_dispatch_table_from_entrypoints( |
| 1127 |
&dispatch_table, |
| 1128 |
&pvr_physical_device_entrypoints, |
| 1129 |
true); |
| 1130 |
|
| 1131 |
vk_physical_device_dispatch_table_from_entrypoints( |
| 1132 |
&dispatch_table, |
| 1133 |
&wsi_physical_device_entrypoints, |
| 1134 |
false); |
| 1135 |
|
| 1136 |
result = vk_physical_device_init(&pdevice->vk, |
| 1137 |
&instance->vk, |
| 1138 |
&supported_extensions, |
| 1139 |
&supported_features, |
| 1140 |
&supported_properties, |
| 1141 |
&dispatch_table); |
| 1142 |
if (result != VK_SUCCESS) |
| 1143 |
goto err_pvr_winsys_destroy; |
| 1144 |
|
| 1145 |
pvr_physical_device_setup_formats(pdevice); |
| 1146 |
|
| 1147 |
pvr_physical_device_setup_uuids(pdevice); |
| 1148 |
|
| 1149 |
if (!pvr_physical_device_setup_pipeline_cache(pdevice)) { |
| 1150 |
result = vk_errorf(NULL, |
| 1151 |
VK_ERROR_INITIALIZATION_FAILED, |
| 1152 |
"Failed to get driver build sha."); |
| 1153 |
goto err_vk_physical_device_finish; |
| 1154 |
} |
| 1155 |
|
| 1156 |
pdevice->vk.supported_sync_types = ws->sync_types; |
| 1157 |
|
| 1158 |
pdevice->pco_ctx = pco_ctx_create(&pdevice->dev_info, NULL); |
| 1159 |
if (!pdevice->pco_ctx) { |
| 1160 |
result = vk_errorf(instance, |
| 1161 |
VK_ERROR_INITIALIZATION_FAILED, |
| 1162 |
"Failed to initialize PCO compiler context"); |
| 1163 |
goto err_free_pipeline_cache; |
| 1164 |
} |
| 1165 |
pco_ctx_setup_usclib(pdevice->pco_ctx, |
| 1166 |
pco_usclib_0_nir, |
| 1167 |
sizeof(pco_usclib_0_nir)); |
| 1168 |
|
| 1169 |
result = pvr_wsi_init(pdevice); |
| 1170 |
if (result != VK_SUCCESS) { |
| 1171 |
vk_error(instance, result); |
| 1172 |
goto err_free_pco_ctx; |
| 1173 |
} |
| 1174 |
|
| 1175 |
return VK_SUCCESS; |
| 1176 |
|
| 1177 |
err_free_pco_ctx: |
| 1178 |
ralloc_free(pdevice->pco_ctx); |
| 1179 |
|
| 1180 |
err_free_pipeline_cache: |
| 1181 |
pvr_physical_device_free_pipeline_cache(pdevice); |
| 1182 |
|
| 1183 |
err_vk_physical_device_finish: |
| 1184 |
vk_physical_device_finish(&pdevice->vk); |
| 1185 |
|
| 1186 |
err_pvr_winsys_destroy: |
| 1187 |
pvr_winsys_destroy(ws); |
| 1188 |
|
| 1189 |
err_vk_free_display_path: |
| 1190 |
vk_free(&instance->vk.alloc, display_path); |
| 1191 |
|
| 1192 |
err_vk_free_render_path: |
| 1193 |
vk_free(&instance->vk.alloc, render_path); |
| 1194 |
|
| 1195 |
err_out: |
| 1196 |
return result; |
| 1197 |
} |
| 1198 |
|
| 1199 |
const static VkQueueFamilyProperties pvr_queue_family_properties = { |
| 1200 |
.queueFlags = VK_QUEUE_COMPUTE_BIT | VK_QUEUE_GRAPHICS_BIT | |
| 1201 |
VK_QUEUE_TRANSFER_BIT, |
| 1202 |
.queueCount = PVR_MAX_QUEUES, |
| 1203 |
.timestampValidBits = 0, |
| 1204 |
.minImageTransferGranularity = { 1, 1, 1 }, |
| 1205 |
}; |
| 1206 |
|
| 1207 |
void pvr_GetPhysicalDeviceQueueFamilyProperties2( |
| 1208 |
VkPhysicalDevice physicalDevice, |
| 1209 |
uint32_t *pQueueFamilyPropertyCount, |
| 1210 |
VkQueueFamilyProperties2 *pQueueFamilyProperties) |
| 1211 |
{ |
| 1212 |
VK_OUTARRAY_MAKE_TYPED(VkQueueFamilyProperties2, |
| 1213 |
out, |
| 1214 |
pQueueFamilyProperties, |
| 1215 |
pQueueFamilyPropertyCount); |
| 1216 |
|
| 1217 |
vk_outarray_append_typed (VkQueueFamilyProperties2, &out, p) { |
| 1218 |
p->queueFamilyProperties = pvr_queue_family_properties; |
| 1219 |
|
| 1220 |
vk_foreach_struct (ext, p->pNext) { |
| 1221 |
vk_debug_ignored_stype(ext->sType); |
| 1222 |
} |
| 1223 |
} |
| 1224 |
} |
| 1225 |
|
| 1226 |
void pvr_GetPhysicalDeviceMemoryProperties2( |
| 1227 |
VkPhysicalDevice physicalDevice, |
| 1228 |
VkPhysicalDeviceMemoryProperties2 *pMemoryProperties) |
| 1229 |
{ |
| 1230 |
VK_FROM_HANDLE(pvr_physical_device, pdevice, physicalDevice); |
| 1231 |
|
| 1232 |
pMemoryProperties->memoryProperties = pdevice->memory; |
| 1233 |
|
| 1234 |
vk_foreach_struct (ext, pMemoryProperties->pNext) { |
| 1235 |
vk_debug_ignored_stype(ext->sType); |
| 1236 |
} |
| 1237 |
} |
| 1238 |
|
| 1239 |
#define PER_ARCH_FUNCS(arch) \ |
| 1240 |
VkResult pvr_##arch##_create_device( \ |
| 1241 |
struct pvr_physical_device *physical_device, \ |
| 1242 |
const VkDeviceCreateInfo *pCreateInfo, \ |
| 1243 |
const VkAllocationCallbacks *pAllocator, \ |
| 1244 |
VkDevice *pDevice); \ |
| 1245 |
\ |
| 1246 |
void pvr_##arch##_destroy_device(struct pvr_device *device, \ |
| 1247 |
const VkAllocationCallbacks *pAllocator); \ |
| 1248 |
\ |
| 1249 |
struct pvr_format_table pvr_##arch##_get_format_table(void) |
| 1250 |
|
| 1251 |
PER_ARCH_FUNCS(rogue); |
| 1252 |
|
| 1253 |
VkResult pvr_CreateDevice(VkPhysicalDevice physicalDevice, |
| 1254 |
const VkDeviceCreateInfo *pCreateInfo, |
| 1255 |
const VkAllocationCallbacks *pAllocator, |
| 1256 |
VkDevice *pDevice) |
| 1257 |
{ |
| 1258 |
VK_FROM_HANDLE(pvr_physical_device, pdevice, physicalDevice); |
| 1259 |
|
| 1260 |
enum pvr_device_arch arch = pdevice->dev_info.ident.arch; |
| 1261 |
VkResult result = VK_ERROR_INITIALIZATION_FAILED; |
| 1262 |
PVR_ARCH_DISPATCH_RET(create_device, |
| 1263 |
arch, |
| 1264 |
result, |
| 1265 |
pdevice, |
| 1266 |
pCreateInfo, |
| 1267 |
pAllocator, |
| 1268 |
pDevice); |
| 1269 |
|
| 1270 |
return result; |
| 1271 |
} |
| 1272 |
|
| 1273 |
void pvr_DestroyDevice(VkDevice _device, |
| 1274 |
const VkAllocationCallbacks *pAllocator) |
| 1275 |
{ |
| 1276 |
VK_FROM_HANDLE(pvr_device, device, _device); |
| 1277 |
|
| 1278 |
enum pvr_device_arch arch = device->pdevice->dev_info.ident.arch; |
| 1279 |
PVR_ARCH_DISPATCH(destroy_device, arch, device, pAllocator); |
| 1280 |
} |
| 1281 |
|
| 1282 |
static void |
| 1283 |
pvr_physical_device_setup_formats(struct pvr_physical_device *const pdevice) |
| 1284 |
{ |
| 1285 |
enum pvr_device_arch arch = pdevice->dev_info.ident.arch; |
| 1286 |
PVR_ARCH_DISPATCH_RET(get_format_table, arch, pdevice->formats); |
| 1287 |
} |
| 1288 |
|
| 1289 |
/* Leave this at the very end, to avoid leakage of HW-defs here */ |
| 1290 |
#define PVR_BUILD_ARCH_ROGUE |
| 1291 |
#include "pvr_border.h" |
| 1292 |
|
| 1293 |
static unsigned |
| 1294 |
get_custom_border_color_samplers(const struct pvr_device_info *dev_info) |
| 1295 |
{ |
| 1296 |
assert(dev_info->ident.arch == PVR_DEVICE_ARCH_ROGUE); |
| 1297 |
return PVR_BORDER_COLOR_TABLE_NR_CUSTOM_ENTRIES; |
| 1298 |
} |