From 3716f72413c9c4f412e69a3128bf6f13f04f9a67 Mon Sep 17 00:00:00 2001 From: Asahi Lina Date: Wed, 1 Mar 2023 18:25:35 +0900 Subject: [PATCH] asahi: Add result buffer to context/batches The result buffer is where the kernel places statistics and fault information after the GPU executes a command. Dummy structure pending UAPI. Signed-off-by: Asahi Lina Part-of: --- src/gallium/drivers/asahi/agx_pipe.c | 7 +++++++ src/gallium/drivers/asahi/agx_state.h | 8 ++++++++ 2 files changed, 15 insertions(+) diff --git a/src/gallium/drivers/asahi/agx_pipe.c b/src/gallium/drivers/asahi/agx_pipe.c index b9def3d..c9ef457 100644 --- a/src/gallium/drivers/asahi/agx_pipe.c +++ b/src/gallium/drivers/asahi/agx_pipe.c @@ -1076,6 +1076,8 @@ agx_destroy_context(struct pipe_context *pctx) agx_meta_cleanup(&ctx->meta); + agx_bo_unreference(ctx->result_buf); + ralloc_free(ctx); } @@ -1144,6 +1146,11 @@ agx_create_context(struct pipe_screen *screen, void *priv, unsigned flags) ctx->blitter = util_blitter_create(pctx); + ctx->result_buf = agx_bo_create( + agx_device(screen), sizeof(union agx_batch_result) * AGX_MAX_BATCHES, 0, + "Batch result buffer"); + assert(ctx->result_buf); + return pctx; } diff --git a/src/gallium/drivers/asahi/agx_state.h b/src/gallium/drivers/asahi/agx_state.h index c510d00..7cab7d2 100644 --- a/src/gallium/drivers/asahi/agx_state.h +++ b/src/gallium/drivers/asahi/agx_state.h @@ -156,6 +156,9 @@ struct agx_stage { uint32_t valid_samplers; }; +union agx_batch_result { +}; + struct agx_batch { struct agx_context *ctx; struct pipe_framebuffer_state key; @@ -198,6 +201,10 @@ struct agx_batch { */ struct util_dynarray occlusion_queries; struct agx_ptr occlusion_buffer; + + /* Result buffer where the kernel places command execution information */ + union agx_batch_result *result; + size_t result_off; }; struct agx_zsa { @@ -279,6 +286,7 @@ struct agx_context { } batches; struct agx_batch *batch; + struct agx_bo *result_buf; struct pipe_vertex_buffer vertex_buffers[PIPE_MAX_ATTRIBS]; uint32_t vb_mask; -- 2.7.4