pan/bi: Return the size of the last clause from bi_pack
authorIcecream95 <ixn@disroot.org>
Thu, 28 Jan 2021 08:38:41 +0000 (21:38 +1300)
committerMarge Bot <eric+marge@anholt.net>
Mon, 8 Feb 2021 14:07:29 +0000 (14:07 +0000)
Will be used for calculating prefetch size.

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8354>

src/panfrost/bifrost/bi_pack.c
src/panfrost/bifrost/compiler.h

index 95a0ef1..c7b8d96 100644 (file)
@@ -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
index e6a85c6..69104f1 100644 (file)
@@ -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;