i965/eu: Take into account the target cache argument in brw_set_dp_read_message.
authorFrancisco Jerez <currojerez@riseup.net>
Fri, 22 Jul 2016 01:49:36 +0000 (18:49 -0700)
committerFrancisco Jerez <currojerez@riseup.net>
Fri, 26 Aug 2016 01:36:08 +0000 (18:36 -0700)
brw_set_dp_read_message() was setting the data cache as send message
SFID on Gen7+ hardware, ignoring the target cache specified by the
caller.  Some of the callers were passing a bogus target cache value
as argument relying on brw_set_dp_read_message not to take it into
account.  Fix them too.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/drivers/dri/i965/brw_eu_emit.c
src/mesa/drivers/dri/i965/brw_vec4_generator.cpp

index fc187d16736d541c998bb1fbff60035847c9cf06..8850173513f4cc19a04ee266e25f2823357c063f 100644 (file)
@@ -756,7 +756,15 @@ brw_set_dp_read_message(struct brw_codegen *p,
    unsigned sfid;
 
    if (devinfo->gen >= 7) {
-      sfid = GEN7_SFID_DATAPORT_DATA_CACHE;
+      if (target_cache == BRW_DATAPORT_READ_TARGET_RENDER_CACHE)
+         sfid = GEN6_SFID_DATAPORT_RENDER_CACHE;
+      else if (target_cache == BRW_DATAPORT_READ_TARGET_DATA_CACHE)
+         sfid = GEN7_SFID_DATAPORT_DATA_CACHE;
+      else if (target_cache == BRW_DATAPORT_READ_TARGET_SAMPLER_CACHE)
+         sfid = GEN6_SFID_DATAPORT_SAMPLER_CACHE;
+      else
+         unreachable("Invalid target cache");
+
    } else if (devinfo->gen == 6) {
       if (target_cache == BRW_DATAPORT_READ_TARGET_RENDER_CACHE)
         sfid = GEN6_SFID_DATAPORT_RENDER_CACHE;
@@ -2204,6 +2212,9 @@ brw_oword_block_read_scratch(struct brw_codegen *p,
        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 ?
+      BRW_DATAPORT_READ_TARGET_DATA_CACHE :
+      BRW_DATAPORT_READ_TARGET_RENDER_CACHE;
 
    {
       brw_push_insn_state(p);
@@ -2238,7 +2249,7 @@ brw_oword_block_read_scratch(struct brw_codegen *p,
                               brw_scratch_surface_idx(p),
                              msg_control,
                              BRW_DATAPORT_READ_MESSAGE_OWORD_BLOCK_READ, /* msg_type */
-                             BRW_DATAPORT_READ_TARGET_RENDER_CACHE,
+                             target_cache,
                              1, /* msg_length */
                               true, /* header_present */
                              rlen);
index 584833b823df312d505d20128aad9e188c7e9630..399b2c627d7b60d245efc71dd1f4c8ee5c9ffb4a 100644 (file)
@@ -1140,6 +1140,10 @@ generate_scratch_read(struct brw_codegen *p,
    else
       msg_type = BRW_DATAPORT_READ_MESSAGE_OWORD_DUAL_BLOCK_READ;
 
+   const unsigned target_cache = devinfo->gen >= 7 ?
+      BRW_DATAPORT_READ_TARGET_DATA_CACHE :
+      BRW_DATAPORT_READ_TARGET_RENDER_CACHE;
+
    /* Each of the 8 channel enables is considered for whether each
     * dword is written.
     */
@@ -1151,8 +1155,7 @@ generate_scratch_read(struct brw_codegen *p,
    brw_set_dp_read_message(p, send,
                            brw_scratch_surface_idx(p),
                           BRW_DATAPORT_OWORD_DUAL_BLOCK_1OWORD,
-                          msg_type,
-                          BRW_DATAPORT_READ_TARGET_RENDER_CACHE,
+                          msg_type, target_cache,
                           2, /* mlen */
                            true, /* header_present */
                           1 /* rlen */);