[03/25] amd/common: cleanup DATA_FORMAT/NUM_FORMAT field names

Submitted by Nicolai Hähnle on Dec. 6, 2018, 2 p.m.

Details

Message ID 20181206140059.77737-4-nhaehnle@gmail.com
State New
Headers show
Series "amd/common, radeonsi: misc cleanups, refactorings, etc." ( rev: 2 1 ) in Mesa

Not browsing as part of any series.

Commit Message

Nicolai Hähnle Dec. 6, 2018, 2 p.m.
From: Nicolai Hähnle <nicolai.haehnle@amd.com>

The definition wasn't actually changed in gfx9, so having the suffix
makes no sense.
---
 src/amd/common/ac_nir_to_llvm.c                   |  2 +-
 src/amd/common/gfx9d.h                            | 12 ++++++------
 src/amd/common/sid.h                              | 12 ++++++------
 src/amd/vulkan/radv_image.c                       |  8 ++++----
 src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c |  6 +++---
 src/gallium/drivers/radeonsi/si_state.c           | 10 +++++-----
 6 files changed, 25 insertions(+), 25 deletions(-)

Patch hide | download patch | download mbox

diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
index fe65dfff8f3..cbb5be4b1a2 100644
--- a/src/amd/common/ac_nir_to_llvm.c
+++ b/src/amd/common/ac_nir_to_llvm.c
@@ -1238,21 +1238,21 @@  static LLVMValueRef lower_gather4_integer(struct ac_llvm_context *ctx,
 		if (stype == GLSL_TYPE_UINT)
 			/* Create a NUM FORMAT - 0x2 or 0x4 - USCALED or UINT */
 			tmp = LLVMBuildSelect(ctx->builder, compare_cube_wa, LLVMConstInt(ctx->i32, 0x8000000, false),
 					      LLVMConstInt(ctx->i32, 0x10000000, false), "");
 		else
 			/* Create a NUM FORMAT - 0x3 or 0x5 - SSCALED or SINT */
 			tmp = LLVMBuildSelect(ctx->builder, compare_cube_wa, LLVMConstInt(ctx->i32, 0xc000000, false),
 					      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, "");
 
 		/* don't modify the coordinates for this case */
 		for (unsigned c = 0; c < 2; ++c)
 			args->coords[c] = LLVMBuildSelect(
 				ctx->builder, compare_cube_wa,
 				orig_coords[c], args->coords[c], "");
 	}
diff --git a/src/amd/common/gfx9d.h b/src/amd/common/gfx9d.h
index 2e790c54699..5d3de5842a1 100644
--- a/src/amd/common/gfx9d.h
+++ b/src/amd/common/gfx9d.h
@@ -1262,23 +1262,23 @@ 
 #define   S_030F14_COUNT_HI(x)                                        (((unsigned)(x) & 0x7FFFFFFF) << 0)
 #define   G_030F14_COUNT_HI(x)                                        (((x) >> 0) & 0x7FFFFFFF)
 #define   C_030F14_COUNT_HI                                           0x80000000
 #define R_008F14_SQ_IMG_RSRC_WORD1                                      0x008F14
 #define   S_008F14_BASE_ADDRESS_HI(x)                                 (((unsigned)(x) & 0xFF) << 0)
 #define   G_008F14_BASE_ADDRESS_HI(x)                                 (((x) >> 0) & 0xFF)
 #define   C_008F14_BASE_ADDRESS_HI                                    0xFFFFFF00
 #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_8                            0x03
 #define     V_008F14_IMG_DATA_FORMAT_32                             0x04
 #define     V_008F14_IMG_DATA_FORMAT_16_16                          0x05
 #define     V_008F14_IMG_DATA_FORMAT_10_11_11                       0x06
 #define     V_008F14_IMG_DATA_FORMAT_11_11_10                       0x07
 #define     V_008F14_IMG_DATA_FORMAT_10_10_10_2                     0x08
 #define     V_008F14_IMG_DATA_FORMAT_2_10_10_10                     0x09
@@ -1329,23 +1329,23 @@ 
 #define     V_008F14_IMG_DATA_FORMAT_N_IN_16_16_16_16               0x36
 #define     V_008F14_IMG_DATA_FORMAT_N_IN_16_AS_16_16_16_16         0x37
 #define     V_008F14_IMG_DATA_FORMAT_RESERVED_56                    0x38
 #define     V_008F14_IMG_DATA_FORMAT_4_4                            0x39
 #define     V_008F14_IMG_DATA_FORMAT_6_5_5                          0x3A
 #define     V_008F14_IMG_DATA_FORMAT_S8_16                          0x3B
 #define     V_008F14_IMG_DATA_FORMAT_S8_32                          0x3C
 #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
 #define     V_008F14_IMG_NUM_FORMAT_SSCALED                         0x03
 #define     V_008F14_IMG_NUM_FORMAT_UINT                            0x04
 #define     V_008F14_IMG_NUM_FORMAT_SINT                            0x05
 #define     V_008F14_IMG_NUM_FORMAT_RESERVED_6                      0x06
 #define     V_008F14_IMG_NUM_FORMAT_FLOAT                           0x07
 #define     V_008F14_IMG_NUM_FORMAT_METADATA                        0x08
 #define     V_008F14_IMG_NUM_FORMAT_SRGB                            0x09
