Mesa (master): i965/fs: Teach compute_to_mrf() about the COMPR4 address transformation.

Francisco Jerez currojerez at kemper.freedesktop.org
Tue May 31 22:58:54 UTC 2016


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

Author: Francisco Jerez <currojerez at riseup.net>
Date:   Fri May 27 14:17:28 2016 -0700

i965/fs: Teach compute_to_mrf() about the COMPR4 address transformation.

This will be required to correctly transform the destination of 8-wide
instructions that write a single GRF of a VGRF to MRF copy marked
COMPR4.

Cc: "12.0" <mesa-stable at lists.freedesktop.org>
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>

---

 src/mesa/drivers/dri/i965/brw_fs.cpp | 24 +++++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index bb36a8e..c04d642 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -2894,8 +2894,30 @@ fs_visitor::compute_to_mrf()
       foreach_inst_in_block_reverse_starting_from(fs_inst, scan_inst, inst) {
          if (regions_overlap(scan_inst->dst, scan_inst->regs_written * REG_SIZE,
                              inst->src[0], inst->regs_read(0) * REG_SIZE)) {
+            const unsigned rel_offset = (reg_offset(scan_inst->dst) -
+                                         reg_offset(inst->src[0])) / REG_SIZE;
+
+            if (inst->dst.nr & BRW_MRF_COMPR4) {
+               /* Apply the same address transformation done by the hardware
+                * for COMPR4 MRF writes.
+                */
+               assert(rel_offset < 2);
+               scan_inst->dst.nr = inst->dst.nr + rel_offset * 4;
+
+               /* Clear the COMPR4 bit if the generating instruction is not
+                * compressed.
+                */
+               if (scan_inst->regs_written < 2)
+                  scan_inst->dst.nr &= ~BRW_MRF_COMPR4;
+
+            } else {
+               /* Calculate the MRF number the result of this instruction is
+                * ultimately written to.
+                */
+               scan_inst->dst.nr = inst->dst.nr + rel_offset;
+            }
+
             scan_inst->dst.file = MRF;
-            scan_inst->dst.nr = inst->dst.nr;
             scan_inst->dst.reg_offset = 0;
             scan_inst->saturate |= inst->saturate;
             break;




More information about the mesa-commit mailing list