From 7e3aa7e627e211d980b6d57fcd47832bb934b758 Mon Sep 17 00:00:00 2001 From: Leon Perianu Date: Tue, 27 Jan 2026 14:30:35 +0200 Subject: [PATCH] pvr: enable VK_KHR_maintenance4 This commit adds support for VK_KHR_maintenance4 extension by implementing the required function. Makes the following tests to pass/be supported: dEQP-VK.api.info.get_physical_device_properties2.features.maintenance4_features dEQP-VK.api.info.vulkan1p3_limits_validation.khr_maintenance4 dEQP-VK.api.device_init.create_device_unsupported_features.maintenance4_features dEQP-VK.memory.requirements.create_info.buffer.regular dEQP-VK.memory.requirements.create_info.image.regular_tiling_linear dEQP-VK.memory.requirements.create_info.image.regular_tiling_optimal dEQP-VK.memory.requirements.create_info.image.transient_tiling_linear dEQP-VK.memory.requirements.create_info.image.transient_tiling_optimal Signed-off-by: Leon Perianu Reviewed-by: Frank Binns Part-of: --- docs/features.txt | 2 +- docs/relnotes/new_features.txt | 1 + src/imagination/vulkan/pvr_device.c | 55 ++++++++++++++++++++ src/imagination/vulkan/pvr_physical_device.c | 7 +++ 4 files changed, 64 insertions(+), 1 deletion(-) diff --git a/docs/features.txt b/docs/features.txt index 75469ac8ef4..e9977e54439 100644 --- a/docs/features.txt +++ b/docs/features.txt @@ -494,7 +494,7 @@ Vulkan 1.3 -- all DONE: anv, hk, kk, lvp, nvk, panvk/v10+, radv, tu, vn, v3dv VK_KHR_copy_commands2 DONE (anv, hasvk, lvp, nvk, panvk, pvr, radv, tu, v3dv, vn) VK_KHR_dynamic_rendering DONE (anv, dzn, hasvk, lvp, nvk, panvk, pvr, radv, tu, v3dv, vn) VK_KHR_format_feature_flags2 DONE (anv, hasvk, lvp, nvk, panvk, pvr, radv, tu, v3dv, vn) - VK_KHR_maintenance4 DONE (anv, hasvk, lvp, nvk, panvk/v10+, radv, tu, v3dv, vn) + VK_KHR_maintenance4 DONE (anv, hasvk, lvp, nvk, panvk/v10+, pvr, radv, tu, v3dv, vn) VK_KHR_shader_integer_dot_product DONE (anv, dzn, hasvk, lvp, nvk, panvk, radv, tu, v3dv, vn) VK_KHR_shader_non_semantic_info DONE (anv, hasvk, nvk, panvk, pvr, radv, tu, v3dv, vn) VK_KHR_shader_terminate_invocation DONE (anv, hasvk, lvp, nvk, panvk, radv, tu, v3dv, vn) diff --git a/docs/relnotes/new_features.txt b/docs/relnotes/new_features.txt index 88cc4343488..7cc0673db40 100644 --- a/docs/relnotes/new_features.txt +++ b/docs/relnotes/new_features.txt @@ -21,3 +21,4 @@ VK_EXT_depth_clamp_control on panvk VK_VALVE_shader_mixed_float_dot_product on RADV (Vega20, Navi14, RDNA2+) VK_EXT_legacy_dithering on panvk GL_ARB_sample_shading on v3d +VK_KHR_maintenance4 on pvr diff --git a/src/imagination/vulkan/pvr_device.c b/src/imagination/vulkan/pvr_device.c index 9a9b0127cb8..917325724cf 100644 --- a/src/imagination/vulkan/pvr_device.c +++ b/src/imagination/vulkan/pvr_device.c @@ -1007,6 +1007,61 @@ void pvr_GetBufferMemoryRequirements2( } } +void pvr_GetDeviceBufferMemoryRequirements( + VkDevice _device, + const VkDeviceBufferMemoryRequirements *pInfo, + VkMemoryRequirements2 *pMemoryRequirements) +{ + VK_FROM_HANDLE(pvr_device, device, _device); + struct pvr_buffer buffer = { 0 }; + + /* Initialize a minimal buffer structure */ + vk_buffer_init(&device->vk, &buffer.vk, pInfo->pCreateInfo); + buffer.alignment = device->pdevice->ws->page_size; + + VkBufferMemoryRequirementsInfo2 buffer_info = { + .sType = VK_STRUCTURE_TYPE_BUFFER_MEMORY_REQUIREMENTS_INFO_2, + .buffer = pvr_buffer_to_handle(&buffer), + }; + + pvr_GetBufferMemoryRequirements2(_device, &buffer_info, pMemoryRequirements); + + /* Clean up the temporary buffer */ + vk_buffer_finish(&buffer.vk); +} + +void pvr_GetDeviceImageMemoryRequirements( + VkDevice _device, + const VkDeviceImageMemoryRequirements *pInfo, + VkMemoryRequirements2 *pMemoryRequirements) +{ + VK_FROM_HANDLE(pvr_device, device, _device); + struct pvr_image image = { 0 }; + + vk_image_init(&device->vk, &image.vk, pInfo->pCreateInfo); + pvr_image_init(device, pInfo->pCreateInfo, &image); + + VkImageMemoryRequirementsInfo2 image_info = { + .sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_REQUIREMENTS_INFO_2, + .image = pvr_image_to_handle(&image), + }; + + pvr_GetImageMemoryRequirements2(_device, &image_info, pMemoryRequirements); + + pvr_image_fini(device, &image); + vk_image_finish(&image.vk); +} + +void pvr_GetDeviceImageSparseMemoryRequirements( + VkDevice device, + const VkDeviceImageMemoryRequirements *pInfo, + uint32_t *pSparseMemoryRequirementCount, + VkSparseImageMemoryRequirements2 *pSparseMemoryRequirements) +{ + /* Sparse images are not yet supported */ + *pSparseMemoryRequirementCount = 0; +} + void pvr_GetImageMemoryRequirements2(VkDevice _device, const VkImageMemoryRequirementsInfo2 *pInfo, VkMemoryRequirements2 *pMemoryRequirements) diff --git a/src/imagination/vulkan/pvr_physical_device.c b/src/imagination/vulkan/pvr_physical_device.c index a2007823c82..dc83506ba4c 100644 --- a/src/imagination/vulkan/pvr_physical_device.c +++ b/src/imagination/vulkan/pvr_physical_device.c @@ -148,6 +148,7 @@ static void pvr_physical_device_get_supported_extensions( .KHR_maintenance1 = true, .KHR_maintenance2 = true, .KHR_maintenance3 = true, + .KHR_maintenance4 = true, .KHR_map_memory2 = true, .KHR_multiview = true, .KHR_pipeline_executable_properties = true, @@ -328,6 +329,9 @@ static void pvr_physical_device_get_supported_features( .multiviewGeometryShader = false, .multiviewTessellationShader = false, + /* Vulkan 1.3 / VK_KHR_maintenance4 */ + .maintenance4 = true, + /* Vulkan 1.1 / VK_KHR_shader_draw_parameters */ .shaderDrawParameters = true, @@ -804,6 +808,9 @@ static bool pvr_physical_device_get_properties( .uniformTexelBufferOffsetAlignmentBytes = PVR_TEXEL_BUFFER_OFFSET_ALIGNMENT, .uniformTexelBufferOffsetSingleTexelAlignment = false, + /* Vulkan 1.3 / VK_KHR_maintenance4 */ + .maxBufferSize = max_memory_alloc_size, + /* Vulkan 1.4 / VK_EXT_vertex_attribute_divisor / VK_KHR_vertex_attribute_divisor */ .maxVertexAttribDivisor = UINT32_MAX, .supportsNonZeroFirstInstance = true,