Mesa (master): i965/fs: Use the actual regsister width in brw_reg_from_fs_reg

Jason Ekstrand jekstrand at kemper.freedesktop.org
Thu Oct 2 21:15:47 UTC 2014


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

Author: Jason Ekstrand <jason.ekstrand at intel.com>
Date:   Wed Oct  1 10:46:48 2014 -0700

i965/fs: Use the actual regsister width in brw_reg_from_fs_reg

This fixes a bug where 1-wide operations don't properly translate down to
1-wide instructions.

Signed-off-by: Jason Ekstrand <jason.ekstrand at intel.com>
Reviewed-by: Matt Turner <mattst88 at gmail.com>

---

 src/mesa/drivers/dri/i965/brw_fs_generator.cpp |   13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
index e20d3cc..c2010c0 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
@@ -1211,7 +1211,20 @@ brw_reg_from_fs_reg(fs_reg *reg)
    case MRF:
       if (reg->stride == 0) {
          brw_reg = brw_vec1_reg(brw_file_from_reg(reg), reg->reg, 0);
+      } else if (reg->width < 8) {
+         brw_reg = brw_vec8_reg(brw_file_from_reg(reg), reg->reg, 0);
+         brw_reg = stride(brw_reg, reg->width * reg->stride,
+                          reg->width, reg->stride);
       } else {
+         /* From the Haswell PRM:
+          *
+          * VertStride must be used to cross GRF register boundaries. This
+          * rule implies that elements within a 'Width' cannot cross GRF
+          * boundaries.
+          *
+          * So, for registers with width > 8, we have to use a width of 8
+          * and trust the compression state to sort out the exec size.
+          */
          brw_reg = brw_vec8_reg(brw_file_from_reg(reg), reg->reg, 0);
          brw_reg = stride(brw_reg, 8 * reg->stride, 8, reg->stride);
       }




More information about the mesa-commit mailing list