amd/common: cleanup DATA_FORMAT/NUM_FORMAT field names
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Mon, 13 Nov 2017 15:35:59 +0000 (16:35 +0100)
committerMarek Olšák <marek.olsak@amd.com>
Tue, 4 Jun 2019 00:05:20 +0000 (20:05 -0400)
The field layout wasn't actually changed in gfx9, so having the suffix
isn't very useful. The field *contents* were changed, but this is
reflected in the V_xxx_xxx definitions and is taken into account by
the ac_debug logic based on the register JSON.

This aligns the definitions with what will be generated from the
register JSON.

src/amd/common/ac_nir_to_llvm.c
src/amd/common/gfx9d.h
src/amd/common/sid.h
src/amd/vulkan/radv_image.c
src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c
src/gallium/drivers/radeonsi/si_state.c

index 51f92a6b0623e663fd730d41b2350e48580208f1..6b37cecebd50e5b1f521023dd6eb3e3f99174021 100644 (file)
@@ -1265,7 +1265,7 @@ static LLVMValueRef lower_gather4_integer(struct ac_llvm_context *ctx,
                                              LLVMConstInt(ctx->i32, 0x14000000, false), "");
 
                /* replace the NUM FORMAT in the descriptor */
-               tmp2 = LLVMBuildAnd(ctx->builder, tmp2, LLVMConstInt(ctx->i32, C_008F14_NUM_FORMAT_GFX6, false), "");
+               tmp2 = LLVMBuildAnd(ctx->builder, tmp2, LLVMConstInt(ctx->i32, C_008F14_NUM_FORMAT, false), "");
                tmp2 = LLVMBuildOr(ctx->builder, tmp2, tmp, "");
 
                args->resource = LLVMBuildInsertElement(ctx->builder, args->resource, tmp2, ctx->i32_1, "");
index 2e790c5469985b29b2569ec11f2d627d98711316..5d3de5842a17bdbd679b6723e54d2d57a191866d 100644 (file)
 #define   S_008F14_MIN_LOD(x)                                         (((unsigned)(x) & 0xFFF) << 8)
 #define   G_008F14_MIN_LOD(x)                                         (((x) >> 8) & 0xFFF)
 #define   C_008F14_MIN_LOD                                            0xFFF000FF
-#define   S_008F14_DATA_FORMAT_GFX9(x)                                (((unsigned)(x) & 0x3F) << 20)
-#define   G_008F14_DATA_FORMAT_GFX9(x)                                (((x) >> 20) & 0x3F)
-#define   C_008F14_DATA_FORMAT_GFX9                                   0xFC0FFFFF
+#define   S_008F14_DATA_FORMAT(x)                                     (((unsigned)(x) & 0x3F) << 20)
+#define   G_008F14_DATA_FORMAT(x)                                     (((x) >> 20) & 0x3F)
+#define   C_008F14_DATA_FORMAT                                        0xFC0FFFFF
 #define     V_008F14_IMG_DATA_FORMAT_INVALID                        0x00
 #define     V_008F14_IMG_DATA_FORMAT_8                              0x01
 #define     V_008F14_IMG_DATA_FORMAT_16                             0x02
 #define     V_008F14_IMG_DATA_FORMAT_8_AS_32                        0x3D
 #define     V_008F14_IMG_DATA_FORMAT_8_AS_32_32                     0x3E
 #define     V_008F14_IMG_DATA_FORMAT_32_AS_32_32_32_32              0x3F
-#define   S_008F14_NUM_FORMAT_GFX9(x)                                 (((unsigned)(x) & 0x0F) << 26)
-#define   G_008F14_NUM_FORMAT_GFX9(x)                                 (((x) >> 26) & 0x0F)
-#define   C_008F14_NUM_FORMAT_GFX9                                    0xC3FFFFFF
+#define   S_008F14_NUM_FORMAT(x)                                      (((unsigned)(x) & 0x0F) << 26)
+#define   G_008F14_NUM_FORMAT(x)                                      (((x) >> 26) & 0x0F)
+#define   C_008F14_NUM_FORMAT                                         0xC3FFFFFF
 #define     V_008F14_IMG_NUM_FORMAT_UNORM                           0x00
 #define     V_008F14_IMG_NUM_FORMAT_SNORM                           0x01
 #define     V_008F14_IMG_NUM_FORMAT_USCALED                         0x02