diff --git a/src/amd/common/sid.h b/src/amd/common/sid.h
index 49683f1aa5a..a6d0bc2fe42 100644
--- a/src/amd/common/sid.h
+++ b/src/amd/common/sid.h
@@ -2120,23 +2120,23 @@ 
 #define   S_030F14_COUNT_HI(x)                                        (((unsigned)(x) & 0x7FFFFFFF) << 0)
 #define   G_030F14_COUNT_HI(x)                                        (((x) >> 0) & 0x7FFFFFFF)
 #define   C_030F14_COUNT_HI                                           0x80000000
 #define R_008F14_SQ_IMG_RSRC_WORD1                                      0x008F14
 #define   S_008F14_BASE_ADDRESS_HI(x)                                 (((unsigned)(x) & 0xFF) << 0)
 #define   G_008F14_BASE_ADDRESS_HI(x)                                 (((x) >> 0) & 0xFF)
 #define   C_008F14_BASE_ADDRESS_HI                                    0xFFFFFF00
 #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_8_8                            0x03
 #define     V_008F14_IMG_DATA_FORMAT_32                             0x04
 #define     V_008F14_IMG_DATA_FORMAT_16_16                          0x05
 #define     V_008F14_IMG_DATA_FORMAT_10_11_11                       0x06
 #define     V_008F14_IMG_DATA_FORMAT_11_11_10                       0x07
 #define     V_008F14_IMG_DATA_FORMAT_10_10_10_2                     0x08
 #define     V_008F14_IMG_DATA_FORMAT_2_10_10_10                     0x09
@@ -2187,23 +2187,23 @@ 
 #define     V_008F14_IMG_DATA_FORMAT_FMASK32_S8_F8                  0x36
 #define     V_008F14_IMG_DATA_FORMAT_FMASK64_S16_F4                 0x37
 #define     V_008F14_IMG_DATA_FORMAT_FMASK64_S16_F8                 0x38
 #define     V_008F14_IMG_DATA_FORMAT_4_4                            0x39
 #define     V_008F14_IMG_DATA_FORMAT_6_5_5                          0x3A
 #define     V_008F14_IMG_DATA_FORMAT_1                              0x3B
 #define     V_008F14_IMG_DATA_FORMAT_1_REVERSED                     0x3C
 #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
 #define     V_008F14_IMG_NUM_FORMAT_SSCALED                         0x03
 #define     V_008F14_IMG_NUM_FORMAT_UINT                            0x04
 #define     V_008F14_IMG_NUM_FORMAT_SINT                            0x05
 #define     V_008F14_IMG_NUM_FORMAT_SNORM_OGL                       0x06
 #define     V_008F14_IMG_NUM_FORMAT_FLOAT                           0x07
 #define     V_008F14_IMG_NUM_FORMAT_RESERVED_8                      0x08
 #define     V_008F14_IMG_NUM_FORMAT_SRGB                            0x09
diff --git a/src/amd/vulkan/radv_image.c b/src/amd/vulkan/radv_image.c
index 090ca70a327..94cde4d19f2 100644
--- a/src/amd/vulkan/radv_image.c
+++ b/src/amd/vulkan/radv_image.c
@@ -528,22 +528,22 @@  si_make_texture_descriptor(struct radv_device *device,
 	        height = 1;
 		depth = image->info.array_size;
 	} else if (type == V_008F1C_SQ_RSRC_IMG_2D_ARRAY ||
 		   type == V_008F1C_SQ_RSRC_IMG_2D_MSAA_ARRAY) {
 		if (view_type != VK_IMAGE_VIEW_TYPE_3D)
 			depth = image->info.array_size;
 	} else if (type == V_008F1C_SQ_RSRC_IMG_CUBE)
 		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));
 	state[3] = (S_008F1C_DST_SEL_X(radv_map_swizzle(swizzle[0])) |
 		    S_008F1C_DST_SEL_Y(radv_map_swizzle(swizzle[1])) |
 		    S_008F1C_DST_SEL_Z(radv_map_swizzle(swizzle[2])) |
 		    S_008F1C_DST_SEL_W(radv_map_swizzle(swizzle[3])) |
 		    S_008F1C_BASE_LEVEL(image->info.samples > 1 ?
 					0 : first_level) |
 		    S_008F1C_LAST_LEVEL(image->info.samples > 1 ?
@@ -628,22 +628,22 @@  si_make_texture_descriptor(struct radv_device *device,
 			default:
 				assert(0);
 				fmask_format = V_008F14_IMG_DATA_FORMAT_INVALID;
 			}
 			num_format = V_008F14_IMG_NUM_FORMAT_UINT;
 		}
 
 		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) |
 			S_008F1C_DST_SEL_Y(V_008F1C_SQ_SEL_X) |
 			S_008F1C_DST_SEL_Z(V_008F1C_SQ_SEL_X) |
 			S_008F1C_DST_SEL_W(V_008F1C_SQ_SEL_X) |
 			S_008F1C_TYPE(radv_tex_dim(image->type, view_type, image->info.array_size, 0, false, false));
 		fmask_state[4] = 0;
 		fmask_state[5] = S_008F24_BASE_ARRAY(first_layer);
 		fmask_state[6] = 0;
