panfrost: XMLify mali_func
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>
diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.c b/src/gallium/drivers/panfrost/pan_cmdstream.c
index 6eedf88..f155f61 100644
--- a/src/gallium/drivers/panfrost/pan_cmdstream.c
+++ b/src/gallium/drivers/panfrost/pan_cmdstream.c
@@ -369,7 +369,7 @@
return MALI_FUNC_GREATER;
case PIPE_FUNC_NOTEQUAL:
- return MALI_FUNC_NOTEQUAL;
+ return MALI_FUNC_NOT_EQUAL;
case PIPE_FUNC_GEQUAL:
return MALI_FUNC_GEQUAL;
diff --git a/src/panfrost/include/panfrost-job.h b/src/panfrost/include/panfrost-job.h
index cdfc6cc..e8f7aaaa 100644
--- a/src/panfrost/include/panfrost-job.h
+++ b/src/panfrost/include/panfrost-job.h
@@ -53,19 +53,6 @@
#define MALI_CULL_FACE_FRONT (1 << 6)
#define MALI_CULL_FACE_BACK (1 << 7)
-/* Used in stencil and depth tests */
-
-enum mali_func {
- MALI_FUNC_NEVER = 0,
- MALI_FUNC_LESS = 1,
- MALI_FUNC_EQUAL = 2,
- MALI_FUNC_LEQUAL = 3,
- MALI_FUNC_GREATER = 4,
- MALI_FUNC_NOTEQUAL = 5,
- MALI_FUNC_GEQUAL = 6,
- MALI_FUNC_ALWAYS = 7
-};
-
/* Flags apply to unknown2_3? */
#define MALI_HAS_MSAA (1 << 0)
diff --git a/src/panfrost/lib/decode.c b/src/panfrost/lib/decode.c
index 6d13333..69f995a 100644
--- a/src/panfrost/lib/decode.c
+++ b/src/panfrost/lib/decode.c
@@ -464,27 +464,6 @@
#undef DEFINE_CASE
-#define DEFINE_CASE(name) case MALI_FUNC_ ## name: return "MALI_FUNC_" #name
-static char *
-pandecode_func(enum mali_func mode)
-{
- switch (mode) {
- DEFINE_CASE(NEVER);
- DEFINE_CASE(LESS);
- DEFINE_CASE(EQUAL);
- DEFINE_CASE(LEQUAL);
- DEFINE_CASE(GREATER);
- DEFINE_CASE(NOTEQUAL);
- DEFINE_CASE(GEQUAL);
- DEFINE_CASE(ALWAYS);
-
- default:
- pandecode_msg("XXX: invalid func %X\n", mode);
- return "";
- }
-}
-#undef DEFINE_CASE
-
#define DEFINE_CASE(name) case MALI_MSAA_ ## name: return "MALI_MSAA_" #name
static char *
pandecode_msaa_mode(enum mali_msaa_mode mode)
@@ -1662,7 +1641,7 @@
if (any_nonzero == 0)
return;
- const char *func = pandecode_func(stencil->func);
+ const char *func = mali_func_as_str(stencil->func);
const char *sfail = pandecode_stencil_op(stencil->sfail);
const char *dpfail = pandecode_stencil_op(stencil->dpfail);
const char *dppass = pandecode_stencil_op(stencil->dppass);
@@ -2597,7 +2576,7 @@
pandecode_prop("wrap_t = %s", pandecode_wrap_mode(s->wrap_t));
pandecode_prop("wrap_r = %s", pandecode_wrap_mode(s->wrap_r));
- pandecode_prop("compare_func = %s", pandecode_func(s->compare_func));
+ pandecode_prop("compare_func = %s", mali_func_as_str(s->compare_func));
if (s->zero || s->zero2) {
pandecode_msg("XXX: sampler zero tripped\n");
@@ -2750,7 +2729,7 @@
/* We're not quite sure what these flags mean without the depth test, if anything */
if (unknown2_3 & (MALI_DEPTH_WRITEMASK | MALI_DEPTH_FUNC_MASK)) {
- const char *func = pandecode_func(MALI_GET_DEPTH_FUNC(unknown2_3));
+ const char *func = mali_func_as_str(MALI_GET_DEPTH_FUNC(unknown2_3));
unknown2_3 &= ~MALI_DEPTH_FUNC_MASK;
pandecode_log_cont("MALI_DEPTH_FUNC(%s) | ", func);
diff --git a/src/panfrost/lib/midgard.xml b/src/panfrost/lib/midgard.xml
index 010f879..b755814 100644
--- a/src/panfrost/lib/midgard.xml
+++ b/src/panfrost/lib/midgard.xml
@@ -27,4 +27,15 @@
<value name="Quad strip" value="15"/>
</enum>
+ <enum name="Func">
+ <value name="Never" value="0"/>
+ <value name="Less" value="1"/>
+ <value name="Equal" value="2"/>
+ <value name="Lequal" value="3"/>
+ <value name="Greater" value="4"/>
+ <value name="Not Equal" value="5"/>
+ <value name="Gequal" value="6"/>
+ <value name="Always" value="7"/>
+ </enum>
+
</panxml>