[Mesa-dev] [PATCH 35/47] i965/fs: Include support for SEND data_format bit for Render Targets
Alejandro Piñeiro
apinheiro at igalia.com
Thu Aug 24 13:54:50 UTC 2017
From: Jose Maria Casanova Crespo <jmcasanova at igalia.com>
>From intel Skylake PRM, vol 07, section "EU Overview", subsection
"Send Message" (page 905):
"Bit 30: Data format. This field specifies the width of data read
from sampler or written to render target. Format = U1 0
Single Precision (32b), 1 Half Precision (16b)"
Also present on vol 02d, "Message Descriptor - Render Target Write"
(page 326).
It is worth to note that this bit is also present on
Cherryview/Braswell but not on Broadwell, both Gen8, so we can't check
for the presence of that bit based just on the gen (example: on
brw_inst.h).
Signed-off-by: Jose Maria Casanova Crespo <jmcasanova at igalia.com>
Signed-off-by: Eduardo Lima <elima at igalia.com>
Signed-off-by: Alejandro Piñeiro <apinheiro at igalia.com>
---
src/intel/compiler/brw_eu.h | 6 ++++--
src/intel/compiler/brw_eu_emit.c | 25 ++++++++++++++++++++-----
src/intel/compiler/brw_fs.cpp | 1 +
src/intel/compiler/brw_fs_generator.cpp | 3 ++-
src/intel/compiler/brw_fs_surface_builder.cpp | 3 ++-
src/intel/compiler/brw_inst.h | 1 +
src/intel/compiler/brw_shader.h | 7 +++++++
src/intel/compiler/brw_vec4_generator.cpp | 3 ++-
8 files changed, 39 insertions(+), 10 deletions(-)
diff --git a/src/intel/compiler/brw_eu.h b/src/intel/compiler/brw_eu.h
index c3a6d6fb439..41a0e1073ad 100644
--- a/src/intel/compiler/brw_eu.h
+++ b/src/intel/compiler/brw_eu.h
@@ -241,7 +241,8 @@ void brw_set_dp_write_message(struct brw_codegen *p,
unsigned last_render_target,
unsigned response_length,
unsigned end_of_thread,
- unsigned send_commit_msg);
+ unsigned send_commit_msg,
+ unsigned data_format);
void brw_urb_WRITE(struct brw_codegen *p,
struct brw_reg dest,
@@ -293,7 +294,8 @@ void brw_fb_WRITE(struct brw_codegen *p,
unsigned response_length,
bool eot,
bool last_render_target,
- bool header_present);
+ bool header_present,
+ unsigned data_format);
brw_inst *gen9_fb_READ(struct brw_codegen *p,
struct brw_reg dst,
diff --git a/src/intel/compiler/brw_eu_emit.c b/src/intel/compiler/brw_eu_emit.c
index 1d91f0e492a..1070ef420af 100644
--- a/src/intel/compiler/brw_eu_emit.c
+++ b/src/intel/compiler/brw_eu_emit.c
@@ -789,7 +789,8 @@ brw_set_dp_write_message(struct brw_codegen *p,
unsigned last_render_target,
unsigned response_length,
unsigned end_of_thread,
- unsigned send_commit_msg)
+ unsigned send_commit_msg,
+ unsigned data_format)
{
const struct gen_device_info *devinfo = p->devinfo;
const unsigned sfid = (devinfo->gen >= 6 ? target_cache :
@@ -801,6 +802,16 @@ brw_set_dp_write_message(struct brw_codegen *p,
brw_inst_set_binding_table_index(devinfo, insn, binding_table_index);
brw_inst_set_dp_write_msg_type(devinfo, insn, msg_type);
brw_inst_set_dp_write_msg_control(devinfo, insn, msg_control);
+ if (data_format) {
+ /* data_format is supported since CherryView. So we can't just set the
+ * any data_format value, because it would trigger an assertion on
+ * brw_inst_set_data_format for previous hw if they try to set it to
+ * zero. And we don't add an generation assert because as mentioned,
+ * brw_inst_set_data_format already does that.
+ */
+ brw_inst_set_data_format(devinfo, insn, data_format);
+ }
+
brw_inst_set_rt_last(devinfo, insn, last_render_target);
if (devinfo->gen < 7) {
brw_inst_set_dp_write_commit(devinfo, insn, send_commit_msg);
@@ -2231,7 +2242,8 @@ void brw_oword_block_write_scratch(struct brw_codegen *p,
0, /* not a render target */
send_commit_msg, /* response_length */
0, /* eot */
- send_commit_msg);
+ send_commit_msg,
+ 0 /* data_format */);
}
}
@@ -2423,7 +2435,8 @@ void brw_fb_WRITE(struct brw_codegen *p,
unsigned response_length,
bool eot,
bool last_render_target,
- bool header_present)
+ bool header_present,
+ unsigned data_format)
{
const struct gen_device_info *devinfo = p->devinfo;
const unsigned target_cache =
@@ -2471,7 +2484,8 @@ void brw_fb_WRITE(struct brw_codegen *p,
last_render_target,
response_length,
eot,
- 0 /* send_commit_msg */);
+ 0, /* send_commit_msg */
+ data_format);
}
brw_inst *
@@ -3024,7 +3038,8 @@ brw_svb_write(struct brw_codegen *p,
0, /* last_render_target: ignored */
send_commit_msg, /* response_length */
0, /* end_of_thread */
- send_commit_msg); /* send_commit_msg */
+ send_commit_msg, /* send_commit_msg */
+ 0 /* data_format */);
}
static unsigned
diff --git a/src/intel/compiler/brw_fs.cpp b/src/intel/compiler/brw_fs.cpp
index 5cfc12f2942..fceed605f47 100644
--- a/src/intel/compiler/brw_fs.cpp
+++ b/src/intel/compiler/brw_fs.cpp
@@ -60,6 +60,7 @@ fs_inst::init(enum opcode opcode, uint8_t exec_size, const fs_reg &dst,
this->sources = sources;
this->exec_size = exec_size;
this->base_mrf = -1;
+ this->data_format = 0;
assert(dst.file != IMM && dst.file != UNIFORM);
diff --git a/src/intel/compiler/brw_fs_generator.cpp b/src/intel/compiler/brw_fs_generator.cpp
index 13d1d88f87c..1f2adeea787 100644
--- a/src/intel/compiler/brw_fs_generator.cpp
+++ b/src/intel/compiler/brw_fs_generator.cpp
@@ -293,7 +293,8 @@ fs_generator::fire_fb_write(fs_inst *inst,
0,
inst->eot,
last_render_target,
- inst->header_size != 0);
+ inst->header_size != 0,
+ inst->data_format);
brw_mark_surface_used(&prog_data->base, surf_index);
}
diff --git a/src/intel/compiler/brw_fs_surface_builder.cpp b/src/intel/compiler/brw_fs_surface_builder.cpp
index 5a5cfcae4cb..d2bea3342df 100644
--- a/src/intel/compiler/brw_fs_surface_builder.cpp
+++ b/src/intel/compiler/brw_fs_surface_builder.cpp
@@ -38,7 +38,7 @@ namespace brw {
emit_send(const fs_builder &bld, enum opcode opcode,
const fs_reg &addr, const fs_reg &src, const fs_reg &surface,
unsigned dims, unsigned arg, unsigned rsize,
- brw_predicate pred = BRW_PREDICATE_NONE)
+ brw_predicate pred = BRW_PREDICATE_NONE, unsigned data_format = 0)
{
/* Reduce the dynamically uniform surface index to a single
* scalar.
@@ -50,6 +50,7 @@ namespace brw {
const fs_reg dst = bld.vgrf(BRW_REGISTER_TYPE_UD, rsize);
fs_inst *inst = bld.emit(opcode, dst, srcs, ARRAY_SIZE(srcs));
+ inst->data_format = data_format;
inst->size_written = rsize * dst.component_size(inst->exec_size);
inst->predicate = pred;
return dst;
diff --git a/src/intel/compiler/brw_inst.h b/src/intel/compiler/brw_inst.h
index 5b2ce32ae40..b5c861ece1f 100644
--- a/src/intel/compiler/brw_inst.h
+++ b/src/intel/compiler/brw_inst.h
@@ -333,6 +333,7 @@ FC(gen4_pop_count, 115, 112, devinfo->gen < 6)
* @{
*/
F(eot, 127, 127)
+FC(data_format, 126, 126, devinfo->gen >= 9 || devinfo->is_cherryview)
FF(mlen,
/* 4: */ 119, 116,
/* 4.5: */ 119, 116,
diff --git a/src/intel/compiler/brw_shader.h b/src/intel/compiler/brw_shader.h
index 30e7bf75c58..b530eef3fc5 100644
--- a/src/intel/compiler/brw_shader.h
+++ b/src/intel/compiler/brw_shader.h
@@ -153,6 +153,13 @@ struct backend_instruction {
uint32_t offset; /**< spill/unspill offset or texture offset bitfield */
uint8_t mlen; /**< SEND message length */
+
+ /* Half Precision Data Format for 16-bit payload SEND messages
+ * 0 = 32-bit
+ * 1 = 16-bit
+ */
+ unsigned data_format:1;
+
int8_t base_mrf; /**< First MRF in the SEND message, if mlen is nonzero. */
uint8_t target; /**< MRT target. */
unsigned size_written; /**< Data written to the destination register in bytes. */
diff --git a/src/intel/compiler/brw_vec4_generator.cpp b/src/intel/compiler/brw_vec4_generator.cpp
index 334933d15a6..292d172d11b 100644
--- a/src/intel/compiler/brw_vec4_generator.cpp
+++ b/src/intel/compiler/brw_vec4_generator.cpp
@@ -1254,7 +1254,8 @@ generate_scratch_write(struct brw_codegen *p,
false, /* not a render target write */
write_commit, /* rlen */
false, /* eot */
- write_commit);
+ write_commit,
+ 0 /* data_format */ );
}
static void
--
2.11.0
More information about the mesa-dev
mailing list