[Mesa-dev] [PATCH 2/9] i965: Make brw_JMPI set predicate_control based on a parameter.

Kenneth Graunke kenneth at whitecape.org
Fri May 30 20:09:11 PDT 2014


We use both predicated and unconditional JMPI instructions.  But in each
case, it's clear which we want.  It's simpler to just specify it as a
parameter, rather than relying on default state.

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
 src/mesa/drivers/dri/i965/brw_eu.h      |  3 ++-
 src/mesa/drivers/dri/i965/brw_eu_emit.c |  4 +++-
 src/mesa/drivers/dri/i965/brw_sf_emit.c | 16 ++++++++--------
 3 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_eu.h b/src/mesa/drivers/dri/i965/brw_eu.h
index fb64bc5..baa135b 100644
--- a/src/mesa/drivers/dri/i965/brw_eu.h
+++ b/src/mesa/drivers/dri/i965/brw_eu.h
@@ -335,7 +335,8 @@ struct brw_instruction *brw_CONT(struct brw_compile *p);
 struct brw_instruction *gen6_CONT(struct brw_compile *p);
 struct brw_instruction *gen6_HALT(struct brw_compile *p);
 
-struct brw_instruction *brw_JMPI(struct brw_compile *p, struct brw_reg index);
+struct brw_instruction *brw_JMPI(struct brw_compile *p, struct brw_reg index,
+                                 unsigned predicate_control);
 
 void brw_NOP(struct brw_compile *p);
 
diff --git a/src/mesa/drivers/dri/i965/brw_eu_emit.c b/src/mesa/drivers/dri/i965/brw_eu_emit.c
index 9178888..0bf6e3e 100644
--- a/src/mesa/drivers/dri/i965/brw_eu_emit.c
+++ b/src/mesa/drivers/dri/i965/brw_eu_emit.c
@@ -1189,7 +1189,8 @@ void brw_NOP(struct brw_compile *p)
  */
 
 struct brw_instruction *brw_JMPI(struct brw_compile *p,
-                                 struct brw_reg index)
+                                 struct brw_reg index,
+                                 unsigned predicate_control)
 {
    struct brw_reg ip = brw_ip_reg();
    struct brw_instruction *insn = brw_alu2(p, BRW_OPCODE_JMPI, ip, ip, index);
@@ -1197,6 +1198,7 @@ struct brw_instruction *brw_JMPI(struct brw_compile *p,
    insn->header.execution_size = 1;
    insn->header.compression_control = BRW_COMPRESSION_NONE;
    insn->header.mask_control = BRW_MASK_DISABLE;
+   insn->header.predicate_control = predicate_control;
 
    p->current->header.predicate_control = BRW_PREDICATE_NONE;
 
diff --git a/src/mesa/drivers/dri/i965/brw_sf_emit.c b/src/mesa/drivers/dri/i965/brw_sf_emit.c
index d8180a2..479d6d5 100644
--- a/src/mesa/drivers/dri/i965/brw_sf_emit.c
+++ b/src/mesa/drivers/dri/i965/brw_sf_emit.c
@@ -207,15 +207,15 @@ static void do_flatshade_triangle( struct brw_sf_compile *c )
    nr = count_flatshaded_attributes(c);
 
    brw_MUL(p, c->pv, c->pv, brw_imm_d(jmpi*(nr*2+1)));
-   brw_JMPI(p, c->pv);
+   brw_JMPI(p, c->pv, BRW_PREDICATE_NONE);
 
    copy_flatshaded_attributes(c, c->vert[1], c->vert[0]);
    copy_flatshaded_attributes(c, c->vert[2], c->vert[0]);
-   brw_JMPI(p, brw_imm_d(jmpi*(nr*4+1)));
+   brw_JMPI(p, brw_imm_d(jmpi*(nr*4+1)), BRW_PREDICATE_NONE);
 
    copy_flatshaded_attributes(c, c->vert[0], c->vert[1]);
    copy_flatshaded_attributes(c, c->vert[2], c->vert[1]);
-   brw_JMPI(p, brw_imm_d(jmpi*nr*2));
+   brw_JMPI(p, brw_imm_d(jmpi*nr*2), BRW_PREDICATE_NONE);
 
    copy_flatshaded_attributes(c, c->vert[0], c->vert[2]);
    copy_flatshaded_attributes(c, c->vert[1], c->vert[2]);
@@ -240,10 +240,10 @@ static void do_flatshade_line( struct brw_sf_compile *c )
    nr = count_flatshaded_attributes(c);
 
    brw_MUL(p, c->pv, c->pv, brw_imm_d(jmpi*(nr+1)));
-   brw_JMPI(p, c->pv);
+   brw_JMPI(p, c->pv, BRW_PREDICATE_NONE);
    copy_flatshaded_attributes(c, c->vert[1], c->vert[0]);
 
-   brw_JMPI(p, brw_imm_ud(jmpi*nr));
+   brw_JMPI(p, brw_imm_ud(jmpi*nr), BRW_PREDICATE_NONE);
    copy_flatshaded_attributes(c, c->vert[0], c->vert[1]);
 }
 
@@ -770,7 +770,7 @@ void brw_emit_anyprim_setup( struct brw_sf_compile *c )
 					       (1<<_3DPRIM_POLYGON) |
 					       (1<<_3DPRIM_RECTLIST) |
 					       (1<<_3DPRIM_TRIFAN_NOSTIPPLE)));
-   jmp = brw_JMPI(p, brw_imm_d(0)) - p->store;
+   jmp = brw_JMPI(p, brw_imm_d(0), BRW_PREDICATE_NORMAL) - p->store;
    brw_emit_tri_setup(c, false);
    brw_land_fwd_jump(p, jmp);
 
@@ -781,13 +781,13 @@ void brw_emit_anyprim_setup( struct brw_sf_compile *c )
 					       (1<<_3DPRIM_LINESTRIP_CONT) |
 					       (1<<_3DPRIM_LINESTRIP_BF) |
 					       (1<<_3DPRIM_LINESTRIP_CONT_BF)));
-   jmp = brw_JMPI(p, brw_imm_d(0)) - p->store;
+   jmp = brw_JMPI(p, brw_imm_d(0), BRW_PREDICATE_NORMAL) - p->store;
    brw_emit_line_setup(c, false);
    brw_land_fwd_jump(p, jmp);
 
    brw_set_conditionalmod(p, BRW_CONDITIONAL_Z);
    brw_AND(p, v1_null_ud, payload_attr, brw_imm_ud(1<<BRW_SPRITE_POINT_ENABLE));
-   jmp = brw_JMPI(p, brw_imm_d(0)) - p->store;
+   jmp = brw_JMPI(p, brw_imm_d(0), BRW_PREDICATE_NORMAL) - p->store;
    brw_emit_point_sprite_setup(c, false);
    brw_land_fwd_jump(p, jmp);
 
-- 
1.9.3



More information about the mesa-dev mailing list