i965/vec4: Move perf_debug about register spilling into the visitor.
authorKenneth Graunke <kenneth@whitecape.org>
Mon, 29 Jun 2015 03:45:47 +0000 (20:45 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Fri, 10 Jul 2015 00:06:26 +0000 (17:06 -0700)
This patch makes us only issue the performance warning about register
spilling if we actually spilled registers.  We also use scratch space
for indirect addressing and the like.

This is basically commit c51163b0cf7aff0375b1a5ea4cb3da9d9e164044 for
the vec4 backend.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
src/mesa/drivers/dri/i965/brw_gs.c
src/mesa/drivers/dri/i965/brw_vec4.cpp
src/mesa/drivers/dri/i965/brw_vs.c

index 52c73031a3c71d9331ab3d8e75a7afe3534a08fe..7f947e0eb251dd770059ad55e051b8977a0cc2b5 100644 (file)
@@ -268,10 +268,6 @@ brw_codegen_gs_prog(struct brw_context *brw,
 
    /* Scratch space is used for register spilling */
    if (c.base.last_scratch) {
-      perf_debug("Geometry shader triggered register spilling.  "
-                 "Try reducing the number of live vec4 values to "
-                 "improve performance.\n");
-
       c.prog_data.base.base.total_scratch
          = brw_get_scratch_size(c.base.last_scratch*REG_SIZE);
 
index 2a565645ce239017d7d3bea1e42f8f2302ff4f6c..60f73e2c82c1b0e7539604bedaf050aff294987c 100644 (file)
@@ -1827,9 +1827,19 @@ vec4_visitor::run(gl_clip_plane *clip_planes)
       }
    }
 
-   while (!reg_allocate()) {
-      if (failed)
-         return false;
+   bool allocated_without_spills = reg_allocate();
+
+   if (!allocated_without_spills) {
+      compiler->shader_perf_log(log_data,
+                                "%s shader triggered register spilling.  "
+                                "Try reducing the number of live vec4 values "
+                                "to improve performance.\n",
+                                stage_name);
+
+      while (!reg_allocate()) {
+         if (failed)
+            return false;
+      }
    }
 
    opt_schedule_instructions();
index 6e9848fb1e90c2d47f69bb1adcb9f2a34e290f3e..edbcbcff818b31fb72d348d984d935f16f97494d 100644 (file)
@@ -196,10 +196,6 @@ brw_codegen_vs_prog(struct brw_context *brw,
 
    /* Scratch space is used for register spilling */
    if (c.base.last_scratch) {
-      perf_debug("Vertex shader triggered register spilling.  "
-                 "Try reducing the number of live vec4 values to "
-                 "improve performance.\n");
-
       prog_data.base.base.total_scratch
          = brw_get_scratch_size(c.base.last_scratch*REG_SIZE);