Module: Mesa
Branch: main
Commit: 3716f72413c9c4f412e69a3128bf6f13f04f9a67
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=3716f72413c9c4f412e69a3128bf6f13f04f9a67

Author: Asahi Lina <[email protected]>
Date:   Wed Mar  1 18:25:35 2023 +0900

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 <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21662>

---

 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 b9def3dc776..c9ef4579b45 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 c510d009ed2..7cab7d213a4 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;

Reply via email to