panfrost: XMLify job_type

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6195>
This commit is contained in:
Alyssa Rosenzweig
2020-08-05 18:40:44 -04:00
committed by Tomeu Vizoso
parent d2ddd4d565
commit 4b7056b8c8
9 changed files with 43 additions and 69 deletions
+4 -4
View File
@@ -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);
}
+1 -1
View File
@@ -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);
}
+1 -1
View File
@@ -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
};
+2 -2
View File
@@ -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 */
-13
View File
@@ -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,
+18 -44
View File
@@ -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;
+13
View File
@@ -1,3 +1,16 @@
<panxml>
<enum name="Job Type">
<value name="Not started" value="0"/>
<value name="Null" value="1"/>
<value name="Write value" value="2"/>
<value name="Cache flush" value="3"/>
<value name="Compute" value="4"/>
<value name="Vertex" value="5"/>
<value name="Geometry" value="6"/>
<value name="Tiler" value="7"/>
<value name="Fused" value="8"/>
<value name="Fragment" value="9"/>
</enum>
</panxml>
+1 -1
View File
@@ -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);
}
+3 -3
View File
@@ -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