[Mesa-dev] [PATCH 02/13] i965: Don't disable exec masking for sampler message sends.

Francisco Jerez currojerez at riseup.net
Fri Feb 27 07:34:45 PST 2015


This was telling the sampler to do texture fetches for *all* channels
in the non-constant surface index case, what could have reduced
throughput unnecessarily when some of the channels were disabled by
control flow.
---
 src/mesa/drivers/dri/i965/brw_fs_generator.cpp   | 12 ++++++------
 src/mesa/drivers/dri/i965/brw_vec4_generator.cpp |  8 ++++----
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
index a54a274..63c59a5 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
@@ -754,6 +754,8 @@ fs_generator::generate_tex(fs_inst *inst, struct brw_reg dst, struct brw_reg src
       brw_AND(p, addr, addr, brw_imm_ud(0x0ff));
       brw_OR(p, addr, addr, temp);
 
+      brw_pop_insn_state(p);
+
       /* dst = send(offset, a0.0 | <descriptor>) */
       brw_inst *insn = brw_send_indirect_message(
          p, BRW_SFID_SAMPLER, dst, src, addr);
@@ -767,8 +769,6 @@ fs_generator::generate_tex(fs_inst *inst, struct brw_reg dst, struct brw_reg src
                               simd_mode,
                               return_format);
 
-      brw_pop_insn_state(p);
-
       /* visitor knows more than we do about the surface limit required,
        * so has already done marking.
        */
@@ -1039,6 +1039,8 @@ fs_generator::generate_uniform_pull_constant_load_gen7(fs_inst *inst,
       brw_set_src0(p, insn_and, vec1(retype(index, BRW_REGISTER_TYPE_UD)));
       brw_set_src1(p, insn_and, brw_imm_ud(0x0ff));
 
+      brw_pop_insn_state(p);
+
       /* dst = send(payload, a0.0 | <descriptor>) */
       brw_inst *insn = brw_send_indirect_message(
          p, GEN6_SFID_DATAPORT_CONSTANT_CACHE, vec16(dst), payload, addr);
@@ -1051,8 +1053,6 @@ fs_generator::generate_uniform_pull_constant_load_gen7(fs_inst *inst,
                               true, /* header */
                               2); /* rlen */
 
-      brw_pop_insn_state(p);
-
       /* visitor knows more than we do about the surface limit required,
        * so has already done marking.
        */
@@ -1186,6 +1186,8 @@ fs_generator::generate_varying_pull_constant_load_gen7(fs_inst *inst,
       brw_set_src0(p, insn_and, vec1(retype(index, BRW_REGISTER_TYPE_UD)));
       brw_set_src1(p, insn_and, brw_imm_ud(0x0ff));
 
+      brw_pop_insn_state(p);
+
       /* dst = send(offset, a0.0 | <descriptor>) */
       brw_inst *insn = brw_send_indirect_message(
          p, BRW_SFID_SAMPLER, dst, offset, addr);
@@ -1199,8 +1201,6 @@ fs_generator::generate_varying_pull_constant_load_gen7(fs_inst *inst,
                               simd_mode,
                               0);
 
-      brw_pop_insn_state(p);
-
       /* visitor knows more than we do about the surface limit required,
        * so has already done marking.
        */
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp b/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp
index 4d67100..c7494e5 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp
@@ -419,6 +419,8 @@ vec4_generator::generate_tex(vec4_instruction *inst,
       brw_AND(p, addr, addr, brw_imm_ud(0x0ff));
       brw_OR(p, addr, addr, temp);
 
+      brw_pop_insn_state(p);
+
       /* dst = send(offset, a0.0 | <descriptor>) */
       brw_inst *insn = brw_send_indirect_message(
          p, BRW_SFID_SAMPLER, dst, src, addr);
@@ -432,8 +434,6 @@ vec4_generator::generate_tex(vec4_instruction *inst,
                               BRW_SAMPLER_SIMD_MODE_SIMD4X2,
                               return_format);
 
-      brw_pop_insn_state(p);
-
       /* visitor knows more than we do about the surface limit required,
        * so has already done marking.
        */
@@ -1083,6 +1083,8 @@ vec4_generator::generate_pull_constant_load_gen7(vec4_instruction *inst,
       brw_set_src0(p, insn_and, vec1(retype(surf_index, BRW_REGISTER_TYPE_UD)));
       brw_set_src1(p, insn_and, brw_imm_ud(0x0ff));
 
+      brw_pop_insn_state(p);
+
       /* dst = send(offset, a0.0 | <descriptor>) */
       brw_inst *insn = brw_send_indirect_message(
          p, BRW_SFID_SAMPLER, dst, offset, addr);
@@ -1096,8 +1098,6 @@ vec4_generator::generate_pull_constant_load_gen7(vec4_instruction *inst,
                               BRW_SAMPLER_SIMD_MODE_SIMD4X2,
                               0);
 
-      brw_pop_insn_state(p);
-
       /* visitor knows more than we do about the surface limit required,
        * so has already done marking.
        */
-- 
2.1.3



More information about the mesa-dev mailing list