diff --git a/src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c b/src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c
index 6decedc4cce..1cb0f9d1c60 100644
--- a/src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c
+++ b/src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c
@@ -1223,24 +1223,24 @@  si_lower_gather4_integer(struct si_shader_context *ctx,
 					    LLVMConstInt(ctx->i32, 20, false), "");
 		data_format = LLVMBuildAnd(builder, data_format,
 					   LLVMConstInt(ctx->i32, (1u << 6) - 1, false), "");
 		wa_8888 = LLVMBuildICmp(
 			builder, LLVMIntEQ, data_format,
 			LLVMConstInt(ctx->i32, V_008F14_IMG_DATA_FORMAT_8_8_8_8, false),
 			"");
 
 		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), "");
 
 		formats = LLVMBuildSelect(builder, wa_8888, wa_formats, formats, "");
 		args->resource = LLVMBuildInsertElement(
 			builder, args->resource, formats, ctx->i32_1, "");
 	}
 
 	if (target == TGSI_TEXTURE_RECT ||
diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c
index 41aa4ef3336..0960f379c4f 100644
--- a/src/gallium/drivers/radeonsi/si_state.c
+++ b/src/gallium/drivers/radeonsi/si_state.c
@@ -3821,22 +3821,22 @@  si_make_texture_descriptor(struct si_screen *screen,
 	        height = 1;
 		depth = res->array_size;
 	} else if (type == V_008F1C_SQ_RSRC_IMG_2D_ARRAY ||
 		   type == V_008F1C_SQ_RSRC_IMG_2D_MSAA_ARRAY) {
 		if (sampler || res->target != PIPE_TEXTURE_3D)
 			depth = res->array_size;
 	} else if (type == V_008F1C_SQ_RSRC_IMG_CUBE)
 		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));
 	state[3] = (S_008F1C_DST_SEL_X(si_map_swizzle(swizzle[0])) |
 		    S_008F1C_DST_SEL_Y(si_map_swizzle(swizzle[1])) |
 		    S_008F1C_DST_SEL_Z(si_map_swizzle(swizzle[2])) |
 		    S_008F1C_DST_SEL_W(si_map_swizzle(swizzle[3])) |
 		    S_008F1C_BASE_LEVEL(num_samples > 1 ? 0 : first_level) |
 		    S_008F1C_LAST_LEVEL(num_samples > 1 ?
 					util_logbase2(num_samples) :
@@ -3977,22 +3977,22 @@  si_make_texture_descriptor(struct si_screen *screen,
 				break;
 			default:
 				unreachable("invalid nr_samples");
 			}
 			num_format = V_008F14_IMG_NUM_FORMAT_UINT;
 		}
 #undef FMASK
 
 		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) |
 				 S_008F1C_DST_SEL_Y(V_008F1C_SQ_SEL_X) |
 				 S_008F1C_DST_SEL_Z(V_008F1C_SQ_SEL_X) |
 				 S_008F1C_DST_SEL_W(V_008F1C_SQ_SEL_X) |
 				 S_008F1C_TYPE(si_tex_dim(screen, tex, target, 0));
 		fmask_state[4] = 0;
 		fmask_state[5] = S_008F24_BASE_ARRAY(first_layer);
 		fmask_state[6] = 0;
@@ -4154,21 +4154,21 @@  si_create_sampler_view_custom(struct pipe_context *ctx,
 						state->u.tex.first_level,
 						state->format);
 
 	si_make_texture_descriptor(sctx->screen, tex, true,
 				   state->target, pipe_format, state_swizzle,
 				   first_level, last_level,
 				   state->u.tex.first_layer, last_layer,
 				   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 ||
 		num_format == V_008F14_IMG_NUM_FORMAT_UINT ||
 		num_format == V_008F14_IMG_NUM_FORMAT_SINT;
 	view->base_level_info = &surflevel[base_level];
 	view->base_level = base_level;
 	view->block_width = util_format_get_blockwidth(pipe_format);
 	return &view->base;
 }

Comments

The definitions weren't changed, but the values were. The names need to be
different, so that si_debug.c prints both the GFX6 and GFX9 values.

Marek

On Thu, Dec 6, 2018 at 9:01 AM Nicolai Hähnle <nhaehnle@gmail.com> wrote:

