summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/lima/ir
diff options
context:
space:
mode:
authorVasily Khoruzhick <[email protected]>2019-07-14 18:22:36 -0700
committerVasily Khoruzhick <[email protected]>2019-07-14 19:49:14 -0700
commiteb862c2365cbc68d07360628f72af0db426f6b6f (patch)
treec07c83a1147d6328d87bd3919bfec0d70ca33847 /src/gallium/drivers/lima/ir
parent8f0160ca249fcfda676b2bb42dc2726edba50f9a (diff)
lima/ppir: Fix branch codegen
"unknown_2" field is actually a size of instruction that branch points to. If it's set to a smaller size than actual instruction branch behavior is not defined (and it usually wedges the GPU). Fix it by setting this field correctly. Fixes: af0de6b91c0b ("lima/ppir: implement discard and discard_if") Reviewed-by: Qiang Yu <[email protected]> Signed-off-by: Vasily Khoruzhick <[email protected]>
Diffstat (limited to 'src/gallium/drivers/lima/ir')
-rw-r--r--src/gallium/drivers/lima/ir/pp/codegen.c5
-rw-r--r--src/gallium/drivers/lima/ir/pp/codegen.h2
-rw-r--r--src/gallium/drivers/lima/ir/pp/ppir.h1
3 files changed, 5 insertions, 3 deletions
diff --git a/src/gallium/drivers/lima/ir/pp/codegen.c b/src/gallium/drivers/lima/ir/pp/codegen.c
index 3b74f2c6afe..49e91a87a38 100644
--- a/src/gallium/drivers/lima/ir/pp/codegen.c
+++ b/src/gallium/drivers/lima/ir/pp/codegen.c
@@ -543,10 +543,10 @@ static void ppir_codegen_encode_branch(ppir_node *node, void *code)
b->branch.cond_eq = branch->cond_eq;
b->branch.cond_lt = branch->cond_lt;
b->branch.unknown_1 = 0x0;
- b->branch.unknown_2 = 0x3;
target_instr = list_first_entry(&branch->target->instr_list, ppir_instr, list);
b->branch.target = target_instr->offset - node->instr->offset;
+ b->branch.next_count = target_instr->encode_size;
}
typedef void (*ppir_codegen_instr_slot_encode_func)(ppir_node *, void *);
@@ -699,7 +699,8 @@ bool ppir_codegen_prog(ppir_compiler *comp)
list_for_each_entry(ppir_block, block, &comp->block_list, list) {
list_for_each_entry(ppir_instr, instr, &block->instr_list, list) {
instr->offset = size;
- size += get_instr_encode_size(instr);
+ instr->encode_size = get_instr_encode_size(instr);
+ size += instr->encode_size;
}
}
diff --git a/src/gallium/drivers/lima/ir/pp/codegen.h b/src/gallium/drivers/lima/ir/pp/codegen.h
index ab80d392dc2..3157566d918 100644
--- a/src/gallium/drivers/lima/ir/pp/codegen.h
+++ b/src/gallium/drivers/lima/ir/pp/codegen.h
@@ -345,7 +345,7 @@ typedef union __attribute__((__packed__)) {
bool cond_lt : 1;
unsigned unknown_1 : 22; /* = 0 0000 0000 0000 0000 0000 0 */
signed target : 27;
- unsigned unknown_2 : 5; /* = 0 0011 */
+ unsigned next_count : 5;
} branch;
struct __attribute__((__packed__)) {
unsigned word0 : 32;
diff --git a/src/gallium/drivers/lima/ir/pp/ppir.h b/src/gallium/drivers/lima/ir/pp/ppir.h
index 2da4ea35a1d..dafbd942532 100644
--- a/src/gallium/drivers/lima/ir/pp/ppir.h
+++ b/src/gallium/drivers/lima/ir/pp/ppir.h
@@ -301,6 +301,7 @@ typedef struct ppir_instr {
int parent_index;
bool scheduled;
int offset;
+ int encode_size;
} ppir_instr;
typedef struct ppir_block {