[Mesa-dev] [PATCH 4/4] i965/fs/skl+: Recognize sample_c_lz.

Matt Turner mattst88 at gmail.com
Wed May 4 06:04:34 UTC 2016


total instructions in shared programs: 8508434 -> 8505467 (-0.03%)
instructions in affected programs: 84569 -> 81602 (-3.51%)
helped: 231

total cycles in shared programs: 64154656 -> 64105302 (-0.08%)
cycles in affected programs: 524474 -> 475120 (-9.41%)
helped: 183
HURT: 48

total spills in shared programs: 1688 -> 1683 (-0.30%)
spills in affected programs: 17 -> 12 (-29.41%)
helped: 1

total fills in shared programs: 2619 -> 2606 (-0.50%)
fills in affected programs: 38 -> 25 (-34.21%)
helped: 1

GAINED: 31
---
 src/mesa/drivers/dri/i965/brw_defines.h        | 1 +
 src/mesa/drivers/dri/i965/brw_disasm.c         | 1 +
 src/mesa/drivers/dri/i965/brw_fs.cpp           | 5 +----
 src/mesa/drivers/dri/i965/brw_fs_generator.cpp | 6 +++++-
 4 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_defines.h b/src/mesa/drivers/dri/i965/brw_defines.h
index fc02ed6..ba22363 100644
--- a/src/mesa/drivers/dri/i965/brw_defines.h
+++ b/src/mesa/drivers/dri/i965/brw_defines.h
@@ -1639,6 +1639,7 @@ enum brw_message_target {
 #define GEN7_SAMPLER_MESSAGE_SAMPLE_GATHER4_PO_C 18
 #define HSW_SAMPLER_MESSAGE_SAMPLE_DERIV_COMPARE 20
 #define GEN9_SAMPLER_MESSAGE_SAMPLE_LZ           24
+#define GEN9_SAMPLER_MESSAGE_SAMPLE_C_LZ         25
 #define GEN9_SAMPLER_MESSAGE_SAMPLE_LD_LZ        26
 #define GEN9_SAMPLER_MESSAGE_SAMPLE_LD2DMS_W     28
 #define GEN7_SAMPLER_MESSAGE_SAMPLE_LD_MCS       29
diff --git a/src/mesa/drivers/dri/i965/brw_disasm.c b/src/mesa/drivers/dri/i965/brw_disasm.c
index 4c7fe50..5d25774 100644
--- a/src/mesa/drivers/dri/i965/brw_disasm.c
+++ b/src/mesa/drivers/dri/i965/brw_disasm.c
@@ -551,6 +551,7 @@ static const char *const gen5_sampler_msg_type[] = {
    [GEN7_SAMPLER_MESSAGE_SAMPLE_GATHER4_PO_C] = "gather4_po_c",
    [HSW_SAMPLER_MESSAGE_SAMPLE_DERIV_COMPARE] = "sample_d_c",
    [GEN9_SAMPLER_MESSAGE_SAMPLE_LZ]           = "sample_lz",
+   [GEN9_SAMPLER_MESSAGE_SAMPLE_C_LZ]         = "sample_c_lz",
    [GEN9_SAMPLER_MESSAGE_SAMPLE_LD_LZ]        = "ld_lz",
    [GEN9_SAMPLER_MESSAGE_SAMPLE_LD2DMS_W]     = "ld2dms_w",
    [GEN7_SAMPLER_MESSAGE_SAMPLE_LD_MCS]       = "ld_mcs",
diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 18002c2..dfa6a0d 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -2524,9 +2524,6 @@ fs_visitor::opt_sample_lz()
           inst->opcode != SHADER_OPCODE_TXL)
          continue;
 
-      if (inst->shadow_compare)
-         continue;
-
       /* If the LOD parameter is not sent or is a constant zero then we can
        * change the instruction.
        */
@@ -2534,7 +2531,7 @@ fs_visitor::opt_sample_lz()
       if (inst->opcode == SHADER_OPCODE_TXF) {
          lod_offset = 2;
       } else if (inst->opcode == SHADER_OPCODE_TXL) {
-         lod_offset = 0;
+         lod_offset = inst->shadow_compare ? 1 : 0;
       } else {
          unreachable("not reached");
       }
diff --git a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
index a3a3b48..5867a48 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
@@ -794,7 +794,11 @@ fs_generator::generate_tex(fs_inst *inst, struct brw_reg dst, struct brw_reg src
 	 break;
       case SHADER_OPCODE_TXL_LZ:
          assert(devinfo->gen >= 9);
-         msg_type = GEN9_SAMPLER_MESSAGE_SAMPLE_LZ;
+	 if (inst->shadow_compare) {
+            msg_type = GEN9_SAMPLER_MESSAGE_SAMPLE_C_LZ;
+         } else {
+            msg_type = GEN9_SAMPLER_MESSAGE_SAMPLE_LZ;
+         }
          break;
       case SHADER_OPCODE_TXS:
 	 msg_type = GEN5_SAMPLER_MESSAGE_SAMPLE_RESINFO;
-- 
2.7.3



More information about the mesa-dev mailing list