> From: Nicolai Hähnle <nicolai.haehnle@amd.com>
>
> The definition wasn't actually changed in gfx9, so having the suffix
> makes no sense.
> ---
>  src/amd/common/ac_nir_to_llvm.c                   |  2 +-
>  src/amd/common/gfx9d.h                            | 12 ++++++------
>  src/amd/common/sid.h                              | 12 ++++++------
>  src/amd/vulkan/radv_image.c                       |  8 ++++----
>  src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c |  6 +++---
>  src/gallium/drivers/radeonsi/si_state.c           | 10 +++++-----
>  6 files changed, 25 insertions(+), 25 deletions(-)
>
> diff --git a/src/amd/common/ac_nir_to_llvm.c
> b/src/amd/common/ac_nir_to_llvm.c
> index fe65dfff8f3..cbb5be4b1a2 100644
> --- a/src/amd/common/ac_nir_to_llvm.c
> +++ b/src/amd/common/ac_nir_to_llvm.c
> @@ -1238,21 +1238,21 @@ static LLVMValueRef lower_gather4_integer(struct
> ac_llvm_context *ctx,
>                 if (stype == GLSL_TYPE_UINT)
>                         /* Create a NUM FORMAT - 0x2 or 0x4 - USCALED or
> UINT */
>                         tmp = LLVMBuildSelect(ctx->builder,
> compare_cube_wa, LLVMConstInt(ctx->i32, 0x8000000, false),
>                                               LLVMConstInt(ctx->i32,
> 0x10000000, false), "");
>                 else
>                         /* Create a NUM FORMAT - 0x3 or 0x5 - SSCALED or
> SINT */
>                         tmp = LLVMBuildSelect(ctx->builder,
> compare_cube_wa, LLVMConstInt(ctx->i32, 0xc000000, false),
>                                               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, "");
>
>                 /* don't modify the coordinates for this case */
>                 for (unsigned c = 0; c < 2; ++c)
>                         args->coords[c] = LLVMBuildSelect(
>                                 ctx->builder, compare_cube_wa,
>                                 orig_coords[c], args->coords[c], "");
>         }
> diff --git a/src/amd/common/gfx9d.h b/src/amd/common/gfx9d.h
> index 2e790c54699..5d3de5842a1 100644
> --- a/src/amd/common/gfx9d.h
> +++ b/src/amd/common/gfx9d.h
> @@ -1262,23 +1262,23 @@
>  #define   S_030F14_COUNT_HI(x)
> (((unsigned)(x) & 0x7FFFFFFF) << 0)
>  #define   G_030F14_COUNT_HI(x)
> (((x) >> 0) & 0x7FFFFFFF)
>  #define   C_030F14_COUNT_HI
>  0x80000000
>  #define R_008F14_SQ_IMG_RSRC_WORD1
> 0x008F14
>  #define   S_008F14_BASE_ADDRESS_HI(x)
>  (((unsigned)(x) & 0xFF) << 0)
>  #define   G_008F14_BASE_ADDRESS_HI(x)
>  (((x) >> 0) & 0xFF)
>  #define   C_008F14_BASE_ADDRESS_HI
> 0xFFFFFF00
>  #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_8                            0x03
>  #define     V_008F14_IMG_DATA_FORMAT_32                             0x04
>  #define     V_008F14_IMG_DATA_FORMAT_16_16                          0x05
>  #define     V_008F14_IMG_DATA_FORMAT_10_11_11                       0x06
>  #define     V_008F14_IMG_DATA_FORMAT_11_11_10                       0x07
>  #define     V_008F14_IMG_DATA_FORMAT_10_10_10_2                     0x08
>  #define     V_008F14_IMG_DATA_FORMAT_2_10_10_10                     0x09
> @@ -1329,23 +1329,23 @@
>  #define     V_008F14_IMG_DATA_FORMAT_N_IN_16_16_16_16               0x36
>  #define     V_008F14_IMG_DATA_FORMAT_N_IN_16_AS_16_16_16_16         0x37
>  #define     V_008F14_IMG_DATA_FORMAT_RESERVED_56                    0x38
>  #define     V_008F14_IMG_DATA_FORMAT_4_4                            0x39
>  #define     V_008F14_IMG_DATA_FORMAT_6_5_5                          0x3A
>  #define     V_008F14_IMG_DATA_FORMAT_S8_16                          0x3B
>  #define     V_008F14_IMG_DATA_FORMAT_S8_32                          0x3C
>  #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
>  #define     V_008F14_IMG_NUM_FORMAT_SSCALED                         0x03
>  #define     V_008F14_IMG_NUM_FORMAT_UINT                            0x04
>  #define     V_008F14_IMG_NUM_FORMAT_SINT                            0x05
>  #define     V_008F14_IMG_NUM_FORMAT_RESERVED_6                      0x06
>  #define     V_008F14_IMG_NUM_FORMAT_FLOAT                           0x07
>  #define     V_008F14_IMG_NUM_FORMAT_METADATA                        0x08
>  #define     V_008F14_IMG_NUM_FORMAT_SRGB                            0x09
> diff --git a/src/amd/common/sid.h b/src/amd/common/sid.h
> index 49683f1aa5a..a6d0bc2fe42 100644
> --- a/src/amd/common/sid.h
> +++ b/src/amd/common/sid.h
> @@ -2120,23 +2120,23 @@
>  #define   S_030F14_COUNT_HI(x)
> (((unsigned)(x) & 0x7FFFFFFF) << 0)
>  #define   G_030F14_COUNT_HI(x)
> (((x) >> 0) & 0x7FFFFFFF)
>  #define   C_030F14_COUNT_HI
>  0x80000000
>  #define R_008F14_SQ_IMG_RSRC_WORD1
> 0x008F14
>  #define   S_008F14_BASE_ADDRESS_HI(x)
>  (((unsigned)(x) & 0xFF) << 0)
>  #define   G_008F14_BASE_ADDRESS_HI(x)
>  (((x) >> 0) & 0xFF)
>  #define   C_008F14_BASE_ADDRESS_HI
> 0xFFFFFF00
>  #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_8_8                            0x03
>  #define     V_008F14_IMG_DATA_FORMAT_32                             0x04
>  #define     V_008F14_IMG_DATA_FORMAT_16_16                          0x05
>  #define     V_008F14_IMG_DATA_FORMAT_10_11_11                       0x06
>  #define     V_008F14_IMG_DATA_FORMAT_11_11_10                       0x07
>  #define     V_008F14_IMG_DATA_FORMAT_10_10_10_2                     0x08
>  #define     V_008F14_IMG_DATA_FORMAT_2_10_10_10                     0x09
> @@ -2187,23 +2187,23 @@
>  #define     V_008F14_IMG_DATA_FORMAT_FMASK32_S8_F8                  0x36
>  #define     V_008F14_IMG_DATA_FORMAT_FMASK64_S16_F4                 0x37
>  #define     V_008F14_IMG_DATA_FORMAT_FMASK64_S16_F8                 0x38
>  #define     V_008F14_IMG_DATA_FORMAT_4_4                            0x39
>  #define     V_008F14_IMG_DATA_FORMAT_6_5_5                          0x3A
>  #define     V_008F14_IMG_DATA_FORMAT_1                              0x3B
>  #define     V_008F14_IMG_DATA_FORMAT_1_REVERSED                     0x3C
>  #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
>  #define     V_008F14_IMG_NUM_FORMAT_SSCALED                         0x03
>  #define     V_008F14_IMG_NUM_FORMAT_UINT                            0x04
>  #define     V_008F14_IMG_NUM_FORMAT_SINT                            0x05
>  #define     V_008F14_IMG_NUM_FORMAT_SNORM_OGL                       0x06
>  #define     V_008F14_IMG_NUM_FORMAT_FLOAT                           0x07
>  #define     V_008F14_IMG_NUM_FORMAT_RESERVED_8                      0x08
>  #define     V_008F14_IMG_NUM_FORMAT_SRGB                            0x09
> diff --git a/src/amd/vulkan/radv_image.c b/src/amd/vulkan/radv_image.c
> index 090ca70a327..94cde4d19f2 100644
> --- a/src/amd/vulkan/radv_image.c
> +++ b/src/amd/vulkan/radv_image.c
> @@ -528,22 +528,22 @@ si_make_texture_descriptor(struct radv_device
> *device,
>                 height = 1;
>                 depth = image->info.array_size;
>         } else if (type == V_008F1C_SQ_RSRC_IMG_2D_ARRAY ||
>                    type == V_008F1C_SQ_RSRC_IMG_2D_MSAA_ARRAY) {
>                 if (view_type != VK_IMAGE_VIEW_TYPE_3D)
>                         depth = image->info.array_size;
>         } else if (type == V_008F1C_SQ_RSRC_IMG_CUBE)
>                 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));
>         state[3] = (S_008F1C_DST_SEL_X(radv_map_swizzle(swizzle[0])) |
>                     S_008F1C_DST_SEL_Y(radv_map_swizzle(swizzle[1])) |
>                     S_008F1C_DST_SEL_Z(radv_map_swizzle(swizzle[2])) |
>                     S_008F1C_DST_SEL_W(radv_map_swizzle(swizzle[3])) |
>                     S_008F1C_BASE_LEVEL(image->info.samples > 1 ?
>                                         0 : first_level) |
>                     S_008F1C_LAST_LEVEL(image->info.samples > 1 ?
> @@ -628,22 +628,22 @@ si_make_texture_descriptor(struct radv_device
> *device,
>                         default:
>                                 assert(0);
>                                 fmask_format =
> V_008F14_IMG_DATA_FORMAT_INVALID;
>                         }
>                         num_format = V_008F14_IMG_NUM_FORMAT_UINT;
>                 }
>
>                 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) |
>                         S_008F1C_DST_SEL_Y(V_008F1C_SQ_SEL_X) |
>                         S_008F1C_DST_SEL_Z(V_008F1C_SQ_SEL_X) |
>                         S_008F1C_DST_SEL_W(V_008F1C_SQ_SEL_X) |
>                         S_008F1C_TYPE(radv_tex_dim(image->type, view_type,
> image->info.array_size, 0, false, false));
>                 fmask_state[4] = 0;
>                 fmask_state[5] = S_008F24_BASE_ARRAY(first_layer);
>                 fmask_state[6] = 0;
> diff --git a/src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c
> b/src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c
> index 6decedc4cce..1cb0f9d1c60 100644
> --- a/src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c
> +++ b/src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c
> @@ -1223,24 +1223,24 @@ si_lower_gather4_integer(struct si_shader_context
> *ctx,
>                                             LLVMConstInt(ctx->i32, 20,
> false), "");
>                 data_format = LLVMBuildAnd(builder, data_format,
>                                            LLVMConstInt(ctx->i32, (1u <<
> 6) - 1, false), "");
>                 wa_8888 = LLVMBuildICmp(
>                         builder, LLVMIntEQ, data_format,
>                         LLVMConstInt(ctx->i32,
> V_008F14_IMG_DATA_FORMAT_8_8_8_8, false),
>                         "");
>
>                 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), "");
>
>                 formats = LLVMBuildSelect(builder, wa_8888, wa_formats,
> formats, "");
>                 args->resource = LLVMBuildInsertElement(
>                         builder, args->resource, formats, ctx->i32_1, "");
>         }
>
>         if (target == TGSI_TEXTURE_RECT ||
> diff --git a/src/gallium/drivers/radeonsi/si_state.c
> b/src/gallium/drivers/radeonsi/si_state.c
> index 41aa4ef3336..0960f379c4f 100644
> --- a/src/gallium/drivers/radeonsi/si_state.c
> +++ b/src/gallium/drivers/radeonsi/si_state.c
> @@ -3821,22 +3821,22 @@ si_make_texture_descriptor(struct si_screen
> *screen,
>                 height = 1;
>                 depth = res->array_size;
>         } else if (type == V_008F1C_SQ_RSRC_IMG_2D_ARRAY ||
>                    type == V_008F1C_SQ_RSRC_IMG_2D_MSAA_ARRAY) {
>                 if (sampler || res->target != PIPE_TEXTURE_3D)
>                         depth = res->array_size;
>         } else if (type == V_008F1C_SQ_RSRC_IMG_CUBE)
>                 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));
>         state[3] = (S_008F1C_DST_SEL_X(si_map_swizzle(swizzle[0])) |
>                     S_008F1C_DST_SEL_Y(si_map_swizzle(swizzle[1])) |
>                     S_008F1C_DST_SEL_Z(si_map_swizzle(swizzle[2])) |
>                     S_008F1C_DST_SEL_W(si_map_swizzle(swizzle[3])) |
>                     S_008F1C_BASE_LEVEL(num_samples > 1 ? 0 : first_level)
> |
>                     S_008F1C_LAST_LEVEL(num_samples > 1 ?
>                                         util_logbase2(num_samples) :
> @@ -3977,22 +3977,22 @@ si_make_texture_descriptor(struct si_screen
> *screen,
>                                 break;
>                         default:
>                                 unreachable("invalid nr_samples");
>                         }
>                         num_format = V_008F14_IMG_NUM_FORMAT_UINT;
>                 }
>  #undef FMASK
>
>                 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) |
>                                  S_008F1C_DST_SEL_Y(V_008F1C_SQ_SEL_X) |
>                                  S_008F1C_DST_SEL_Z(V_008F1C_SQ_SEL_X) |
>                                  S_008F1C_DST_SEL_W(V_008F1C_SQ_SEL_X) |
>                                  S_008F1C_TYPE(si_tex_dim(screen, tex,
> target, 0));
>                 fmask_state[4] = 0;
>                 fmask_state[5] = S_008F24_BASE_ARRAY(first_layer);
>                 fmask_state[6] = 0;
> @@ -4154,21 +4154,21 @@ si_create_sampler_view_custom(struct pipe_context
> *ctx,
>                                                 state->u.tex.first_level,
>                                                 state->format);
>
>         si_make_texture_descriptor(sctx->screen, tex, true,
>                                    state->target, pipe_format,
> state_swizzle,
>                                    first_level, last_level,
>                                    state->u.tex.first_layer, last_layer,
>                                    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 ||
>                 num_format == V_008F14_IMG_NUM_FORMAT_UINT ||
>                 num_format == V_008F14_IMG_NUM_FORMAT_SINT;
>         view->base_level_info = &surflevel[base_level];
>         view->base_level = base_level;
>         view->block_width = util_format_get_blockwidth(pipe_format);
>         return &view->base;
>  }
> --
> 2.19.1
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
On 17.12.18 04:23, Marek Olšák wrote:
> The definitions weren't changed, but the values were. The names need to 

