i965: Add GS support to INTEL_DEBUG=shader_time.
authorPaul Berry <stereotype441@gmail.com>
Fri, 17 Jan 2014 22:42:48 +0000 (14:42 -0800)
committerPaul Berry <stereotype441@gmail.com>
Tue, 21 Jan 2014 17:05:12 +0000 (09:05 -0800)
Previously, time spent in geometry shaders would be counted as part of
the vertex shader time.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/drivers/dri/i965/brw_context.h
src/mesa/drivers/dri/i965/brw_program.c
src/mesa/drivers/dri/i965/brw_vec4.cpp
src/mesa/drivers/dri/i965/brw_vec4.h
src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp
src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
src/mesa/drivers/dri/i965/brw_vec4_vs_visitor.cpp
src/mesa/drivers/dri/i965/test_vec4_register_coalesce.cpp

index 6a0cebed593d1070b4dd02adb538a64ef1bd7775..0c4c021f4425ee2889d023a29b534d594fe511bb 100644 (file)
@@ -783,6 +783,9 @@ enum shader_time_shader_type {
    ST_VS,
    ST_VS_WRITTEN,
    ST_VS_RESET,
+   ST_GS,
+   ST_GS_WRITTEN,
+   ST_GS_RESET,
    ST_FS8,
    ST_FS8_WRITTEN,
    ST_FS8_RESET,
index abfc921ef119ae6b3aefbd7bb7ab291533f095b3..a6a2403f538a5e3ad5ed431bf0a412fc1863c026 100644 (file)
@@ -288,7 +288,7 @@ get_written_and_reset(struct brw_context *brw, int i,
                       uint64_t *written, uint64_t *reset)
 {
    enum shader_time_shader_type type = brw->shader_time.types[i];
-   assert(type == ST_VS || type == ST_FS8 || type == ST_FS16);
+   assert(type == ST_VS || type == ST_GS || type == ST_FS8 || type == ST_FS16);
 
    /* Find where we recorded written and reset. */
    int wi, ri;
@@ -340,6 +340,8 @@ brw_report_shader_time(struct brw_context *brw)
       switch (type) {
       case ST_VS_WRITTEN:
       case ST_VS_RESET:
+      case ST_GS_WRITTEN:
+      case ST_GS_RESET:
       case ST_FS8_WRITTEN:
       case ST_FS8_RESET:
       case ST_FS16_WRITTEN:
@@ -349,6 +351,7 @@ brw_report_shader_time(struct brw_context *brw)
          continue;
 
       case ST_VS:
+      case ST_GS:
       case ST_FS8:
       case ST_FS16:
          get_written_and_reset(brw, i, &written, &reset);
@@ -372,6 +375,7 @@ brw_report_shader_time(struct brw_context *brw)
 
       switch (type) {
       case ST_VS:
+      case ST_GS:
       case ST_FS8:
       case ST_FS16:
          total_by_type[type] += scaled[i];
@@ -432,6 +436,9 @@ brw_report_shader_time(struct brw_context *brw)
       case ST_VS:
          stage = "vs";
          break;
+      case ST_GS:
+         stage = "gs";
+         break;
       case ST_FS8:
          stage = "fs8";
          break;
@@ -449,6 +456,7 @@ brw_report_shader_time(struct brw_context *brw)
 
    printf("\n");
    print_shader_time_line("total", "vs", -1, total_by_type[ST_VS], total);
+   print_shader_time_line("total", "gs", -1, total_by_type[ST_GS], total);
    print_shader_time_line("total", "fs8", -1, total_by_type[ST_FS8], total);
    print_shader_time_line("total", "fs16", -1, total_by_type[ST_FS16], total);
 }
index d4ed820fe3bc60d55174ed55994e631aa6fea723..2a0cb138587c785d88d6ef78e20079e13c34b603 100644 (file)
@@ -1494,10 +1494,10 @@ vec4_visitor::emit_shader_time_end()
     */
    emit(ADD(diff, src_reg(diff), src_reg(-2u)));
 
-   emit_shader_time_write(ST_VS, src_reg(diff));
-   emit_shader_time_write(ST_VS_WRITTEN, src_reg(1u));
+   emit_shader_time_write(st_base, src_reg(diff));
+   emit_shader_time_write(st_written, src_reg(1u));
    emit(BRW_OPCODE_ELSE);
-   emit_shader_time_write(ST_VS_RESET, src_reg(1u));
+   emit_shader_time_write(st_reset, src_reg(1u));
    emit(BRW_OPCODE_ENDIF);
 }
 
index 71aaf1adfaca33df49805b71619b238ede923f81..4a5b57775c30abea3bb29aaacbf96267b7b49176 100644 (file)
@@ -232,7 +232,10 @@ public:
                struct brw_shader *shader,
                void *mem_ctx,
                 bool debug_flag,
-                bool no_spills);
+                bool no_spills,
+                shader_time_shader_type st_base,
+                shader_time_shader_type st_written,
+                shader_time_shader_type st_reset);
    ~vec4_visitor();
 
    dst_reg dst_null_f()
