summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <alyssa@rosenzweig.io>2023-02-02 00:24:11 -0500
committerAlyssa Rosenzweig <alyssa@rosenzweig.io>2023-02-04 10:32:38 -0500
commit507ca71f3e9d03c6e9c66e3f9a471ac6ac717af1 (patch)
treef34ab2e5001866409e535f02480b03afbef39132 /src
parentafce5be65906e972e7def642660d4545ce1441ff (diff)
agx/decode: Handle extended samplers
These include a border colour field. Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20570>
Diffstat (limited to 'src')
-rw-r--r--src/asahi/lib/decode.c27
1 files changed, 24 insertions, 3 deletions
diff --git a/src/asahi/lib/decode.c b/src/asahi/lib/decode.c
index 9b790cfd91d..67b3faf3b37 100644
--- a/src/asahi/lib/decode.c
+++ b/src/asahi/lib/decode.c
@@ -330,8 +330,14 @@ static unsigned
agxdecode_usc(const uint8_t *map, UNUSED uint64_t *link, UNUSED bool verbose,
UNUSED void *data)
{
+ enum agx_sampler_states *sampler_states = data;
enum agx_usc_control type = map[0];
+ bool extended_samplers =
+ (sampler_states != NULL) &&
+ (((*sampler_states) == AGX_SAMPLER_STATES_8_EXTENDED) ||
+ ((*sampler_states) == AGX_SAMPLER_STATES_16_EXTENDED));
+
#define USC_CASE(name, human) \
case AGX_USC_CONTROL_##name: { \
DUMP_CL(USC_##name, map, human); \
@@ -376,6 +382,11 @@ agxdecode_usc(const uint8_t *map, UNUSED uint64_t *link, UNUSED bool verbose,
for (unsigned i = 0; i < temp.count; ++i) {
DUMP_CL(SAMPLER, samp, "Sampler");
samp += AGX_SAMPLER_LENGTH;
+
+ if (extended_samplers) {
+ DUMP_CL(BORDER, samp, "Border");
+ samp += AGX_BORDER_LENGTH;
+ }
}
return AGX_USC_SAMPLER_LENGTH;
@@ -462,7 +473,7 @@ agxdecode_record(uint64_t va, size_t size, bool verbose)
if (hdr.fragment_shader) {
agx_unpack(agxdecode_dump_stream, map, FRAGMENT_SHADER, frag);
agxdecode_stateful(frag.pipeline, "Fragment pipeline", agxdecode_usc,
- verbose, NULL);
+ verbose, &frag.sampler_state_register_count);
if (frag.cf_bindings) {
uint8_t *cf = agxdecode_fetch_gpu_mem(frag.cf_bindings, 128);
@@ -503,7 +514,7 @@ agxdecode_cdm(const uint8_t *map, uint64_t *link, bool verbose,
case AGX_CDM_BLOCK_TYPE_COMPUTE_KERNEL: {
agx_unpack(agxdecode_dump_stream, map, LAUNCH, cmd);
agxdecode_stateful(cmd.pipeline, "Pipeline", agxdecode_usc, verbose,
- NULL);
+ &cmd.sampler_state_register_count);
DUMP_UNPACKED(LAUNCH, cmd, "Launch\n");
return AGX_LAUNCH_LENGTH;
}
@@ -563,6 +574,16 @@ agxdecode_vdm(const uint8_t *map, uint64_t *link, bool verbose,
}
VDM_PRINT(restart_index, RESTART_INDEX, "Restart index");
+
+ /* If word 1 is present but word 0 is not, fallback to compact samplers */
+ enum agx_sampler_states sampler_states = 0;
+
+ if (hdr.vertex_shader_word_0_present) {
+ agx_unpack(agxdecode_dump_stream, map, VDM_STATE_VERTEX_SHADER_WORD_0,
+ word_0);
+ sampler_states = word_0.sampler_state_register_count;
+ }
+
VDM_PRINT(vertex_shader_word_0, VERTEX_SHADER_WORD_0,
"Vertex shader word 0");
@@ -572,7 +593,7 @@ agxdecode_vdm(const uint8_t *map, uint64_t *link, bool verbose,
fprintf(agxdecode_dump_stream, "Pipeline %X\n",
(uint32_t)word_1.pipeline);
agxdecode_stateful(word_1.pipeline, "Pipeline", agxdecode_usc, verbose,
- NULL);
+ &sampler_states);
}
VDM_PRINT(vertex_shader_word_1, VERTEX_SHADER_WORD_1,