From aa8dad141c3f6d7758e4b917b03c10d2dc6efdcf 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 Part-of: --- 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 +-- 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/imagination/vulkan/pds/pvr_pds.h b/src/imagination/vulkan/pds/pvr_pds.h index 51c90ec274d..4a979167439 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 53db316c48c..febe0aa001c 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 2a1cfefd9a1..e1de7ba6ecb 100644 --- a/src/imagination/vulkan/pvr_arch_cmd_buffer.c +++ b/src/imagination/vulkan/pvr_arch_cmd_buffer.c @@ -5319,7 +5319,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 */ @@ -5390,7 +5390,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 f8b451221d1..06b16a16369 100644 --- a/src/imagination/vulkan/pvr_arch_pipeline.c +++ b/src/imagination/vulkan/pvr_arch_pipeline.c @@ -1466,8 +1466,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; }