From: Chia-I Wu Date: Fri, 13 Feb 2015 22:28:12 +0000 (+0800) Subject: ilo: fix JIP/UIP on Gen8 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8323796840a343ee39687cc8e8b424ee43d6fee7;p=mesa.git ilo: fix JIP/UIP on Gen8 UIP is in DW2 and JIP is in DW3 on Gen8. Also, the units are in bytes. --- diff --git a/src/gallium/drivers/ilo/shader/toy_compiler_asm.c b/src/gallium/drivers/ilo/shader/toy_compiler_asm.c index 0977d60c2c4..1f465a3b13b 100644 --- a/src/gallium/drivers/ilo/shader/toy_compiler_asm.c +++ b/src/gallium/drivers/ilo/shader/toy_compiler_asm.c @@ -444,8 +444,12 @@ translate_src_gen6(const struct codegen *cg, int idx) /* special treatment may be needed if any of the operand is immediate */ if (cg->src[0].file == GEN6_FILE_IMM) { assert(!cg->src[0].absolute && !cg->src[0].negate); - /* only the last src operand can be an immediate */ - assert(src_is_null(cg, 1)); + + /* only the last src operand can be an immediate unless it is Gen8+ */ + assert(ilo_dev_gen(cg->dev) >= ILO_GEN(8) || src_is_null(cg, 1)); + + if (!src_is_null(cg, 1)) + return cg->src[idx].origin; if (idx == 0) { if (ilo_dev_gen(cg->dev) >= ILO_GEN(8)) { diff --git a/src/gallium/drivers/ilo/shader/toy_legalize.c b/src/gallium/drivers/ilo/shader/toy_legalize.c index f1bacbdc1b1..4e573caadf4 100644 --- a/src/gallium/drivers/ilo/shader/toy_legalize.c +++ b/src/gallium/drivers/ilo/shader/toy_legalize.c @@ -335,7 +335,9 @@ patch_while_jip(struct toy_compiler *tc, struct toy_inst *inst) dist--; } - if (ilo_dev_gen(tc->dev) >= ILO_GEN(7)) + if (ilo_dev_gen(tc->dev) >= ILO_GEN(8)) + inst->src[1] = tsrc_imm_d(dist * 16); + else if (ilo_dev_gen(tc->dev) >= ILO_GEN(7)) inst->src[1] = tsrc_imm_w(dist * 2); else inst->dst = tdst_imm_w(dist * 2); @@ -388,13 +390,16 @@ patch_if_else_jip(struct toy_compiler *tc, struct toy_inst *inst) dist++; } - if (ilo_dev_gen(tc->dev) >= ILO_GEN(7)) { + if (ilo_dev_gen(tc->dev) >= ILO_GEN(8)) { + inst->dst.type = TOY_TYPE_D; + inst->src[0] = tsrc_imm_d(uip * 8); + inst->src[1] = tsrc_imm_d(jip * 8); + } else if (ilo_dev_gen(tc->dev) >= ILO_GEN(7)) { /* what should the type be? */ inst->dst.type = TOY_TYPE_D; inst->src[0].type = TOY_TYPE_D; inst->src[1] = tsrc_imm_d(uip << 16 | jip); - } - else { + } else { inst->dst = tdst_imm_w(jip); } } @@ -431,7 +436,9 @@ patch_endif_jip(struct toy_compiler *tc, struct toy_inst *inst) if (!found) dist = 1; - if (ilo_dev_gen(tc->dev) >= ILO_GEN(7)) + if (ilo_dev_gen(tc->dev) >= ILO_GEN(8)) + inst->src[1] = tsrc_imm_d(dist * 16); + else if (ilo_dev_gen(tc->dev) >= ILO_GEN(7)) inst->src[1] = tsrc_imm_w(dist * 2); else inst->dst = tdst_imm_w(dist * 2); @@ -495,8 +502,13 @@ patch_break_continue_jip(struct toy_compiler *tc, struct toy_inst *inst) /* should the type be D or W? */ inst->dst.type = TOY_TYPE_D; - inst->src[0].type = TOY_TYPE_D; - inst->src[1] = tsrc_imm_d(uip << 16 | jip); + if (ilo_dev_gen(tc->dev) >= ILO_GEN(8)) { + inst->src[0] = tsrc_imm_d(uip * 8); + inst->src[1] = tsrc_imm_d(jip * 8); + } else { + inst->src[0].type = TOY_TYPE_D; + inst->src[1] = tsrc_imm_d(uip << 16 | jip); + } } /**