[Mesa-dev] [PATCH 06/23] i965: Make the disassembler take a device_info instead of a context
Jason Ekstrand
jason at jlekstrand.net
Fri Apr 17 19:11:46 PDT 2015
---
src/mesa/drivers/dri/i965/brw_clip.c | 3 +-
src/mesa/drivers/dri/i965/brw_context.h | 2 +-
src/mesa/drivers/dri/i965/brw_disasm.c | 162 +++++++++++------------
src/mesa/drivers/dri/i965/brw_eu.c | 8 +-
src/mesa/drivers/dri/i965/brw_eu.h | 4 +-
src/mesa/drivers/dri/i965/brw_eu_compact.c | 11 +-
src/mesa/drivers/dri/i965/brw_ff_gs.c | 3 +-
src/mesa/drivers/dri/i965/brw_sf.c | 3 +-
src/mesa/drivers/dri/i965/brw_state_dump.c | 4 +-
src/mesa/drivers/dri/i965/intel_asm_annotation.c | 2 +-
src/mesa/drivers/dri/i965/test_eu_compact.c | 6 +-
11 files changed, 99 insertions(+), 109 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_clip.c b/src/mesa/drivers/dri/i965/brw_clip.c
index de78f46..07b10a2 100644
--- a/src/mesa/drivers/dri/i965/brw_clip.c
+++ b/src/mesa/drivers/dri/i965/brw_clip.c
@@ -117,7 +117,8 @@ static void compile_clip_prog( struct brw_context *brw,
if (unlikely(INTEL_DEBUG & DEBUG_CLIP)) {
fprintf(stderr, "clip:\n");
- brw_disassemble(brw, c.func.store, 0, program_size, stderr);
+ brw_disassemble(brw->intelScreen->devinfo, c.func.store,
+ 0, program_size, stderr);
fprintf(stderr, "\n");
}
diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
index a6d6787..80556ea 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -1622,7 +1622,7 @@ void brw_fs_alloc_reg_sets(struct intel_screen *screen);
void brw_vec4_alloc_reg_set(struct intel_screen *screen);
/* brw_disasm.c */
-int brw_disassemble_inst(FILE *file, struct brw_context *brw,
+int brw_disassemble_inst(FILE *file, const struct brw_device_info *devinfo,
struct brw_inst *inst, bool is_compacted);
/* brw_vs.c */
diff --git a/src/mesa/drivers/dri/i965/brw_disasm.c b/src/mesa/drivers/dri/i965/brw_disasm.c
index 873ae86..d1078c0 100644
--- a/src/mesa/drivers/dri/i965/brw_disasm.c
+++ b/src/mesa/drivers/dri/i965/brw_disasm.c
@@ -103,9 +103,9 @@ const struct opcode_desc opcode_descs[128] = {
};
static bool
-has_jip(struct brw_context *brw, enum opcode opcode)
+has_jip(const struct brw_device_info *devinfo, enum opcode opcode)
{
- if (brw->gen < 6)
+ if (devinfo->gen < 6)
return false;
return opcode == BRW_OPCODE_IF ||
@@ -118,22 +118,22 @@ has_jip(struct brw_context *brw, enum opcode opcode)
}
static bool
-has_uip(struct brw_context *brw, enum opcode opcode)
+has_uip(const struct brw_device_info *devinfo, enum opcode opcode)
{
- if (brw->gen < 6)
+ if (devinfo->gen < 6)
return false;
- return (brw->gen >= 7 && opcode == BRW_OPCODE_IF) ||
- (brw->gen >= 8 && opcode == BRW_OPCODE_ELSE) ||
+ return (devinfo->gen >= 7 && opcode == BRW_OPCODE_IF) ||
+ (devinfo->gen >= 8 && opcode == BRW_OPCODE_ELSE) ||
opcode == BRW_OPCODE_BREAK ||
opcode == BRW_OPCODE_CONTINUE ||
opcode == BRW_OPCODE_HALT;
}
static bool
-has_branch_ctrl(struct brw_context *brw, enum opcode opcode)
+has_branch_ctrl(const struct brw_device_info *devinfo, enum opcode opcode)
{
- if (brw->gen < 8)
+ if (devinfo->gen < 8)
return false;
return opcode == BRW_OPCODE_IF ||
@@ -718,10 +718,9 @@ reg(FILE *file, unsigned _reg_file, unsigned _reg_nr)
}
static int
-dest(FILE *file, struct brw_context *brw, brw_inst *inst)
+dest(FILE *file, const struct brw_device_info *devinfo, brw_inst *inst)
{
int err = 0;
- const struct brw_device_info *devinfo = brw->intelScreen->devinfo;
if (brw_inst_access_mode(devinfo, inst) == BRW_ALIGN_1) {
if (brw_inst_dst_address_mode(devinfo, inst) == BRW_ADDRESS_DIRECT) {
@@ -776,13 +775,12 @@ dest(FILE *file, struct brw_context *brw, brw_inst *inst)
}
static int
-dest_3src(FILE *file, struct brw_context *brw, brw_inst *inst)
+dest_3src(FILE *file, const struct brw_device_info *devinfo, brw_inst *inst)
{
int err = 0;
uint32_t reg_file;
- const struct brw_device_info *devinfo = brw->intelScreen->devinfo;
- if (brw->gen == 6 && brw_inst_3src_dst_reg_file(devinfo, inst))
+ if (devinfo->gen == 6 && brw_inst_3src_dst_reg_file(devinfo, inst))
reg_file = BRW_MESSAGE_REGISTER_FILE;
else
reg_file = BRW_GENERAL_REGISTER_FILE;
@@ -819,7 +817,7 @@ src_align1_region(FILE *file,
static int
src_da1(FILE *file,
- const struct brw_context *brw,
+ const struct brw_device_info *devinfo,
unsigned opcode,
unsigned type, unsigned _reg_file,
unsigned _vert_stride, unsigned _width, unsigned _horiz_stride,
@@ -828,7 +826,7 @@ src_da1(FILE *file,
{
int err = 0;
- if (brw->gen >= 8 && is_logic_instruction(opcode))
+ if (devinfo->gen >= 8 && is_logic_instruction(opcode))
err |= control(file, "bitnot", m_bitnot, _negate, NULL);
else
err |= control(file, "negate", m_negate, _negate, NULL);
@@ -847,7 +845,7 @@ src_da1(FILE *file,
static int
src_ia1(FILE *file,
- const struct brw_context *brw,
+ const struct brw_device_info *devinfo,
unsigned opcode,
unsigned type,
unsigned _reg_file,
@@ -860,7 +858,7 @@ src_ia1(FILE *file,
{
int err = 0;
- if (brw->gen >= 8 && is_logic_instruction(opcode))
+ if (devinfo->gen >= 8 && is_logic_instruction(opcode))
err |= control(file, "bitnot", m_bitnot, _negate, NULL);
else
err |= control(file, "negate", m_negate, _negate, NULL);
@@ -902,7 +900,7 @@ src_swizzle(FILE *file, unsigned swiz)
static int
src_da16(FILE *file,
- const struct brw_context *brw,
+ const struct brw_device_info *devinfo,
unsigned opcode,
unsigned _reg_type,
unsigned _reg_file,
@@ -915,7 +913,7 @@ src_da16(FILE *file,
{
int err = 0;
- if (brw->gen >= 8 && is_logic_instruction(opcode))
+ if (devinfo->gen >= 8 && is_logic_instruction(opcode))
err |= control(file, "bitnot", m_bitnot, _negate, NULL);
else
err |= control(file, "negate", m_negate, _negate, NULL);
@@ -938,10 +936,9 @@ src_da16(FILE *file,
}
static int
-src0_3src(FILE *file, struct brw_context *brw, brw_inst *inst)
+src0_3src(FILE *file, const struct brw_device_info *devinfo, brw_inst *inst)
{
int err = 0;
- const struct brw_device_info *devinfo = brw->intelScreen->devinfo;
unsigned src0_subreg_nr = brw_inst_3src_src0_subreg_nr(devinfo, inst);
err |= control(file, "negate", m_negate,
@@ -965,10 +962,9 @@ src0_3src(FILE *file, struct brw_context *brw, brw_inst *inst)
}
static int
-src1_3src(FILE *file, struct brw_context *brw, brw_inst *inst)
+src1_3src(FILE *file, const struct brw_device_info *devinfo, brw_inst *inst)
{
int err = 0;
- const struct brw_device_info *devinfo = brw->intelScreen->devinfo;
unsigned src1_subreg_nr = brw_inst_3src_src1_subreg_nr(devinfo, inst);
err |= control(file, "negate", m_negate,
@@ -993,10 +989,9 @@ src1_3src(FILE *file, struct brw_context *brw, brw_inst *inst)
static int
-src2_3src(FILE *file, struct brw_context *brw, brw_inst *inst)
+src2_3src(FILE *file, const struct brw_device_info *devinfo, brw_inst *inst)
{
int err = 0;
- const struct brw_device_info *devinfo = brw->intelScreen->devinfo;
unsigned src2_subreg_nr = brw_inst_3src_src2_subreg_nr(devinfo, inst);
err |= control(file, "negate", m_negate,
@@ -1020,9 +1015,8 @@ src2_3src(FILE *file, struct brw_context *brw, brw_inst *inst)
}
static int
-imm(FILE *file, struct brw_context *brw, unsigned type, brw_inst *inst)
+imm(FILE *file, const struct brw_device_info *devinfo, unsigned type, brw_inst *inst)
{
- const struct brw_device_info *devinfo = brw->intelScreen->devinfo;
switch (type) {
case BRW_HW_REG_TYPE_UD:
format(file, "0x%08xUD", brw_inst_imm_ud(devinfo, inst));
@@ -1063,15 +1057,14 @@ imm(FILE *file, struct brw_context *brw, unsigned type, brw_inst *inst)
}
static int
-src0(FILE *file, struct brw_context *brw, brw_inst *inst)
+src0(FILE *file, const struct brw_device_info *devinfo, brw_inst *inst)
{
- const struct brw_device_info *devinfo = brw->intelScreen->devinfo;
if (brw_inst_src0_reg_file(devinfo, inst) == BRW_IMMEDIATE_VALUE) {
- return imm(file, brw, brw_inst_src0_reg_type(devinfo, inst), inst);
+ return imm(file, devinfo, brw_inst_src0_reg_type(devinfo, inst), inst);
} else if (brw_inst_access_mode(devinfo, inst) == BRW_ALIGN_1) {
if (brw_inst_src0_address_mode(devinfo, inst) == BRW_ADDRESS_DIRECT) {
return src_da1(file,
- brw,
+ devinfo,
brw_inst_opcode(devinfo, inst),
brw_inst_src0_reg_type(devinfo, inst),
brw_inst_src0_reg_file(devinfo, inst),
@@ -1084,7 +1077,7 @@ src0(FILE *file, struct brw_context *brw, brw_inst *inst)
brw_inst_src0_negate(devinfo, inst));
} else {
return src_ia1(file,
- brw,
+ devinfo,
brw_inst_opcode(devinfo, inst),
brw_inst_src0_reg_type(devinfo, inst),
brw_inst_src0_reg_file(devinfo, inst),
@@ -1100,7 +1093,7 @@ src0(FILE *file, struct brw_context *brw, brw_inst *inst)
} else {
if (brw_inst_src0_address_mode(devinfo, inst) == BRW_ADDRESS_DIRECT) {
return src_da16(file,
- brw,
+ devinfo,
brw_inst_opcode(devinfo, inst),
brw_inst_src0_reg_type(devinfo, inst),
brw_inst_src0_reg_file(devinfo, inst),
@@ -1121,15 +1114,14 @@ src0(FILE *file, struct brw_context *brw, brw_inst *inst)
}
static int
-src1(FILE *file, struct brw_context *brw, brw_inst *inst)
+src1(FILE *file, const struct brw_device_info *devinfo, brw_inst *inst)
{
- const struct brw_device_info *devinfo = brw->intelScreen->devinfo;
if (brw_inst_src1_reg_file(devinfo, inst) == BRW_IMMEDIATE_VALUE) {
- return imm(file, brw, brw_inst_src1_reg_type(devinfo, inst), inst);
+ return imm(file, devinfo, brw_inst_src1_reg_type(devinfo, inst), inst);
} else if (brw_inst_access_mode(devinfo, inst) == BRW_ALIGN_1) {
if (brw_inst_src1_address_mode(devinfo, inst) == BRW_ADDRESS_DIRECT) {
return src_da1(file,
- brw,
+ devinfo,
brw_inst_opcode(devinfo, inst),
brw_inst_src1_reg_type(devinfo, inst),
brw_inst_src1_reg_file(devinfo, inst),
@@ -1142,7 +1134,7 @@ src1(FILE *file, struct brw_context *brw, brw_inst *inst)
brw_inst_src1_negate(devinfo, inst));
} else {
return src_ia1(file,
- brw,
+ devinfo,
brw_inst_opcode(devinfo, inst),
brw_inst_src1_reg_type(devinfo, inst),
brw_inst_src1_reg_file(devinfo, inst),
@@ -1158,7 +1150,7 @@ src1(FILE *file, struct brw_context *brw, brw_inst *inst)
} else {
if (brw_inst_src1_address_mode(devinfo, inst) == BRW_ADDRESS_DIRECT) {
return src_da16(file,
- brw,
+ devinfo,
brw_inst_opcode(devinfo, inst),
brw_inst_src1_reg_type(devinfo, inst),
brw_inst_src1_reg_file(devinfo, inst),
@@ -1179,9 +1171,8 @@ src1(FILE *file, struct brw_context *brw, brw_inst *inst)
}
static int
-qtr_ctrl(FILE *file, struct brw_context *brw, brw_inst *inst)
+qtr_ctrl(FILE *file, const struct brw_device_info *devinfo, brw_inst *inst)
{
- const struct brw_device_info *devinfo = brw->intelScreen->devinfo;
int qtr_ctl = brw_inst_qtr_control(devinfo, inst);
int exec_size = 1 << brw_inst_exec_size(devinfo, inst);
@@ -1211,23 +1202,22 @@ qtr_ctrl(FILE *file, struct brw_context *brw, brw_inst *inst)
#ifdef DEBUG
static __attribute__((__unused__)) int
-brw_disassemble_imm(struct brw_context *brw,
+brw_disassemble_imm(const struct brw_device_info *devinfo,
uint32_t dw3, uint32_t dw2, uint32_t dw1, uint32_t dw0)
{
brw_inst inst;
inst.data[0] = (((uint64_t) dw1) << 32) | ((uint64_t) dw0);
inst.data[1] = (((uint64_t) dw3) << 32) | ((uint64_t) dw2);
- return brw_disassemble_inst(stderr, brw, &inst, false);
+ return brw_disassemble_inst(stderr, devinfo, &inst, false);
}
#endif
int
-brw_disassemble_inst(FILE *file, struct brw_context *brw, brw_inst *inst,
- bool is_compacted)
+brw_disassemble_inst(FILE *file, const struct brw_device_info *devinfo,
+ brw_inst *inst, bool is_compacted)
{
int err = 0;
int space = 0;
- const struct brw_device_info *devinfo = brw->intelScreen->devinfo;
const enum opcode opcode = brw_inst_opcode(devinfo, inst);
@@ -1268,11 +1258,11 @@ brw_disassemble_inst(FILE *file, struct brw_context *brw, brw_inst *inst,
* control flow doesn't update flags.
*/
if (brw_inst_cond_modifier(devinfo, inst) &&
- (brw->gen < 6 || (opcode != BRW_OPCODE_SEL &&
+ (devinfo->gen < 6 || (opcode != BRW_OPCODE_SEL &&
opcode != BRW_OPCODE_IF &&
opcode != BRW_OPCODE_WHILE))) {
format(file, ".f%ld",
- brw->gen >= 7 ? brw_inst_flag_reg_nr(devinfo, inst) : 0);
+ devinfo->gen >= 7 ? brw_inst_flag_reg_nr(devinfo, inst) : 0);
if (brw_inst_flag_subreg_nr(devinfo, inst))
format(file, ".%ld", brw_inst_flag_subreg_nr(devinfo, inst));
}
@@ -1285,66 +1275,66 @@ brw_disassemble_inst(FILE *file, struct brw_context *brw, brw_inst *inst,
string(file, ")");
}
- if (opcode == BRW_OPCODE_SEND && brw->gen < 6)
+ if (opcode == BRW_OPCODE_SEND && devinfo->gen < 6)
format(file, " %ld", brw_inst_base_mrf(devinfo, inst));
- if (has_uip(brw, opcode)) {
+ if (has_uip(devinfo, opcode)) {
/* Instructions that have UIP also have JIP. */
pad(file, 16);
format(file, "JIP: %d", brw_inst_jip(devinfo, inst));
pad(file, 32);
format(file, "UIP: %d", brw_inst_uip(devinfo, inst));
- } else if (has_jip(brw, opcode)) {
+ } else if (has_jip(devinfo, opcode)) {
pad(file, 16);
- if (brw->gen >= 7) {
+ if (devinfo->gen >= 7) {
format(file, "JIP: %d", brw_inst_jip(devinfo, inst));
} else {
format(file, "JIP: %d", brw_inst_gen6_jump_count(devinfo, inst));
}
- } else if (brw->gen < 6 && (opcode == BRW_OPCODE_BREAK ||
+ } else if (devinfo->gen < 6 && (opcode == BRW_OPCODE_BREAK ||
opcode == BRW_OPCODE_CONTINUE ||
opcode == BRW_OPCODE_ELSE)) {
pad(file, 16);
format(file, "Jump: %d", brw_inst_gen4_jump_count(devinfo, inst));
pad(file, 32);
format(file, "Pop: %ld", brw_inst_gen4_pop_count(devinfo, inst));
- } else if (brw->gen < 6 && (opcode == BRW_OPCODE_IF ||
+ } else if (devinfo->gen < 6 && (opcode == BRW_OPCODE_IF ||
opcode == BRW_OPCODE_IFF ||
opcode == BRW_OPCODE_HALT)) {
pad(file, 16);
format(file, "Jump: %d", brw_inst_gen4_jump_count(devinfo, inst));
- } else if (brw->gen < 6 && opcode == BRW_OPCODE_ENDIF) {
+ } else if (devinfo->gen < 6 && opcode == BRW_OPCODE_ENDIF) {
pad(file, 16);
format(file, "Pop: %ld", brw_inst_gen4_pop_count(devinfo, inst));
} else if (opcode == BRW_OPCODE_JMPI) {
pad(file, 16);
- err |= src1(file, brw, inst);
+ err |= src1(file, devinfo, inst);
} else if (opcode_descs[opcode].nsrc == 3) {
pad(file, 16);
- err |= dest_3src(file, brw, inst);
+ err |= dest_3src(file, devinfo, inst);
pad(file, 32);
- err |= src0_3src(file, brw, inst);
+ err |= src0_3src(file, devinfo, inst);
pad(file, 48);
- err |= src1_3src(file, brw, inst);
+ err |= src1_3src(file, devinfo, inst);
pad(file, 64);
- err |= src2_3src(file, brw, inst);
+ err |= src2_3src(file, devinfo, inst);
} else {
if (opcode_descs[opcode].ndst > 0) {
pad(file, 16);
- err |= dest(file, brw, inst);
+ err |= dest(file, devinfo, inst);
}
if (opcode_descs[opcode].nsrc > 0) {
pad(file, 32);
- err |= src0(file, brw, inst);
+ err |= src0(file, devinfo, inst);
}
if (opcode_descs[opcode].nsrc > 1) {
pad(file, 48);
- err |= src1(file, brw, inst);
+ err |= src1(file, devinfo, inst);
}
}
@@ -1354,7 +1344,7 @@ brw_disassemble_inst(FILE *file, struct brw_context *brw, brw_inst *inst,
if (brw_inst_src1_reg_file(devinfo, inst) != BRW_IMMEDIATE_VALUE) {
/* show the indirect descriptor source */
pad(file, 48);
- err |= src1(file, brw, inst);
+ err |= src1(file, devinfo, inst);
}
newline(file);
@@ -1362,7 +1352,7 @@ brw_disassemble_inst(FILE *file, struct brw_context *brw, brw_inst *inst,
space = 0;
fprintf(file, " ");
- err |= control(file, "SFID", brw->gen >= 6 ? gen6_sfid : gen4_sfid,
+ err |= control(file, "SFID", devinfo->gen >= 6 ? gen6_sfid : gen4_sfid,
sfid, &space);
@@ -1383,7 +1373,7 @@ brw_disassemble_inst(FILE *file, struct brw_context *brw, brw_inst *inst,
brw_inst_math_msg_precision(devinfo, inst), &space);
break;
case BRW_SFID_SAMPLER:
- if (brw->gen >= 5) {
+ if (devinfo->gen >= 5) {
format(file, " (%ld, %ld, %ld, %ld)",
brw_inst_binding_table_index(devinfo, inst),
brw_inst_sampler(devinfo, inst),
@@ -1394,7 +1384,7 @@ brw_disassemble_inst(FILE *file, struct brw_context *brw, brw_inst *inst,
brw_inst_binding_table_index(devinfo, inst),
brw_inst_sampler(devinfo, inst),
brw_inst_sampler_msg_type(devinfo, inst));
- if (!brw->is_g4x) {
+ if (!devinfo->is_g4x) {
err |= control(file, "sampler target format",
sampler_target_format,
brw_inst_sampler_return_format(devinfo, inst), NULL);
@@ -1404,12 +1394,12 @@ brw_disassemble_inst(FILE *file, struct brw_context *brw, brw_inst *inst,
break;
case GEN6_SFID_DATAPORT_SAMPLER_CACHE:
/* aka BRW_SFID_DATAPORT_READ on Gen4-5 */
- if (brw->gen >= 6) {
+ if (devinfo->gen >= 6) {
format(file, " (%ld, %ld, %ld, %ld)",
brw_inst_binding_table_index(devinfo, inst),
brw_inst_dp_msg_control(devinfo, inst),
brw_inst_dp_msg_type(devinfo, inst),
- brw->gen >= 7 ? 0 : brw_inst_dp_write_commit(devinfo, inst));
+ devinfo->gen >= 7 ? 0 : brw_inst_dp_write_commit(devinfo, inst));
} else {
format(file, " (%ld, %ld, %ld)",
brw_inst_binding_table_index(devinfo, inst),
@@ -1423,22 +1413,22 @@ brw_disassemble_inst(FILE *file, struct brw_context *brw, brw_inst *inst,
unsigned msg_type = brw_inst_dp_write_msg_type(devinfo, inst);
err |= control(file, "DP rc message type",
- brw->gen >= 6 ? dp_rc_msg_type_gen6
+ devinfo->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);
+ (devinfo->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(devinfo, inst), &space);
- if (brw->gen >= 6 && brw_inst_rt_slot_group(devinfo, inst))
+ if (devinfo->gen >= 6 && brw_inst_rt_slot_group(devinfo, inst))
string(file, " Hi");
if (brw_inst_rt_last(devinfo, inst))
string(file, " LastRT");
- if (brw->gen < 7 && brw_inst_dp_write_commit(devinfo, inst))
+ if (devinfo->gen < 7 && brw_inst_dp_write_commit(devinfo, inst))
string(file, " WriteCommit");
} else {
format(file, " MsgCtrl = 0x%lx",
@@ -1453,22 +1443,22 @@ brw_disassemble_inst(FILE *file, struct brw_context *brw, brw_inst *inst,
format(file, " %ld", brw_inst_urb_global_offset(devinfo, inst));
space = 1;
- if (brw->gen >= 7) {
+ if (devinfo->gen >= 7) {
err |= control(file, "urb opcode", gen7_urb_opcode,
brw_inst_urb_opcode(devinfo, inst), &space);
- } else if (brw->gen >= 5) {
+ } else if (devinfo->gen >= 5) {
err |= control(file, "urb opcode", gen5_urb_opcode,
brw_inst_urb_opcode(devinfo, inst), &space);
}
err |= control(file, "urb swizzle", urb_swizzle,
brw_inst_urb_swizzle_control(devinfo, inst), &space);
- if (brw->gen < 7) {
+ if (devinfo->gen < 7) {
err |= control(file, "urb allocate", urb_allocate,
brw_inst_urb_allocate(devinfo, inst), &space);
err |= control(file, "urb used", urb_used,
brw_inst_urb_used(devinfo, inst), &space);
}
- if (brw->gen < 8) {
+ if (devinfo->gen < 8) {
err |= control(file, "urb complete", urb_complete,
brw_inst_urb_complete(devinfo, inst), &space);
}
@@ -1476,7 +1466,7 @@ brw_disassemble_inst(FILE *file, struct brw_context *brw, brw_inst *inst,
case BRW_SFID_THREAD_SPAWNER:
break;
case GEN7_SFID_DATAPORT_DATA_CACHE:
- if (brw->gen >= 7) {
+ if (devinfo->gen >= 7) {
format(file, " (");
err |= control(file, "DP DC0 message type",
@@ -1499,7 +1489,7 @@ brw_disassemble_inst(FILE *file, struct brw_context *brw, brw_inst *inst,
/* FALLTHROUGH */
case HSW_SFID_DATAPORT_DATA_CACHE_1: {
- if (brw->gen >= 7) {
+ if (devinfo->gen >= 7) {
format(file, " (");
unsigned msg_ctrl = brw_inst_dp_msg_control(devinfo, inst);
@@ -1541,7 +1531,7 @@ brw_disassemble_inst(FILE *file, struct brw_context *brw, brw_inst *inst,
}
case GEN7_SFID_PIXEL_INTERPOLATOR:
- if (brw->gen >= 7) {
+ if (devinfo->gen >= 7) {
format(file, " (%s, %s, 0x%02lx)",
brw_inst_pi_nopersp(devinfo, inst) ? "linear" : "persp",
pixel_interpolator_msg_types[brw_inst_pi_message_type(devinfo, inst)],
@@ -1567,7 +1557,7 @@ brw_disassemble_inst(FILE *file, struct brw_context *brw, brw_inst *inst,
space = 1;
err |= control(file, "access mode", access_mode,
brw_inst_access_mode(devinfo, inst), &space);
- if (brw->gen >= 6) {
+ if (devinfo->gen >= 6) {
err |= control(file, "write enable control", wectrl,
brw_inst_mask_control(devinfo, inst), &space);
} else {
@@ -1578,8 +1568,8 @@ brw_disassemble_inst(FILE *file, struct brw_context *brw, brw_inst *inst,
((brw_inst_no_dd_check(devinfo, inst) << 1) |
brw_inst_no_dd_clear(devinfo, inst)), &space);
- if (brw->gen >= 6)
- err |= qtr_ctrl(file, brw, inst);
+ if (devinfo->gen >= 6)
+ err |= qtr_ctrl(file, devinfo, inst);
else {
if (brw_inst_qtr_control(devinfo, inst) == BRW_COMPRESSION_COMPRESSED &&
opcode_descs[opcode].ndst > 0 &&
@@ -1595,10 +1585,10 @@ brw_disassemble_inst(FILE *file, struct brw_context *brw, brw_inst *inst,
err |= control(file, "compaction", cmpt_ctrl, is_compacted, &space);
err |= control(file, "thread control", thread_ctrl,
brw_inst_thread_control(devinfo, inst), &space);
- if (has_branch_ctrl(brw, opcode)) {
+ if (has_branch_ctrl(devinfo, opcode)) {
err |= control(file, "branch ctrl", branch_ctrl,
brw_inst_branch_control(devinfo, inst), &space);
- } else if (brw->gen >= 6) {
+ } else if (devinfo->gen >= 6) {
err |= control(file, "acc write control", accwr,
brw_inst_acc_wr_control(devinfo, inst), &space);
}
diff --git a/src/mesa/drivers/dri/i965/brw_eu.c b/src/mesa/drivers/dri/i965/brw_eu.c
index 1aae9b2..a6abb75 100644
--- a/src/mesa/drivers/dri/i965/brw_eu.c
+++ b/src/mesa/drivers/dri/i965/brw_eu.c
@@ -255,7 +255,7 @@ const unsigned *brw_get_program( struct brw_compile *p,
}
void
-brw_disassemble(struct brw_context *brw,
+brw_disassemble(const struct brw_device_info *devinfo,
void *assembly, int start, int end, FILE *out)
{
bool dump_hex = false;
@@ -263,7 +263,7 @@ brw_disassemble(struct brw_context *brw,
for (int offset = start; offset < end;) {
brw_inst *insn = assembly + offset;
brw_inst uncompacted;
- bool compacted = brw_inst_cmpt_control(brw->intelScreen->devinfo, insn);
+ bool compacted = brw_inst_cmpt_control(devinfo, insn);
if (0)
fprintf(out, "0x%08x: ", offset);
@@ -275,7 +275,7 @@ brw_disassemble(struct brw_context *brw,
((uint32_t *)insn)[0]);
}
- brw_uncompact_instruction(brw->intelScreen->devinfo, &uncompacted, compacted);
+ brw_uncompact_instruction(devinfo, &uncompacted, compacted);
insn = &uncompacted;
offset += 8;
} else {
@@ -289,6 +289,6 @@ brw_disassemble(struct brw_context *brw,
offset += 16;
}
- brw_disassemble_inst(out, brw, insn, compacted);
+ brw_disassemble_inst(out, devinfo, insn, compacted);
}
}
diff --git a/src/mesa/drivers/dri/i965/brw_eu.h b/src/mesa/drivers/dri/i965/brw_eu.h
index b9566ca..6855708 100644
--- a/src/mesa/drivers/dri/i965/brw_eu.h
+++ b/src/mesa/drivers/dri/i965/brw_eu.h
@@ -111,7 +111,7 @@ void brw_set_default_acc_write_control(struct brw_compile *p, unsigned value);
void brw_init_compile(struct brw_context *, struct brw_compile *p,
void *mem_ctx);
-void brw_disassemble(struct brw_context *brw, void *assembly,
+void brw_disassemble(const struct brw_device_info *devinfo, void *assembly,
int start, int end, FILE *out);
const unsigned *brw_get_program( struct brw_compile *p, unsigned *sz );
@@ -470,7 +470,7 @@ void brw_uncompact_instruction(const struct brw_device_info *devinfo,
bool brw_try_compact_instruction(const struct brw_device_info *devinfo,
brw_compact_inst *dst, brw_inst *src);
-void brw_debug_compact_uncompact(struct brw_context *brw,
+void brw_debug_compact_uncompact(const struct brw_device_info *devinfo,
brw_inst *orig, brw_inst *uncompacted);
static inline int
diff --git a/src/mesa/drivers/dri/i965/brw_eu_compact.c b/src/mesa/drivers/dri/i965/brw_eu_compact.c
index 4432b88..8995aa7 100644
--- a/src/mesa/drivers/dri/i965/brw_eu_compact.c
+++ b/src/mesa/drivers/dri/i965/brw_eu_compact.c
@@ -1217,18 +1217,18 @@ brw_uncompact_instruction(const struct brw_device_info *devinfo, brw_inst *dst,
}
}
-void brw_debug_compact_uncompact(struct brw_context *brw,
+void brw_debug_compact_uncompact(const struct brw_device_info *devinfo,
brw_inst *orig,
brw_inst *uncompacted)
{
fprintf(stderr, "Instruction compact/uncompact changed (gen%d):\n",
- brw->gen);
+ devinfo->gen);
fprintf(stderr, " before: ");
- brw_disassemble_inst(stderr, brw, orig, true);
+ brw_disassemble_inst(stderr, devinfo, orig, true);
fprintf(stderr, " after: ");
- brw_disassemble_inst(stderr, brw, uncompacted, false);
+ brw_disassemble_inst(stderr, devinfo, uncompacted, false);
uint32_t *before_bits = (uint32_t *)orig;
uint32_t *after_bits = (uint32_t *)uncompacted;
@@ -1364,7 +1364,6 @@ void
brw_compact_instructions(struct brw_compile *p, int start_offset,
int num_annotations, struct annotation *annotation)
{
- struct brw_context *brw = p->brw;
const struct brw_device_info *devinfo = p->devinfo;
void *store = p->store + start_offset / 16;
/* For an instruction at byte offset 16*i before compaction, this is the
@@ -1399,7 +1398,7 @@ brw_compact_instructions(struct brw_compile *p, int start_offset,
brw_inst uncompacted;
brw_uncompact_instruction(devinfo, &uncompacted, dst);
if (memcmp(&saved, &uncompacted, sizeof(uncompacted))) {
- brw_debug_compact_uncompact(brw, &saved, &uncompacted);
+ brw_debug_compact_uncompact(devinfo, &saved, &uncompacted);
}
}
diff --git a/src/mesa/drivers/dri/i965/brw_ff_gs.c b/src/mesa/drivers/dri/i965/brw_ff_gs.c
index e6f837c..a7d061a 100644
--- a/src/mesa/drivers/dri/i965/brw_ff_gs.c
+++ b/src/mesa/drivers/dri/i965/brw_ff_gs.c
@@ -136,7 +136,8 @@ brw_compile_ff_gs_prog(struct brw_context *brw,
if (unlikely(INTEL_DEBUG & DEBUG_GS)) {
fprintf(stderr, "gs:\n");
- brw_disassemble(brw, c.func.store, 0, program_size, stderr);
+ brw_disassemble(brw->intelScreen->devinfo, c.func.store,
+ 0, program_size, stderr);
fprintf(stderr, "\n");
}
diff --git a/src/mesa/drivers/dri/i965/brw_sf.c b/src/mesa/drivers/dri/i965/brw_sf.c
index d5395de..47bc454 100644
--- a/src/mesa/drivers/dri/i965/brw_sf.c
+++ b/src/mesa/drivers/dri/i965/brw_sf.c
@@ -119,7 +119,8 @@ static void compile_sf_prog( struct brw_context *brw,
if (unlikely(INTEL_DEBUG & DEBUG_SF)) {
fprintf(stderr, "sf:\n");
- brw_disassemble(brw, c.func.store, 0, program_size, stderr);
+ brw_disassemble(brw->intelScreen->devinfo,
+ c.func.store, 0, program_size, stderr);
fprintf(stderr, "\n");
}
diff --git a/src/mesa/drivers/dri/i965/brw_state_dump.c b/src/mesa/drivers/dri/i965/brw_state_dump.c
index 8b32810..5cf70eb 100644
--- a/src/mesa/drivers/dri/i965/brw_state_dump.c
+++ b/src/mesa/drivers/dri/i965/brw_state_dump.c
@@ -496,8 +496,8 @@ dump_prog_cache(struct brw_context *brw)
}
fprintf(stderr, "%s:\n", name);
- brw_disassemble(brw, brw->cache.bo->virtual, item->offset, item->size,
- stderr);
+ brw_disassemble(brw->intelScreen->devinfo, brw->cache.bo->virtual,
+ item->offset, item->size, stderr);
}
}
diff --git a/src/mesa/drivers/dri/i965/intel_asm_annotation.c b/src/mesa/drivers/dri/i965/intel_asm_annotation.c
index eed5756..b4a693f 100644
--- a/src/mesa/drivers/dri/i965/intel_asm_annotation.c
+++ b/src/mesa/drivers/dri/i965/intel_asm_annotation.c
@@ -79,7 +79,7 @@ dump_assembly(void *assembly, int num_annotations, struct annotation *annotation
fprintf(stderr, " %s\n", last_annotation_string);
}
- brw_disassemble(brw, assembly, start_offset, end_offset, stderr);
+ brw_disassemble(brw->intelScreen->devinfo, assembly, start_offset, end_offset, stderr);
if (annotation[i].block_end) {
fprintf(stderr, " END B%d", annotation[i].block_end->num);
diff --git a/src/mesa/drivers/dri/i965/test_eu_compact.c b/src/mesa/drivers/dri/i965/test_eu_compact.c
index 3990aa3..c80cc89 100644
--- a/src/mesa/drivers/dri/i965/test_eu_compact.c
+++ b/src/mesa/drivers/dri/i965/test_eu_compact.c
@@ -31,8 +31,6 @@
static bool
test_compact_instruction(struct brw_compile *p, brw_inst src)
{
- struct brw_context *brw = p->brw;
-
brw_compact_inst dst;
memset(&dst, 0xd0, sizeof(dst));
@@ -41,7 +39,7 @@ test_compact_instruction(struct brw_compile *p, brw_inst src)
brw_uncompact_instruction(p->devinfo, &uncompacted, &dst);
if (memcmp(&uncompacted, &src, sizeof(src))) {
- brw_debug_compact_uncompact(brw, &src, &uncompacted);
+ brw_debug_compact_uncompact(p->devinfo, &src, &uncompacted);
return false;
}
} else {
@@ -51,7 +49,7 @@ test_compact_instruction(struct brw_compile *p, brw_inst src)
if (memcmp(&unchanged, &dst, sizeof(dst))) {
fprintf(stderr, "Failed to compact, but dst changed\n");
fprintf(stderr, " Instruction: ");
- brw_disassemble_inst(stderr, brw, &src, false);
+ brw_disassemble_inst(stderr, p->devinfo, &src, false);
return false;
}
}
--
2.3.5
More information about the mesa-dev
mailing list