From 535f1c1166bdf7e12a603cfec3f9c846e34288d2 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Mon, 21 Feb 2022 11:41:39 -0500 Subject: [PATCH] asahi: Identify IOGPU Clear Z/S structure Not sure on the details yet but identify and dump the data structure to start. Signed-off-by: Alyssa Rosenzweig Part-of: --- src/asahi/lib/cmdbuf.xml | 10 ++++++++++ src/asahi/lib/decode.c | 2 ++ src/gallium/drivers/asahi/magic.c | 10 +++++----- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/asahi/lib/cmdbuf.xml b/src/asahi/lib/cmdbuf.xml index 8de70ab..0eeb47a 100644 --- a/src/asahi/lib/cmdbuf.xml +++ b/src/asahi/lib/cmdbuf.xml @@ -546,4 +546,14 @@ in a decimal percentage [0, 100] + + + + + + + + + + diff --git a/src/asahi/lib/decode.c b/src/asahi/lib/decode.c index 217aaab..fa033c5 100644 --- a/src/asahi/lib/decode.c +++ b/src/asahi/lib/decode.c @@ -443,6 +443,8 @@ agxdecode_cmdstream(unsigned cmdbuf_handle, unsigned map_handle, bool verbose) DUMP_UNPACKED(IOGPU_HEADER, cmd, "IOGPU Header\n"); assert(cmd.attachment_offset_1 == cmd.attachment_offset_2); + DUMP_CL(IOGPU_CLEAR_Z_S, ((uint32_t *) cmdbuf->ptr.cpu) + 276, "Clear Z/S"); + uint32_t *attachments = (uint32_t *) ((uint8_t *) cmdbuf->ptr.cpu + cmd.attachment_offset_1); unsigned attachment_count = attachments[3]; for (unsigned i = 0; i < attachment_count; ++i) { diff --git a/src/gallium/drivers/asahi/magic.c b/src/gallium/drivers/asahi/magic.c index 2c48bca..0452f2d 100644 --- a/src/gallium/drivers/asahi/magic.c +++ b/src/gallium/drivers/asahi/magic.c @@ -96,12 +96,12 @@ demo_cmdbuf(uint64_t *buf, size_t size, map[226] = unk_buffer_2 & 0xFFFFFFFF; map[227] = unk_buffer_2 >> 32; - float depth_clear = 1.0; - uint8_t stencil_clear = 0; + agx_pack(map + 276, IOGPU_CLEAR_Z_S, cfg) { + cfg.depth_clear_value = fui(1.0); // 32-bit float + cfg.stencil_clear_value = 0; + cfg.z16_unorm_attachment = false; + } - map[278] = fui(depth_clear); - map[279] = (0x3 << 8) | stencil_clear; - map[282] = 0x1000000; map[284] = 0xffffffff; map[285] = 0xffffffff; map[286] = 0xffffffff; -- 2.7.4