diff --git a/src/gallium/drivers/v3d/v3d_job.c b/src/gallium/drivers/v3d/v3d_job.c index d1c495bf1ea..229754c761a 100644 --- a/src/gallium/drivers/v3d/v3d_job.c +++ b/src/gallium/drivers/v3d/v3d_job.c @@ -554,36 +554,18 @@ alloc_tile_state(struct v3d_job *job) { assert(!job->tile_alloc && !job->tile_state); - /* The PTB will request the tile alloc initial size per tile at start - * of tile binning. - */ - uint32_t tile_alloc_size = - MAX2(job->num_layers, 1) * job->tile_desc.draw_x * - job->tile_desc.draw_y * 64; - - /* The PTB allocates in aligned 4k chunks after the initial setup. */ - tile_alloc_size = align(tile_alloc_size, 4096); - - /* Include the first two chunk allocations that the PTB does so that - * we definitely clear the OOM condition before triggering one (the HW - * won't trigger OOM during the first allocations). - */ - tile_alloc_size += 8192; - - /* For performance, allocate some extra initial memory after the PTB's - * minimal allocations, so that we hopefully don't have to block the - * GPU on the kernel handling an OOM signal. - */ - tile_alloc_size += 512 * 1024; + uint32_t tile_alloc_size, tile_state_size; + v3d_tile_alloc_sizes(MAX2(job->num_layers, 1), + job->tile_desc.draw_x, + job->tile_desc.draw_y, + job->draw_calls_queued, + job->v3d->screen->devinfo.page_size, + &tile_alloc_size, + &tile_state_size); job->tile_alloc = v3d_bo_alloc(job->v3d->screen, tile_alloc_size, "tile_alloc"); - uint32_t tsda_per_tile_size = 256; - job->tile_state = v3d_bo_alloc(job->v3d->screen, - MAX2(job->num_layers, 1) * - job->tile_desc.draw_y * - job->tile_desc.draw_x * - tsda_per_tile_size, + job->tile_state = v3d_bo_alloc(job->v3d->screen, tile_state_size, "TSDA"); } diff --git a/src/gallium/drivers/v3d/v3dx_draw.c b/src/gallium/drivers/v3d/v3dx_draw.c index d47623c7caf..1dc918d3e1f 100644 --- a/src/gallium/drivers/v3d/v3dx_draw.c +++ b/src/gallium/drivers/v3d/v3dx_draw.c @@ -74,6 +74,11 @@ v3dX(start_binning)(struct v3d_context *v3d, struct v3d_job *job) config.log2_tile_width = log2_tile_size(job->tile_desc.width); config.log2_tile_height = log2_tile_size(job->tile_desc.height); + + config.tile_allocation_initial_block_size = + V3D_TILE_ALLOC_INITIAL_BLOCK_SIZE_ENUM; + config.tile_allocation_block_size = + V3D_TILE_ALLOC_OVERFLOW_BLOCK_SIZE_ENUM; } #endif @@ -88,6 +93,11 @@ v3dX(start_binning)(struct v3d_context *v3d, struct v3d_job *job) config.double_buffer_in_non_ms_mode = job->double_buffer; config.maximum_bpp_of_all_render_targets = job->internal_bpp; + + config.tile_allocation_initial_block_size = + V3D_TILE_ALLOC_INITIAL_BLOCK_SIZE_ENUM; + config.tile_allocation_block_size = + V3D_TILE_ALLOC_OVERFLOW_BLOCK_SIZE_ENUM; } #endif diff --git a/src/gallium/drivers/v3d/v3dx_job.c b/src/gallium/drivers/v3d/v3dx_job.c index 934b8851485..94e3c6cb687 100644 --- a/src/gallium/drivers/v3d/v3dx_job.c +++ b/src/gallium/drivers/v3d/v3dx_job.c @@ -80,6 +80,10 @@ v3dX(job_emit_enable_double_buffer)(struct v3d_job *job) config.width_in_pixels = job->draw_width; config.height_in_pixels = job->draw_height; + config.tile_allocation_initial_block_size = + V3D_TILE_ALLOC_INITIAL_BLOCK_SIZE_ENUM; + config.tile_allocation_block_size = + V3D_TILE_ALLOC_OVERFLOW_BLOCK_SIZE_ENUM; #if V3D_VERSION == 42 config.number_of_render_targets = MAX2(job->nr_cbufs, 1); config.multisample_mode_4x = job->msaa; diff --git a/src/gallium/drivers/v3d/v3dx_rcl.c b/src/gallium/drivers/v3d/v3dx_rcl.c index 45f64ac5c25..f74b4dea2f2 100644 --- a/src/gallium/drivers/v3d/v3dx_rcl.c +++ b/src/gallium/drivers/v3d/v3dx_rcl.c @@ -571,7 +571,8 @@ emit_render_layer(struct v3d_job *job, uint32_t layer) * core's tile list here. */ uint32_t tile_alloc_offset = - layer * job->tile_desc.draw_x * job->tile_desc.draw_y * 64; + layer * job->tile_desc.draw_x * job->tile_desc.draw_y * + V3D_TILE_ALLOC_INITIAL_BLOCK_SIZE; cl_emit(&job->rcl, MULTICORE_RENDERING_TILE_LIST_SET_BASE, list) { list.address = cl_address(job->tile_alloc, tile_alloc_offset); } @@ -927,7 +928,7 @@ v3dX(emit_rcl)(struct v3d_job *job) cl_emit(&job->rcl, TILE_LIST_INITIAL_BLOCK_SIZE, init) { init.use_auto_chained_tile_lists = true; init.size_of_first_block_in_chained_tile_lists = - TILE_ALLOCATION_BLOCK_SIZE_64B; + V3D_TILE_ALLOC_INITIAL_BLOCK_SIZE_ENUM; } /* ARB_framebuffer_no_attachments allows rendering to happen even when