> be different, so that si_debug.c prints both the GFX6 and GFX9 values.


You're right. I have some larger changes of the debug printing that is 
smarter about which fields to print based on the chip_class, but it 
needs to be cleaned up. I'm withholding this patch until I'm ready to 
upstream those changes.

Cheers,
Nicolai


> 

> Marek

> 

> On Thu, Dec 6, 2018 at 9:01 AM Nicolai Hähnle <nhaehnle@gmail.com 

> <mailto:nhaehnle@gmail.com>> wrote:

> 

>     From: Nicolai Hähnle <nicolai.haehnle@amd.com

>     <mailto:nicolai.haehnle@amd.com>>

> 

>     The definition wasn't actually changed in gfx9, so having the suffix

>     makes no sense.

>     ---

>       src/amd/common/ac_nir_to_llvm.c                   |  2 +-

>       src/amd/common/gfx9d.h                            | 12 ++++++------

>       src/amd/common/sid.h                              | 12 ++++++------

>       src/amd/vulkan/radv_image.c                       |  8 ++++----

>       src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c |  6 +++---

>       src/gallium/drivers/radeonsi/si_state.c           | 10 +++++-----

>       6 files changed, 25 insertions(+), 25 deletions(-)

> 

>     diff --git a/src/amd/common/ac_nir_to_llvm.c

