diff --git a/src/panfrost/vulkan/csf/panvk_cmd_buffer.h b/src/panfrost/vulkan/csf/panvk_cmd_buffer.h index 315cadc0475..82dcec60dc9 100644 --- a/src/panfrost/vulkan/csf/panvk_cmd_buffer.h +++ b/src/panfrost/vulkan/csf/panvk_cmd_buffer.h @@ -34,7 +34,11 @@ struct panvk_sync_scope { #define MAX_VBS 16 #define MAX_RTS 8 +#if PAN_ARCH >= 14 +#define MAX_LAYERS_PER_TILER_DESC 256 +#else #define MAX_LAYERS_PER_TILER_DESC 8 +#endif struct panvk_cs_sync32 { uint32_t seqno; diff --git a/src/panfrost/vulkan/csf/panvk_vX_cmd_draw.c b/src/panfrost/vulkan/csf/panvk_vX_cmd_draw.c index a6948b4d880..c8bf172d5e0 100644 --- a/src/panfrost/vulkan/csf/panvk_vX_cmd_draw.c +++ b/src/panfrost/vulkan/csf/panvk_vX_cmd_draw.c @@ -942,6 +942,18 @@ calc_render_descs_size(struct panvk_cmd_buffer *cmdbuf) uint32_t td_count = DIV_ROUND_UP(cmdbuf->state.gfx.render.layer_count, MAX_LAYERS_PER_TILER_DESC); + /* v14+ supports a maximum of one tiler descriptor. + * This should be enough since the driver reports maxFramebufferLayers + * and maxMultiviewViewCount lower or equal to MAX_LAYERS_PER_TILER_DESC. */ + assert(PAN_ARCH < 14 || td_count <= 1); + static_assert( + PAN_ARCH < 14 || MAX_FRAMEBUFFER_LAYERS <= MAX_LAYERS_PER_TILER_DESC, + "MAX_FRAMEBUFFER_LAYERS must be <= max amount of layers a Tiler descriptor can index"); + static_assert( + PAN_ARCH < 14 || + PAN_MAX_MULTIVIEW_VIEW_COUNT <= MAX_LAYERS_PER_TILER_DESC, + "PAN_MAX_MULTIVIEW_VIEW_COUNT must be <= max amount of layers a Tiler descriptor can index"); + return (calc_fbd_size(cmdbuf) * fbd_count) + (td_count * pan_size(TILER_CONTEXT)); } diff --git a/src/panfrost/vulkan/panvk_cmd_draw.h b/src/panfrost/vulkan/panvk_cmd_draw.h index 7c11787fd44..19ea68f7168 100644 --- a/src/panfrost/vulkan/panvk_cmd_draw.h +++ b/src/panfrost/vulkan/panvk_cmd_draw.h @@ -27,6 +27,7 @@ #include "pan_props.h" #define MAX_VBS 16 +#define MAX_FRAMEBUFFER_LAYERS 256 struct panvk_cmd_buffer; diff --git a/src/panfrost/vulkan/panvk_vX_physical_device.c b/src/panfrost/vulkan/panvk_vX_physical_device.c index 84a9e0af2b1..a8650a3df26 100644 --- a/src/panfrost/vulkan/panvk_vX_physical_device.c +++ b/src/panfrost/vulkan/panvk_vX_physical_device.c @@ -918,7 +918,7 @@ panvk_per_arch(get_physical_device_properties)( .subPixelInterpolationOffsetBits = 8, .maxFramebufferWidth = (1 << 14), .maxFramebufferHeight = (1 << 14), - .maxFramebufferLayers = 256, + .maxFramebufferLayers = MAX_FRAMEBUFFER_LAYERS, .framebufferColorSampleCounts = sample_counts, .framebufferDepthSampleCounts = sample_counts, .framebufferStencilSampleCounts = sample_counts,