Mesa (master): freedreno: Fix "Offset of packed bitfield changed" warnings:

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Aug 4 03:01:43 UTC 2020


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

Author: Eric Anholt <eric at anholt.net>
Date:   Mon Aug  3 12:59:11 2020 -0700

freedreno: Fix "Offset of packed bitfield changed" warnings:

Example:

../src/freedreno/ir2/instr-a2xx.h:384:1: note: offset of packed bit-field
‘const_index’ has changed in GCC 4.4
  384 | } instr_fetch_vtx_t;

It's apparently due to bitfields that would cross the width of their type.
Just expand the types of the affected fields so that the compiler quiets
down.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6165>

---

 src/freedreno/ir2/instr-a2xx.h | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/src/freedreno/ir2/instr-a2xx.h b/src/freedreno/ir2/instr-a2xx.h
index 0078b24b509..5049c553870 100644
--- a/src/freedreno/ir2/instr-a2xx.h
+++ b/src/freedreno/ir2/instr-a2xx.h
@@ -217,8 +217,8 @@ typedef struct PACKED {
 	uint8_t             count                    : 3;
 	uint8_t             yeild                    : 1;
 	uint16_t            serialize                : 12;
-	uint8_t             vc                       : 6;   /* vertex cache? */
-	uint8_t             bool_addr                : 8;
+	uint32_t            vc                       : 6;   /* vertex cache? */
+	uint32_t            bool_addr                : 8;
 	uint8_t             condition                : 1;
 	instr_addr_mode_t   address_mode             : 1;
 	instr_cf_opc_t      opc                      : 4;
@@ -240,7 +240,7 @@ typedef struct PACKED {
 	uint8_t             predicated_jmp           : 1;
 	uint32_t            reserved1                : 18;
 	uint8_t             direction                : 1;
-	uint8_t             bool_addr                : 8;
+	uint32_t            bool_addr                : 8;
 	uint8_t             condition                : 1;
 	instr_addr_mode_t   address_mode             : 1;
 	instr_cf_opc_t      opc                      : 4;
@@ -322,12 +322,12 @@ typedef enum a2xx_sq_surfaceformat instr_surf_fmt_t;
 typedef struct PACKED {
 	/* dword0: */
 	instr_fetch_opc_t   opc                      : 5;
-	uint8_t             src_reg                  : 6;
+	uint32_t            src_reg                  : 6;
 	uint8_t             src_reg_am               : 1;
-	uint8_t             dst_reg                  : 6;
+	uint32_t            dst_reg                  : 6;
 	uint8_t             dst_reg_am               : 1;
 	uint8_t             fetch_valid_only         : 1;
-	uint8_t             const_idx                : 5;
+	uint32_t            const_idx                : 5;
 	uint8_t             tx_coord_denorm          : 1;
 	uint8_t             src_swiz                 : 6;
 	/* dword1: */
@@ -345,10 +345,10 @@ typedef struct PACKED {
 	/* dword2: */
 	uint8_t             use_reg_gradients        : 1;
 	instr_sample_loc_t  sample_location          : 1;
-	uint8_t             lod_bias                 : 7;
+	uint32_t            lod_bias                 : 7;
 	uint8_t             unused                   : 7;
 	uint8_t             offset_x                 : 5;
-	uint8_t             offset_y                 : 5;
+	uint32_t            offset_y                 : 5;
 	uint8_t             offset_z                 : 5;
 	uint8_t             pred_condition           : 1;
 } instr_fetch_tex_t;
@@ -356,12 +356,12 @@ typedef struct PACKED {
 typedef struct PACKED {
 	/* dword0: */
 	instr_fetch_opc_t   opc                      : 5;
-	uint8_t             src_reg                  : 6;
+	uint32_t            src_reg                  : 6;
 	uint8_t             src_reg_am               : 1;
-	uint8_t             dst_reg                  : 6;
+	uint32_t            dst_reg                  : 6;
 	uint8_t             dst_reg_am               : 1;
 	uint8_t             must_be_one              : 1;
-	uint8_t             const_index              : 5;
+	uint32_t            const_index              : 5;
 	uint8_t             const_index_sel          : 2;
 	uint8_t             reserved0                : 3;
 	uint8_t             src_swiz                 : 2;



More information about the mesa-commit mailing list