index 3c0b7001d2b998b914ba6b5b10c4acc521d3620d..6e818f9af1be5db2b41cda188086166ad247f012 100644 (file)
 #define   S_008F14_MIN_LOD(x)                                         (((unsigned)(x) & 0xFFF) << 8)
 #define   G_008F14_MIN_LOD(x)                                         (((x) >> 8) & 0xFFF)
 #define   C_008F14_MIN_LOD                                            0xFFF000FF
-#define   S_008F14_DATA_FORMAT_GFX6(x)                                (((unsigned)(x) & 0x3F) << 20)
-#define   G_008F14_DATA_FORMAT_GFX6(x)                                (((x) >> 20) & 0x3F)
-#define   C_008F14_DATA_FORMAT_GFX6                                   0xFC0FFFFF
+#define   S_008F14_DATA_FORMAT(x)                                     (((unsigned)(x) & 0x3F) << 20)
+#define   G_008F14_DATA_FORMAT(x)                                     (((x) >> 20) & 0x3F)
+#define   C_008F14_DATA_FORMAT                                        0xFC0FFFFF
 #define     V_008F14_IMG_DATA_FORMAT_INVALID                        0x00
 #define     V_008F14_IMG_DATA_FORMAT_8                              0x01
 #define     V_008F14_IMG_DATA_FORMAT_16                             0x02
 #define     V_008F14_IMG_DATA_FORMAT_32_AS_8                        0x3D /* not on stoney */
 #define     V_008F14_IMG_DATA_FORMAT_32_AS_8_8                      0x3E /* not on stoney */
 #define     V_008F14_IMG_DATA_FORMAT_32_AS_32_32_32_32              0x3F
-#define   S_008F14_NUM_FORMAT_GFX6(x)                                 (((unsigned)(x) & 0x0F) << 26)
-#define   G_008F14_NUM_FORMAT_GFX6(x)                                 (((x) >> 26) & 0x0F)
-#define   C_008F14_NUM_FORMAT_GFX6                                    0xC3FFFFFF
+#define   S_008F14_NUM_FORMAT(x)                                      (((unsigned)(x) & 0x0F) << 26)
+#define   G_008F14_NUM_FORMAT(x)                                      (((x) >> 26) & 0x0F)
+#define   C_008F14_NUM_FORMAT                                         0xC3FFFFFF
 #define     V_008F14_IMG_NUM_FORMAT_UNORM                           0x00
 #define     V_008F14_IMG_NUM_FORMAT_SNORM                           0x01
 #define     V_008F14_IMG_NUM_FORMAT_USCALED                         0x02
