Mesa (master): panfrost: Fix panfrost_format_to_bifrost_blend()

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Nov 13 13:48:19 UTC 2020


Module: Mesa
Branch: master
Commit: 6e069d1c3febebb7996240ad5ce76b352ea2fe8d
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=6e069d1c3febebb7996240ad5ce76b352ea2fe8d

Author: Boris Brezillon <boris.brezillon at collabora.com>
Date:   Thu Nov 12 16:03:24 2020 +0100

panfrost: Fix panfrost_format_to_bifrost_blend()

panfrost_format_to_bifrost_blend() shouldn't return a pipe_format, but
a mali_format.

Signed-off-by: Boris Brezillon <boris.brezillon at collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7530>

---

 src/gallium/drivers/panfrost/pan_blend_shaders.c | 7 ++++---
 src/gallium/drivers/panfrost/pan_cmdstream.c     | 2 +-
 src/panfrost/lib/pan_blit.c                      | 2 +-
 src/panfrost/lib/pan_format.c                    | 5 +++--
 src/panfrost/lib/pan_texture.h                   | 4 +++-
 5 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/src/gallium/drivers/panfrost/pan_blend_shaders.c b/src/gallium/drivers/panfrost/pan_blend_shaders.c
index 7d036be7729..93570bf6b50 100644
--- a/src/gallium/drivers/panfrost/pan_blend_shaders.c
+++ b/src/gallium/drivers/panfrost/pan_blend_shaders.c
@@ -219,7 +219,8 @@ panfrost_create_blend_shader(struct panfrost_context *ctx,
 }
 
 static uint64_t
-bifrost_get_blend_desc(enum pipe_format fmt, unsigned rt)
+bifrost_get_blend_desc(const struct panfrost_device *dev,
+                       enum pipe_format fmt, unsigned rt)
 {
         const struct util_format_description *desc = util_format_description(fmt);
         uint64_t res;
@@ -263,7 +264,7 @@ bifrost_get_blend_desc(enum pipe_format fmt, unsigned rt)
                         desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB;
 
                 cfg.fixed_function.conversion.memory_format.format =
-                         panfrost_format_to_bifrost_blend(desc, true);
+                         panfrost_format_to_bifrost_blend(dev, desc, true);
         }
 
         return res;
@@ -299,7 +300,7 @@ panfrost_compile_blend_shader(struct panfrost_blend_shader *shader,
 
         if (dev->quirks & IS_BIFROST) {
                 inputs.blend.bifrost_blend_desc =
-                        bifrost_get_blend_desc(shader->key.format, shader->key.rt);
+                        bifrost_get_blend_desc(dev, shader->key.format, shader->key.rt);
                 program = bifrost_compile_shader_nir(NULL, shader->nir, &inputs);
 	} else {
                 program = midgard_compile_shader_nir(NULL, shader->nir, &inputs);
diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.c b/src/gallium/drivers/panfrost/pan_cmdstream.c
index 9d043211f70..fed8d652ca2 100644
--- a/src/gallium/drivers/panfrost/pan_cmdstream.c
+++ b/src/gallium/drivers/panfrost/pan_cmdstream.c
@@ -301,7 +301,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.format =
-                                        panfrost_format_to_bifrost_blend(format_desc, true);
+                                        panfrost_format_to_bifrost_blend(dev, format_desc, true);
                                 if (dev->quirks & HAS_SWIZZLES) {
                                         cfg.bifrost.internal.fixed_function.conversion.memory_format.swizzle =
                                                 panfrost_get_default_swizzle(4);
diff --git a/src/panfrost/lib/pan_blit.c b/src/panfrost/lib/pan_blit.c
index 7ef69d95723..595d094d692 100644
--- a/src/panfrost/lib/pan_blit.c
+++ b/src/panfrost/lib/pan_blit.c
@@ -570,7 +570,7 @@ bifrost_load_emit_blend_rt(struct pan_pool *pool, void *out,
                         cfg.bifrost.equation.color_mask = 0xf;
                         cfg.bifrost.internal.fixed_function.num_comps = 4;
                         cfg.bifrost.internal.fixed_function.conversion.memory_format.format =
-                                panfrost_format_to_bifrost_blend(format_desc, true);
+                                panfrost_format_to_bifrost_blend(pool->dev, format_desc, true);
                         cfg.bifrost.internal.fixed_function.conversion.register_format =
                                 blit_type_to_reg_fmt(T);
 
diff --git a/src/panfrost/lib/pan_format.c b/src/panfrost/lib/pan_format.c
index 08fcbbc7bf1..6777661bbb4 100644
--- a/src/panfrost/lib/pan_format.c
+++ b/src/panfrost/lib/pan_format.c
@@ -673,13 +673,14 @@ panfrost_invert_swizzle(const unsigned char *in, unsigned char *out)
 }
 
 enum mali_format
-panfrost_format_to_bifrost_blend(const struct util_format_description *desc, bool dither)
+panfrost_format_to_bifrost_blend(const struct panfrost_device *dev,
+                                 const struct util_format_description *desc, bool dither)
 {
         struct pan_blendable_format fmt = panfrost_blend_format(desc->format);
 
         /* Formats requiring blend shaders are stored raw in the tilebuffer */
         if (!fmt.internal)
-                return desc->format;
+                return MALI_EXTRACT_INDEX(dev->formats[desc->format].hw);
 
         /* Else, pick the pixel format matching the tilebuffer format */
         switch (fmt.internal) {
diff --git a/src/panfrost/lib/pan_texture.h b/src/panfrost/lib/pan_texture.h
index 1135fadc5f3..f7da2a13dc9 100644
--- a/src/panfrost/lib/pan_texture.h
+++ b/src/panfrost/lib/pan_texture.h
@@ -191,7 +191,9 @@ panfrost_bifrost_swizzle(unsigned components)
 }
 
 enum mali_format
-panfrost_format_to_bifrost_blend(const struct util_format_description *desc, bool dither);
+panfrost_format_to_bifrost_blend(const struct panfrost_device *dev,
+                                 const struct util_format_description *desc,
+                                 bool dither);
 
 struct pan_pool;
 struct pan_scoreboard;



More information about the mesa-commit mailing list