pan/buffer: Drop pan_buffer_view::offset

We can handle that inside pan_buffer.c and make the interface simpler.

Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Christoph Pillmayer <christoph.pillmayer@arm.com>
Reviewed-by: Lorenzo Rossi <lorenzo.rossi@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40576>
This commit is contained in:
Faith Ekstrand 2026-03-24 14:31:53 -04:00 committed by Marge Bot
parent ce56f49561
commit 8471a90eb4
3 changed files with 16 additions and 18 deletions

View file

@ -49,17 +49,28 @@ GENX(pan_buffer_texture_emit)(const struct pan_buffer_view *bview,
unsigned stride = util_format_get_blocksize(bview->format);
uint32_t hw_fmt = GENX(pan_format_from_pipe_format)(bview->format)->hw;
/* The base address has shr(6) applied so we need to use the offset of the
* attribute to get the last 6 bits.
*/
uint64_t base = bview->base & ~0x3f;
uint32_t offset = bview->base & 0x3f;
pan_pack(out_buf, ATTRIBUTE_BUFFER, cfg) {
cfg.type = MALI_ATTRIBUTE_TYPE_1D;
cfg.pointer = bview->base;
cfg.pointer = base;
cfg.stride = stride;
cfg.size = bview->width_el * stride + bview->offset;
/* The ATTRIBUTE_BUFFER.size specifies the size of the buffer starting
* at ATTRIBUTE_BUFFER.pointer and and ATTRIBUTE.offset specifies an
* offset into that window. If we're going to use it to offset the base
* of the buffer, we need to increase the size as well.
*/
cfg.size = bview->width_el * stride + offset;
}
pan_pack(out_attrib, ATTRIBUTE, cfg) {
cfg.format = hw_fmt;
cfg.offset = bview->offset;
cfg.offset_enable = bview->offset != 0;
cfg.offset = offset;
cfg.offset_enable = offset != 0;
}
}

View file

@ -20,7 +20,6 @@ struct pan_buffer_view {
} astc;
unsigned width_el;
uint64_t base;
uint32_t offset;
};
struct pan_compute_dim {

View file

@ -49,26 +49,14 @@ panvk_per_arch(CreateBufferView)(VkDevice _device,
VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT;
if (buffer->vk.usage & tex_usage_mask) {
#if PAN_ARCH >= 9
struct pan_buffer_view bview = {
.format = pfmt,
.width_el = view->vk.elements,
.base = panvk_buffer_gpu_ptr(buffer, pCreateInfo->offset),
};
#if PAN_ARCH >= 9
GENX(pan_buffer_texture_emit)(&bview, &view->descs.buf);
#else
/* Bifrost requires the base address to be 64 byte aligned and passes the
* remaing offset through the Attribute Descriptor. */
uint64_t aligned_offset = pCreateInfo->offset & ~0x3f;
uint32_t remainder_offset = pCreateInfo->offset & 0x3f;
struct pan_buffer_view bview = {
.format = pfmt,
.width_el = view->vk.elements,
.base = panvk_buffer_gpu_ptr(buffer, aligned_offset),
.offset = remainder_offset,
};
GENX(pan_buffer_texture_emit)(&bview, &view->descs.attrib_buf,
&view->descs.attrib);
#endif