diff --git a/src/gallium/drivers/panfrost/pan_csf.c b/src/gallium/drivers/panfrost/pan_csf.c index 7c4053038b5..c4e8260f1e1 100644 --- a/src/gallium/drivers/panfrost/pan_csf.c +++ b/src/gallium/drivers/panfrost/pan_csf.c @@ -110,14 +110,19 @@ csf_oom_handler_init(struct panfrost_context *ctx) .capacity = panfrost_bo_size(cs_bo) / sizeof(uint64_t), }; struct cs_builder b; - struct cs_exception_handler handler; const struct cs_builder_conf conf = { .nr_registers = 96, .nr_kernel_registers = 4, .reg_perm = (dev->debug & PAN_DBG_CS) ? csf_reg_perm_cb : NULL, }; cs_builder_init(&b, &conf, queue); - cs_exception_handler_start(&b, &handler, reg_save_bo->ptr.gpu, 0); + + struct cs_exception_handler_ctx handler_ctx = { + .addr = reg_save_bo->ptr.gpu, + .sb_slot = 0, + }; + struct cs_exception_handler handler; + cs_exception_handler_start(&b, &handler, handler_ctx); struct cs_index tiler_oom_ctx = cs_reg64(&b, TILER_OOM_CTX_REG); struct cs_index counter = cs_reg32(&b, 47); diff --git a/src/panfrost/lib/genxml/cs_builder.h b/src/panfrost/lib/genxml/cs_builder.h index 17496541a19..14e754ca970 100644 --- a/src/panfrost/lib/genxml/cs_builder.h +++ b/src/panfrost/lib/genxml/cs_builder.h @@ -1672,24 +1672,27 @@ cs_nop(struct cs_builder *b) cs_emit(b, NOP, I) {}; } +struct cs_exception_handler_ctx { + uint64_t addr; + uint8_t sb_slot; +}; + struct cs_exception_handler { struct cs_block block; struct cs_dirty_tracker dirty; - uint64_t backup_addr; - uint8_t sb_slot; + struct cs_exception_handler_ctx ctx; }; static inline struct cs_exception_handler * cs_exception_handler_start(struct cs_builder *b, struct cs_exception_handler *handler, - uint64_t backup_addr, uint8_t sb_slot) + struct cs_exception_handler_ctx ctx) { assert(cs_cur_block(b) == NULL); assert(b->conf.dirty_tracker == NULL); *handler = (struct cs_exception_handler){ - .backup_addr = backup_addr, - .sb_slot = sb_slot, + .ctx = ctx, }; cs_block_start(b, &handler->block); @@ -1761,7 +1764,7 @@ cs_exception_handler_end(struct cs_builder *b, if (num_ranges > 0) { unsigned offset = 0; - cs_move64_to(b, addr_reg, handler->backup_addr); + cs_move64_to(b, addr_reg, handler->ctx.addr); for (unsigned i = 0; i < num_ranges; ++i) { unsigned reg_count = util_bitcount(masks[i]); @@ -1770,7 +1773,7 @@ cs_exception_handler_end(struct cs_builder *b, offset += reg_count * 4; } - cs_wait_slot(b, handler->sb_slot, false); + cs_wait_slot(b, handler->ctx.sb_slot, false); } /* Now that the preamble is emitted, we can flush the instructions we have in @@ -1788,6 +1791,6 @@ cs_exception_handler_end(struct cs_builder *b, offset += reg_count * 4; } - cs_wait_slot(b, handler->sb_slot, false); + cs_wait_slot(b, handler->ctx.sb_slot, false); } }