From 493cf2f0082d958729c3268f425edbd7d70e39df Mon Sep 17 00:00:00 2001 From: Boris Brezillon Date: Mon, 11 Dec 2023 11:11:20 +0100 Subject: [PATCH] panfrost: Make pan_desc.{c,h} panfrost_bo agnostic Signed-off-by: Boris Brezillon Reviewed-by: Constantine Shablya Reviewed-by: Erik Faye-Lund Part-of: --- src/gallium/drivers/panfrost/pan_cmdstream.c | 15 ++++++++------- src/gallium/drivers/panfrost/pan_job.h | 3 +++ src/panfrost/lib/pan_desc.c | 9 ++++----- src/panfrost/lib/pan_desc.h | 2 +- 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.c b/src/gallium/drivers/panfrost/pan_cmdstream.c index ce0855f8294..8b356df8d43 100644 --- a/src/gallium/drivers/panfrost/pan_cmdstream.c +++ b/src/gallium/drivers/panfrost/pan_cmdstream.c @@ -3686,23 +3686,24 @@ batch_get_polygon_list(struct panfrost_batch *batch) * no WRITE_VALUE job in the chain */ bool init_polygon_list = !has_draws; - batch->tiler_ctx.midgard.polygon_list = panfrost_batch_create_bo( + batch->polygon_list_bo = panfrost_batch_create_bo( batch, size, init_polygon_list ? 0 : PAN_BO_INVISIBLE, PIPE_SHADER_VERTEX, "Polygon list"); - panfrost_batch_add_bo(batch, batch->tiler_ctx.midgard.polygon_list, + batch->tiler_ctx.midgard.polygon_list = batch->polygon_list_bo->ptr.gpu; + panfrost_batch_add_bo(batch, batch->polygon_list_bo, PIPE_SHADER_FRAGMENT); if (init_polygon_list && dev->model->quirks.no_hierarchical_tiling) { - assert(batch->tiler_ctx.midgard.polygon_list->ptr.cpu); + assert(batch->polygon_list_bo->ptr.cpu); uint32_t *polygon_list_body = - batch->tiler_ctx.midgard.polygon_list->ptr.cpu + + batch->polygon_list_bo->ptr.cpu + MALI_MIDGARD_TILER_MINIMUM_HEADER_SIZE; /* Magic for Mali T720 */ polygon_list_body[0] = 0xa0000000; } else if (init_polygon_list) { - assert(batch->tiler_ctx.midgard.polygon_list->ptr.cpu); - uint32_t *header = batch->tiler_ctx.midgard.polygon_list->ptr.cpu; + assert(batch->polygon_list_bo->ptr.cpu); + uint32_t *header = batch->polygon_list_bo->ptr.cpu; memset(header, 0, size); } @@ -3713,7 +3714,7 @@ batch_get_polygon_list(struct panfrost_batch *batch) batch->tiler_ctx.midgard.heap.size = panfrost_bo_size(dev->tiler_heap); } - return batch->tiler_ctx.midgard.polygon_list->ptr.gpu; + return batch->tiler_ctx.midgard.polygon_list; } #endif diff --git a/src/gallium/drivers/panfrost/pan_job.h b/src/gallium/drivers/panfrost/pan_job.h index 3f825ae6ecb..04d3745493b 100644 --- a/src/gallium/drivers/panfrost/pan_job.h +++ b/src/gallium/drivers/panfrost/pan_job.h @@ -154,6 +154,9 @@ struct panfrost_batch { /* Tiler context */ struct pan_tiler_context tiler_ctx; + /* Only used on midgard. */ + struct panfrost_bo *polygon_list_bo; + /* Keep the num_work_groups sysval around for indirect dispatch */ mali_ptr num_wg_sysval[3]; diff --git a/src/panfrost/lib/pan_desc.c b/src/panfrost/lib/pan_desc.c index beedf4a9d56..405b2be6e41 100644 --- a/src/panfrost/lib/pan_desc.c +++ b/src/panfrost/lib/pan_desc.c @@ -29,7 +29,6 @@ #include "genxml/gen_macros.h" -#include "pan_bo.h" #include "pan_desc.h" #include "pan_encoder.h" #include "pan_texture.h" @@ -570,7 +569,7 @@ pan_emit_midgard_tiler(const struct pan_fb_info *fb, { bool hierarchy = !tiler_ctx->midgard.no_hierarchical_tiling; - assert(tiler_ctx->midgard.polygon_list->ptr.gpu); + assert(tiler_ctx->midgard.polygon_list); pan_pack(out, TILER_CONTEXT, cfg) { unsigned header_size; @@ -580,8 +579,8 @@ pan_emit_midgard_tiler(const struct pan_fb_info *fb, hierarchy ? MALI_MIDGARD_TILER_DISABLED : MALI_MIDGARD_TILER_USER; header_size = MALI_MIDGARD_TILER_MINIMUM_HEADER_SIZE; cfg.polygon_list_size = header_size + (hierarchy ? 0 : 4); - cfg.heap_start = tiler_ctx->midgard.polygon_list->ptr.gpu; - cfg.heap_end = tiler_ctx->midgard.polygon_list->ptr.gpu; + cfg.heap_start = tiler_ctx->midgard.polygon_list; + cfg.heap_end = tiler_ctx->midgard.polygon_list; } else { cfg.hierarchy_mask = panfrost_choose_hierarchy_mask( fb->width, fb->height, tiler_ctx->vertex_count, hierarchy); @@ -593,7 +592,7 @@ pan_emit_midgard_tiler(const struct pan_fb_info *fb, cfg.heap_end = cfg.heap_start + tiler_ctx->midgard.heap.size; } - cfg.polygon_list = tiler_ctx->midgard.polygon_list->ptr.gpu; + cfg.polygon_list = tiler_ctx->midgard.polygon_list; cfg.polygon_list_body = cfg.polygon_list + header_size; } } diff --git a/src/panfrost/lib/pan_desc.h b/src/panfrost/lib/pan_desc.h index f20b24e5853..21e2bf2dea8 100644 --- a/src/panfrost/lib/pan_desc.h +++ b/src/panfrost/lib/pan_desc.h @@ -80,7 +80,7 @@ struct pan_tiler_context { struct { bool disable; bool no_hierarchical_tiling; - struct panfrost_bo *polygon_list; + mali_ptr polygon_list; struct { mali_ptr start; unsigned size;