diff options
author | Francisco Jerez <currojerez@riseup.net> | 2016-09-01 15:11:21 -0700 |
---|---|---|
committer | Francisco Jerez <currojerez@riseup.net> | 2016-09-14 14:50:53 -0700 |
commit | be095e11e41158f91bcb3f6fcbc2e2a91a5d9124 (patch) | |
tree | 1315f0ccdb7bf49a81247250f8ad77a92dd61915 /src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp | |
parent | 9a523dd051fc06bfd89f32fcd85535d268472820 (diff) | |
download | external_mesa3d-be095e11e41158f91bcb3f6fcbc2e2a91a5d9124.zip external_mesa3d-be095e11e41158f91bcb3f6fcbc2e2a91a5d9124.tar.gz external_mesa3d-be095e11e41158f91bcb3f6fcbc2e2a91a5d9124.tar.bz2 |
i965/fs: Replace fs_reg::subreg_offset with fs_reg::offset expressed in bytes.
The fs_reg::subreg_offset and ::offset fields are now redundant, the
sub-GRF offset can just be added to the single ::offset field
expressed in byte units. The current subreg_offset value can be
recovered by applying the following rule: Replace each rvalue
reference of subreg_offset like 'x = r.subreg_offset' with 'x =
r.offset % reg_unit', and each lvalue reference like 'r.subreg_offset
= x' with 'r.offset = ROUND_DOWN_TO(r.offset, reg_unit) + x'.
For the same reason as in the previous patches, this doesn't attempt
to be particularly clever about simplifying the result in the interest
of keeping the rather lengthy patch as obvious as possible. I'll come
back later to clean up any ugliness introduced here.
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp b/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp index 09d0a4e..10f0a5b 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp @@ -341,7 +341,7 @@ region_contained_in(const fs_reg &src, unsigned regs_read, const fs_reg &dst, unsigned regs_written) { return src.file == dst.file && src.nr == dst.nr && - (src.offset + src.subreg_offset >= dst.offset + dst.subreg_offset) && + src.offset >= dst.offset && src.offset / REG_SIZE + regs_read <= dst.offset / REG_SIZE + regs_written; } @@ -461,30 +461,21 @@ fs_visitor::try_copy_propagate(fs_inst *inst, int arg, acp_entry *entry) inst->saturate = inst->saturate || entry->saturate; /* Compute the offset of inst->src[arg] relative to entry->dst */ - const unsigned rel_offset = inst->src[arg].offset - entry->dst.offset + - inst->src[arg].subreg_offset; + const unsigned rel_offset = inst->src[arg].offset - entry->dst.offset; /* Compute the first component of the copy that the instruction is * reading, and the base byte offset within that component. */ - assert(entry->dst.subreg_offset == 0 && entry->dst.stride == 1); + assert(entry->dst.offset % REG_SIZE == 0 && entry->dst.stride == 1); const unsigned component = rel_offset / type_sz(entry->dst.type); const unsigned suboffset = rel_offset % type_sz(entry->dst.type); - /* Account for the inconsistent units reg_offset is expressed in. - * FINISHME -- Make the units of reg_offset consistent (e.g. bytes?) for - * all register files. - */ - const unsigned reg_size = (entry->src.file == UNIFORM ? 4 : REG_SIZE); - /* Calculate the byte offset at the origin of the copy of the given * component and suboffset. */ - const unsigned offset = suboffset + + inst->src[arg].offset = suboffset + component * entry->src.stride * type_sz(entry->src.type) + - entry->src.offset + entry->src.subreg_offset; - inst->src[arg].offset = ROUND_DOWN_TO(offset, reg_size); - inst->src[arg].subreg_offset = offset % reg_size; + entry->src.offset; if (has_source_modifiers) { if (entry->dst.type != inst->src[arg].type) { |