pan/v9+: Change texel buffer limits

Increase texel buffer size limit and lower uniform texel buffer
alignment limit.

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37007>
This commit is contained in:
Ludvig Lindau
2025-08-26 12:17:54 +00:00
committed by Marge Bot
parent 4573110e4e
commit 290c830416
5 changed files with 29 additions and 14 deletions
+3 -2
View File
@@ -1091,7 +1091,8 @@ panfrost_upload_txs_sysval(struct panfrost_batch *batch,
if (tex->target == PIPE_BUFFER) {
assert(dim == 1);
unsigned buf_size = tex->u.buf.size / util_format_get_blocksize(tex->format);
uniform->i[0] = MIN2(buf_size, PAN_MAX_TEXEL_BUFFER_ELEMENTS);
uniform->i[0] =
MIN2(buf_size, pan_get_max_texel_buffer_elements(PAN_ARCH));
return;
}
@@ -1725,7 +1726,7 @@ panfrost_create_sampler_view_bo(struct panfrost_sampler_view *so,
.format = format,
.width_el =
MIN2(so->base.u.buf.size / util_format_get_blocksize(format),
PAN_MAX_TEXEL_BUFFER_ELEMENTS),
pan_get_max_texel_buffer_elements(PAN_ARCH)),
.base = prsrc->plane.base + so->base.u.buf.offset,
};
+13 -2
View File
@@ -66,8 +66,6 @@ extern "C" {
* Gallium interface limits us to 32k at the moment */
#define PAN_MAX_MIP_LEVELS 16
#define PAN_MAX_TEXEL_BUFFER_ELEMENTS 65536
/* How many power-of-two levels in the BO cache do we want? 2^12
* minimum chosen as it is the page size that all allocations are
* rounded to */
@@ -246,6 +244,19 @@ pan_gpu_time_to_ns(struct panfrost_device *dev, uint64_t gpu_time)
return (gpu_time * NSEC_PER_SEC) / dev->kmod.props.timestamp_frequency;
}
static inline uint32_t
pan_get_max_texel_buffer_elements(unsigned arch)
{
if (arch >= 11)
/* TODO 1<<27 can be made larger for v11+ with a refactor of the buffer
* path away from using image logic. */
return 1 << 27;
else if (arch >= 9)
return 1 << 27;
else
return 65536;
}
#if defined(__cplusplus)
} // extern "C"
#endif
+2 -1
View File
@@ -782,7 +782,8 @@ panfrost_init_screen_caps(struct panfrost_screen *screen)
caps->texture_border_color_quirk = dev->arch == 7 || dev->arch >= 10 ?
PIPE_QUIRK_TEXTURE_BORDER_COLOR_SWIZZLE_FREEDRENO : 0;
caps->max_texel_buffer_elements = PAN_MAX_TEXEL_BUFFER_ELEMENTS;
caps->max_texel_buffer_elements =
pan_get_max_texel_buffer_elements(dev->arch);
/* Must be at least 64 for correct behaviour */
caps->texture_buffer_offset_alignment = 64;
+3 -2
View File
@@ -49,9 +49,10 @@ panvk_per_arch(CreateBufferView)(VkDevice _device,
#if PAN_ARCH >= 9
tex_usage_mask |= VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT;
#endif
#else
/* This alignment constraint only applies when TextureDescriptors are used. */
assert(!(address & 63));
#endif
if (buffer->vk.usage & tex_usage_mask) {
struct pan_buffer_view bview = {
@@ -635,11 +635,12 @@ panvk_per_arch(get_physical_device_properties)(
.maxImageDimension3D = PAN_ARCH <= 10 ? (1 << 9) : (1 << 14),
.maxImageDimensionCube = PAN_ARCH <= 10 ? (1 << 14) - 1 : (1 << 16),
.maxImageArrayLayers = (1 << 16),
/* Currently limited by the 1D texture size, which is 2^16.
* TODO: If we expose buffer views as 2D textures, we can increase the
* limit.
*/
.maxTexelBufferElements = (1 << 16),
/* Currently Bifrost is limited by the 1D texture size, which is 2^16,
while pre-v11 is limited to 2^27 elements of 16 byte formats due to
size fields of 32 bits. */
.maxTexelBufferElements = PAN_ARCH >= 11 ? PANVK_MAX_BUFFER_SIZE
: PAN_ARCH >= 9 ? (1 << 27)
: (1 << 16),
/* Each uniform entry is 16-byte and the number of entries is encoded in a
* 12-bit field, with the minus(1) modifier, which gives 2^20.
*/
@@ -965,8 +966,8 @@ panvk_per_arch(get_physical_device_properties)(
.integerDotProductAccumulatingSaturating64BitMixedSignednessAccelerated = false,
.storageTexelBufferOffsetAlignmentBytes = 64,
.storageTexelBufferOffsetSingleTexelAlignment = false,
.uniformTexelBufferOffsetAlignmentBytes = 64,
.uniformTexelBufferOffsetSingleTexelAlignment = false,
.uniformTexelBufferOffsetAlignmentBytes = PAN_ARCH >= 9 ? 4 : 64,
.uniformTexelBufferOffsetSingleTexelAlignment = PAN_ARCH >= 9,
.maxBufferSize = PANVK_MAX_BUFFER_SIZE,
/* Vulkan 1.4 properties */