Mesa (master): panfrost: Always pick dithered tb formats
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Apr 21 13:34:54 UTC 2021
Module: Mesa
Branch: master
Commit: fae90a794040de758abf223404240402c8e14b9f
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=fae90a794040de758abf223404240402c8e14b9f
Author: Alyssa Rosenzweig <alyssa at collabora.com>
Date: Mon Apr 12 12:42:50 2021 -0400
panfrost: Always pick dithered tb formats
Matches current logic and simplifies the code considerably.
Signed-off-by: Alyssa Rosenzweig <alyssa at collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10188>
---
src/gallium/drivers/panfrost/pan_cmdstream.c | 2 +-
src/panfrost/lib/pan_blend.c | 2 +-
src/panfrost/lib/pan_blitter.c | 2 +-
src/panfrost/lib/pan_format.c | 23 ++++++++++++-----------
src/panfrost/lib/pan_texture.h | 2 +-
5 files changed, 16 insertions(+), 15 deletions(-)
diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.c b/src/gallium/drivers/panfrost/pan_cmdstream.c
index 41bf00071bd..1c50dbf443f 100644
--- a/src/gallium/drivers/panfrost/pan_cmdstream.c
+++ b/src/gallium/drivers/panfrost/pan_cmdstream.c
@@ -358,7 +358,7 @@ panfrost_emit_bifrost_blend(struct panfrost_batch *batch,
*/
cfg.bifrost.internal.fixed_function.num_comps = 4;
cfg.bifrost.internal.fixed_function.conversion.memory_format =
- panfrost_format_to_bifrost_blend(dev, format, true);
+ panfrost_format_to_bifrost_blend(dev, format);
cfg.bifrost.internal.fixed_function.conversion.register_format =
bifrost_blend_type_from_nir(fs->info.bifrost.blend[i].type);
cfg.bifrost.internal.fixed_function.rt = i;
diff --git a/src/panfrost/lib/pan_blend.c b/src/panfrost/lib/pan_blend.c
index daef7d76824..f8830303a46 100644
--- a/src/panfrost/lib/pan_blend.c
+++ b/src/panfrost/lib/pan_blend.c
@@ -614,7 +614,7 @@ pan_blend_get_bifrost_desc(const struct panfrost_device *dev,
}
cfg.fixed_function.conversion.memory_format =
- panfrost_format_to_bifrost_blend(dev, fmt, true);
+ panfrost_format_to_bifrost_blend(dev, fmt);
}
return res;
diff --git a/src/panfrost/lib/pan_blitter.c b/src/panfrost/lib/pan_blitter.c
index ce6f9a8b11d..fe8279084a3 100644
--- a/src/panfrost/lib/pan_blitter.c
+++ b/src/panfrost/lib/pan_blitter.c
@@ -257,7 +257,7 @@ pan_blitter_emit_bifrost_blend(const struct panfrost_device *dev,
cfg.bifrost.equation.color_mask = 0xf;
cfg.bifrost.internal.fixed_function.num_comps = 4;
cfg.bifrost.internal.fixed_function.conversion.memory_format =
- panfrost_format_to_bifrost_blend(dev, iview->format, true);
+ panfrost_format_to_bifrost_blend(dev, iview->format);
cfg.bifrost.internal.fixed_function.conversion.register_format =
blit_type_to_reg_fmt(type);
diff --git a/src/panfrost/lib/pan_format.c b/src/panfrost/lib/pan_format.c
index 86c9db6e8f4..74328488e54 100644
--- a/src/panfrost/lib/pan_format.c
+++ b/src/panfrost/lib/pan_format.c
@@ -691,22 +691,23 @@ panfrost_invert_swizzle(const unsigned char *in, unsigned char *out)
}
}
+/* Formats requiring blend shaders are stored raw in the tilebuffer and will
+ * have 0 as their pixel format. Assumes dithering is set, I don't know of a
+ * case when it makes sense to turn off dithering. */
+
unsigned
panfrost_format_to_bifrost_blend(const struct panfrost_device *dev,
- enum pipe_format format, bool dither)
+ enum pipe_format format)
{
- struct pan_blendable_format fmt = panfrost_blendable_formats[format];
+ mali_pixel_format pixfmt =
+ panfrost_blendable_formats[format].bifrost_dither;
- /* Formats requiring blend shaders are stored raw in the tilebuffer */
- if (!fmt.internal)
+ if (pixfmt) {
+ return pixfmt | ((dev->quirks & HAS_SWIZZLES) ?
+ panfrost_get_default_swizzle(4) : 0);
+ } else {
return dev->formats[format].hw;
-
- unsigned extra = 0;
-
- if (dev->quirks & HAS_SWIZZLES)
- extra |= panfrost_get_default_swizzle(4);
-
- return (dither ? fmt.bifrost_dither : fmt.bifrost_no_dither) | extra;
+ }
}
enum mali_z_internal_format
diff --git a/src/panfrost/lib/pan_texture.h b/src/panfrost/lib/pan_texture.h
index 660d13bb6f0..d62bf8e2a2b 100644
--- a/src/panfrost/lib/pan_texture.h
+++ b/src/panfrost/lib/pan_texture.h
@@ -252,7 +252,7 @@ panfrost_bifrost_swizzle(unsigned components)
unsigned
panfrost_format_to_bifrost_blend(const struct panfrost_device *dev,
- enum pipe_format format, bool dither);
+ enum pipe_format format);
struct pan_pool;
struct pan_scoreboard;
More information about the mesa-commit
mailing list