Mesa (master): panfrost: Drop blendable format accessor

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Apr 21 13:34:54 UTC 2021


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

Author: Alyssa Rosenzweig <alyssa at collabora.com>
Date:   Mon Apr 12 11:26:08 2021 -0400

panfrost: Drop blendable format accessor

Needless indirection.

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/panfrost/lib/pan_blend.c   | 2 +-
 src/panfrost/lib/pan_blitter.c | 2 +-
 src/panfrost/lib/pan_cs.c      | 6 +++---
 src/panfrost/lib/pan_format.c  | 8 +-------
 src/panfrost/lib/pan_texture.h | 4 +---
 5 files changed, 7 insertions(+), 15 deletions(-)

diff --git a/src/panfrost/lib/pan_blend.c b/src/panfrost/lib/pan_blend.c
index cdb3844c53d..daef7d76824 100644
--- a/src/panfrost/lib/pan_blend.c
+++ b/src/panfrost/lib/pan_blend.c
@@ -143,7 +143,7 @@ pan_blend_can_fixed_function(const struct panfrost_device *dev,
                 return false;
 
         /* Not all formats can be blended by fixed-function hardware */
-        if (!panfrost_blend_format(rt_state->format).internal)
+        if (!panfrost_blendable_formats[rt_state->format].internal)
                 return false;
 
         if (!rt_state->equation.blend_enable)
diff --git a/src/panfrost/lib/pan_blitter.c b/src/panfrost/lib/pan_blitter.c
index 655eeef9f64..ce6f9a8b11d 100644
--- a/src/panfrost/lib/pan_blitter.c
+++ b/src/panfrost/lib/pan_blitter.c
@@ -371,7 +371,7 @@ pan_blitter_get_blend_shaders(struct panfrost_device *dev,
         };
 
         for (unsigned i = 0; i < rt_count; i++) {
-                if (!rts[i] || panfrost_blend_format(rts[i]->format).internal)
+                if (!rts[i] || panfrost_blendable_formats[rts[i]->format].internal)
                         continue;
 
                 struct pan_blit_blend_shader_key key = {
diff --git a/src/panfrost/lib/pan_cs.c b/src/panfrost/lib/pan_cs.c
index 73cb74340a3..a4f584a9b77 100644
--- a/src/panfrost/lib/pan_cs.c
+++ b/src/panfrost/lib/pan_cs.c
@@ -239,7 +239,7 @@ pan_emit_zs_crc_ext(const struct panfrost_device *dev,
 static unsigned
 pan_bytes_per_pixel_tib(enum pipe_format format)
 {
-        if (panfrost_blend_format(format).internal) {
+        if (panfrost_blendable_formats[format].internal) {
                 /* Blendable formats are always 32-bits in the tile buffer,
                  * extra bits are used as padding or to dither */
                 return 4;
@@ -394,7 +394,7 @@ pan_rt_init_format(const struct panfrost_device *dev,
         if (desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB)
                 cfg->srgb = true;
 
-        struct pan_blendable_format fmt = panfrost_blend_format(rt->format);
+        struct pan_blendable_format fmt = panfrost_blendable_formats[rt->format];
 
         if (fmt.internal) {
                 cfg->internal_format = fmt.internal;
@@ -804,7 +804,7 @@ pan_emit_sfbd(const struct panfrost_device *dev,
                         panfrost_invert_swizzle(desc->swizzle, swizzle);
                         cfg.swizzle = panfrost_translate_swizzle_4(swizzle);
 
-                        struct pan_blendable_format fmt = panfrost_blend_format(rt->format);
+                        struct pan_blendable_format fmt = panfrost_blendable_formats[rt->format];
                         if (fmt.internal) {
                                 cfg.internal_format = fmt.internal;
                                 cfg.color_writeback_format = fmt.writeback;
diff --git a/src/panfrost/lib/pan_format.c b/src/panfrost/lib/pan_format.c
index dc11b083a6d..86c9db6e8f4 100644
--- a/src/panfrost/lib/pan_format.c
+++ b/src/panfrost/lib/pan_format.c
@@ -59,7 +59,7 @@
         BFMT2(pipe ##_UNORM, R8G8B8A8, writeback, 0), \
         BFMT2(pipe ##_SRGB, R8G8B8A8, writeback, 1)
 
-static const struct pan_blendable_format panfrost_blendable_formats[PIPE_FORMAT_COUNT] = {
+const struct pan_blendable_format panfrost_blendable_formats[PIPE_FORMAT_COUNT] = {
         BFMT_SRGB(L8, R8),
         BFMT_SRGB(L8A8, R8G8),
         BFMT_SRGB(R8, R8),
@@ -93,12 +93,6 @@ static const struct pan_blendable_format panfrost_blendable_formats[PIPE_FORMAT_
         BFMT(B5G5R5X1_UNORM, R5G5B5A1),
 };
 
-struct pan_blendable_format
-panfrost_blend_format(enum pipe_format format)
-{
-        return panfrost_blendable_formats[format];
-}
-
 /* Convenience */
 
 #define _V PIPE_BIND_VERTEX_BUFFER
diff --git a/src/panfrost/lib/pan_texture.h b/src/panfrost/lib/pan_texture.h
index eb5794b957c..660d13bb6f0 100644
--- a/src/panfrost/lib/pan_texture.h
+++ b/src/panfrost/lib/pan_texture.h
@@ -205,9 +205,7 @@ struct pan_blendable_format {
         mali_pixel_format bifrost_no_dither;
 };
 
-struct pan_blendable_format
-panfrost_blend_format(enum pipe_format format);
-
+extern const struct pan_blendable_format panfrost_blendable_formats[PIPE_FORMAT_COUNT];
 extern const struct panfrost_format panfrost_pipe_format_v6[PIPE_FORMAT_COUNT];
 extern const struct panfrost_format panfrost_pipe_format_v7[PIPE_FORMAT_COUNT];
 



More information about the mesa-commit mailing list