@@ -548,6 +551,10 @@ private:
     * If true, then register allocation should fail instead of spilling.
     */
    const bool no_spills;
+
+   const shader_time_shader_type st_base;
+   const shader_time_shader_type st_written;
+   const shader_time_shader_type st_reset;
 };
 
 
index f0351eaa32a2aac5fdd736c28065fdfc84aa8af8..40743cc12e8e2402fe378d5a320ff74a5cba5019 100644 (file)
@@ -41,7 +41,8 @@ vec4_gs_visitor::vec4_gs_visitor(struct brw_context *brw,
                                  bool no_spills)
    : vec4_visitor(brw, &c->base, &c->gp->program.Base, &c->key.base,
                   &c->prog_data.base, prog, shader, mem_ctx,
-                  INTEL_DEBUG & DEBUG_GS, no_spills),
+                  INTEL_DEBUG & DEBUG_GS, no_spills,
+                  ST_GS, ST_GS_WRITTEN, ST_GS_RESET),
      c(c)
 {
 }
index f6dc3a8f155d52ead7c14a804154bd53c60ba923..76b24ad720acf1eaef25ff119c9bbdce89f0ab9b 100644 (file)
@@ -3283,13 +3283,19 @@ vec4_visitor::vec4_visitor(struct brw_context *brw,
                           struct brw_shader *shader,
                           void *mem_ctx,
                            bool debug_flag,
-                           bool no_spills)
+                           bool no_spills,
+                           shader_time_shader_type st_base,
+                           shader_time_shader_type st_written,
+                           shader_time_shader_type st_reset)
    : sanity_param_count(0),
      fail_msg(NULL),
      first_non_payload_grf(0),
      need_all_constants_in_pull_buffer(false),
      debug_flag(debug_flag),
-     no_spills(no_spills)
+     no_spills(no_spills),
+     st_base(st_base),
+     st_written(st_written),
+     st_reset(st_reset)
 {
    this->brw = brw;
    this->ctx = &brw->ctx;
index 0146cf9beab59f38e140183a1f671593d1e6d915..6bfbf93e6577629644c6907af576f31b1edd532d 100644 (file)
@@ -215,7 +215,8 @@ vec4_vs_visitor::vec4_vs_visitor(struct brw_context *brw,
                                  void *mem_ctx)
    : vec4_visitor(brw, &vs_compile->base, &vs_compile->vp->program.Base,
                   &vs_compile->key.base, &vs_prog_data->base, prog, shader,
-                  mem_ctx, INTEL_DEBUG & DEBUG_VS, false /* no_spills */),
+                  mem_ctx, INTEL_DEBUG & DEBUG_VS, false /* no_spills */,
+                  ST_VS, ST_VS_WRITTEN, ST_VS_RESET),
      vs_compile(vs_compile),
      vs_prog_data(vs_prog_data)
 {
index 83d931cb9d2ddcebab1babe3367823951647b08d..4e971b54d029f7331deca82e410170be97c4409b 100644 (file)
@@ -49,7 +49,8 @@ public:
    register_coalesce_vec4_visitor(struct brw_context *brw,
                                   struct gl_shader_program *shader_prog)
       : vec4_visitor(brw, NULL, NULL, NULL, NULL, shader_prog, NULL, NULL,
-                     false, false /* no_spills */)
+                     false, false /* no_spills */,
+                     ST_NONE, ST_NONE, ST_NONE)
    {
    }