>     b/src/amd/common/ac_nir_to_llvm.c

>     index fe65dfff8f3..cbb5be4b1a2 100644

>     --- a/src/amd/common/ac_nir_to_llvm.c

>     +++ b/src/amd/common/ac_nir_to_llvm.c

>     @@ -1238,21 +1238,21 @@ static LLVMValueRef

>     lower_gather4_integer(struct ac_llvm_context *ctx,

>                      if (stype == GLSL_TYPE_UINT)

>                              /* Create a NUM FORMAT - 0x2 or 0x4 -

>     USCALED or UINT */

>                              tmp = LLVMBuildSelect(ctx->builder,

>     compare_cube_wa, LLVMConstInt(ctx->i32, 0x8000000, false),

>                                                   

>     LLVMConstInt(ctx->i32, 0x10000000, false), "");

>                      else

>                              /* Create a NUM FORMAT - 0x3 or 0x5 -

>     SSCALED or SINT */

>                              tmp = LLVMBuildSelect(ctx->builder,

>     compare_cube_wa, LLVMConstInt(ctx->i32, 0xc000000, false),

>                                                   

>     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, "");

> 

>                      /* don't modify the coordinates for this case */

>                      for (unsigned c = 0; c < 2; ++c)

>                              args->coords[c] = LLVMBuildSelect(

>                                      ctx->builder, compare_cube_wa,

>                                      orig_coords[c], args->coords[c], "");

>              }

>     diff --git a/src/amd/common/gfx9d.h b/src/amd/common/gfx9d.h

>     index 2e790c54699..5d3de5842a1 100644

>     --- a/src/amd/common/gfx9d.h

>     +++ b/src/amd/common/gfx9d.h

>     @@ -1262,23 +1262,23 @@

>       #define   S_030F14_COUNT_HI(x)                                   

>          (((unsigned)(x) & 0x7FFFFFFF) << 0)

>       #define   G_030F14_COUNT_HI(x)                                   

>          (((x) >> 0) & 0x7FFFFFFF)

>       #define   C_030F14_COUNT_HI                                       

>         0x80000000

>       #define R_008F14_SQ_IMG_RSRC_WORD1                               

>            0x008F14

>       #define   S_008F14_BASE_ADDRESS_HI(x)                             

>         (((unsigned)(x) & 0xFF) << 0)

>       #define   G_008F14_BASE_ADDRESS_HI(x)                             

>         (((x) >> 0) & 0xFF)

>       #define   C_008F14_BASE_ADDRESS_HI                               

>          0xFFFFFF00

>       #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_8                         

>        0x03

>       #define     V_008F14_IMG_DATA_FORMAT_32                           

>       0x04

>       #define     V_008F14_IMG_DATA_FORMAT_16_16                       

>        0x05

>       #define     V_008F14_IMG_DATA_FORMAT_10_11_11                     

>       0x06

>       #define     V_008F14_IMG_DATA_FORMAT_11_11_10                     

>       0x07

>       #define     V_008F14_IMG_DATA_FORMAT_10_10_10_2                   

>       0x08

>       #define     V_008F14_IMG_DATA_FORMAT_2_10_10_10                   

>       0x09

>     @@ -1329,23 +1329,23 @@

>       #define     V_008F14_IMG_DATA_FORMAT_N_IN_16_16_16_16             

>       0x36

>       #define     V_008F14_IMG_DATA_FORMAT_N_IN_16_AS_16_16_16_16       

>       0x37

