panfrost: XMLify draw_mode
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Wed, 5 Aug 2020 22:44:36 +0000 (18:44 -0400)
committerTomeu Vizoso <tomeu.vizoso@collabora.com>
Thu, 13 Aug 2020 06:55:15 +0000 (08:55 +0200)
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>

src/gallium/drivers/panfrost/pan_cmdstream.c
src/gallium/drivers/panfrost/pan_context.c
src/panfrost/include/panfrost-job.h
src/panfrost/lib/decode.c
src/panfrost/lib/midgard.xml
src/panfrost/lib/pan_blit.c

index 3af812f3e859f62d723baad6ee231840e2602b4a..6eedf888fbd9a1f26d47eccdb9b7188a1ad98a3d 100644 (file)
@@ -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)
index 78fa96286688b6b8b12c9c79984bd35078567a6c..bb4ba3b8f458aa76211d754c27c1a60ae79d9bbe 100644 (file)
@@ -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)
index 5c7664ead782d28460d0a309dee696e49b470fdd..cdfc6ccc97a189f9df93b70523779334d03be922 100644 (file)
@@ -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)
index 79201030a12d50e35ffe2357df52cbf036405268..6d13333d83a3de2b3cbf6a3a1f05a179493e22a8 100644 (file)
@@ -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 */
 
index 82eabf78e07ccf0053242e3363c961bc92aa5c46..010f8797d2030de2b4754f92b7853f5bf25607e3 100644 (file)
     <value name="Fragment" value="9"/>
   </enum>
 
+  <enum name="Draw Mode">
+    <value name="None" value="0"/>
+    <value name="Points" value="1"/>
+    <value name="Lines" value="2"/>
+    <value name="Line strip" value="4"/>
+    <value name="Line loop" value="6"/>
+    <value name="Triangles" value="8"/>
+    <value name="Triangle strip" value="10"/>
+    <value name="Triangle fan" value="12"/>
+    <value name="Polygon" value="13"/>
+    <value name="Quads" value="14"/>
+    <value name="Quad strip" value="15"/>
+  </enum>
+
 </panxml>
index a7e1928a39cbe216b6add5963af84c433ee99c48..a9289de35f93304cc3a367d99bef2b8cad1c6433 100644 (file)
@@ -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)
                 },