Mesa (master): i965/fs: Include everything but the final FB write in shader_time.

Eric Anholt anholt at kemper.freedesktop.org
Thu Mar 28 18:52:52 UTC 2013


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

Author: Eric Anholt <eric at anholt.net>
Date:   Tue Mar 19 15:14:20 2013 -0700

i965/fs: Include everything but the final FB write in shader_time.

Previously, if you just wrote a constant color to the render target, no
time got noted at all.  This is convenient for doing single-instruction
timings, but not so much for actual program analysis.

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

---

 src/mesa/drivers/dri/i965/brw_fs.cpp         |    3 ---
 src/mesa/drivers/dri/i965/brw_fs_visitor.cpp |   17 +++++++++++++++--
 2 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 9ea7339..273761b 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -2784,9 +2784,6 @@ fs_visitor::run()
       if (failed)
 	 return false;
 
-      if (INTEL_DEBUG & DEBUG_SHADER_TIME)
-         emit_shader_time_end();
-
       emit_fb_writes();
 
       split_virtual_grfs();
diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
index 735a33d..857f956 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
@@ -2263,6 +2263,9 @@ fs_visitor::emit_fb_writes()
 	 inst->saturate = c->key.clamp_fragment_color;
       }
 
+      if (INTEL_DEBUG & DEBUG_SHADER_TIME)
+         emit_shader_time_end();
+
       fs_inst *inst = emit(FS_OPCODE_FB_WRITE);
       inst->target = 0;
       inst->base_mrf = base_mrf;
@@ -2297,6 +2300,14 @@ fs_visitor::emit_fb_writes()
       for (unsigned i = 0; i < this->output_components[target]; i++)
          emit_color_write(target, i, write_color_mrf);
 
+      bool eot = false;
+      if (target == c->key.nr_color_regions - 1) {
+         eot = true;
+
+         if (INTEL_DEBUG & DEBUG_SHADER_TIME)
+            emit_shader_time_end();
+      }
+
       fs_inst *inst = emit(FS_OPCODE_FB_WRITE);
       inst->target = target;
       inst->base_mrf = base_mrf;
@@ -2304,8 +2315,7 @@ fs_visitor::emit_fb_writes()
          inst->mlen = nr - base_mrf - reg_width;
       else
          inst->mlen = nr - base_mrf;
-      if (target == c->key.nr_color_regions - 1)
-	 inst->eot = true;
+      inst->eot = eot;
       inst->header_present = header_present;
    }
 
@@ -2316,6 +2326,9 @@ fs_visitor::emit_fb_writes()
        */
       emit_color_write(0, 3, color_mrf);
 
+      if (INTEL_DEBUG & DEBUG_SHADER_TIME)
+         emit_shader_time_end();
+
       fs_inst *inst = emit(FS_OPCODE_FB_WRITE);
       inst->base_mrf = base_mrf;
       inst->mlen = nr - base_mrf;




More information about the mesa-commit mailing list