panfrost: XMLify wrap modes
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Wed, 5 Aug 2020 22:53:41 +0000 (18:53 -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/panfrost/include/panfrost-job.h
src/panfrost/lib/decode.c
src/panfrost/lib/midgard.xml
src/panfrost/lib/pan_blit.c

index c1a5ebbf3ea96d83cff936e2722742c9f5d8a84e..bf1efa42256b2ec914893317bc3b164ad8259686 100644 (file)
@@ -420,28 +420,28 @@ translate_tex_wrap(enum pipe_tex_wrap w)
 {
         switch (w) {
         case PIPE_TEX_WRAP_REPEAT:
-                return MALI_WRAP_REPEAT;
+                return MALI_WRAP_MODE_REPEAT;
 
         case PIPE_TEX_WRAP_CLAMP:
-                return MALI_WRAP_CLAMP;
+                return MALI_WRAP_MODE_CLAMP;
 
         case PIPE_TEX_WRAP_CLAMP_TO_EDGE:
-                return MALI_WRAP_CLAMP_TO_EDGE;
+                return MALI_WRAP_MODE_CLAMP_TO_EDGE;
 
         case PIPE_TEX_WRAP_CLAMP_TO_BORDER:
-                return MALI_WRAP_CLAMP_TO_BORDER;
+                return MALI_WRAP_MODE_CLAMP_TO_BORDER;
 
         case PIPE_TEX_WRAP_MIRROR_REPEAT:
-                return MALI_WRAP_MIRRORED_REPEAT;
+                return MALI_WRAP_MODE_MIRRORED_REPEAT;
 
         case PIPE_TEX_WRAP_MIRROR_CLAMP:
-                return MALI_WRAP_MIRRORED_CLAMP;
+                return MALI_WRAP_MODE_MIRRORED_CLAMP;
 
         case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_EDGE:
-                return MALI_WRAP_MIRRORED_CLAMP_TO_EDGE;
+                return MALI_WRAP_MODE_MIRRORED_CLAMP_TO_EDGE;
 
         case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_BORDER:
-                return MALI_WRAP_MIRRORED_CLAMP_TO_BORDER;
+                return MALI_WRAP_MODE_MIRRORED_CLAMP_TO_BORDER;
 
         default:
                 unreachable("Invalid wrap");
index 99d3d85f1bc58a4eacf2348a6fef79652f153d08..db92c13c3ab737bda936fb8912153fa80987f8f1 100644 (file)
@@ -1170,19 +1170,6 @@ struct bifrost_payload_fused {
 
 #define MALI_POSITIVE(dim) (dim - 1)
 
-/* Used with wrapping. Unclear what top bit conveys */
-
-enum mali_wrap_mode {
-        MALI_WRAP_REPEAT                   = 0x8 |       0x0,
-        MALI_WRAP_CLAMP_TO_EDGE            = 0x8 |       0x1,
-        MALI_WRAP_CLAMP                    = 0x8 |       0x2,
-        MALI_WRAP_CLAMP_TO_BORDER          = 0x8 |       0x3,
-        MALI_WRAP_MIRRORED_REPEAT          = 0x8 | 0x4 | 0x0,
-        MALI_WRAP_MIRRORED_CLAMP_TO_EDGE   = 0x8 | 0x4 | 0x1,
-        MALI_WRAP_MIRRORED_CLAMP           = 0x8 | 0x4 | 0x2,
-        MALI_WRAP_MIRRORED_CLAMP_TO_BORDER = 0x8 | 0x4 | 0x3,
-};
-
 /* Shared across both command stream and Midgard, and even with Bifrost */
 
 enum mali_texture_type {
index 66bd6827bf88230c37103ddd3858e57fefcf415a..fa9e6c5f01b77d36e8fddc65277d0deb0577c3ce 100644 (file)
@@ -521,27 +521,6 @@ pandecode_special_record(uint64_t v, bool* attribute)
         }
 }
 
-#define DEFINE_CASE(name) case MALI_WRAP_## name: return "MALI_WRAP_" #name
-static char *
-pandecode_wrap_mode(enum mali_wrap_mode op)
-{
-        switch (op) {
-                DEFINE_CASE(REPEAT);
-                DEFINE_CASE(CLAMP_TO_EDGE);
-                DEFINE_CASE(CLAMP);
-                DEFINE_CASE(CLAMP_TO_BORDER);
-                DEFINE_CASE(MIRRORED_REPEAT);
-                DEFINE_CASE(MIRRORED_CLAMP_TO_EDGE);
-                DEFINE_CASE(MIRRORED_CLAMP);
-                DEFINE_CASE(MIRRORED_CLAMP_TO_BORDER);
-
-        default:
-                pandecode_msg("XXX: invalid wrap mode %X\n", op);
-                return "";
-        }
-}
-#undef DEFINE_CASE
-
 #define DEFINE_CASE(name) case MALI_BLOCK_## name: return "MALI_BLOCK_" #name
 static char *
 pandecode_block_format(enum mali_block_format fmt)
@@ -2503,9 +2482,9 @@ pandecode_samplers(mali_ptr samplers, unsigned sampler_count, int job_no, bool i
                                 pandecode_prop("unk1 = 0x%x", s->unk1);
                         }
 
-                        pandecode_prop("wrap_s = %s", pandecode_wrap_mode(s->wrap_s));
-                        pandecode_prop("wrap_t = %s", pandecode_wrap_mode(s->wrap_t));
-                        pandecode_prop("wrap_r = %s", pandecode_wrap_mode(s->wrap_r));
+                        pandecode_prop("wrap_s = %s", mali_wrap_mode_as_str(s->wrap_s));
+                        pandecode_prop("wrap_t = %s", mali_wrap_mode_as_str(s->wrap_t));
+                        pandecode_prop("wrap_r = %s", mali_wrap_mode_as_str(s->wrap_r));
 
                         if (s->unk8 != 0x8) {
                                 pandecode_msg("XXX: unk8 tripped\n");
@@ -2550,9 +2529,9 @@ pandecode_samplers(mali_ptr samplers, unsigned sampler_count, int job_no, bool i
                         if (s->lod_bias)
                                 pandecode_prop("lod_bias = FIXED_16(%f)", DECODE_FIXED_16(s->lod_bias));
 
-                        pandecode_prop("wrap_s = %s", pandecode_wrap_mode(s->wrap_s));
-                        pandecode_prop("wrap_t = %s", pandecode_wrap_mode(s->wrap_t));
-                        pandecode_prop("wrap_r = %s", pandecode_wrap_mode(s->wrap_r));
+                        pandecode_prop("wrap_s = %s", mali_wrap_mode_as_str(s->wrap_s));
+                        pandecode_prop("wrap_t = %s", mali_wrap_mode_as_str(s->wrap_t));
+                        pandecode_prop("wrap_r = %s", mali_wrap_mode_as_str(s->wrap_r));
 
                         pandecode_prop("compare_func = %s", mali_func_as_str(s->compare_func));
 
index 3a9351afe6e6677880b293c4d35d62323e557fac..e811c27dc4cfbe6c80992a3f1513a8f95bf5bf1b 100644 (file)
     <value name="Decr Sat" value="7"/>
   </enum>
 
+  <enum name="Wrap Mode">
+    <value name="Repeat" value="8"/>
+    <value name="Clamp to Edge" value="9"/>
+    <value name="Clamp" value="10"/>
+    <value name="Clamp to Border" value="11"/>
+    <value name="Mirrored Repeat" value="12"/>
+    <value name="Mirrored Clamp to Edge" value="13"/>
+    <value name="Mirrored Clamp" value="14"/>
+    <value name="Mirrored Clamp to Border" value="15"/>
+  </enum>
+
 </panxml>
index 7d5b10de9b0203d60620a48d7fd5312a17596fbd..041059eeda11f4df3b0579e1f4d3c1f3248ba219 100644 (file)
@@ -313,9 +313,9 @@ panfrost_load_midg(
 
         struct mali_sampler_descriptor sampler = {
                 .filter_mode = MALI_SAMP_MAG_NEAREST | MALI_SAMP_MIN_NEAREST,
-                .wrap_s = MALI_WRAP_CLAMP_TO_EDGE,
-                .wrap_t = MALI_WRAP_CLAMP_TO_EDGE,
-                .wrap_r = MALI_WRAP_CLAMP_TO_EDGE,
+                .wrap_s = MALI_WRAP_MODE_CLAMP_TO_EDGE,
+                .wrap_t = MALI_WRAP_MODE_CLAMP_TO_EDGE,
+                .wrap_r = MALI_WRAP_MODE_CLAMP_TO_EDGE,
         };
 
         struct panfrost_transfer shader_meta_t = panfrost_pool_alloc(pool, sizeof(shader_meta) + 8 * sizeof(struct midgard_blend_rt));