diff options
author | Francisco Jerez <currojerez@riseup.net> | 2016-12-08 19:58:25 -0800 |
---|---|---|
committer | Francisco Jerez <currojerez@riseup.net> | 2016-12-09 10:33:43 -0800 |
commit | b01de15422173a94f89247a9edb5f046987a6c7e (patch) | |
tree | 9f64b81a65ac1310ee6e9dd3277a790a00fb8206 | |
parent | aa041cfbb9e9590460e39e978140ce3d27ad89ae (diff) |
i965: Factor out oword block read and write message control calculation.
We'll need roughly the same logic in other places and it would be
annoying to duplicate it. Instead factor it out into a function-like
macro that takes the number of dwords per block (which will prove more
convenient than taking the same value in owords or some other unit).
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_defines.h | 6 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_eu_emit.c | 14 |
2 files changed, 8 insertions, 12 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_defines.h b/src/mesa/drivers/dri/i965/brw_defines.h index cae8e9ac67f..1c638a09c0b 100644 --- a/src/mesa/drivers/dri/i965/brw_defines.h +++ b/src/mesa/drivers/dri/i965/brw_defines.h @@ -1669,6 +1669,12 @@ enum brw_message_target { #define BRW_DATAPORT_OWORD_BLOCK_2_OWORDS 2 #define BRW_DATAPORT_OWORD_BLOCK_4_OWORDS 3 #define BRW_DATAPORT_OWORD_BLOCK_8_OWORDS 4 +#define BRW_DATAPORT_OWORD_BLOCK_DWORDS(n) \ + ((n) == 4 ? BRW_DATAPORT_OWORD_BLOCK_1_OWORDLOW : \ + (n) == 8 ? BRW_DATAPORT_OWORD_BLOCK_2_OWORDS : \ + (n) == 16 ? BRW_DATAPORT_OWORD_BLOCK_4_OWORDS : \ + (n) == 32 ? BRW_DATAPORT_OWORD_BLOCK_8_OWORDS : \ + (abort(), ~0)) #define BRW_DATAPORT_OWORD_DUAL_BLOCK_1OWORD 0 #define BRW_DATAPORT_OWORD_DUAL_BLOCK_4OWORDS 2 diff --git a/src/mesa/drivers/dri/i965/brw_eu_emit.c b/src/mesa/drivers/dri/i965/brw_eu_emit.c index 341f543dbdb..6141bfb99ea 100644 --- a/src/mesa/drivers/dri/i965/brw_eu_emit.c +++ b/src/mesa/drivers/dri/i965/brw_eu_emit.c @@ -2056,11 +2056,6 @@ void brw_oword_block_write_scratch(struct brw_codegen *p, mrf = retype(mrf, BRW_REGISTER_TYPE_UD); const unsigned mlen = 1 + num_regs; - const unsigned msg_control = - (num_regs == 1 ? BRW_DATAPORT_OWORD_BLOCK_2_OWORDS : - num_regs == 2 ? BRW_DATAPORT_OWORD_BLOCK_4_OWORDS : - num_regs == 4 ? BRW_DATAPORT_OWORD_BLOCK_8_OWORDS : 0); - assert(msg_control); /* Set up the message header. This is g0, with g0.2 filled with * the offset. We don't want to leave our offset around in g0 or @@ -2134,7 +2129,7 @@ void brw_oword_block_write_scratch(struct brw_codegen *p, brw_set_dp_write_message(p, insn, brw_scratch_surface_idx(p), - msg_control, + BRW_DATAPORT_OWORD_BLOCK_DWORDS(num_regs * 8), msg_type, target_cache, mlen, @@ -2181,11 +2176,6 @@ brw_oword_block_read_scratch(struct brw_codegen *p, dest = retype(dest, BRW_REGISTER_TYPE_UW); const unsigned rlen = num_regs; - const unsigned msg_control = - (num_regs == 1 ? BRW_DATAPORT_OWORD_BLOCK_2_OWORDS : - num_regs == 2 ? BRW_DATAPORT_OWORD_BLOCK_4_OWORDS : - num_regs == 4 ? BRW_DATAPORT_OWORD_BLOCK_8_OWORDS : 0); - assert(msg_control); const unsigned target_cache = (devinfo->gen >= 7 ? GEN7_SFID_DATAPORT_DATA_CACHE : devinfo->gen >= 6 ? GEN6_SFID_DATAPORT_RENDER_CACHE : @@ -2222,7 +2212,7 @@ brw_oword_block_read_scratch(struct brw_codegen *p, brw_set_dp_read_message(p, insn, brw_scratch_surface_idx(p), - msg_control, + BRW_DATAPORT_OWORD_BLOCK_DWORDS(num_regs * 8), BRW_DATAPORT_READ_MESSAGE_OWORD_BLOCK_READ, /* msg_type */ target_cache, 1, /* msg_length */ |