From 675c1885b6fbc5fd7273609275d93cd3e2164b14 Mon Sep 17 00:00:00 2001 From: "Eric R. Smith" Date: Mon, 16 Mar 2026 18:45:42 -0300 Subject: [PATCH] panfrost: fix texel buffer calculations We were computing some positions using `void*` rather than pointers to the appropriate structures. This caused bad pointers, the effect of which depended on the current memory environment -- tests related to texel buffers could pass or not depending on what other tests had run previously. Fixes: a21ee564e20 ("pan/bi: Make texel buffers use Attribute Buffers") Signed-off-by: Eric R. Smith Reviewed-by: Lars-Ivar Hesselberg Simonsen Reviewed-by: Erik Faye-Lund Reviewed-by: Lorenzo Rossi (cherry picked from commit 0142e2e5e390e52311b65c3c3f0266cc816f8711) Part-of: --- .pick_status.json | 2 +- src/gallium/drivers/panfrost/pan_cmdstream.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index fb816c88a41..46dbc75e35b 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -6204,7 +6204,7 @@ "description": "panfrost: fix texel buffer calculations", "nominated": true, "nomination_type": 2, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "a21ee564e2051e5e6827ce333da1f85b8b828e1d", "notes": null diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.c b/src/gallium/drivers/panfrost/pan_cmdstream.c index b6b7ad770f3..1659fcbb12a 100644 --- a/src/gallium/drivers/panfrost/pan_cmdstream.c +++ b/src/gallium/drivers/panfrost/pan_cmdstream.c @@ -2223,18 +2223,18 @@ panfrost_emit_image_texbuf_attribs(struct panfrost_batch *batch, emit_image_bufs(batch, type, bufs.cpu, image_mask); #if PAN_ARCH >= 6 + struct mali_attribute_packed *attr_array = attribs.cpu; + struct mali_attribute_buffer_packed *attrib_bufs = bufs.cpu; /* Texel buffers come after the images, which require two buffers per image. */ unsigned image_buf_offset = image_count * 2; - emit_texbuf_attribs(ctx, type, attribs.cpu + image_count, image_buf_offset); - emit_texbuf_bufs(ctx, type, bufs.cpu + image_buf_offset); + emit_texbuf_attribs(ctx, type, attr_array + image_count, image_buf_offset); + emit_texbuf_bufs(ctx, type, attrib_bufs + image_buf_offset); /* We need an empty attrib buf to stop the prefetching on Bifrost */ - struct mali_attribute_buffer_packed *attrib_bufs = bufs.cpu; pan_pack(&attrib_bufs[buf_count - 1], ATTRIBUTE_BUFFER, cfg) ; /* Ensure any shader read attributes that are not bound behave properly */ - struct mali_attribute_packed *attr_array = attribs.cpu; for (unsigned i = bound_attrib_count; i < attrib_array_size; ++i) { pan_pack(&attr_array[i], ATTRIBUTE, cfg) cfg.format = MALI_PACK_FMT(CONSTANT, 0000, L);