>       #define     V_008F14_IMG_DATA_FORMAT_RESERVED_56                 

>        0x38

>       #define     V_008F14_IMG_DATA_FORMAT_4_4                         

>        0x39

>       #define     V_008F14_IMG_DATA_FORMAT_6_5_5                       

>        0x3A

>       #define     V_008F14_IMG_DATA_FORMAT_S8_16                       

>        0x3B

>       #define     V_008F14_IMG_DATA_FORMAT_S8_32                       

>        0x3C

>       #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

>       #define     V_008F14_IMG_NUM_FORMAT_SSCALED                       

>       0x03

>       #define     V_008F14_IMG_NUM_FORMAT_UINT                         

>        0x04

>       #define     V_008F14_IMG_NUM_FORMAT_SINT                         

>        0x05

>       #define     V_008F14_IMG_NUM_FORMAT_RESERVED_6                   

>        0x06

>       #define     V_008F14_IMG_NUM_FORMAT_FLOAT                         

>       0x07

>       #define     V_008F14_IMG_NUM_FORMAT_METADATA                     

>        0x08

>       #define     V_008F14_IMG_NUM_FORMAT_SRGB                         

>        0x09

>     diff --git a/src/amd/common/sid.h b/src/amd/common/sid.h

>     index 49683f1aa5a..a6d0bc2fe42 100644

>     --- a/src/amd/common/sid.h

>     +++ b/src/amd/common/sid.h

>     @@ -2120,23 +2120,23 @@

>       #define   S_030F14_COUNT_HI(x)                                   

>          (((unsigned)(x) & 0x7FFFFFFF) << 0)

>       #define   G_030F14_COUNT_HI(x)                                   

>          (((x) >> 0) & 0x7FFFFFFF)

>       #define   C_030F14_COUNT_HI                                       

>         0x80000000

>       #define R_008F14_SQ_IMG_RSRC_WORD1                               

>            0x008F14

>       #define   S_008F14_BASE_ADDRESS_HI(x)                             

>         (((unsigned)(x) & 0xFF) << 0)

>       #define   G_008F14_BASE_ADDRESS_HI(x)                             

>         (((x) >> 0) & 0xFF)

>       #define   C_008F14_BASE_ADDRESS_HI                               

>          0xFFFFFF00

>       #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_8_8                         

>        0x03

>       #define     V_008F14_IMG_DATA_FORMAT_32                           

>       0x04

>       #define     V_008F14_IMG_DATA_FORMAT_16_16                       

>        0x05

>       #define     V_008F14_IMG_DATA_FORMAT_10_11_11                     

>       0x06

>       #define     V_008F14_IMG_DATA_FORMAT_11_11_10                     

>       0x07

>       #define     V_008F14_IMG_DATA_FORMAT_10_10_10_2                   

>       0x08

>       #define     V_008F14_IMG_DATA_FORMAT_2_10_10_10                   

>       0x09

>     @@ -2187,23 +2187,23 @@

>       #define     V_008F14_IMG_DATA_FORMAT_FMASK32_S8_F8               

>        0x36

>       #define     V_008F14_IMG_DATA_FORMAT_FMASK64_S16_F4               

>       0x37

>       #define     V_008F14_IMG_DATA_FORMAT_FMASK64_S16_F8               

>       0x38

>       #define     V_008F14_IMG_DATA_FORMAT_4_4                         

>        0x39

>       #define     V_008F14_IMG_DATA_FORMAT_6_5_5                       

>        0x3A

>       #define     V_008F14_IMG_DATA_FORMAT_1                           

>        0x3B

>       #define     V_008F14_IMG_DATA_FORMAT_1_REVERSED                   

>       0x3C

>       #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

>       #define     V_008F14_IMG_NUM_FORMAT_SSCALED                       

>       0x03

>       #define     V_008F14_IMG_NUM_FORMAT_UINT                         

>        0x04

>       #define     V_008F14_IMG_NUM_FORMAT_SINT                         

>        0x05

>       #define     V_008F14_IMG_NUM_FORMAT_SNORM_OGL                     

>       0x06

>       #define     V_008F14_IMG_NUM_FORMAT_FLOAT                         

>       0x07

>       #define     V_008F14_IMG_NUM_FORMAT_RESERVED_8                   

>        0x08

>       #define     V_008F14_IMG_NUM_FORMAT_SRGB                         

>        0x09

>     diff --git a/src/amd/vulkan/radv_image.c b/src/amd/vulkan/radv_image.c

>     index 090ca70a327..94cde4d19f2 100644

>     --- a/src/amd/vulkan/radv_image.c

>     +++ b/src/amd/vulkan/radv_image.c

>     @@ -528,22 +528,22 @@ si_make_texture_descriptor(struct radv_device

>     *device,

>                      height = 1;

>                      depth = image->info.array_size;

>              } else if (type == V_008F1C_SQ_RSRC_IMG_2D_ARRAY ||

>                         type == V_008F1C_SQ_RSRC_IMG_2D_MSAA_ARRAY) {

>                      if (view_type != VK_IMAGE_VIEW_TYPE_3D)

>                              depth = image->info.array_size;

>              } else if (type == V_008F1C_SQ_RSRC_IMG_CUBE)

>                      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));

>              state[3] = (S_008F1C_DST_SEL_X(radv_map_swizzle(swizzle[0])) |

>                          S_008F1C_DST_SEL_Y(radv_map_swizzle(swizzle[1])) |

>                          S_008F1C_DST_SEL_Z(radv_map_swizzle(swizzle[2])) |

>                          S_008F1C_DST_SEL_W(radv_map_swizzle(swizzle[3])) |

>                          S_008F1C_BASE_LEVEL(image->info.samples > 1 ?

>                                              0 : first_level) |

>                          S_008F1C_LAST_LEVEL(image->info.samples > 1 ?

>     @@ -628,22 +628,22 @@ si_make_texture_descriptor(struct radv_device

>     *device,

>                              default:

>                                      assert(0);

>                                      fmask_format =

>     V_008F14_IMG_DATA_FORMAT_INVALID;

>                              }

>                              num_format = V_008F14_IMG_NUM_FORMAT_UINT;

>                      }

> 

>                      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) |

