[Mesa-dev] [PATCH] radeonsi: fix assertion failure by using the correct type

Marek Olšák maraeo at gmail.com
Wed Feb 27 23:33:48 UTC 2019


From: Marek Olšák <marek.olsak at amd.com>

src/gallium/drivers/radeonsi/si_state_viewport.c:196: si_emit_guardband:
Assertion `vp_as_scissor.maxx <= max_viewport_size[vp_as_scissor.quant_mode]
&& vp_as_scissor.maxy <= max_viewport_size[vp_as_scissor.quant_mode]' failed.

The comparison was unsigned, so negative maxx or maxy would fail.

Fixes: 3c540e0a7488 "radeonsi: Fix guardband computation for large render targets"
---
 src/gallium/drivers/radeonsi/si_state_viewport.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/drivers/radeonsi/si_state_viewport.c b/src/gallium/drivers/radeonsi/si_state_viewport.c
index 64bb956b200..a9a1be73ba4 100644
--- a/src/gallium/drivers/radeonsi/si_state_viewport.c
+++ b/src/gallium/drivers/radeonsi/si_state_viewport.c
@@ -179,21 +179,21 @@ static void si_emit_guardband(struct si_context *ctx)
 	 * within the viewport range in order to maximize the guardband size.
 	 */
 	int hw_screen_offset_x = (vp_as_scissor.maxx + vp_as_scissor.minx) / 2;
 	int hw_screen_offset_y = (vp_as_scissor.maxy + vp_as_scissor.miny) / 2;
 
 	/* SI-CI need to align the offset to an ubertile consisting of all SEs. */
 	const unsigned hw_screen_offset_alignment =
 		ctx->chip_class >= VI ? 16 : MAX2(ctx->screen->se_tile_repeat, 16);
 
 	/* Indexed by quantization modes */
-	static unsigned max_viewport_size[] = {65535, 16383, 4095};
+	static int max_viewport_size[] = {65535, 16383, 4095};
 
 	/* Ensure that the whole viewport stays representable in
 	 * absolute coordinates.
 	 * See comment in si_set_viewport_states.
 	 */
 	assert(vp_as_scissor.maxx <= max_viewport_size[vp_as_scissor.quant_mode] &&
 	       vp_as_scissor.maxy <= max_viewport_size[vp_as_scissor.quant_mode]);
 
 	hw_screen_offset_x = CLAMP(hw_screen_offset_x, 0, MAX_PA_SU_HARDWARE_SCREEN_OFFSET);
 	hw_screen_offset_y = CLAMP(hw_screen_offset_y, 0, MAX_PA_SU_HARDWARE_SCREEN_OFFSET);
-- 
2.17.1



More information about the mesa-dev mailing list