<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Oct 24, 2014 at 12:25 PM, Jason Ekstrand <span dir="ltr"><<a href="mailto:jason@jlekstrand.net" target="_blank">jason@jlekstrand.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">---<br>
 src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp | 11 +++++------<br>
 1 file changed, 5 insertions(+), 6 deletions(-)<br>
<br>
diff --git a/src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp b/src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp<br>
index d4b72d8..49b50ee 100644<br>
--- a/src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp<br>
+++ b/src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp<br>
@@ -651,7 +651,7 @@ fs_visitor::emit_unspill(bblock_t *block, fs_inst *inst, fs_reg dst,<br>
       inst->insert_before(block, unspill_inst);<br>
<br>
       dst.reg_offset += reg_size;<br>
-      spill_offset += reg_size * 8 * sizeof(float);<br>
+      spill_offset += reg_size * REG_SIZE;<br></blockquote><div><br></div><div>This change is purely cosmetic<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
    }<br>
 }<br>
<br>
@@ -671,7 +671,7 @@ fs_visitor::emit_spill(bblock_t *block, fs_inst *inst, fs_reg src,<br>
          new(mem_ctx) fs_inst(SHADER_OPCODE_GEN4_SCRATCH_WRITE,<br>
                               reg_null_f, src);<br>
       src.reg_offset += reg_size;<br>
-      spill_inst->offset = spill_offset + i * reg_size;<br>
+      spill_inst->offset = spill_offset + i * reg_size * REG_SIZE;<br></blockquote><div><br></div><div>The offset is supposed to be in bytes, but we were giving it an offset in registers.  This fixes that.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
       spill_inst->ir = inst->ir;<br>
       spill_inst->annotation = inst->annotation;<br>
       spill_inst->mlen = 1 + reg_size; /* header, value */<br>
@@ -759,7 +759,6 @@ fs_visitor::choose_spill_reg(struct ra_graph *g)<br>
 void<br>
 fs_visitor::spill_reg(int spill_reg)<br>
 {<br>
-   int reg_size = dispatch_width * sizeof(float);<br>
    int size = virtual_grf_sizes[spill_reg];<br>
    unsigned int spill_offset = last_scratch;<br>
    assert(ALIGN(spill_offset, 16) == spill_offset); /* oword read/write req. */<br>
@@ -786,7 +785,7 @@ fs_visitor::spill_reg(int spill_reg)<br>
       spilled_any_registers = true;<br>
    }<br>
<br>
-   last_scratch += size * reg_size;<br>
+   last_scratch += size * REG_SIZE;<br></blockquote><div><br></div><div>The offset is supposed to be in bytes but virtual_grf_size is in actual hardware registers.  Therefore, the offset is virtual_grf_size * REG_SIZE.  Before, we had an extra factor of 2 in SIMD16 mode<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
    /* Generate spill/unspill instructions for the objects being<br>
     * spilled.  Right now, we spill or unspill the whole thing to a<br>
@@ -799,7 +798,7 @@ fs_visitor::spill_reg(int spill_reg)<br>
             inst->src[i].reg == spill_reg) {<br>
             int regs_read = inst->regs_read(this, i);<br>
             int subset_spill_offset = (spill_offset +<br>
-                                       reg_size * inst->src[i].reg_offset);<br>
+                                       REG_SIZE * inst->src[i].reg_offset);<br></blockquote><div><br></div><div>same as above<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
             fs_reg unspill_dst(GRF, virtual_grf_alloc(regs_read));<br>
<br>
             inst->src[i].reg = unspill_dst.reg;<br>
@@ -813,7 +812,7 @@ fs_visitor::spill_reg(int spill_reg)<br>
       if (inst->dst.file == GRF &&<br>
          inst->dst.reg == spill_reg) {<br>
          int subset_spill_offset = (spill_offset +<br>
-                                    reg_size * inst->dst.reg_offset);<br>
+                                    REG_SIZE * inst->dst.reg_offset);<br></blockquote><div><br></div><div>same as above<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
          fs_reg spill_src(GRF, virtual_grf_alloc(inst->regs_written));<br>
<br>
          inst->dst.reg = spill_src.reg;<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.1.0<br>
<br>
</font></span></blockquote></div><br></div></div>