[Mesa-dev] [PATCH 5/6] r600g: some -Wsign-compare fixes

Konstantin Kharlamov Hi-Angel at yandex.ru
Fri Dec 29 05:32:31 UTC 2017


Signed-off-by: Konstantin Kharlamov <Hi-Angel at yandex.ru>
---
 src/gallium/drivers/r600/eg_debug.c          | 6 +++---
 src/gallium/drivers/r600/evergreen_state.c   | 6 +++---
 src/gallium/drivers/r600/r600_isa.c          | 6 +++---
 src/gallium/drivers/r600/r600_pipe.h         | 2 +-
 src/gallium/drivers/r600/r600_state_common.c | 5 ++---
 src/gallium/drivers/r600/r600_test_dma.c     | 2 +-
 6 files changed, 13 insertions(+), 14 deletions(-)

diff --git a/src/gallium/drivers/r600/eg_debug.c b/src/gallium/drivers/r600/eg_debug.c
index ceb7c1672c..56195df296 100644
--- a/src/gallium/drivers/r600/eg_debug.c
+++ b/src/gallium/drivers/r600/eg_debug.c
@@ -78,7 +78,7 @@ static void print_named_value(FILE *file, const char *name, uint32_t value,
 static void eg_dump_reg(FILE *file, unsigned offset, uint32_t value,
 			uint32_t field_mask)
 {
-	int r, f;
+	unsigned r, f;
 
 	for (r = 0; r < ARRAY_SIZE(egd_reg_table); r++) {
 		const struct eg_reg *reg = &egd_reg_table[r];
@@ -134,7 +134,7 @@ static void ac_parse_set_reg_packet(FILE *f, uint32_t *ib, unsigned count,
 				    unsigned reg_offset)
 {
 	unsigned reg = (ib[1] << 2) + reg_offset;
-	int i;
+	unsigned i;
 
 	for (i = 0; i < count; i++)
 		eg_dump_reg(f, reg + i*4, ib[2+i], ~0);
@@ -149,7 +149,7 @@ static uint32_t *ac_parse_packet3(FILE *f, uint32_t *ib, int *num_dw,
 	unsigned op = PKT3_IT_OPCODE_G(ib[0]);
 	const char *predicate = PKT3_PREDICATE(ib[0]) ? "(predicate)" : "";
 	const char *compute_mode = (ib[0] & 0x2) ? "(C)" : "";
-	int i;
+	unsigned i;
 
 	/* Print the name first. */
 	for (i = 0; i < ARRAY_SIZE(packet3_table); i++)
diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c
index ecb9c598e3..1aae9097f3 100644
--- a/src/gallium/drivers/r600/evergreen_state.c
+++ b/src/gallium/drivers/r600/evergreen_state.c
@@ -3915,7 +3915,7 @@ static void evergreen_set_hw_atomic_buffers(struct pipe_context *ctx,
 {
 	struct r600_context *rctx = (struct r600_context *)ctx;
 	struct r600_atomic_buffer_state *astate;
-	int i, idx;
+	unsigned i, idx;
 
 	astate = &rctx->atomic_buffer_state;
 
@@ -3951,7 +3951,7 @@ static void evergreen_set_shader_buffers(struct pipe_context *ctx,
 	struct r600_tex_color_info color;
 	struct eg_buf_res_params buf_params;
 	struct r600_resource *resource;
-	int i, idx;
+	unsigned i, idx;
 	unsigned old_mask;
 
 	if (shader != PIPE_SHADER_FRAGMENT &&
@@ -4042,7 +4042,7 @@ static void evergreen_set_shader_images(struct pipe_context *ctx,
 					const struct pipe_image_view *images)
 {
 	struct r600_context *rctx = (struct r600_context *)ctx;
-	int i;
+	unsigned i;
 	struct r600_image_view *rview;
 	struct pipe_resource *image;
 	struct r600_resource *resource;
diff --git a/src/gallium/drivers/r600/r600_isa.c b/src/gallium/drivers/r600/r600_isa.c
index 2633cdcdb9..0d3e93d141 100644
--- a/src/gallium/drivers/r600/r600_isa.c
+++ b/src/gallium/drivers/r600/r600_isa.c
@@ -557,7 +557,7 @@ int r600_isa_init(struct r600_context *ctx, struct r600_isa *isa) {
 
 	for (i = 0; i < ARRAY_SIZE(r600_alu_op_table); ++i) {
 		const struct alu_op_info *op = &r600_alu_op_table[i];
-		unsigned opc;
+		int opc;
 		if (op->flags & AF_LDS || op->slots[isa->hw_class] == 0)
 			continue;
 		opc = op->opcode[isa->hw_class >> 1];
@@ -570,7 +570,7 @@ int r600_isa_init(struct r600_context *ctx, struct r600_isa *isa) {
 
 	for (i = 0; i < ARRAY_SIZE(fetch_op_table); ++i) {
 		const struct fetch_op_info *op = &fetch_op_table[i];
-		unsigned opc = op->opcode[isa->hw_class];
+		int opc = op->opcode[isa->hw_class];
 		if ((op->flags & FF_GDS) || ((opc & 0xFF) != opc))
 			continue; /* ignore GDS ops and INST_MOD versions for now */
 		isa->fetch_map[opc] = i + 1;
@@ -578,7 +578,7 @@ int r600_isa_init(struct r600_context *ctx, struct r600_isa *isa) {
 
 	for (i = 0; i < ARRAY_SIZE(cf_op_table); ++i) {
 		const struct cf_op_info *op = &cf_op_table[i];
-		unsigned opc = op->opcode[isa->hw_class];
+		int opc = op->opcode[isa->hw_class];
 		if (opc == -1)
 			continue;
 		/* using offset for CF_ALU_xxx opcodes because they overlap with other
diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h
index e042edf2b4..65206b023d 100644
--- a/src/gallium/drivers/r600/r600_pipe.h
+++ b/src/gallium/drivers/r600/r600_pipe.h
@@ -560,7 +560,7 @@ struct r600_context {
 	bool                            gs_tri_strip_adj_fix;
 	boolean				dual_src_blend;
 	unsigned			zwritemask;
-	int					ps_iter_samples;
+	unsigned			ps_iter_samples;
 
 	/* The list of all texture buffer objects in this context.
 	 * This list is walked when a buffer is invalidated/reallocated and
diff --git a/src/gallium/drivers/r600/r600_state_common.c b/src/gallium/drivers/r600/r600_state_common.c
index e5a5a33367..ec8945f084 100644
--- a/src/gallium/drivers/r600/r600_state_common.c
+++ b/src/gallium/drivers/r600/r600_state_common.c
@@ -1291,7 +1291,7 @@ void r600_update_driver_const_buffers(struct r600_context *rctx, bool compute_on
 }
 
 static void *r600_alloc_buf_consts(struct r600_context *rctx, int shader_type,
-				   int array_size, uint32_t *base_offset)
+				   unsigned array_size, uint32_t *base_offset)
 {
 	struct r600_shader_driver_constants_info *info = &rctx->driver_consts[shader_type];
 	if (array_size + R600_UCP_SIZE > info->alloc_size) {
@@ -1433,14 +1433,13 @@ void eg_setup_buffer_constants(struct r600_context *rctx, int shader_type)
 /* set sample xy locations as array of fragment shader constants */
 void r600_set_sample_locations_constant_buffer(struct r600_context *rctx)
 {
-	int i;
 	struct pipe_context *ctx = &rctx->b.b;
 
 	assert(rctx->framebuffer.nr_samples < R600_UCP_SIZE);
 	assert(rctx->framebuffer.nr_samples <= ARRAY_SIZE(rctx->sample_positions)/4);
 
 	memset(rctx->sample_positions, 0, 4 * 4 * 16);
-	for (i = 0; i < rctx->framebuffer.nr_samples; i++) {
+	for (unsigned i = 0; i < rctx->framebuffer.nr_samples; i++) {
 		ctx->get_sample_position(ctx, rctx->framebuffer.nr_samples, i, &rctx->sample_positions[4*i]);
 		/* Also fill in center-zeroed positions used for interpolateAtSample */
 		rctx->sample_positions[4*i + 2] = rctx->sample_positions[4*i + 0] - 0.5f;
diff --git a/src/gallium/drivers/r600/r600_test_dma.c b/src/gallium/drivers/r600/r600_test_dma.c
index 9e1ff9e5fe..af86ad386f 100644
--- a/src/gallium/drivers/r600/r600_test_dma.c
+++ b/src/gallium/drivers/r600/r600_test_dma.c
@@ -57,7 +57,7 @@ static void set_random_pixels(struct pipe_context *ctx,
 {
 	struct pipe_transfer *t;
 	uint8_t *map;
-	int x,y,z;
+	unsigned x,y,z;
 
 	map = pipe_transfer_map_3d(ctx, tex, 0, PIPE_TRANSFER_WRITE,
 				   0, 0, 0, tex->width0, tex->height0,
-- 
2.15.1



More information about the mesa-dev mailing list