[Mesa-dev] [PATCH 20/23] i965/disasm: Improve render target write message disassembly.
Kristian Høgsberg
hoegsberg at gmail.com
Mon Jun 30 12:10:35 PDT 2014
On Sat, Jun 28, 2014 at 09:33:59PM -0700, Kenneth Graunke wrote:
> Previously, we decoded render target write messages as:
>
> render ( RT write, 0, 16, 12, 0) mlen 8 rlen 0
>
> which made you remember (or look up) what the numbers meant:
>
> 1. The binding table index
> 2. The raw message control, undecoded:
> - Last Render Target Select
> - Slot Group Select
> - Message Type (SIMD8, normal SIMD16, SIMD16 replicate data, ...)
> 3. The dataport message type, again (already decoded as "RT write")
> 4. The write commit bit (0 or 1)
>
> Needless to say, having to decipher that yourself is annoying. Now, we
> do:
>
> render RT write SIMD16 LastRT Surface = 0 mlen 8 rlen 0
>
> with optional "Hi" and "WriteCommit" for slot group/write commit.
>
> Thanks to the new brw_inst API, we can also stop duplicating code on a
> per-generation basis.
This is awesome, I've wanted that for a while, thanks.
Reviewed-by: Kristian Høgsberg <krh at bitplanet.net>
> Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
> ---
> src/mesa/drivers/dri/i965/brw_disasm.c | 77 +++++++++++++++++++++-------------
> 1 file changed, 47 insertions(+), 30 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_disasm.c b/src/mesa/drivers/dri/i965/brw_disasm.c
> index fa286b3..00c0fc4 100644
> --- a/src/mesa/drivers/dri/i965/brw_disasm.c
> +++ b/src/mesa/drivers/dri/i965/brw_disasm.c
> @@ -381,6 +381,17 @@ static const char *const gen6_sfid[16] = {
> [HSW_SFID_CRE] = "cre",
> };
>
> +static const char *const dp_write_port_msg_type[8] = {
> + [0b000] = "OWord block write",
> + [0b001] = "OWord dual block write",
> + [0b010] = "media block write",
> + [0b011] = "DWord scattered write",
> + [0b100] = "RT write",
> + [0b101] = "streamed VB write",
> + [0b110] = "RT UNORM write", /* G45+ */
> + [0b111] = "flush render cache",
> +};
> +
> static const char *const dp_rc_msg_type_gen6[16] = {
> [BRW_DATAPORT_READ_MESSAGE_OWORD_BLOCK_READ] = "OWORD block read",
> [GEN6_DATAPORT_READ_MESSAGE_RENDER_UNORM_READ] = "RT UNORM read",
> @@ -401,6 +412,16 @@ static const char *const dp_rc_msg_type_gen6[16] = {
> [GEN6_DATAPORT_WRITE_MESSAGE_RENDER_TARGET_UNORM_WRITE] = "RT UNORM write",
> };
>
> +static const char *const m_rt_write_subtype[] = {
> + [0b000] = "SIMD16",
> + [0b001] = "SIMD16/RepData",
> + [0b010] = "SIMD8/DualSrcLow",
> + [0b011] = "SIMD8/DualSrcHigh",
> + [0b100] = "SIMD8",
> + [0b101] = "SIMD8/ImageWrite", /* Gen6+ */
> + [0b111] = "SIMD16/RepData-111", /* no idea how this is different than 1 */
> +};
> +
> static const char *const dp_dc0_msg_type_gen7[16] = {
> [GEN7_DATAPORT_DC_OWORD_BLOCK_READ] = "DC OWORD block read",
> [GEN7_DATAPORT_DC_UNALIGNED_OWORD_BLOCK_READ] =
> @@ -1322,40 +1343,36 @@ brw_disassemble_inst(FILE *file, struct brw_context *brw, brw_inst *inst,
> }
> break;
>
> - case GEN6_SFID_DATAPORT_RENDER_CACHE:
> + case GEN6_SFID_DATAPORT_RENDER_CACHE: {
> /* aka BRW_SFID_DATAPORT_WRITE on Gen4-5 */
> - if (brw->gen >= 7) {
> - format(file, " (");
> -
> - err |= control(file, "DP rc message type",
> - dp_rc_msg_type_gen6,
> - brw_inst_dp_msg_type(brw, inst), &space);
> -
> - format(file, ", %d, %d, %d)",
> - brw_inst_binding_table_index(brw, inst),
> - brw_inst_dp_msg_control(brw, inst),
> - brw_inst_dp_msg_type(brw, inst));
> - } else if (brw->gen == 6) {
> - format(file, " (");
> -
> - err |= control(file, "DP rc message type",
> - dp_rc_msg_type_gen6,
> - brw_inst_dp_msg_type(brw, inst), &space);
> -
> - format(file, ", %d, %d, %d, %d)",
> - brw_inst_binding_table_index(brw, inst),
> - brw_inst_dp_msg_control(brw, inst),
> - brw_inst_dp_msg_type(brw, inst),
> - brw_inst_dp_write_commit(brw, inst));
> + unsigned msg_type = brw_inst_dp_write_msg_type(brw, inst);
> +
> + err |= control(file, "DP rc message type",
> + brw->gen >= 6 ? dp_rc_msg_type_gen6
> + : dp_write_port_msg_type,
> + msg_type, &space);
> +
> + bool is_rt_write = msg_type ==
> + (brw->gen >= 6 ? GEN6_DATAPORT_WRITE_MESSAGE_RENDER_TARGET_WRITE
> + : BRW_DATAPORT_WRITE_MESSAGE_RENDER_TARGET_WRITE);
> +
> + if (is_rt_write) {
> + err |= control(file, "RT message type", m_rt_write_subtype,
> + brw_inst_rt_message_type(brw, inst), &space);
> + if (brw->gen >= 6 && brw_inst_rt_slot_group(brw, inst))
> + string(file, " Hi");
> + if (brw_inst_rt_last(brw, inst))
> + string(file, " LastRT");
> + if (brw->gen < 7 && brw_inst_dp_write_commit(brw, inst))
> + string(file, " WriteCommit");
> } else {
> - format(file, " (%d, %d, %d, %d)",
> - brw_inst_binding_table_index(brw, inst),
> - (brw_inst_rt_last(brw, inst) << 3) |
> - brw_inst_dp_write_msg_control(brw, inst),
> - brw_inst_dp_write_msg_type(brw, inst),
> - brw_inst_dp_write_commit(brw, inst));
> + format(file, " MsgCtrl = 0x%x",
> + brw_inst_dp_write_msg_control(brw, inst));
> }
> +
> + format(file, " Surface = %d", brw_inst_binding_table_index(brw, inst));
> break;
> + }
>
> case BRW_SFID_URB:
> format(file, " %d", brw_inst_urb_global_offset(brw, inst));
> --
> 2.0.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list