asahi: Allow specifying an encoder ID
authorAlyssa Rosenzweig <alyssa@rosenzweig.io>
Sun, 11 Jul 2021 17:17:30 +0000 (13:17 -0400)
committerAlyssa Rosenzweig <alyssa@rosenzweig.io>
Sun, 11 Jul 2021 18:48:59 +0000 (14:48 -0400)
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11815>

src/gallium/drivers/asahi/agx_pipe.c
src/gallium/drivers/asahi/magic.c
src/gallium/drivers/asahi/magic.h

index 3047631..b53a6ea 100644 (file)
@@ -510,10 +510,14 @@ agx_flush(struct pipe_context *pctx,
    /* Size calculation should've been exact */
    assert(handle_i == handle_count);
 
+   unsigned cmdbuf_id = 0xDEADBEEF;
+   unsigned encoder_id = 0xCAFECAFE;
+
    unsigned cmdbuf_size = demo_cmdbuf(dev->cmdbuf.ptr.cpu,
                dev->cmdbuf.size,
                &ctx->batch->pool,
                ctx->batch->encoder->ptr.gpu,
+               encoder_id,
                ctx->batch->scissor.bo->ptr.gpu,
                ctx->batch->width,
                ctx->batch->height,
@@ -525,7 +529,7 @@ agx_flush(struct pipe_context *pctx,
 
    /* Generate the mapping table from the BO list */
    demo_mem_map(dev->memmap.ptr.cpu, dev->memmap.size, handles, handle_count,
-                0xDEADBEEF, 0xCAFECAFE, cmdbuf_size);
+                cmdbuf_id, encoder_id, cmdbuf_size);
 
    free(handles);
 
index 6d4b75f..91300cd 100644 (file)
@@ -79,6 +79,7 @@ unsigned
 demo_cmdbuf(uint64_t *buf, size_t size,
             struct agx_pool *pool,
             uint64_t encoder_ptr,
+            uint64_t encoder_id,
             uint64_t scissor_ptr,
             unsigned width, unsigned height,
             uint32_t pipeline_null,
@@ -186,7 +187,7 @@ demo_cmdbuf(uint64_t *buf, size_t size,
    /* Compare compute case ,which has a bit of reordering, but we can swap */
    EMIT32(cmdbuf, 0x1c); // 0x5a0
    EMIT32(cmdbuf, 0);
-   EMIT64(cmdbuf, 0xCAFECAFE); // encoder ID XXX: don't fix
+   EMIT64(cmdbuf, encoder_id);
    EMIT32(cmdbuf, 0);
    EMIT32(cmdbuf, 0xffffffff);
 
index 429e7e2..98215d3 100644 (file)
@@ -28,6 +28,7 @@ unsigned
 demo_cmdbuf(uint64_t *buf, size_t size,
             struct agx_pool *pool,
             uint64_t encoder_ptr,
+            uint64_t encoder_id,
             uint64_t scissor_ptr,
             unsigned width, unsigned height,
             uint32_t pipeline_null,