[Mesa-dev] [PATCH 10/32] i965/fs: Remove logic to keep track of MRF metadata in lower_load_payload().

Francisco Jerez currojerez at riseup.net
Fri Feb 6 06:42:50 PST 2015


MRFs cannot be read from anyway so they cannot possibly be a valid
source of LOAD_PAYLOAD.
---
 src/mesa/drivers/dri/i965/brw_fs.cpp | 39 ++++++++++++------------------------
 1 file changed, 13 insertions(+), 26 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index bafe438..eccae06 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -3055,7 +3055,7 @@ fs_visitor::lower_load_payload()
    bool progress = false;
 
    int vgrf_to_reg[alloc.count];
-   int reg_count = 16; /* Leave room for MRF */
+   int reg_count = 0;
    for (unsigned i = 0; i < alloc.count; ++i) {
       vgrf_to_reg[i] = reg_count;
       reg_count += alloc.sizes[i];
@@ -3069,15 +3069,8 @@ fs_visitor::lower_load_payload()
    memset(metadata, 0, sizeof(metadata));
 
    foreach_block_and_inst_safe (block, fs_inst, inst, cfg) {
-      int dst_reg;
       if (inst->dst.file == GRF) {
-         dst_reg = vgrf_to_reg[inst->dst.reg];
-      } else {
-         /* MRF */
-         dst_reg = inst->dst.reg;
-      }
-
-      if (inst->dst.file == MRF || inst->dst.file == GRF) {
+         const int dst_reg = vgrf_to_reg[inst->dst.reg];
          bool force_sechalf = inst->force_sechalf &&
                               !inst->force_writemask_all;
          bool toggle_sechalf = inst->dst.width == 16 &&
@@ -3123,26 +3116,20 @@ fs_visitor::lower_load_payload()
                                 inst->src[i].reg_offset;
                   mov->force_sechalf = metadata[src_reg].force_sechalf;
                   mov->force_writemask_all = metadata[src_reg].force_writemask_all;
-                  metadata[dst_reg] = metadata[src_reg];
+               }
+
+               if (dst.file == GRF) {
+                  const int dst_reg = vgrf_to_reg[dst.reg];
+                  const bool force_writemask = mov->force_writemask_all;
+                  metadata[dst_reg].force_writemask_all = force_writemask;
+                  metadata[dst_reg].force_sechalf = mov->force_sechalf;
                   if (dst.width * type_sz(dst.type) > 32) {
-                     if (metadata[src_reg].force_writemask_all) {
-                        metadata[dst_reg + 1] = metadata[src_reg];
-                     } else {
-                        assert((!metadata[src_reg].written ||
-                                !metadata[src_reg].force_sechalf) &&
-                               (!metadata[src_reg + 1].written ||
-                                metadata[src_reg + 1].force_sechalf));
-                        metadata[dst_reg + 1] = metadata[src_reg + 1];
-                     }
-                  }
-               } else {
-                  metadata[dst_reg].force_writemask_all = false;
-                  metadata[dst_reg].force_sechalf = false;
-                  if (dst.width == 16) {
-                     metadata[dst_reg + 1].force_writemask_all = false;
-                     metadata[dst_reg + 1].force_sechalf = true;
+                     assert(!mov->force_sechalf);
+                     metadata[dst_reg + 1].force_writemask_all = force_writemask;
+                     metadata[dst_reg + 1].force_sechalf = !force_writemask;
                   }
                }
+
                inst->insert_before(block, mov);
             }
 
-- 
2.1.3



More information about the mesa-dev mailing list