panfrost: XMLify wrap modes
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 c1a5ebb..bf1efa4 100644
--- a/src/gallium/drivers/panfrost/pan_cmdstream.c
+++ b/src/gallium/drivers/panfrost/pan_cmdstream.c
@@ -420,28 +420,28 @@
{
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");
diff --git a/src/panfrost/include/panfrost-job.h b/src/panfrost/include/panfrost-job.h
index 99d3d85..db92c13 100644
--- a/src/panfrost/include/panfrost-job.h
+++ b/src/panfrost/include/panfrost-job.h
@@ -1170,19 +1170,6 @@
#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 {
diff --git a/src/panfrost/lib/decode.c b/src/panfrost/lib/decode.c
index 66bd682..fa9e6c5 100644
--- a/src/panfrost/lib/decode.c
+++ b/src/panfrost/lib/decode.c
@@ -521,27 +521,6 @@
}
}
-#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_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 @@
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));
diff --git a/src/panfrost/lib/midgard.xml b/src/panfrost/lib/midgard.xml
index 3a9351a..e811c27 100644
--- a/src/panfrost/lib/midgard.xml
+++ b/src/panfrost/lib/midgard.xml
@@ -49,4 +49,15 @@
<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>
diff --git a/src/panfrost/lib/pan_blit.c b/src/panfrost/lib/pan_blit.c
index 7d5b10d..041059e 100644
--- a/src/panfrost/lib/pan_blit.c
+++ b/src/panfrost/lib/pan_blit.c
@@ -313,9 +313,9 @@
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));