v3d,v3dv: set max supertiles to 256

So far the driver was configuring the supertiles to be less than 256.
But actually, there can be up to 256, not strictly less than 256.

There is one restriction though: the frame width or height in supertiles
must be less than 256.

It also moves this limit to the limits file, which is shared by v3d and
v3dv.

Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35257>
This commit is contained in:
Juan A. Suarez Romero 2025-05-29 22:10:32 +02:00 committed by Marge Bot
parent 9e3f190e2e
commit 2cac70558d
3 changed files with 21 additions and 5 deletions

View file

@ -48,6 +48,8 @@
#define V3D_MAX_BUFFER_RANGE (1 << 30)
#define V3D_MAX_SUPERTILES 256
/* Sub-pixel precision bits in the rasterizer */
#define V3D_COORD_SHIFT 6

View file

@ -412,7 +412,6 @@ job_compute_frame_tiling(struct v3dv_job *job,
tiling->draw_tiles_y = DIV_ROUND_UP(height, tiling->tile_height);
/* Size up our supertiles until we get under the limit */
const uint32_t max_supertiles = 256;
tiling->supertile_width = 1;
tiling->supertile_height = 1;
for (;;) {
@ -422,8 +421,16 @@ job_compute_frame_tiling(struct v3dv_job *job,
DIV_ROUND_UP(tiling->draw_tiles_y, tiling->supertile_height);
const uint32_t num_supertiles = tiling->frame_width_in_supertiles *
tiling->frame_height_in_supertiles;
if (num_supertiles < max_supertiles)
/* While the hardware allows up to V3D_MAX_SUPERTILES, it doesn't allow
* 1xV3D_MAX_SUPERTILES or V3D_MAX_SUPERTILESx1 frame configurations; in
* these cases we need to increase the supertile size.
*/
if (tiling->frame_width_in_supertiles < V3D_MAX_SUPERTILES &&
tiling->frame_height_in_supertiles < V3D_MAX_SUPERTILES &&
num_supertiles <= V3D_MAX_SUPERTILES) {
break;
}
if (tiling->supertile_width < tiling->supertile_height)
tiling->supertile_width++;

View file

@ -512,7 +512,6 @@ emit_render_layer(struct v3d_job *job, uint32_t layer)
cl_emit(&job->rcl, MULTICORE_RENDERING_SUPERTILE_CFG, config) {
uint32_t frame_w_in_supertiles, frame_h_in_supertiles;
const uint32_t max_supertiles = 256;
/* Size up our supertiles until we get under the limit. */
for (;;) {
@ -520,8 +519,16 @@ emit_render_layer(struct v3d_job *job, uint32_t layer)
supertile_w);
frame_h_in_supertiles = DIV_ROUND_UP(job->tile_desc.draw_y,
supertile_h);
if (frame_w_in_supertiles *
frame_h_in_supertiles < max_supertiles) {
uint32_t num_supertiles = frame_w_in_supertiles *
frame_h_in_supertiles;
/* While the hardware allows up to V3D_MAX_SUPERTILES,
* it doesn't allow 1xV3D_MAX_SUPERTILES or
* V3D_MAX_SUPERTILESx1 frame configurations; in these
* cases we need to increase the supertile size.
*/
if (frame_w_in_supertiles < V3D_MAX_SUPERTILES &&
frame_h_in_supertiles < V3D_MAX_SUPERTILES &&
num_supertiles <= V3D_MAX_SUPERTILES) {
break;
}