index b69dda39ce117de7f0e8918ffc397c2cd90d2fbf..fbfabea3b6f52febd01bdcc243a46dc1bf638570 100644 (file)
@@ -555,8 +555,8 @@ si_make_texture_descriptor(struct radv_device *device,
                depth = image->info.array_size / 6;
 
        state[0] = 0;
-       state[1] = (S_008F14_DATA_FORMAT_GFX6(data_format) |
-                   S_008F14_NUM_FORMAT_GFX6(num_format));
+       state[1] = (S_008F14_DATA_FORMAT(data_format) |
+                   S_008F14_NUM_FORMAT(num_format));
        state[2] = (S_008F18_WIDTH(width - 1) |
                    S_008F18_HEIGHT(height - 1) |
                    S_008F18_PERF_MOD(4));
@@ -657,8 +657,8 @@ si_make_texture_descriptor(struct radv_device *device,
                fmask_state[0] = va >> 8;
                fmask_state[0] |= image->fmask.tile_swizzle;
                fmask_state[1] = S_008F14_BASE_ADDRESS_HI(va >> 40) |
-                       S_008F14_DATA_FORMAT_GFX6(fmask_format) |
-                       S_008F14_NUM_FORMAT_GFX6(num_format);
+                       S_008F14_DATA_FORMAT(fmask_format) |
+                       S_008F14_NUM_FORMAT(num_format);
                fmask_state[2] = S_008F18_WIDTH(width - 1) |
                        S_008F18_HEIGHT(height - 1);
                fmask_state[3] = S_008F1C_DST_SEL_X(V_008F1C_SQ_SEL_X) |
index be0cb89f72287d1e97996b50f8d5241fbfeb1d10..c5704bc0eae4e0731fd7c45cad25dbdfb160abc8 100644 (file)
@@ -1243,10 +1243,10 @@ si_lower_gather4_integer(struct si_shader_context *ctx,
 
                uint32_t wa_num_format =
                        return_type == TGSI_RETURN_TYPE_UINT ?
-                       S_008F14_NUM_FORMAT_GFX6(V_008F14_IMG_NUM_FORMAT_USCALED) :
-                       S_008F14_NUM_FORMAT_GFX6(V_008F14_IMG_NUM_FORMAT_SSCALED);
+                       S_008F14_NUM_FORMAT(V_008F14_IMG_NUM_FORMAT_USCALED) :
+                       S_008F14_NUM_FORMAT(V_008F14_IMG_NUM_FORMAT_SSCALED);
                wa_formats = LLVMBuildAnd(builder, formats,
-                                         LLVMConstInt(ctx->i32, C_008F14_NUM_FORMAT_GFX6, false),
+                                         LLVMConstInt(ctx->i32, C_008F14_NUM_FORMAT, false),
                                          "");
                wa_formats = LLVMBuildOr(builder, wa_formats,
                                        LLVMConstInt(ctx->i32, wa_num_format, false), "");
index 9bebafa69a48917aedc1545072b812ad5edf0108..e86ff29f0a59a90a28100c3e32e765bda0b34c77 100644 (file)
@@ -3850,8 +3850,8 @@ si_make_texture_descriptor(struct si_screen *screen,
                depth = res->array_size / 6;
 
        state[0] = 0;
-       state[1] = (S_008F14_DATA_FORMAT_GFX6(data_format) |
-                   S_008F14_NUM_FORMAT_GFX6(num_format));
+       state[1] = (S_008F14_DATA_FORMAT(data_format) |
+                   S_008F14_NUM_FORMAT(num_format));
        state[2] = (S_008F18_WIDTH(width - 1) |
                    S_008F18_HEIGHT(height - 1) |
                    S_008F18_PERF_MOD(4));
@@ -4006,8 +4006,8 @@ si_make_texture_descriptor(struct si_screen *screen,
 
                fmask_state[0] = (va >> 8) | tex->surface.fmask_tile_swizzle;
                fmask_state[1] = S_008F14_BASE_ADDRESS_HI(va >> 40) |
-                                S_008F14_DATA_FORMAT_GFX6(data_format) |
-                                S_008F14_NUM_FORMAT_GFX6(num_format);
+                                S_008F14_DATA_FORMAT(data_format) |
+                                S_008F14_NUM_FORMAT(num_format);
                fmask_state[2] = S_008F18_WIDTH(width - 1) |
                                 S_008F18_HEIGHT(height - 1);
                fmask_state[3] = S_008F1C_DST_SEL_X(V_008F1C_SQ_SEL_X) |
@@ -4183,7 +4183,7 @@ si_create_sampler_view_custom(struct pipe_context *ctx,
                                   width, height, depth,
                                   view->state, view->fmask_state);
 
-       unsigned num_format = G_008F14_NUM_FORMAT_GFX6(view->state[1]);
+       unsigned num_format = G_008F14_NUM_FORMAT(view->state[1]);
        view->is_integer =
                num_format == V_008F14_IMG_NUM_FORMAT_USCALED ||
                num_format == V_008F14_IMG_NUM_FORMAT_SSCALED ||