panvk: increase maxBufferSize on v11 and later
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run

The HW supports larger buffer-sizes on v11 and later, so let's bump
this up.

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40999>
This commit is contained in:
Erik Faye-Lund 2026-04-16 16:00:02 +02:00 committed by Marge Bot
parent bd2646482b
commit 36983b50fe
5 changed files with 16 additions and 8 deletions

View file

@ -107,7 +107,9 @@ panvk_CreateBuffer(VkDevice _device, const VkBufferCreateInfo *pCreateInfo,
if (buffer == NULL)
return panvk_error(device, VK_ERROR_OUT_OF_HOST_MEMORY);
if (buffer->vk.size > PANVK_MAX_BUFFER_SIZE) {
struct panvk_physical_device *phys_dev =
to_panvk_physical_device(device->vk.physical);
if (buffer->vk.size > panvk_get_max_buffer_size(phys_dev)) {
result = panvk_error(device, VK_ERROR_OUT_OF_DEVICE_MEMORY);
goto err_destroy_buffer;
}

View file

@ -10,8 +10,6 @@
#include "vk_buffer.h"
#define PANVK_MAX_BUFFER_SIZE UINT32_MAX
struct panvk_priv_bo;
struct panvk_buffer {

View file

@ -923,6 +923,14 @@ panvk_get_max_resource_size(const struct panvk_physical_device *device)
return MIN2(max_desc_size, device->memory.max_supported_va);
}
VkDeviceSize
panvk_get_max_buffer_size(const struct panvk_physical_device *device)
{
const unsigned arch = pan_arch(device->kmod.dev->props.gpu_id);
unsigned max_desc_size = u_uintN_max(arch < 11 ? 32 : 48);
return MIN2(max_desc_size, device->memory.max_supported_va);
}
static VkFormatFeatureFlags2
get_image_format_sample_counts(struct panvk_physical_device *physical_device,
VkFormat format)

View file

@ -105,6 +105,9 @@ VkSampleCountFlags panvk_get_sample_counts(unsigned arch,
VkDeviceSize
panvk_get_max_resource_size(const struct panvk_physical_device *device);
VkDeviceSize
panvk_get_max_buffer_size(const struct panvk_physical_device *device);
#ifdef PAN_ARCH
void panvk_per_arch(get_physical_device_extensions)(
const struct panvk_physical_device *device,

View file

@ -741,10 +741,7 @@ panvk_per_arch(get_physical_device_properties)(
.maxImageDimension3D = (1 << 16),
.maxImageDimensionCube = (1 << 16),
.maxImageArrayLayers = (1 << 16),
/* 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 : (1 << 27),
.maxTexelBufferElements = UINT64_C(1) << (util_logbase2(panvk_get_max_buffer_size(device) / 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.
*/
@ -1086,7 +1083,7 @@ panvk_per_arch(get_physical_device_properties)(
.storageTexelBufferOffsetSingleTexelAlignment = true,
.uniformTexelBufferOffsetAlignmentBytes = 4,
.uniformTexelBufferOffsetSingleTexelAlignment = true,
.maxBufferSize = PANVK_MAX_BUFFER_SIZE,
.maxBufferSize = panvk_get_max_buffer_size(device),
/* Vulkan 1.4 properties */
.lineSubPixelPrecisionBits = 8,