summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>2020-08-05 18:53:41 -0400
committerTomeu Vizoso <tomeu.vizoso@collabora.com>2020-08-13 08:55:15 +0200
commitef20691e3d81021fcb246468e1a170220591617d (patch)
treea4319648f2560c26c51f597c42e1aeb28573d1d1
parente9ca3204619b1b090d660b61cc69460e7e1e2d99 (diff)
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>
-rw-r--r--src/gallium/drivers/panfrost/pan_cmdstream.c16
-rw-r--r--src/panfrost/include/panfrost-job.h13
-rw-r--r--src/panfrost/lib/decode.c33
-rw-r--r--src/panfrost/lib/midgard.xml11
-rw-r--r--src/panfrost/lib/pan_blit.c6
5 files changed, 28 insertions, 51 deletions
diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.c b/src/gallium/drivers/panfrost/pan_cmdstream.c
index c1a5ebbf3ea..bf1efa42256 100644
--- a/src/gallium/drivers/panfrost/pan_cmdstream.c
+++ b/src/gallium/drivers/panfrost/pan_cmdstream.c
@@ -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");
diff --git a/src/panfrost/include/panfrost-job.h b/src/panfrost/include/panfrost-job.h
index 99d3d85f1bc..db92c13c3ab 100644
--- a/src/panfrost/include/panfrost-job.h
+++ b/src/panfrost/include/panfrost-job.h
@@ -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 {
diff --git a/src/panfrost/lib/decode.c b/src/panfrost/lib/decode.c
index 66bd6827bf8..fa9e6c5f01b 100644
--- a/src/panfrost/lib/decode.c
+++ b/src/panfrost/lib/decode.c
@@ -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));
diff --git a/src/panfrost/lib/midgard.xml b/src/panfrost/lib/midgard.xml
index 3a9351afe6e..e811c27dc4c 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 7d5b10de9b0..041059eeda1 100644
--- a/src/panfrost/lib/pan_blit.c
+++ b/src/panfrost/lib/pan_blit.c
@@ -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));