From 778c3580e705d3961f9434eb0f30818ffc099b29 Mon Sep 17 00:00:00 2001 From: Icenowy Zheng Date: Fri, 20 Mar 2026 22:13:00 +0800 Subject: [PATCH] pvr: save vertex attribute size for DMA checking Currently the size of single components inside one attribute is saved and checked against when checking DMA capability. However, the vertex attribute DMA happens for a whole attribute instead of individually for its components, so checking against the component size is useless -- the size of the whole attribute is what needs to be saved and checked. Rename all component_size_in_bytes fields to attrib_size_in_bytes, and save the size of the whole attribute inside them. Fixes: 8991e646411b ("pvr: Add a Vulkan driver for Imagination Technologies PowerVR Rogue GPUs") Signed-off-by: Icenowy Zheng Reviewed-by: Ella Stanforth (cherry picked from commit aa8dad141c3f6d7758e4b917b03c10d2dc6efdcf) Part-of: --- .pick_status.json | 2 +- src/imagination/vulkan/pds/pvr_pds.h | 6 +++--- src/imagination/vulkan/pds/pvr_pipeline_pds.c | 7 +++---- src/imagination/vulkan/pvr_arch_cmd_buffer.c | 4 ++-- src/imagination/vulkan/pvr_arch_pipeline.c | 3 +-- 5 files changed, 10 insertions(+), 12 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index f3c85943137..94fea2e3cc5 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -1864,7 +1864,7 @@ "description": "pvr: save vertex attribute size for DMA checking", "nominated": true, "nomination_type": 2, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "8991e646411b73c1e03278267c80758e921f2352", "notes": null diff --git a/src/imagination/vulkan/pds/pvr_pds.h b/src/imagination/vulkan/pds/pvr_pds.h index 2b76ca378e6..8db3a1a858c 100644 --- a/src/imagination/vulkan/pds/pvr_pds.h +++ b/src/imagination/vulkan/pds/pvr_pds.h @@ -1017,7 +1017,7 @@ struct pvr_pds_vertex_dma { uint8_t flags; uint8_t size_in_dwords; - uint8_t component_size_in_bytes; + uint8_t attrib_size_in_bytes; uint8_t destination; uint8_t binding_index; uint32_t divisor; @@ -1169,7 +1169,7 @@ struct pvr_const_map_entry_robust_vertex_attribute_address { uint8_t binding_index; uint8_t size_in_dwords; uint16_t robustness_buffer_offset; - uint8_t component_size_in_bytes; + uint8_t attrib_size_in_bytes; } PVR_PACKED; struct pvr_const_map_entry_vertex_attribute_max_index { @@ -1180,7 +1180,7 @@ struct pvr_const_map_entry_vertex_attribute_max_index { uint8_t size_in_dwords; uint16_t offset; uint16_t stride; - uint8_t component_size_in_bytes; + uint8_t attrib_size_in_bytes; } PVR_PACKED; struct pvr_const_map_entry_base_instance { diff --git a/src/imagination/vulkan/pds/pvr_pipeline_pds.c b/src/imagination/vulkan/pds/pvr_pipeline_pds.c index dab6c2925a5..d33d20225f3 100644 --- a/src/imagination/vulkan/pds/pvr_pipeline_pds.c +++ b/src/imagination/vulkan/pds/pvr_pipeline_pds.c @@ -142,8 +142,7 @@ static void pvr_write_pds_const_map_entry_vertex_attribute_address( PVR_PDS_CONST_MAP_ENTRY_TYPE_ROBUST_VERTEX_ATTRIBUTE_ADDRESS; robust_attribute_entry->const_offset = const_val; robust_attribute_entry->binding_index = DMA->binding_index; - robust_attribute_entry->component_size_in_bytes = - DMA->component_size_in_bytes; + robust_attribute_entry->attrib_size_in_bytes = DMA->attrib_size_in_bytes; robust_attribute_entry->offset = DMA->offset; robust_attribute_entry->stride = DMA->stride; robust_attribute_entry->size_in_dwords = DMA->size_in_dwords; @@ -1226,8 +1225,8 @@ void pvr_pds_generate_vertex_primary_program( max_index_entry->offset = vertex_dma->offset; max_index_entry->stride = vertex_dma->stride; max_index_entry->size_in_dwords = vertex_dma->size_in_dwords; - max_index_entry->component_size_in_bytes = - vertex_dma->component_size_in_bytes; + max_index_entry->attrib_size_in_bytes = + vertex_dma->attrib_size_in_bytes; PVR_PDS_MODE_TOGGLE( code, diff --git a/src/imagination/vulkan/pvr_arch_cmd_buffer.c b/src/imagination/vulkan/pvr_arch_cmd_buffer.c index 5c1f8a02d43..aef0ac3076a 100644 --- a/src/imagination/vulkan/pvr_arch_cmd_buffer.c +++ b/src/imagination/vulkan/pvr_arch_cmd_buffer.c @@ -5312,7 +5312,7 @@ pvr_setup_vertex_buffers(struct pvr_cmd_buffer *cmd_buffer, pvr_dev_addr_t addr; if (binding->size < - (attribute->offset + attribute->component_size_in_bytes)) { + (attribute->offset + attribute->attrib_size_in_bytes)) { /* Replace with load from robustness buffer when no attribute is in * range */ @@ -5383,7 +5383,7 @@ pvr_setup_vertex_buffers(struct pvr_cmd_buffer *cmd_buffer, &state->vertex_bindings[attribute->binding_index]; const uint64_t bound_size = binding->buffer->vk.size - binding->offset; const uint32_t attribute_end = - attribute->offset + attribute->component_size_in_bytes; + attribute->offset + attribute->attrib_size_in_bytes; const struct vk_dynamic_graphics_state *dynamic_state = &cmd_buffer->vk.dynamic_graphics_state; const uint32_t stride = diff --git a/src/imagination/vulkan/pvr_arch_pipeline.c b/src/imagination/vulkan/pvr_arch_pipeline.c index a0ed72438f2..52362de105e 100644 --- a/src/imagination/vulkan/pvr_arch_pipeline.c +++ b/src/imagination/vulkan/pvr_arch_pipeline.c @@ -1390,8 +1390,7 @@ static void pvr_graphics_pipeline_setup_vertex_dma( /* Used by later on by the driver to figure out if the buffer is being * accessed out of bounds, for robust buffer access. */ - dma_desc->component_size_in_bytes = - fmt_description->block.bits / fmt_description->nr_channels / 8; + dma_desc->attrib_size_in_bytes = fmt_description->block.bits / 8; ++*dma_count; }