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: 8991e64641 ("pvr: Add a Vulkan driver for Imagination Technologies PowerVR Rogue GPUs")
Signed-off-by: Icenowy Zheng <zhengxingda@iscas.ac.cn>
Reviewed-by: Ella Stanforth <ella@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40528>
This commit is contained in:
Icenowy Zheng 2026-03-20 22:13:00 +08:00 committed by Marge Bot
parent caea72cffc
commit aa8dad141c
4 changed files with 9 additions and 11 deletions

View file

@ -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 {

View file

@ -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,

View file

@ -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 =

View file

@ -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;
}