Mesa (17.3): r600: Take ALU_EXTENDED into account when evaluating jump offsets

Juan Antonio Suárez Romero jasuarez at kemper.freedesktop.org
Mon Mar 19 11:25:43 UTC 2018


Module: Mesa
Branch: 17.3
Commit: 91325ea754fc1c23910b44e8efd04f6c3c76fecd
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=91325ea754fc1c23910b44e8efd04f6c3c76fecd

Author: Gert Wollny <gw.fossdev at gmail.com>
Date:   Sat Feb 24 11:31:22 2018 +0100

r600: Take ALU_EXTENDED into account when evaluating jump offsets

ALU_EXTENDED needs 4 DWORDS instead of the usual 2, hence if the last ALU
clause within a IF-JUMP or ELSE branch is ALU_EXTENDED the target jump
offset needs to be adjusted accordingly.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104654
Cc: <mesa-stable at lists.freedesktop.org>
Signed-off-by: Gert Wollny <gw.fossdev at gmail.com>
Reviewed-by: Dave Airlie <airlied at redhat.com>
(cherry picked from commit c7cadcbda47537d474eea52b9e77e57ef9287f9b)
[Juan A. Suarez: resolve trivial conflicts]
Signed-off-by: Juan A. Suarez Romero <jasuarez at igalia.com>

Conflicts:
	src/gallium/drivers/r600/r600_shader.c

---

 src/gallium/drivers/r600/r600_shader.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c
index 1fd009f5db..e2f2e94666 100644
--- a/src/gallium/drivers/r600/r600_shader.c
+++ b/src/gallium/drivers/r600/r600_shader.c
@@ -8564,17 +8564,22 @@ static int tgsi_else(struct r600_shader_ctx *ctx)
 
 static int tgsi_endif(struct r600_shader_ctx *ctx)
 {
+	int offset = 2;
 	pops(ctx, 1);
 	if (ctx->bc->fc_stack[ctx->bc->fc_sp - 1].type != FC_IF) {
 		R600_ERR("if/endif unbalanced in shader\n");
 		return -1;
 	}
 
+	/* ALU_EXTENDED needs 4 DWords instead of two, adjust jump target offset accordingly */
+	if (ctx->bc->cf_last->eg_alu_extended)
+			offset += 2;
+
 	if (ctx->bc->fc_stack[ctx->bc->fc_sp - 1].mid == NULL) {
-		ctx->bc->fc_stack[ctx->bc->fc_sp - 1].start->cf_addr = ctx->bc->cf_last->id + 2;
+		ctx->bc->fc_stack[ctx->bc->fc_sp - 1].start->cf_addr = ctx->bc->cf_last->id + offset;
 		ctx->bc->fc_stack[ctx->bc->fc_sp - 1].start->pop_count = 1;
 	} else {
-		ctx->bc->fc_stack[ctx->bc->fc_sp - 1].mid[0]->cf_addr = ctx->bc->cf_last->id + 2;
+		ctx->bc->fc_stack[ctx->bc->fc_sp - 1].mid[0]->cf_addr = ctx->bc->cf_last->id + offset;
 	}
 	fc_poplevel(ctx);
 




More information about the mesa-commit mailing list