From b5ab019b5a5a29d4b65f7b8bb37a5372919fa287 Mon Sep 17 00:00:00 2001 From: Icecream95 Date: Thu, 28 Jan 2021 21:38:41 +1300 Subject: [PATCH] pan/bi: Return the size of the last clause from bi_pack Will be used for calculating prefetch size. Reviewed-by: Boris Brezillon Part-of: --- src/panfrost/bifrost/bi_pack.c | 8 +++++++- src/panfrost/bifrost/compiler.h | 3 ++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/panfrost/bifrost/bi_pack.c b/src/panfrost/bifrost/bi_pack.c index 95a0ef1..c7b8d96 100644 --- a/src/panfrost/bifrost/bi_pack.c +++ b/src/panfrost/bifrost/bi_pack.c @@ -914,11 +914,13 @@ bi_collect_blend_ret_addr(bi_context *ctx, struct util_dynarray *emission, assert(!(ctx->blend_ret_offsets[loc] & 0x7)); } -void +unsigned bi_pack(bi_context *ctx, struct util_dynarray *emission) { bool tdd = bi_terminate_discarded_threads(ctx); + unsigned previous_size = emission->size; + bi_foreach_block(ctx, _block) { bi_block *block = (bi_block *) _block; @@ -937,12 +939,16 @@ bi_pack(bi_context *ctx, struct util_dynarray *emission) bi_clause *next = bi_next_clause(ctx, _block, clause); bi_clause *next_2 = is_last ? succ_clause : NULL; + previous_size = emission->size; + bi_pack_clause(ctx, clause, next, next_2, emission, ctx->stage, tdd); if (!is_last) bi_collect_blend_ret_addr(ctx, emission, clause); } } + + return emission->size - previous_size; } #ifndef NDEBUG diff --git a/src/panfrost/bifrost/compiler.h b/src/panfrost/bifrost/compiler.h index e6a85c6..69104f1 100644 --- a/src/panfrost/bifrost/compiler.h +++ b/src/panfrost/bifrost/compiler.h @@ -761,7 +761,8 @@ bi_is_terminal_block(bi_context *ctx, bi_block *block) /* Code emit */ -void bi_pack(bi_context *ctx, struct util_dynarray *emission); +/* Returns the size of the final clause */ +unsigned bi_pack(bi_context *ctx, struct util_dynarray *emission); struct bi_packed_tuple { uint64_t lo; -- 2.7.4