Mesa (main): panfrost: Get rid of the mali_xxx enum redefinitions

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Aug 26 08:52:46 UTC 2021


Module: Mesa
Branch: main
Commit: 5f3910a3439137dfe4ed2d7b391f1b13e9433fd9
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=5f3910a3439137dfe4ed2d7b391f1b13e9433fd9

Author: Boris Brezillon <boris.brezillon at collabora.com>
Date:   Fri Aug  6 12:30:04 2021 +0200

panfrost: Get rid of the mali_xxx enum redefinitions

The gen_macros.h header should include the common header file when
PAN_ARCH is undefined, thus making those redefinitions useless.

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/12551>

---

 src/panfrost/lib/pan_clear.c   | 20 +++++---------------
 src/panfrost/lib/pan_format.h  | 14 ++------------
 src/panfrost/lib/pan_texture.h | 11 -----------
 3 files changed, 7 insertions(+), 38 deletions(-)

diff --git a/src/panfrost/lib/pan_clear.c b/src/panfrost/lib/pan_clear.c
index f67af951130..4f364f17a6b 100644
--- a/src/panfrost/lib/pan_clear.c
+++ b/src/panfrost/lib/pan_clear.c
@@ -23,6 +23,8 @@
  *
  */
 
+#include "gen_macros.h"
+
 #include <string.h>
 #include "pan_util.h"
 #include "pan_format.h"
@@ -70,18 +72,6 @@ float_to_fixed(float f, unsigned bits_int, unsigned bits_frac, bool dither)
         }
 }
 
-/* These values are shared across hardware versions. Don't include GenXML. */
-enum mali_color_buffer_internal_format {
-        MALI_COLOR_BUFFER_INTERNAL_FORMAT_RAW = 0,
-        MALI_COLOR_BUFFER_INTERNAL_FORMAT_R8G8B8A8 = 1,
-        MALI_COLOR_BUFFER_INTERNAL_FORMAT_R10G10B10A2 = 2,
-        MALI_COLOR_BUFFER_INTERNAL_FORMAT_R8G8B8A2 = 3,
-        MALI_COLOR_BUFFER_INTERNAL_FORMAT_R4G4B4A4 = 4,
-        MALI_COLOR_BUFFER_INTERNAL_FORMAT_R5G6B5A0 = 5,
-        MALI_COLOR_BUFFER_INTERNAL_FORMAT_R5G5B5A1 = 6,
-        MALI_COLOR_BUFFER_NUM_FORMATS,
-};
-
 struct mali_tib_layout {
         unsigned int_r, frac_r;
         unsigned int_g, frac_g;
@@ -89,7 +79,7 @@ struct mali_tib_layout {
         unsigned int_a, frac_a;
 };
 
-static const struct mali_tib_layout tib_layouts[MALI_COLOR_BUFFER_NUM_FORMATS] = {
+static const struct mali_tib_layout tib_layouts[] = {
         [MALI_COLOR_BUFFER_INTERNAL_FORMAT_R8G8B8A8] = { 8, 0, 8, 0, 8, 0, 8, 0 },
         [MALI_COLOR_BUFFER_INTERNAL_FORMAT_R10G10B10A2] = { 10, 0, 10, 0, 10, 0, 2, 0 },
         [MALI_COLOR_BUFFER_INTERNAL_FORMAT_R8G8B8A2] = { 8, 2, 8, 2, 8, 2, 2, 0 },
@@ -132,7 +122,7 @@ pan_pack_color(uint32_t *packed, const union pipe_color_union *color,
         enum mali_color_buffer_internal_format internal =
                 panfrost_blendable_formats_v7[format].internal;
 
-        if (internal == MALI_COLOR_BUFFER_INTERNAL_FORMAT_RAW) {
+        if (internal == MALI_COLOR_BUFFER_INTERNAL_FORMAT_RAW_VALUE) {
                 pan_pack_raw(packed, color, format);
                 return;
         }
@@ -155,7 +145,7 @@ pan_pack_color(uint32_t *packed, const union pipe_color_union *color,
         }
 
         /* Look up the layout of the tilebuffer */
-        assert(internal < MALI_COLOR_BUFFER_NUM_FORMATS);
+        assert(internal < ARRAY_SIZE(tib_layouts));
         struct mali_tib_layout l = tib_layouts[internal];
 
         unsigned count_r = l.int_r + l.frac_r;
diff --git a/src/panfrost/lib/pan_format.h b/src/panfrost/lib/pan_format.h
index b0dd038e54a..8aa9b1ab96c 100644
--- a/src/panfrost/lib/pan_format.h
+++ b/src/panfrost/lib/pan_format.h
@@ -28,6 +28,8 @@
 #ifndef __PAN_FORMAT_H
 #define __PAN_FORMAT_H
 
+#include "gen_macros.h"
+
 #include "util/format/u_format.h"
 
 /* Formats */
@@ -53,18 +55,6 @@ extern const struct panfrost_format panfrost_pipe_format_v6[PIPE_FORMAT_COUNT];
 extern const struct panfrost_format panfrost_pipe_format_v7[PIPE_FORMAT_COUNT];
 
 /* Helpers to construct swizzles */
-#ifndef PAN_PACK_H
-/* Avoid the GenXML dependence */
-
-enum mali_channel {
-        MALI_CHANNEL_R = 0,
-        MALI_CHANNEL_G = 1,
-        MALI_CHANNEL_B = 2,
-        MALI_CHANNEL_A = 3,
-        MALI_CHANNEL_0 = 4,
-        MALI_CHANNEL_1 = 5,
-};
-#endif
 
 #define PAN_V6_SWIZZLE(R, G, B, A) ( \
         ((MALI_CHANNEL_ ## R) << 0) | \
diff --git a/src/panfrost/lib/pan_texture.h b/src/panfrost/lib/pan_texture.h
index 8d329e30ff1..d33a14c2b19 100644
--- a/src/panfrost/lib/pan_texture.h
+++ b/src/panfrost/lib/pan_texture.h
@@ -83,17 +83,6 @@ enum pan_image_crc_mode {
       PAN_IMAGE_CRC_OOB,
 };
 
-#ifndef PAN_PACK_H
-/* Avoid the GenXML dependence */
-
-enum mali_texture_dimension {
-        MALI_TEXTURE_DIMENSION_CUBE = 0,
-        MALI_TEXTURE_DIMENSION_1D   = 1,
-        MALI_TEXTURE_DIMENSION_2D   = 2,
-        MALI_TEXTURE_DIMENSION_3D   = 3,
-};
-#endif
-
 struct pan_image_layout {
         uint64_t modifier;
         enum pipe_format format;



More information about the mesa-commit mailing list