From 3c0f84aa419e59371795bb4fe7cf0b7924c06e03 Mon Sep 17 00:00:00 2001 From: Iago Toral Quiroga Date: Tue, 29 Oct 2024 08:35:37 +0100 Subject: [PATCH] v3d: group tile spec into a struct inside the job Reviewed-by: Jose Maria Casanova Crespo Part-of: --- src/gallium/drivers/v3d/v3d_blit.c | 13 +++++++------ src/gallium/drivers/v3d/v3d_context.h | 10 ++++++---- src/gallium/drivers/v3d/v3d_job.c | 12 ++++++------ src/gallium/drivers/v3d/v3dx_draw.c | 11 ++++++----- src/gallium/drivers/v3d/v3dx_rcl.c | 24 ++++++++++++------------ 5 files changed, 37 insertions(+), 33 deletions(-) diff --git a/src/gallium/drivers/v3d/v3d_blit.c b/src/gallium/drivers/v3d/v3d_blit.c index 2512a3cc065..0b7dbe50759 100644 --- a/src/gallium/drivers/v3d/v3d_blit.c +++ b/src/gallium/drivers/v3d/v3d_blit.c @@ -530,8 +530,6 @@ v3d_tlb_blit(struct pipe_context *pctx, struct pipe_blit_info *info) src_surf); job->msaa = msaa; job->double_buffer = double_buffer; - job->tile_width = tile_width; - job->tile_height = tile_height; job->internal_bpp = max_bpp; job->draw_min_x = info->dst.box.x; job->draw_min_y = info->dst.box.y; @@ -547,10 +545,13 @@ v3d_tlb_blit(struct pipe_context *pctx, struct pipe_blit_info *info) */ job->draw_width = MIN2(dst_surf->width, src_surf->width); job->draw_height = MIN2(dst_surf->height, src_surf->height); - job->draw_tiles_x = DIV_ROUND_UP(job->draw_width, - job->tile_width); - job->draw_tiles_y = DIV_ROUND_UP(job->draw_height, - job->tile_height); + + job->tile_desc.width = tile_width; + job->tile_desc.height = tile_height; + job->tile_desc.draw_x = DIV_ROUND_UP(job->draw_width, + job->tile_desc.width); + job->tile_desc.draw_y = DIV_ROUND_UP(job->draw_height, + job->tile_desc.height); job->needs_flush = true; job->num_layers = info->dst.box.depth; diff --git a/src/gallium/drivers/v3d/v3d_context.h b/src/gallium/drivers/v3d/v3d_context.h index 4bd48b78fcd..f32e5fcadcc 100644 --- a/src/gallium/drivers/v3d/v3d_context.h +++ b/src/gallium/drivers/v3d/v3d_context.h @@ -427,11 +427,13 @@ struct v3d_job { /** @} */ /** @{ Tile information, depending on MSAA and float color buffer. */ - uint32_t draw_tiles_x; /** @< Number of tiles wide for framebuffer. */ - uint32_t draw_tiles_y; /** @< Number of tiles high for framebuffer. */ + struct { + uint32_t draw_x; /** @< Number of tiles wide for framebuffer. */ + uint32_t draw_y; /** @< Number of tiles high for framebuffer. */ + uint32_t width; /** @< Width of a tile. */ + uint32_t height; /** @< Height of a tile. */ + } tile_desc; - uint32_t tile_width; /** @< Width of a tile. */ - uint32_t tile_height; /** @< Height of a tile. */ /** maximum internal_bpp of all color render targets. */ uint32_t internal_bpp; diff --git a/src/gallium/drivers/v3d/v3d_job.c b/src/gallium/drivers/v3d/v3d_job.c index aec6fca09f3..210fa91fd62 100644 --- a/src/gallium/drivers/v3d/v3d_job.c +++ b/src/gallium/drivers/v3d/v3d_job.c @@ -403,8 +403,8 @@ v3d_get_job_for_fbo(struct v3d_context *v3d) v3d_get_tile_buffer_size(&v3d->screen->devinfo, job->msaa, job->double_buffer, job->nr_cbufs, job->cbufs, job->bbuf, - &job->tile_width, - &job->tile_height, + &job->tile_desc.width, + &job->tile_desc.height, &job->internal_bpp); /* The dirty flags are tracking what's been updated while v3d->job has @@ -436,10 +436,10 @@ v3d_get_job_for_fbo(struct v3d_context *v3d) job->clear_tlb |= PIPE_CLEAR_STENCIL; } - job->draw_tiles_x = DIV_ROUND_UP(v3d->framebuffer.width, - job->tile_width); - job->draw_tiles_y = DIV_ROUND_UP(v3d->framebuffer.height, - job->tile_height); + job->tile_desc.draw_x = DIV_ROUND_UP(v3d->framebuffer.width, + job->tile_desc.width); + job->tile_desc.draw_y = DIV_ROUND_UP(v3d->framebuffer.height, + job->tile_desc.height); v3d->job = job; diff --git a/src/gallium/drivers/v3d/v3dx_draw.c b/src/gallium/drivers/v3d/v3dx_draw.c index c28572d4df0..ecd5842d7f4 100644 --- a/src/gallium/drivers/v3d/v3dx_draw.c +++ b/src/gallium/drivers/v3d/v3dx_draw.c @@ -58,7 +58,8 @@ v3dX(start_binning)(struct v3d_context *v3d, struct v3d_job *job) * of tile binning. */ uint32_t tile_alloc_size = - MAX2(job->num_layers, 1) * job->draw_tiles_x * job->draw_tiles_y * 64; + 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); @@ -80,8 +81,8 @@ v3dX(start_binning)(struct v3d_context *v3d, struct v3d_job *job) uint32_t tsda_per_tile_size = 256; job->tile_state = v3d_bo_alloc(v3d->screen, MAX2(job->num_layers, 1) * - job->draw_tiles_y * - job->draw_tiles_x * + job->tile_desc.draw_y * + job->tile_desc.draw_x * tsda_per_tile_size, "TSDA"); @@ -100,8 +101,8 @@ v3dX(start_binning)(struct v3d_context *v3d, struct v3d_job *job) config.width_in_pixels = job->draw_width; config.height_in_pixels = job->draw_height; - config.log2_tile_width = log2_tile_size(job->tile_width); - config.log2_tile_height = log2_tile_size(job->tile_height); + config.log2_tile_width = log2_tile_size(job->tile_desc.width); + config.log2_tile_height = log2_tile_size(job->tile_desc.height); /* FIXME: ideallly we would like next assert on the packet header (as is * general, so also applies to GL). We would need to expand diff --git a/src/gallium/drivers/v3d/v3dx_rcl.c b/src/gallium/drivers/v3d/v3dx_rcl.c index 80b2c2a7591..0c995387fed 100644 --- a/src/gallium/drivers/v3d/v3dx_rcl.c +++ b/src/gallium/drivers/v3d/v3dx_rcl.c @@ -493,7 +493,7 @@ do_double_initial_tile_clear(const struct v3d_job *job) * clear for double buffer mode is required. */ return job->double_buffer && - (job->draw_tiles_x > 1 || job->draw_tiles_y > 1); + (job->tile_desc.draw_x > 1 || job->tile_desc.draw_y > 1); } static void @@ -505,7 +505,7 @@ emit_render_layer(struct v3d_job *job, uint32_t layer) * core's tile list here. */ uint32_t tile_alloc_offset = - layer * job->draw_tiles_x * job->draw_tiles_y * 64; + layer * job->tile_desc.draw_x * job->tile_desc.draw_y * 64; cl_emit(&job->rcl, MULTICORE_RENDERING_TILE_LIST_SET_BASE, list) { list.address = cl_address(job->tile_alloc, tile_alloc_offset); } @@ -516,9 +516,9 @@ emit_render_layer(struct v3d_job *job, uint32_t layer) /* Size up our supertiles until we get under the limit. */ for (;;) { - frame_w_in_supertiles = DIV_ROUND_UP(job->draw_tiles_x, + frame_w_in_supertiles = DIV_ROUND_UP(job->tile_desc.draw_x, supertile_w); - frame_h_in_supertiles = DIV_ROUND_UP(job->draw_tiles_y, + 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) { @@ -532,8 +532,8 @@ emit_render_layer(struct v3d_job *job, uint32_t layer) } config.number_of_bin_tile_lists = 1; - config.total_frame_width_in_tiles = job->draw_tiles_x; - config.total_frame_height_in_tiles = job->draw_tiles_y; + config.total_frame_width_in_tiles = job->tile_desc.draw_x; + config.total_frame_height_in_tiles = job->tile_desc.draw_y; config.supertile_width_in_tiles = supertile_w; config.supertile_height_in_tiles = supertile_h; @@ -589,8 +589,8 @@ emit_render_layer(struct v3d_job *job, uint32_t layer) * improve X11 performance, but we should use Morton order * otherwise to improve cache locality. */ - uint32_t supertile_w_in_pixels = job->tile_width * supertile_w; - uint32_t supertile_h_in_pixels = job->tile_height * supertile_h; + uint32_t supertile_w_in_pixels = job->tile_desc.width * supertile_w; + uint32_t supertile_h_in_pixels = job->tile_desc.height * supertile_h; uint32_t min_x_supertile = job->draw_min_x / supertile_w_in_pixels; uint32_t min_y_supertile = job->draw_min_y / supertile_h_in_pixels; @@ -679,8 +679,8 @@ v3dX(emit_rcl)(struct v3d_job *job) config.maximum_bpp_of_all_render_targets = job->internal_bpp; #endif #if V3D_VERSION >= 71 - config.log2_tile_width = log2_tile_size(job->tile_width); - config.log2_tile_height = log2_tile_size(job->tile_height); + config.log2_tile_width = log2_tile_size(job->tile_desc.width); + config.log2_tile_height = log2_tile_size(job->tile_desc.height); /* FIXME: ideallly we would like next assert on the packet header (as is * general, so also applies to GL). We would need to expand @@ -774,12 +774,12 @@ v3dX(emit_rcl)(struct v3d_job *job) v3d_setup_render_target(job, i, &rt.internal_bpp, &rt.internal_type_and_clamping); rt.stride = - v3d_compute_rt_row_row_stride_128_bits(job->tile_width, + v3d_compute_rt_row_row_stride_128_bits(job->tile_desc.width, v3d_internal_bpp_words(rt.internal_bpp)); rt.base_address = base_addr; rt.render_target_number = i; - base_addr += (job->tile_height * rt.stride) / 8; + base_addr += (job->tile_desc.height * rt.stride) / 8; } if (surf->internal_bpp >= V3D_INTERNAL_BPP_64) {