Mesa (master): ilo: fix JIP/UIP on Gen8

Chia-I Wu olv at kemper.freedesktop.org
Fri Feb 13 22:58:16 UTC 2015


Module: Mesa
Branch: master
Commit: 8323796840a343ee39687cc8e8b424ee43d6fee7
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=8323796840a343ee39687cc8e8b424ee43d6fee7

Author: Chia-I Wu <olvaffe at gmail.com>
Date:   Sat Feb 14 06:28:12 2015 +0800

ilo: fix JIP/UIP on Gen8

UIP is in DW2 and JIP is in DW3 on Gen8.  Also, the units are in bytes.

---

 src/gallium/drivers/ilo/shader/toy_compiler_asm.c |    8 +++++--
 src/gallium/drivers/ilo/shader/toy_legalize.c     |   26 +++++++++++++++------
 2 files changed, 25 insertions(+), 9 deletions(-)

diff --git a/src/gallium/drivers/ilo/shader/toy_compiler_asm.c b/src/gallium/drivers/ilo/shader/toy_compiler_asm.c
index 0977d60..1f465a3 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 f1bacbd..4e573ca 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);
+   }
 }
 
 /**




More information about the mesa-commit mailing list