From 29eb8059fd7906d2595ea99bc65a27691b9fbe53 Mon Sep 17 00:00:00 2001 From: Francisco Jerez Date: Thu, 21 Jul 2016 18:49:36 -0700 Subject: [PATCH] i965/eu: Take into account the target cache argument in brw_set_dp_read_message. 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 Reviewed-by: Kenneth Graunke --- src/mesa/drivers/dri/i965/brw_eu_emit.c | 15 +++++++++++++-- src/mesa/drivers/dri/i965/brw_vec4_generator.cpp | 7 +++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_eu_emit.c b/src/mesa/drivers/dri/i965/brw_eu_emit.c index fc187d16736..8850173513f 100644 --- a/src/mesa/drivers/dri/i965/brw_eu_emit.c +++ b/src/mesa/drivers/dri/i965/brw_eu_emit.c @@ -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); diff --git a/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp b/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp index 584833b823d..399b2c627d7 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp +++ b/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp @@ -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 */); -- 2.30.2