>                              S_008F1C_DST_SEL_Y(V_008F1C_SQ_SEL_X) |

>                              S_008F1C_DST_SEL_Z(V_008F1C_SQ_SEL_X) |

>                              S_008F1C_DST_SEL_W(V_008F1C_SQ_SEL_X) |

>                              S_008F1C_TYPE(radv_tex_dim(image->type,

>     view_type, image->info.array_size, 0, false, false));

>                      fmask_state[4] = 0;

>                      fmask_state[5] = S_008F24_BASE_ARRAY(first_layer);

>                      fmask_state[6] = 0;

>     diff --git a/src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c

>     b/src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c

>     index 6decedc4cce..1cb0f9d1c60 100644

>     --- a/src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c

>     +++ b/src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c

>     @@ -1223,24 +1223,24 @@ si_lower_gather4_integer(struct

>     si_shader_context *ctx,

>                                                  LLVMConstInt(ctx->i32,

>     20, false), "");

>                      data_format = LLVMBuildAnd(builder, data_format,

>                                                 LLVMConstInt(ctx->i32,

>     (1u << 6) - 1, false), "");

>                      wa_8888 = LLVMBuildICmp(

>                              builder, LLVMIntEQ, data_format,

>                              LLVMConstInt(ctx->i32,

>     V_008F14_IMG_DATA_FORMAT_8_8_8_8, false),

>                              "");

> 

>                      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), "");

> 

>                      formats = LLVMBuildSelect(builder, wa_8888,

>     wa_formats, formats, "");

>                      args->resource = LLVMBuildInsertElement(

>                              builder, args->resource, formats,

>     ctx->i32_1, "");

>              }

> 

>              if (target == TGSI_TEXTURE_RECT ||

>     diff --git a/src/gallium/drivers/radeonsi/si_state.c

>     b/src/gallium/drivers/radeonsi/si_state.c

>     index 41aa4ef3336..0960f379c4f 100644

>     --- a/src/gallium/drivers/radeonsi/si_state.c

>     +++ b/src/gallium/drivers/radeonsi/si_state.c

>     @@ -3821,22 +3821,22 @@ si_make_texture_descriptor(struct si_screen

>     *screen,

>                      height = 1;

>                      depth = res->array_size;

>              } else if (type == V_008F1C_SQ_RSRC_IMG_2D_ARRAY ||

>                         type == V_008F1C_SQ_RSRC_IMG_2D_MSAA_ARRAY) {

>                      if (sampler || res->target != PIPE_TEXTURE_3D)

>                              depth = res->array_size;

>              } else if (type == V_008F1C_SQ_RSRC_IMG_CUBE)

>                      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));

>              state[3] = (S_008F1C_DST_SEL_X(si_map_swizzle(swizzle[0])) |

>                          S_008F1C_DST_SEL_Y(si_map_swizzle(swizzle[1])) |

>                          S_008F1C_DST_SEL_Z(si_map_swizzle(swizzle[2])) |

>                          S_008F1C_DST_SEL_W(si_map_swizzle(swizzle[3])) |

>                          S_008F1C_BASE_LEVEL(num_samples > 1 ? 0 :

>     first_level) |

>                          S_008F1C_LAST_LEVEL(num_samples > 1 ?

>                                              util_logbase2(num_samples) :

>     @@ -3977,22 +3977,22 @@ si_make_texture_descriptor(struct si_screen

>     *screen,

>                                      break;

>                              default:

>                                      unreachable("invalid nr_samples");

>                              }

>                              num_format = V_008F14_IMG_NUM_FORMAT_UINT;

>                      }

>       #undef FMASK

> 

>                      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) |

>                                     

>       S_008F1C_DST_SEL_Y(V_008F1C_SQ_SEL_X) |

>                                     

>       S_008F1C_DST_SEL_Z(V_008F1C_SQ_SEL_X) |

>                                     

>       S_008F1C_DST_SEL_W(V_008F1C_SQ_SEL_X) |

>                                       S_008F1C_TYPE(si_tex_dim(screen,

>     tex, target, 0));

>                      fmask_state[4] = 0;

>                      fmask_state[5] = S_008F24_BASE_ARRAY(first_layer);

>                      fmask_state[6] = 0;

>     @@ -4154,21 +4154,21 @@ si_create_sampler_view_custom(struct

>     pipe_context *ctx,

>                                                     

>     state->u.tex.first_level,

>                                                      state->format);

> 

>              si_make_texture_descriptor(sctx->screen, tex, true,

>                                         state->target, pipe_format,

>     state_swizzle,

>                                         first_level, last_level,

>                                         state->u.tex.first_layer,

>     last_layer,

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

>                      num_format == V_008F14_IMG_NUM_FORMAT_UINT ||

>                      num_format == V_008F14_IMG_NUM_FORMAT_SINT;

>              view->base_level_info = &surflevel[base_level];

>              view->base_level = base_level;

>              view->block_width = util_format_get_blockwidth(pipe_format);

>              return &view->base;

>       }

>     -- 

>     2.19.1

> 

>     _______________________________________________

>     mesa-dev mailing list

>     mesa-dev@lists.freedesktop.org <mailto:mesa-dev@lists.freedesktop.org>

>     https://lists.freedesktop.org/mailman/listinfo/mesa-dev

>