Mesa (master): i965/fs: Fix segfault in instruction scheduling with LINTERP using last GRF.

Eric Anholt anholt at kemper.freedesktop.org
Wed May 29 17:21:05 UTC 2013


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

Author: Eric Anholt <eric at anholt.net>
Date:   Thu May  9 09:00:11 2013 -0700

i965/fs: Fix segfault in instruction scheduling with LINTERP using last GRF.

The scheduler didn't know about uniform-type accesses, and if a uniform
access was last in a 16-wide, we'd walk off the end of the array.  This
never happened, because we'd never coalesce out all the GRFs, due to a bug
to be fixed in the next commit.

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

---

 .../drivers/dri/i965/brw_schedule_instructions.cpp |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp b/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp
index 6a52754..ccedee3 100644
--- a/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp
+++ b/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp
@@ -579,7 +579,10 @@ fs_instruction_scheduler::calculate_deps()
 		    (inst->src[i].fixed_hw_reg.file ==
 		     BRW_GENERAL_REGISTER_FILE)) {
 	    if (post_reg_alloc) {
-               for (int r = 0; r < reg_width; r++)
+               int size = reg_width;
+               if (inst->src[i].fixed_hw_reg.vstride == BRW_VERTICAL_STRIDE_0)
+                  size = 1;
+               for (int r = 0; r < size; r++)
                   add_dep(last_grf_write[inst->src[i].fixed_hw_reg.nr + r], n);
             } else {
                add_dep(last_fixed_grf_write, n);
@@ -684,7 +687,10 @@ fs_instruction_scheduler::calculate_deps()
 		    (inst->src[i].fixed_hw_reg.file ==
 		     BRW_GENERAL_REGISTER_FILE)) {
 	    if (post_reg_alloc) {
-               for (int r = 0; r < reg_width; r++)
+               int size = reg_width;
+               if (inst->src[i].fixed_hw_reg.vstride == BRW_VERTICAL_STRIDE_0)
+                  size = 1;
+               for (int r = 0; r < size; r++)
                   add_dep(n, last_grf_write[inst->src[i].fixed_hw_reg.nr + r]);
             } else {
                add_dep(n, last_fixed_grf_write);




More information about the mesa-commit mailing list