From 32dbc80979e18d119105e46cb37c4bc9890fb6a9 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Wed, 5 Aug 2020 18:44:36 -0400 Subject: [PATCH] panfrost: XMLify draw_mode Signed-off-by: Alyssa Rosenzweig Reviewed-by: Tomeu Vizoso Part-of: --- src/gallium/drivers/panfrost/pan_cmdstream.c | 2 +- src/gallium/drivers/panfrost/pan_context.c | 2 +- src/panfrost/include/panfrost-job.h | 16 ----------- src/panfrost/lib/decode.c | 30 ++------------------ src/panfrost/lib/midgard.xml | 14 +++++++++ src/panfrost/lib/pan_blit.c | 2 +- 6 files changed, 19 insertions(+), 47 deletions(-) diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.c b/src/gallium/drivers/panfrost/pan_cmdstream.c index 3af812f3e85..6eedf888fbd 100644 --- a/src/gallium/drivers/panfrost/pan_cmdstream.c +++ b/src/gallium/drivers/panfrost/pan_cmdstream.c @@ -101,7 +101,7 @@ panfrost_vt_update_primitive_size(struct panfrost_context *ctx, struct panfrost_rasterizer *rasterizer = ctx->rasterizer; if (!panfrost_writes_point_size(ctx)) { - bool points = prefix->draw_mode == MALI_POINTS; + bool points = prefix->draw_mode == MALI_DRAW_MODE_POINTS; float val = 0.0f; if (rasterizer) diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c index 78fa9628668..bb4ba3b8f45 100644 --- a/src/gallium/drivers/panfrost/pan_context.c +++ b/src/gallium/drivers/panfrost/pan_context.c @@ -265,7 +265,7 @@ panfrost_texture_barrier(struct pipe_context *pipe, unsigned flags) panfrost_flush_all_batches(ctx, 0); } -#define DEFINE_CASE(c) case PIPE_PRIM_##c: return MALI_##c; +#define DEFINE_CASE(c) case PIPE_PRIM_##c: return MALI_DRAW_MODE_##c; static int g2m_draw_mode(enum pipe_prim_type mode) diff --git a/src/panfrost/include/panfrost-job.h b/src/panfrost/include/panfrost-job.h index 5c7664ead78..cdfc6ccc97a 100644 --- a/src/panfrost/include/panfrost-job.h +++ b/src/panfrost/include/panfrost-job.h @@ -38,22 +38,6 @@ typedef uint32_t u32; typedef uint64_t u64; typedef uint64_t mali_ptr; -enum mali_draw_mode { - MALI_DRAW_NONE = 0x0, - MALI_POINTS = 0x1, - MALI_LINES = 0x2, - MALI_LINE_STRIP = 0x4, - MALI_LINE_LOOP = 0x6, - MALI_TRIANGLES = 0x8, - MALI_TRIANGLE_STRIP = 0xA, - MALI_TRIANGLE_FAN = 0xC, - MALI_POLYGON = 0xD, - MALI_QUADS = 0xE, - MALI_QUAD_STRIP = 0xF, - - /* All other modes invalid */ -}; - /* Applies to tiler_gl_enables */ #define MALI_OCCLUSION_QUERY (1 << 3) diff --git a/src/panfrost/lib/decode.c b/src/panfrost/lib/decode.c index 79201030a12..6d13333d83a 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_draw_mode(enum mali_draw_mode mode) -{ -#define DEFINE_CASE(name) case MALI_ ## name: return "MALI_" #name - - switch (mode) { - DEFINE_CASE(DRAW_NONE); - DEFINE_CASE(POINTS); - DEFINE_CASE(LINES); - DEFINE_CASE(TRIANGLES); - DEFINE_CASE(TRIANGLE_STRIP); - DEFINE_CASE(TRIANGLE_FAN); - DEFINE_CASE(LINE_STRIP); - DEFINE_CASE(LINE_LOOP); - DEFINE_CASE(POLYGON); - DEFINE_CASE(QUADS); - DEFINE_CASE(QUAD_STRIP); - - default: - pandecode_msg("XXX: invalid draw mode %X\n", mode); - return ""; - } - -#undef DEFINE_CASE -} - #define DEFINE_CASE(name) case MALI_FUNC_ ## name: return "MALI_FUNC_" #name static char * pandecode_func(enum mali_func mode) @@ -2013,8 +1987,8 @@ pandecode_vertex_tiler_prefix(struct mali_vertex_tiler_prefix *p, int job_no, bo pandecode_prop("workgroups_x_shift_3 = 0x%" PRIx32, p->workgroups_x_shift_3); - if (p->draw_mode != MALI_DRAW_NONE) - pandecode_prop("draw_mode = %s", pandecode_draw_mode(p->draw_mode)); + if (p->draw_mode != MALI_DRAW_MODE_NONE) + pandecode_prop("draw_mode = %s", mali_draw_mode_as_str(p->draw_mode)); /* Index count only exists for tiler jobs anyway */ diff --git a/src/panfrost/lib/midgard.xml b/src/panfrost/lib/midgard.xml index 82eabf78e07..010f8797d20 100644 --- a/src/panfrost/lib/midgard.xml +++ b/src/panfrost/lib/midgard.xml @@ -13,4 +13,18 @@ + + + + + + + + + + + + + + diff --git a/src/panfrost/lib/pan_blit.c b/src/panfrost/lib/pan_blit.c index a7e1928a39c..a9289de35f9 100644 --- a/src/panfrost/lib/pan_blit.c +++ b/src/panfrost/lib/pan_blit.c @@ -346,7 +346,7 @@ panfrost_load_midg( struct midgard_payload_vertex_tiler payload = { .prefix = { - .draw_mode = MALI_TRIANGLES, + .draw_mode = MALI_DRAW_MODE_TRIANGLES, .unknown_draw = 0x3000, .index_count = MALI_POSITIVE(vertex_count) }, -- 2.30.2