From 4b7056b8c8a384819a00908b76be8bf4d407cdb6 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Wed, 5 Aug 2020 18:40:44 -0400 Subject: [PATCH] panfrost: XMLify job_type Signed-off-by: Alyssa Rosenzweig Reviewed-by: Tomeu Vizoso Part-of: --- src/gallium/drivers/panfrost/pan_cmdstream.c | 8 +-- src/gallium/drivers/panfrost/pan_compute.c | 2 +- src/gallium/drivers/panfrost/pan_fragment.c | 2 +- src/panfrost/bifrost/test/bi_submit.c | 4 +- src/panfrost/include/panfrost-job.h | 13 ---- src/panfrost/lib/decode.c | 62 ++++++-------------- src/panfrost/lib/midgard.xml | 13 ++++ src/panfrost/lib/pan_blit.c | 2 +- src/panfrost/lib/pan_scoreboard.c | 6 +- 9 files changed, 43 insertions(+), 69 deletions(-) diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.c b/src/gallium/drivers/panfrost/pan_cmdstream.c index 756520c5ffe..3af812f3e85 100644 --- a/src/gallium/drivers/panfrost/pan_cmdstream.c +++ b/src/gallium/drivers/panfrost/pan_cmdstream.c @@ -2207,9 +2207,9 @@ panfrost_emit_vertex_tiler_jobs(struct panfrost_batch *batch, if (wallpapering) { /* Inject in reverse order, with "predicted" job indices. * THIS IS A HACK XXX */ - panfrost_new_job(&batch->pool, &batch->scoreboard, JOB_TYPE_TILER, false, + panfrost_new_job(&batch->pool, &batch->scoreboard, MALI_JOB_TYPE_TILER, false, batch->scoreboard.job_index + 2, tp, tp_size, true); - panfrost_new_job(&batch->pool, &batch->scoreboard, JOB_TYPE_VERTEX, false, 0, + panfrost_new_job(&batch->pool, &batch->scoreboard, MALI_JOB_TYPE_VERTEX, false, 0, vp, vp_size, true); return; } @@ -2219,13 +2219,13 @@ panfrost_emit_vertex_tiler_jobs(struct panfrost_batch *batch, bool rasterizer_discard = ctx->rasterizer && ctx->rasterizer->base.rasterizer_discard; - unsigned vertex = panfrost_new_job(&batch->pool, &batch->scoreboard, JOB_TYPE_VERTEX, false, 0, + unsigned vertex = panfrost_new_job(&batch->pool, &batch->scoreboard, MALI_JOB_TYPE_VERTEX, false, 0, vp, vp_size, false); if (rasterizer_discard) return; - panfrost_new_job(&batch->pool, &batch->scoreboard, JOB_TYPE_TILER, false, vertex, tp, tp_size, + panfrost_new_job(&batch->pool, &batch->scoreboard, MALI_JOB_TYPE_TILER, false, vertex, tp, tp_size, false); } diff --git a/src/gallium/drivers/panfrost/pan_compute.c b/src/gallium/drivers/panfrost/pan_compute.c index 4abb414091a..64d86844844 100644 --- a/src/gallium/drivers/panfrost/pan_compute.c +++ b/src/gallium/drivers/panfrost/pan_compute.c @@ -133,7 +133,7 @@ panfrost_launch_grid(struct pipe_context *pipe, false); panfrost_new_job(&batch->pool, &batch->scoreboard, - JOB_TYPE_COMPUTE, true, 0, &payload, + MALI_JOB_TYPE_COMPUTE, true, 0, &payload, sizeof(payload), false); panfrost_flush_all_batches(ctx, 0); } diff --git a/src/gallium/drivers/panfrost/pan_fragment.c b/src/gallium/drivers/panfrost/pan_fragment.c index 0b37fec07c0..6e4875ba171 100644 --- a/src/gallium/drivers/panfrost/pan_fragment.c +++ b/src/gallium/drivers/panfrost/pan_fragment.c @@ -69,7 +69,7 @@ panfrost_fragment_job(struct panfrost_batch *batch, bool has_draws) panfrost_initialize_surface(batch, fb->zsbuf); struct mali_job_descriptor_header header = { - .job_type = JOB_TYPE_FRAGMENT, + .job_type = MALI_JOB_TYPE_FRAGMENT, .job_index = 1, .job_descriptor_size = 1 }; diff --git a/src/panfrost/bifrost/test/bi_submit.c b/src/panfrost/bifrost/test/bi_submit.c index f11fea3bd2c..a131adda55a 100644 --- a/src/panfrost/bifrost/test/bi_submit.c +++ b/src/panfrost/bifrost/test/bi_submit.c @@ -117,7 +117,7 @@ bit_sanity_check(struct panfrost_device *dev) }; struct panfrost_bo *bos[] = { scratch }; - bool success = bit_submit(dev, JOB_TYPE_WRITE_VALUE, + bool success = bit_submit(dev, MALI_JOB_TYPE_WRITE_VALUE, &payload, sizeof(payload), bos, 1, false); return success && (((uint8_t *) scratch->cpu)[0] == 0x0); @@ -224,7 +224,7 @@ bit_vertex(struct panfrost_device *dev, panfrost_program prog, scratchpad, shmem, shader, shader_desc, ubo, var, attr }; - bool succ = bit_submit(dev, JOB_TYPE_VERTEX, &payload, + bool succ = bit_submit(dev, MALI_JOB_TYPE_VERTEX, &payload, sizeof(payload), bos, ARRAY_SIZE(bos), debug); /* Check the output varyings */ diff --git a/src/panfrost/include/panfrost-job.h b/src/panfrost/include/panfrost-job.h index a282c6e32e1..5c7664ead78 100644 --- a/src/panfrost/include/panfrost-job.h +++ b/src/panfrost/include/panfrost-job.h @@ -38,19 +38,6 @@ typedef uint32_t u32; typedef uint64_t u64; typedef uint64_t mali_ptr; -enum mali_job_type { - JOB_NOT_STARTED = 0, - JOB_TYPE_NULL = 1, - JOB_TYPE_WRITE_VALUE = 2, - JOB_TYPE_CACHE_FLUSH = 3, - JOB_TYPE_COMPUTE = 4, - JOB_TYPE_VERTEX = 5, - JOB_TYPE_GEOMETRY = 6, - JOB_TYPE_TILER = 7, - JOB_TYPE_FUSED = 8, - JOB_TYPE_FRAGMENT = 9, -}; - enum mali_draw_mode { MALI_DRAW_NONE = 0x0, MALI_POINTS = 0x1, diff --git a/src/panfrost/lib/decode.c b/src/panfrost/lib/decode.c index 059a74d24aa..79201030a12 100644 --- a/src/panfrost/lib/decode.c +++ b/src/panfrost/lib/decode.c @@ -464,32 +464,6 @@ static char *pandecode_format(enum mali_format format) #undef DEFINE_CASE -static char * -pandecode_job_type(enum mali_job_type type) -{ -#define DEFINE_CASE(name) case JOB_TYPE_ ## name: return "JOB_TYPE_" #name - - switch (type) { - DEFINE_CASE(NULL); - DEFINE_CASE(WRITE_VALUE); - DEFINE_CASE(CACHE_FLUSH); - DEFINE_CASE(COMPUTE); - DEFINE_CASE(VERTEX); - DEFINE_CASE(TILER); - DEFINE_CASE(FUSED); - DEFINE_CASE(FRAGMENT); - - case JOB_NOT_STARTED: - return "NOT_STARTED"; - - default: - pandecode_log("Warning! Unknown job type %x\n", type); - return "!?!?!?"; - } - -#undef DEFINE_CASE -} - static char * pandecode_draw_mode(enum mali_draw_mode mode) { @@ -2115,9 +2089,9 @@ static const char * shader_type_for_job(unsigned type) { switch (type) { - case JOB_TYPE_VERTEX: return "VERTEX"; - case JOB_TYPE_TILER: return "FRAGMENT"; - case JOB_TYPE_COMPUTE: return "COMPUTE"; + case MALI_JOB_TYPE_VERTEX: return "VERTEX"; + case MALI_JOB_TYPE_TILER: return "FRAGMENT"; + case MALI_JOB_TYPE_COMPUTE: return "COMPUTE"; default: return "UNKNOWN"; } @@ -2161,14 +2135,14 @@ pandecode_shader_disassemble(mali_ptr shader_ptr, int shader_no, int type, } else { stats = disassemble_midgard(pandecode_dump_stream, code, sz, gpu_id, - type == JOB_TYPE_TILER ? + type == MALI_JOB_TYPE_TILER ? MESA_SHADER_FRAGMENT : MESA_SHADER_VERTEX); } /* Print shader-db stats. Skip COMPUTE jobs since they are used for * driver-internal purposes with the blob and interfere */ - bool should_shaderdb = type != JOB_TYPE_COMPUTE; + bool should_shaderdb = type != MALI_JOB_TYPE_COMPUTE; if (should_shaderdb) { unsigned nr_threads = @@ -2693,8 +2667,8 @@ pandecode_vertex_tiler_postfix_pre( pandecode_log_cont("\t/* %X %/\n", p->shared_memory & 1); pandecode_compute_fbd(p->shared_memory & ~1, job_no); } else if (p->shared_memory & MALI_MFBD) - fbd_info = pandecode_mfbd_bfr((u64) ((uintptr_t) p->shared_memory) & FBD_MASK, job_no, false, job_type == JOB_TYPE_COMPUTE, false); - else if (job_type == JOB_TYPE_COMPUTE) + fbd_info = pandecode_mfbd_bfr((u64) ((uintptr_t) p->shared_memory) & FBD_MASK, job_no, false, job_type == MALI_JOB_TYPE_COMPUTE, false); + else if (job_type == MALI_JOB_TYPE_COMPUTE) pandecode_compute_fbd((u64) (uintptr_t) p->shared_memory, job_no); else fbd_info = pandecode_sfbd((u64) (uintptr_t) p->shared_memory, job_no, false, gpu_id); @@ -2865,7 +2839,7 @@ pandecode_vertex_tiler_postfix_pre( /* MRT blend fields are used whenever MFBD is used, with * per-RT descriptors */ - if (job_type == JOB_TYPE_TILER && (is_bifrost || p->shared_memory & MALI_MFBD)) { + if (job_type == MALI_JOB_TYPE_TILER && (is_bifrost || p->shared_memory & MALI_MFBD)) { void* blend_base = (void *) (s + 1); for (unsigned i = 0; i < fbd_info.rt_count; i++) { @@ -2982,7 +2956,7 @@ pandecode_vertex_tiler_postfix(const struct mali_vertex_tiler_postfix *p, int jo pandecode_log(".postfix = {\n"); pandecode_indent++; - pandecode_gl_enables(p->gl_enables, JOB_TYPE_TILER); + pandecode_gl_enables(p->gl_enables, MALI_JOB_TYPE_TILER); pandecode_prop("instance_shift = 0x%x", p->instance_shift); pandecode_prop("instance_odd = 0x%x", p->instance_odd); @@ -3197,7 +3171,7 @@ pandecode_vertex_or_tiler_job_mdg(const struct mali_job_descriptor_header *h, mali_ptr payload, int job_no, unsigned gpu_id) { struct midgard_payload_vertex_tiler *PANDECODE_PTR_VAR(v, mem, payload); - bool is_graphics = (h->job_type == JOB_TYPE_VERTEX) || (h->job_type == JOB_TYPE_TILER); + bool is_graphics = (h->job_type == MALI_JOB_TYPE_VERTEX) || (h->job_type == MALI_JOB_TYPE_TILER); pandecode_vertex_tiler_postfix_pre(&v->postfix, job_no, h->job_type, "", false, gpu_id); @@ -3335,7 +3309,7 @@ pandecode_jc(mali_ptr jc_gpu_va, bool bifrost, unsigned gpu_id, bool minimal) * something else. */ int offset = h->job_descriptor_size == MALI_JOB_32 && - h->job_type != JOB_TYPE_FRAGMENT ? 4 : 0; + h->job_type != MALI_JOB_TYPE_FRAGMENT ? 4 : 0; mali_ptr payload_ptr = jc_gpu_va + sizeof(*h) - offset; payload = pandecode_fetch_gpu_mem(mem, payload_ptr, 256); @@ -3349,7 +3323,7 @@ pandecode_jc(mali_ptr jc_gpu_va, bool bifrost, unsigned gpu_id, bool minimal) pandecode_log("struct mali_job_descriptor_header job_%"PRIx64"_%d = {\n", jc_gpu_va, job_no); pandecode_indent++; - pandecode_prop("job_type = %s", pandecode_job_type(h->job_type)); + pandecode_prop("job_type = %s", mali_job_type_as_str(h->job_type)); if (h->job_descriptor_size) pandecode_prop("job_descriptor_size = %d", h->job_descriptor_size); @@ -3385,7 +3359,7 @@ pandecode_jc(mali_ptr jc_gpu_va, bool bifrost, unsigned gpu_id, bool minimal) pandecode_log("};\n"); switch (h->job_type) { - case JOB_TYPE_WRITE_VALUE: { + case MALI_JOB_TYPE_WRITE_VALUE: { struct mali_payload_write_value *s = payload; pandecode_log("struct mali_payload_write_value payload_%"PRIx64"_%d = {\n", payload_ptr, job_no); pandecode_indent++; @@ -3408,11 +3382,11 @@ pandecode_jc(mali_ptr jc_gpu_va, bool bifrost, unsigned gpu_id, bool minimal) break; } - case JOB_TYPE_TILER: - case JOB_TYPE_VERTEX: - case JOB_TYPE_COMPUTE: + case MALI_JOB_TYPE_TILER: + case MALI_JOB_TYPE_VERTEX: + case MALI_JOB_TYPE_COMPUTE: if (bifrost) { - if (h->job_type == JOB_TYPE_TILER) + if (h->job_type == MALI_JOB_TYPE_TILER) pandecode_tiler_job_bfr(h, mem, payload_ptr, job_no, gpu_id); else pandecode_vertex_job_bfr(h, mem, payload_ptr, job_no, gpu_id); @@ -3421,7 +3395,7 @@ pandecode_jc(mali_ptr jc_gpu_va, bool bifrost, unsigned gpu_id, bool minimal) break; - case JOB_TYPE_FRAGMENT: + case MALI_JOB_TYPE_FRAGMENT: pandecode_fragment_job(mem, payload_ptr, job_no, bifrost, gpu_id); break; diff --git a/src/panfrost/lib/midgard.xml b/src/panfrost/lib/midgard.xml index 569cc137ca5..82eabf78e07 100644 --- a/src/panfrost/lib/midgard.xml +++ b/src/panfrost/lib/midgard.xml @@ -1,3 +1,16 @@ + + + + + + + + + + + + + diff --git a/src/panfrost/lib/pan_blit.c b/src/panfrost/lib/pan_blit.c index e1cfb1e5b17..a7e1928a39c 100644 --- a/src/panfrost/lib/pan_blit.c +++ b/src/panfrost/lib/pan_blit.c @@ -366,5 +366,5 @@ panfrost_load_midg( panfrost_pack_work_groups_compute(&payload.prefix, 1, vertex_count, 1, 1, 1, 1, true); payload.prefix.workgroups_x_shift_3 = 6; - panfrost_new_job(pool, scoreboard, JOB_TYPE_TILER, false, 0, &payload, sizeof(payload), true); + panfrost_new_job(pool, scoreboard, MALI_JOB_TYPE_TILER, false, 0, &payload, sizeof(payload), true); } diff --git a/src/panfrost/lib/pan_scoreboard.c b/src/panfrost/lib/pan_scoreboard.c index c72c9a37c3a..85ae14df266 100644 --- a/src/panfrost/lib/pan_scoreboard.c +++ b/src/panfrost/lib/pan_scoreboard.c @@ -117,7 +117,7 @@ panfrost_new_job( { unsigned global_dep = 0; - if (type == JOB_TYPE_TILER) { + if (type == MALI_JOB_TYPE_TILER) { /* Tiler jobs must be chained, and on Midgard, the first tiler * job must depend on the write value job, whose index we * reserve now */ @@ -155,7 +155,7 @@ panfrost_new_job( } /* Form a chain */ - if (type == JOB_TYPE_TILER) + if (type == MALI_JOB_TYPE_TILER) scoreboard->tiler_dep = index; if (scoreboard->prev_job) @@ -183,7 +183,7 @@ panfrost_scoreboard_initialize_tiler(struct pan_pool *pool, * regardless of size. */ struct mali_job_descriptor_header job = { - .job_type = JOB_TYPE_WRITE_VALUE, + .job_type = MALI_JOB_TYPE_WRITE_VALUE, .job_index = scoreboard->write_value_index, .job_descriptor_size = 1, .next_job = scoreboard->first_job -- 2.30.2