@@ -717,20 +717,36 @@
#define BRW_POLYGON_FACING_FRONT 0
#define BRW_POLYGON_FACING_BACK 1
-#define BRW_MESSAGE_TARGET_NULL 0
-#define BRW_MESSAGE_TARGET_MATH 1
-#define BRW_MESSAGE_TARGET_SAMPLER 2
-#define BRW_MESSAGE_TARGET_GATEWAY 3
-#define BRW_MESSAGE_TARGET_DATAPORT_READ 4
-#define BRW_MESSAGE_TARGET_DP_SC 4 /* data port sampler cache */
-#define BRW_MESSAGE_TARGET_DATAPORT_WRITE 5
-#define BRW_MESSAGE_TARGET_DP_RC 5 /* data port render cache */
-#define BRW_MESSAGE_TARGET_URB 6
-#define BRW_MESSAGE_TARGET_THREAD_SPAWNER 7
-#define BRW_MESSAGE_TARGET_VME 8
-#define BRW_MESSAGE_TARGET_DP_CC 9 /* data port constant cache */
-#define BRW_MESSAGE_TARGET_DP_DC 10 /* data port data cache */
-#define BRW_MESSAGE_TARGET_CRE 0x0d /* check & refinement enginee */
+
+/**
+ * Message target: Shared Function ID for where to SEND a message.
+ *
+ * These are enumerated in the ISA reference under "send - Send Message".
+ * In particular, see the following tables:
+ * - G45 PRM, Volume 4, Table 14-15 "Message Descriptor Definition"
+ * - Sandybridge PRM, Volume 4 Part 2, Table 8-16 "Extended Message Descriptor"
+ * - BSpec, Volume 1a (GPU Overview) / Graphics Processing Engine (GPE) /
+ * Overview / GPE Function IDs
+ */
+enum brw_message_target {
+ BRW_SFID_NULL = 0,
+ BRW_SFID_MATH = 1, /* Only valid on Gen4-5 */
+ BRW_SFID_SAMPLER = 2,
+ BRW_SFID_MESSAGE_GATEWAY = 3,
+ BRW_SFID_DATAPORT_READ = 4,
+ BRW_SFID_DATAPORT_WRITE = 5,
+ BRW_SFID_URB = 6,
+ BRW_SFID_THREAD_SPAWNER = 7,
+
+ GEN6_SFID_DATAPORT_SAMPLER_CACHE = 4,
+ GEN6_SFID_DATAPORT_RENDER_CACHE = 5,
+ GEN6_SFID_VME = 8,
+ GEN6_SFID_DATAPORT_CONSTANT_CACHE = 9,
+
+ GEN7_SFID_DATAPORT_DATA_CACHE = 10,
+
+ HSW_SFID_CRE = 0x0d,
+};
#define BRW_SAMPLER_RETURN_FORMAT_FLOAT32 0
#define BRW_SAMPLER_RETURN_FORMAT_UINT32 2
@@ -275,14 +275,14 @@ char *end_of_thread[2] = {
};
char *target_function[16] = {
- [BRW_MESSAGE_TARGET_NULL] = "null",
- [BRW_MESSAGE_TARGET_MATH] = "math",
- [BRW_MESSAGE_TARGET_SAMPLER] = "sampler",
- [BRW_MESSAGE_TARGET_GATEWAY] = "gateway",
- [BRW_MESSAGE_TARGET_DATAPORT_READ] = "read",
- [BRW_MESSAGE_TARGET_DATAPORT_WRITE] = "write",
- [BRW_MESSAGE_TARGET_URB] = "urb",
- [BRW_MESSAGE_TARGET_THREAD_SPAWNER] = "thread_spawner"
+ [BRW_SFID_NULL] = "null",
+ [BRW_SFID_MATH] = "math",
+ [BRW_SFID_SAMPLER] = "sampler",
+ [BRW_SFID_MESSAGE_GATEWAY] = "gateway",
+ [BRW_SFID_DATAPORT_READ] = "read",
+ [BRW_SFID_DATAPORT_WRITE] = "write",
+ [BRW_SFID_URB] = "urb",
+ [BRW_SFID_THREAD_SPAWNER] = "thread_spawner"
};
char *math_function[16] = {
@@ -831,7 +831,7 @@ int disasm (FILE *file, struct brw_instruction *inst)
err |= control (file, "target function", target_function,
inst->header.destreg__conditionalmod, &space);
switch (inst->header.destreg__conditionalmod) {
- case BRW_MESSAGE_TARGET_MATH:
+ case BRW_SFID_MATH:
err |= control (file, "math function", math_function,
inst->bits3.math.function, &space);
err |= control (file, "math saturate", math_saturate,
@@ -843,7 +843,7 @@ int disasm (FILE *file, struct brw_instruction *inst)
err |= control (file, "math precision", math_precision,
inst->bits3.math.precision, &space);
break;
- case BRW_MESSAGE_TARGET_SAMPLER:
+ case BRW_SFID_SAMPLER:
format (file, " (%d, %d, ",
inst->bits3.sampler.binding_table_index,
inst->bits3.sampler.sampler);
@@ -851,7 +851,7 @@ int disasm (FILE *file, struct brw_instruction *inst)
inst->bits3.sampler.return_format, NULL);
string (file, ")");
break;
- case BRW_MESSAGE_TARGET_DATAPORT_WRITE:
+ case BRW_SFID_DATAPORT_WRITE:
format (file, " (%d, %d, %d, %d)",
inst->bits3.dp_write.binding_table_index,
(inst->bits3.dp_write.last_render_target << 3) |
@@ -859,7 +859,7 @@ int disasm (FILE *file, struct brw_instruction *inst)
inst->bits3.dp_write.msg_type,
inst->bits3.dp_write.send_commit_msg);
break;
- case BRW_MESSAGE_TARGET_URB:
+ case BRW_SFID_URB:
format (file, " %d", inst->bits3.urb.offset);
space = 1;
err |= control (file, "urb swizzle", urb_swizzle,
@@ -871,7 +871,7 @@ int disasm (FILE *file, struct brw_instruction *inst)
err |= control (file, "urb complete", urb_complete,
inst->bits3.urb.complete, &space);
break;
- case BRW_MESSAGE_TARGET_THREAD_SPAWNER:
+ case BRW_SFID_THREAD_SPAWNER:
break;
default:
format (file, "unsupported target %d", inst->bits3.generic.msg_target);
@@ -1168,29 +1168,29 @@ post_dst: dst
msgtarget: NULL_TOKEN
{
if (IS_GENp(5)) {
- $$.bits2.send_gen5.sfid= BRW_MESSAGE_TARGET_NULL;
+ $$.bits2.send_gen5.sfid= BRW_SFID_NULL;
$$.bits3.generic_gen5.header_present = 0; /* ??? */
} else {
- $$.bits3.generic.msg_target = BRW_MESSAGE_TARGET_NULL;
+ $$.bits3.generic.msg_target = BRW_SFID_NULL;
}
}
| SAMPLER LPAREN INTEGER COMMA INTEGER COMMA
sampler_datatype RPAREN
{
if (IS_GENp(7)) {
- $$.bits2.send_gen5.sfid = BRW_MESSAGE_TARGET_SAMPLER;
+ $$.bits2.send_gen5.sfid = BRW_SFID_SAMPLER;
$$.bits3.generic_gen5.header_present = 1; /* ??? */
$$.bits3.sampler_gen7.binding_table_index = $3;
$$.bits3.sampler_gen7.sampler = $5;
$$.bits3.sampler_gen7.simd_mode = 2; /* SIMD16, maybe we should add a new parameter */
} else if (IS_GENp(5)) {
- $$.bits2.send_gen5.sfid = BRW_MESSAGE_TARGET_SAMPLER;
+ $$.bits2.send_gen5.sfid = BRW_SFID_SAMPLER;
$$.bits3.generic_gen5.header_present = 1; /* ??? */
$$.bits3.sampler_gen5.binding_table_index = $3;
$$.bits3.sampler_gen5.sampler = $5;
$$.bits3.sampler_gen5.simd_mode = 2; /* SIMD16, maybe we should add a new parameter */
} else {
- $$.bits3.generic.msg_target = BRW_MESSAGE_TARGET_SAMPLER;
+ $$.bits3.generic.msg_target = BRW_SFID_SAMPLER;
$$.bits3.sampler.binding_table_index = $3;
$$.bits3.sampler.sampler = $5;
switch ($7) {
@@ -1215,7 +1215,7 @@ msgtarget: NULL_TOKEN
fprintf (stderr, "Gen6+ doesn't have math function\n");
YYERROR;
} else if (IS_GENx(5)) {
- $$.bits2.send_gen5.sfid = BRW_MESSAGE_TARGET_MATH;
+ $$.bits2.send_gen5.sfid = BRW_SFID_MATH;
$$.bits3.generic_gen5.header_present = 0;
$$.bits3.math_gen5.function = $2;
if ($3 == BRW_INSTRUCTION_SATURATE)
@@ -1226,7 +1226,7 @@ msgtarget: NULL_TOKEN
$$.bits3.math_gen5.precision = BRW_MATH_PRECISION_FULL;
$$.bits3.math_gen5.data_type = $5;
} else {
- $$.bits3.generic.msg_target = BRW_MESSAGE_TARGET_MATH;
+ $$.bits3.generic.msg_target = BRW_SFID_MATH;
$$.bits3.math.function = $2;
if ($3 == BRW_INSTRUCTION_SATURATE)
$$.bits3.math.saturate = 1;
@@ -1240,10 +1240,10 @@ msgtarget: NULL_TOKEN
| GATEWAY
{
if (IS_GENp(5)) {
- $$.bits2.send_gen5.sfid = BRW_MESSAGE_TARGET_GATEWAY;
+ $$.bits2.send_gen5.sfid = BRW_SFID_MESSAGE_GATEWAY;
$$.bits3.generic_gen5.header_present = 0; /* ??? */
} else {
- $$.bits3.generic.msg_target = BRW_MESSAGE_TARGET_GATEWAY;
+ $$.bits3.generic.msg_target = BRW_SFID_MESSAGE_GATEWAY;
}
}
| READ LPAREN INTEGER COMMA INTEGER COMMA INTEGER COMMA
@@ -1251,21 +1251,21 @@ msgtarget: NULL_TOKEN
{
if (IS_GENx(7)) {
$$.bits2.send_gen5.sfid =
- BRW_MESSAGE_TARGET_DP_SC;
+ GEN6_SFID_DATAPORT_SAMPLER_CACHE;
$$.bits3.generic_gen5.header_present = 1;
$$.bits3.gen7_dp.binding_table_index = $3;
$$.bits3.gen7_dp.msg_control = $7;
$$.bits3.gen7_dp.msg_type = $9;
} else if (IS_GENx(6)) {
$$.bits2.send_gen5.sfid =
- BRW_MESSAGE_TARGET_DP_SC;
+ GEN6_SFID_DATAPORT_SAMPLER_CACHE;
$$.bits3.generic_gen5.header_present = 1;
$$.bits3.gen6_dp_sampler_const_cache.binding_table_index = $3;
$$.bits3.gen6_dp_sampler_const_cache.msg_control = $7;
$$.bits3.gen6_dp_sampler_const_cache.msg_type = $9;
} else if (IS_GENx(5)) {
$$.bits2.send_gen5.sfid =
- BRW_MESSAGE_TARGET_DATAPORT_READ;
+ BRW_SFID_DATAPORT_READ;
$$.bits3.generic_gen5.header_present = 1;
$$.bits3.dp_read_gen5.binding_table_index = $3;
$$.bits3.dp_read_gen5.target_cache = $5;
@@ -1273,7 +1273,7 @@ msgtarget: NULL_TOKEN
$$.bits3.dp_read_gen5.msg_type = $9;
} else {
$$.bits3.generic.msg_target =
- BRW_MESSAGE_TARGET_DATAPORT_READ;
+ BRW_SFID_DATAPORT_READ;
$$.bits3.dp_read.binding_table_index = $3;
$$.bits3.dp_read.target_cache = $5;
$$.bits3.dp_read.msg_control = $7;
@@ -1284,15 +1284,13 @@ msgtarget: NULL_TOKEN
INTEGER RPAREN
{
if (IS_GENx(7)) {
- $$.bits2.send_gen5.sfid =
- BRW_MESSAGE_TARGET_DP_RC;
+ $$.bits2.send_gen5.sfid = GEN6_SFID_DATAPORT_RENDER_CACHE;
$$.bits3.generic_gen5.header_present = 1;
$$.bits3.gen7_dp.binding_table_index = $3;
$$.bits3.gen7_dp.msg_control = $5;
$$.bits3.gen7_dp.msg_type = $7;
} else if (IS_GENx(6)) {
- $$.bits2.send_gen5.sfid =
- BRW_MESSAGE_TARGET_DP_RC;
+ $$.bits2.send_gen5.sfid = GEN6_SFID_DATAPORT_RENDER_CACHE;
/* Sandybridge supports headerlesss message for render target write.
* Currently the GFX assembler doesn't support it. so the program must provide
* message header
@@ -1304,7 +1302,7 @@ msgtarget: NULL_TOKEN
$$.bits3.gen6_dp.send_commit_msg = $9;
} else if (IS_GENx(5)) {
$$.bits2.send_gen5.sfid =
- BRW_MESSAGE_TARGET_DATAPORT_WRITE;
+ BRW_SFID_DATAPORT_WRITE;
$$.bits3.generic_gen5.header_present = 1;
$$.bits3.dp_write_gen5.binding_table_index = $3;
$$.bits3.dp_write_gen5.last_render_target = ($5 & 0x8) >> 3;
@@ -1313,7 +1311,7 @@ msgtarget: NULL_TOKEN
$$.bits3.dp_write_gen5.send_commit_msg = $9;
} else {
$$.bits3.generic.msg_target =
- BRW_MESSAGE_TARGET_DATAPORT_WRITE;
+ BRW_SFID_DATAPORT_WRITE;
$$.bits3.dp_write.binding_table_index = $3;
/* The msg control field of brw_struct.h is split into
* msg control and last_render_target, even though
@@ -1329,15 +1327,13 @@ msgtarget: NULL_TOKEN
INTEGER COMMA INTEGER RPAREN
{
if (IS_GENx(7)) {
- $$.bits2.send_gen5.sfid =
- BRW_MESSAGE_TARGET_DP_RC;
+ $$.bits2.send_gen5.sfid = GEN6_SFID_DATAPORT_RENDER_CACHE;
$$.bits3.generic_gen5.header_present = ($11 != 0);
$$.bits3.gen7_dp.binding_table_index = $3;
$$.bits3.gen7_dp.msg_control = $5;
$$.bits3.gen7_dp.msg_type = $7;
} else if (IS_GENx(6)) {
- $$.bits2.send_gen5.sfid =
- BRW_MESSAGE_TARGET_DP_RC;
+ $$.bits2.send_gen5.sfid = GEN6_SFID_DATAPORT_RENDER_CACHE;
$$.bits3.generic_gen5.header_present = ($11 != 0);
$$.bits3.gen6_dp.binding_table_index = $3;
$$.bits3.gen6_dp.msg_control = $5;
@@ -1345,7 +1341,7 @@ msgtarget: NULL_TOKEN
$$.bits3.gen6_dp.send_commit_msg = $9;
} else if (IS_GENx(5)) {
$$.bits2.send_gen5.sfid =
- BRW_MESSAGE_TARGET_DATAPORT_WRITE;
+ BRW_SFID_DATAPORT_WRITE;
$$.bits3.generic_gen5.header_present = ($11 != 0);
$$.bits3.dp_write_gen5.binding_table_index = $3;
$$.bits3.dp_write_gen5.last_render_target = ($5 & 0x8) >> 3;
@@ -1354,7 +1350,7 @@ msgtarget: NULL_TOKEN
$$.bits3.dp_write_gen5.send_commit_msg = $9;
} else {
$$.bits3.generic.msg_target =
- BRW_MESSAGE_TARGET_DATAPORT_WRITE;
+ BRW_SFID_DATAPORT_WRITE;
$$.bits3.dp_write.binding_table_index = $3;
/* The msg control field of brw_struct.h is split into
* msg control and last_render_target, even though
@@ -1368,9 +1364,9 @@ msgtarget: NULL_TOKEN
}
| URB INTEGER urb_swizzle urb_allocate urb_used urb_complete
{
- $$.bits3.generic.msg_target = BRW_MESSAGE_TARGET_URB;
+ $$.bits3.generic.msg_target = BRW_SFID_URB;
if (IS_GENp(5)) {
- $$.bits2.send_gen5.sfid = BRW_MESSAGE_TARGET_URB;
+ $$.bits2.send_gen5.sfid = BRW_SFID_URB;
$$.bits3.generic_gen5.header_present = 1;
$$.bits3.urb_gen5.opcode = BRW_URB_OPCODE_WRITE;
$$.bits3.urb_gen5.offset = $2;
@@ -1380,7 +1376,7 @@ msgtarget: NULL_TOKEN
$$.bits3.urb_gen5.used = $5;
$$.bits3.urb_gen5.complete = $6;
} else {
- $$.bits3.generic.msg_target = BRW_MESSAGE_TARGET_URB;
+ $$.bits3.generic.msg_target = BRW_SFID_URB;
$$.bits3.urb.opcode = BRW_URB_OPCODE_WRITE;
$$.bits3.urb.offset = $2;
$$.bits3.urb.swizzle_control = $3;
@@ -1394,17 +1390,17 @@ msgtarget: NULL_TOKEN
INTEGER RPAREN
{
$$.bits3.generic.msg_target =
- BRW_MESSAGE_TARGET_THREAD_SPAWNER;
+ BRW_SFID_THREAD_SPAWNER;
if (IS_GENp(5)) {
$$.bits2.send_gen5.sfid =
- BRW_MESSAGE_TARGET_THREAD_SPAWNER;
+ BRW_SFID_THREAD_SPAWNER;
$$.bits3.generic_gen5.header_present = 0;
$$.bits3.thread_spawner_gen5.opcode = $3;
$$.bits3.thread_spawner_gen5.requester_type = $5;
$$.bits3.thread_spawner_gen5.resource_select = $7;
} else {
$$.bits3.generic.msg_target =
- BRW_MESSAGE_TARGET_THREAD_SPAWNER;
+ BRW_SFID_THREAD_SPAWNER;
$$.bits3.thread_spawner.opcode = $3;
$$.bits3.thread_spawner.requester_type = $5;
$$.bits3.thread_spawner.resource_select = $7;
@@ -1412,12 +1408,10 @@ msgtarget: NULL_TOKEN
}
| VME LPAREN INTEGER COMMA INTEGER COMMA INTEGER COMMA INTEGER RPAREN
{
- $$.bits3.generic.msg_target =
- BRW_MESSAGE_TARGET_VME;
+ $$.bits3.generic.msg_target = GEN6_SFID_VME;
if (IS_GENp(6)) {
- $$.bits2.send_gen5.sfid =
- BRW_MESSAGE_TARGET_VME;
+ $$.bits2.send_gen5.sfid = GEN6_SFID_VME;
$$.bits3.vme_gen6.binding_table_index = $3;
$$.bits3.vme_gen6.search_path_index = $5;
$$.bits3.vme_gen6.lut_subindex = $7;
@@ -1434,11 +1428,9 @@ msgtarget: NULL_TOKEN
fprintf (stderr, "Below Gen7.5 doesn't have CRE function\n");
YYERROR;
}
- $$.bits3.generic.msg_target =
- BRW_MESSAGE_TARGET_CRE;
+ $$.bits3.generic.msg_target = HSW_SFID_CRE;
- $$.bits2.send_gen5.sfid =
- BRW_MESSAGE_TARGET_CRE;
+ $$.bits2.send_gen5.sfid = HSW_SFID_CRE;
$$.bits3.cre_gen75.binding_table_index = $3;
$$.bits3.cre_gen75.message_type = $5;
$$.bits3.generic_gen5.header_present = 1;
@@ -1451,10 +1443,10 @@ msgtarget: NULL_TOKEN
$$.bits3.generic_gen5.header_present = ($13 != 0);
if (IS_GENp(7)) {
- if ($3 != BRW_MESSAGE_TARGET_DP_SC &&
- $3 != BRW_MESSAGE_TARGET_DP_RC &&
- $3 != BRW_MESSAGE_TARGET_DP_CC &&
- $3 != BRW_MESSAGE_TARGET_DP_DC) {
+ if ($3 != GEN6_SFID_DATAPORT_SAMPLER_CACHE &&
+ $3 != GEN6_SFID_DATAPORT_RENDER_CACHE &&
+ $3 != GEN6_SFID_DATAPORT_CONSTANT_CACHE &&
+ $3 != GEN7_SFID_DATAPORT_DATA_CACHE) {
fprintf (stderr, "error: wrong cache type\n");
YYERROR;
}
@@ -1464,9 +1456,9 @@ msgtarget: NULL_TOKEN
$$.bits3.gen7_dp.msg_control = $7;
$$.bits3.gen7_dp.msg_type = $5;
} else if (IS_GENx(6)) {
- if ($3 != BRW_MESSAGE_TARGET_DP_SC &&
- $3 != BRW_MESSAGE_TARGET_DP_RC &&
- $3 != BRW_MESSAGE_TARGET_DP_CC) {
+ if ($3 != GEN6_SFID_DATAPORT_SAMPLER_CACHE &&
+ $3 != GEN6_SFID_DATAPORT_RENDER_CACHE &&
+ $3 != GEN6_SFID_DATAPORT_CONSTANT_CACHE) {
fprintf (stderr, "error: wrong cache type\n");
YYERROR;
}
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com> --- assembler/brw_defines.h | 44 +++++++++++++++++-------- assembler/disasm.c | 26 +++++++------- assembler/gram.y | 84 +++++++++++++++++++++------------------------- 3 files changed, 81 insertions(+), 73 deletions(-)