From a76e5dce4fc8d50f8699c108833f24e80167d706 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Sun, 22 Dec 2013 23:29:31 -0800 Subject: [PATCH] i965: Move compiler debugging output to stderr. Reviewed-by: Ian Romanick Reviewed-by: Kenneth Graunke Reviewed-by: Matt Turner --- src/mesa/drivers/dri/i965/brw_blorp_blit.cpp | 4 +- .../drivers/dri/i965/brw_blorp_blit_eu.cpp | 4 +- src/mesa/drivers/dri/i965/brw_blorp_clear.cpp | 6 +- src/mesa/drivers/dri/i965/brw_cfg.cpp | 16 +-- src/mesa/drivers/dri/i965/brw_clip.c | 6 +- src/mesa/drivers/dri/i965/brw_eu_compact.c | 4 +- src/mesa/drivers/dri/i965/brw_fs.cpp | 109 +++++++++--------- .../dri/i965/brw_fs_channel_expressions.cpp | 4 +- .../dri/i965/brw_fs_copy_propagation.cpp | 24 ++-- .../drivers/dri/i965/brw_fs_generator.cpp | 45 ++++---- .../dri/i965/brw_fs_vector_splitting.cpp | 8 +- src/mesa/drivers/dri/i965/brw_fs_visitor.cpp | 4 +- src/mesa/drivers/dri/i965/brw_gs.c | 6 +- src/mesa/drivers/dri/i965/brw_program.c | 11 +- .../dri/i965/brw_schedule_instructions.cpp | 16 +-- src/mesa/drivers/dri/i965/brw_sf.c | 6 +- src/mesa/drivers/dri/i965/brw_shader.cpp | 25 ++-- src/mesa/drivers/dri/i965/brw_vec4.cpp | 96 +++++++-------- .../drivers/dri/i965/brw_vec4_generator.cpp | 26 ++--- .../drivers/dri/i965/brw_vec4_visitor.cpp | 4 +- src/mesa/drivers/dri/i965/brw_vs.c | 2 +- .../drivers/dri/i965/gen8_fs_generator.cpp | 40 ++++--- src/mesa/drivers/dri/i965/gen8_generator.cpp | 14 +-- .../drivers/dri/i965/gen8_vec4_generator.cpp | 26 ++--- 24 files changed, 258 insertions(+), 248 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp index 39a15edfd8f..acdc9c7a7b4 100644 --- a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp +++ b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp @@ -629,7 +629,7 @@ public: const brw_blorp_blit_prog_key *key); const GLuint *compile(struct brw_context *brw, GLuint *program_size, - FILE *dump_file = stdout); + FILE *dump_file = stderr); brw_blorp_prog_data prog_data; @@ -2255,7 +2255,7 @@ brw_blorp_blit_params::get_wm_prog(struct brw_context *brw, &prog_offset, prog_data)) { brw_blorp_blit_program prog(brw, &this->wm_prog_key); GLuint program_size; - const GLuint *program = prog.compile(brw, &program_size, stdout); + const GLuint *program = prog.compile(brw, &program_size, stderr); brw_upload_cache(&brw->cache, BRW_BLORP_BLIT_PROG, &this->wm_prog_key, sizeof(this->wm_prog_key), program, program_size, diff --git a/src/mesa/drivers/dri/i965/brw_blorp_blit_eu.cpp b/src/mesa/drivers/dri/i965/brw_blorp_blit_eu.cpp index 5b652add1e4..38969d8a920 100644 --- a/src/mesa/drivers/dri/i965/brw_blorp_blit_eu.cpp +++ b/src/mesa/drivers/dri/i965/brw_blorp_blit_eu.cpp @@ -42,9 +42,9 @@ brw_blorp_eu_emitter::get_program(unsigned *program_size, FILE *dump_file) const unsigned *res; if (unlikely(INTEL_DEBUG & DEBUG_BLORP)) { - printf("Native code for BLORP blit:\n"); + fprintf(stderr, "Native code for BLORP blit:\n"); res = generator.generate_assembly(NULL, &insts, program_size, dump_file); - printf("\n"); + fprintf(stderr, "\n"); } else { res = generator.generate_assembly(NULL, &insts, program_size); } diff --git a/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp b/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp index 9159df5978c..76f82997fbe 100644 --- a/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp +++ b/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp @@ -486,9 +486,9 @@ brw_blorp_const_color_program::compile(struct brw_context *brw, false /* header present */); if (unlikely(INTEL_DEBUG & DEBUG_BLORP)) { - printf("Native code for BLORP clear:\n"); - brw_dump_compile(&func, stdout, 0, func.next_insn_offset); - printf("\n"); + fprintf(stderr, "Native code for BLORP clear:\n"); + brw_dump_compile(&func, stderr, 0, func.next_insn_offset); + fprintf(stderr, "\n"); } return brw_get_program(&func, program_size); } diff --git a/src/mesa/drivers/dri/i965/brw_cfg.cpp b/src/mesa/drivers/dri/i965/brw_cfg.cpp index 32ba4a4cdcc..53281c6faa0 100644 --- a/src/mesa/drivers/dri/i965/brw_cfg.cpp +++ b/src/mesa/drivers/dri/i965/brw_cfg.cpp @@ -71,7 +71,7 @@ bblock_t::dump(backend_visitor *v) for (backend_instruction *inst = (backend_instruction *)this->start; inst != this->end->next; inst = (backend_instruction *) inst->next) { - printf("%5d: ", ip); + fprintf(stderr, "%5d: ", ip); v->dump_instruction(inst); ip++; } @@ -297,18 +297,20 @@ cfg_t::dump(backend_visitor *v) { for (int b = 0; b < this->num_blocks; b++) { bblock_t *block = this->blocks[b]; - printf("START B%d", b); + fprintf(stderr, "START B%d", b); foreach_list(node, &block->parents) { bblock_link *link = (bblock_link *)node; - printf(" <-B%d", link->block->block_num); + fprintf(stderr, " <-B%d", + link->block->block_num); } - printf("\n"); + fprintf(stderr, "\n"); block->dump(v); - printf("END B%d", b); + fprintf(stderr, "END B%d", b); foreach_list(node, &block->children) { bblock_link *link = (bblock_link *)node; - printf(" ->B%d", link->block->block_num); + fprintf(stderr, " ->B%d", + link->block->block_num); } - printf("\n"); + fprintf(stderr, "\n"); } } diff --git a/src/mesa/drivers/dri/i965/brw_clip.c b/src/mesa/drivers/dri/i965/brw_clip.c index 3a4442f7be7..c32bf5c0e7c 100644 --- a/src/mesa/drivers/dri/i965/brw_clip.c +++ b/src/mesa/drivers/dri/i965/brw_clip.c @@ -118,11 +118,11 @@ static void compile_clip_prog( struct brw_context *brw, program = brw_get_program(&c.func, &program_size); if (unlikely(INTEL_DEBUG & DEBUG_CLIP)) { - printf("clip:\n"); + fprintf(stderr, "clip:\n"); for (i = 0; i < program_size / sizeof(struct brw_instruction); i++) - brw_disasm(stdout, &((struct brw_instruction *)program)[i], + brw_disasm(stderr, &((struct brw_instruction *)program)[i], brw->gen); - printf("\n"); + fprintf(stderr, "\n"); } brw_upload_cache(&brw->cache, diff --git a/src/mesa/drivers/dri/i965/brw_eu_compact.c b/src/mesa/drivers/dri/i965/brw_eu_compact.c index fa43444d5d1..f619045e120 100644 --- a/src/mesa/drivers/dri/i965/brw_eu_compact.c +++ b/src/mesa/drivers/dri/i965/brw_eu_compact.c @@ -785,8 +785,8 @@ brw_compact_instructions(struct brw_compile *p) p->nr_insn = p->next_insn_offset / 16; if (0) { - fprintf(stdout, "dumping compacted program\n"); - brw_dump_compile(p, stdout, 0, p->next_insn_offset); + fprintf(stderr, "dumping compacted program\n"); + brw_dump_compile(p, stderr, 0, p->next_insn_offset); int cmp = 0; for (offset = 0; offset < p->next_insn_offset;) { diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 109c7dc3719..27cf0f6f2f1 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -2987,11 +2987,11 @@ fs_visitor::dump_instructions() foreach_list(node, &this->instructions) { backend_instruction *inst = (backend_instruction *)node; max_pressure = MAX2(max_pressure, regs_live_at_ip[ip]); - printf("{%3d} %4d: ", regs_live_at_ip[ip], ip); + fprintf(stderr, "{%3d} %4d: ", regs_live_at_ip[ip], ip); dump_instruction(inst); ++ip; } - printf("Maximum %3d registers live at once.\n", max_pressure); + fprintf(stderr, "Maximum %3d registers live at once.\n", max_pressure); } void @@ -3000,174 +3000,175 @@ fs_visitor::dump_instruction(backend_instruction *be_inst) fs_inst *inst = (fs_inst *)be_inst; if (inst->predicate) { - printf("(%cf0.%d) ", + fprintf(stderr, "(%cf0.%d) ", inst->predicate_inverse ? '-' : '+', inst->flag_subreg); } - printf("%s", brw_instruction_name(inst->opcode)); + fprintf(stderr, "%s", brw_instruction_name(inst->opcode)); if (inst->saturate) - printf(".sat"); + fprintf(stderr, ".sat"); if (inst->conditional_mod) { - printf("%s", conditional_modifier[inst->conditional_mod]); + fprintf(stderr, "%s", conditional_modifier[inst->conditional_mod]); if (!inst->predicate && (brw->gen < 5 || (inst->opcode != BRW_OPCODE_SEL && inst->opcode != BRW_OPCODE_IF && inst->opcode != BRW_OPCODE_WHILE))) { - printf(".f0.%d", inst->flag_subreg); + fprintf(stderr, ".f0.%d", inst->flag_subreg); } } - printf(" "); + fprintf(stderr, " "); switch (inst->dst.file) { case GRF: - printf("vgrf%d", inst->dst.reg); + fprintf(stderr, "vgrf%d", inst->dst.reg); if (virtual_grf_sizes[inst->dst.reg] != 1 || inst->dst.subreg_offset) - printf("+%d.%d", inst->dst.reg_offset, inst->dst.subreg_offset); + fprintf(stderr, "+%d.%d", + inst->dst.reg_offset, inst->dst.subreg_offset); break; case MRF: - printf("m%d", inst->dst.reg); + fprintf(stderr, "m%d", inst->dst.reg); break; case BAD_FILE: - printf("(null)"); + fprintf(stderr, "(null)"); break; case UNIFORM: - printf("***u%d***", inst->dst.reg); + fprintf(stderr, "***u%d***", inst->dst.reg); break; case HW_REG: if (inst->dst.fixed_hw_reg.file == BRW_ARCHITECTURE_REGISTER_FILE) { switch (inst->dst.fixed_hw_reg.nr) { case BRW_ARF_NULL: - printf("null"); + fprintf(stderr, "null"); break; case BRW_ARF_ADDRESS: - printf("a0.%d", inst->dst.fixed_hw_reg.subnr); + fprintf(stderr, "a0.%d", inst->dst.fixed_hw_reg.subnr); break; case BRW_ARF_ACCUMULATOR: - printf("acc%d", inst->dst.fixed_hw_reg.subnr); + fprintf(stderr, "acc%d", inst->dst.fixed_hw_reg.subnr); break; case BRW_ARF_FLAG: - printf("f%d.%d", inst->dst.fixed_hw_reg.nr & 0xf, + fprintf(stderr, "f%d.%d", inst->dst.fixed_hw_reg.nr & 0xf, inst->dst.fixed_hw_reg.subnr); break; default: - printf("arf%d.%d", inst->dst.fixed_hw_reg.nr & 0xf, + fprintf(stderr, "arf%d.%d", inst->dst.fixed_hw_reg.nr & 0xf, inst->dst.fixed_hw_reg.subnr); break; } } else { - printf("hw_reg%d", inst->dst.fixed_hw_reg.nr); + fprintf(stderr, "hw_reg%d", inst->dst.fixed_hw_reg.nr); } if (inst->dst.fixed_hw_reg.subnr) - printf("+%d", inst->dst.fixed_hw_reg.subnr); + fprintf(stderr, "+%d", inst->dst.fixed_hw_reg.subnr); break; default: - printf("???"); + fprintf(stderr, "???"); break; } - printf(":%s, ", reg_encoding[inst->dst.type]); + fprintf(stderr, ":%s, ", reg_encoding[inst->dst.type]); for (int i = 0; i < 3 && inst->src[i].file != BAD_FILE; i++) { if (inst->src[i].negate) - printf("-"); + fprintf(stderr, "-"); if (inst->src[i].abs) - printf("|"); + fprintf(stderr, "|"); switch (inst->src[i].file) { case GRF: - printf("vgrf%d", inst->src[i].reg); + fprintf(stderr, "vgrf%d", inst->src[i].reg); if (virtual_grf_sizes[inst->src[i].reg] != 1 || inst->src[i].subreg_offset) - printf("+%d.%d", inst->src[i].reg_offset, - inst->src[i].subreg_offset); + fprintf(stderr, "+%d.%d", inst->src[i].reg_offset, + inst->src[i].subreg_offset); break; case MRF: - printf("***m%d***", inst->src[i].reg); + fprintf(stderr, "***m%d***", inst->src[i].reg); break; case UNIFORM: - printf("u%d", inst->src[i].reg); + fprintf(stderr, "u%d", inst->src[i].reg); if (virtual_grf_sizes[inst->src[i].reg] != 1 || inst->src[i].subreg_offset) - printf("+%d.%d", inst->src[i].reg_offset, - inst->src[i].subreg_offset); + fprintf(stderr, "+%d.%d", inst->src[i].reg_offset, + inst->src[i].subreg_offset); break; case BAD_FILE: - printf("(null)"); + fprintf(stderr, "(null)"); break; case IMM: switch (inst->src[i].type) { case BRW_REGISTER_TYPE_F: - printf("%ff", inst->src[i].imm.f); + fprintf(stderr, "%ff", inst->src[i].imm.f); break; case BRW_REGISTER_TYPE_D: - printf("%dd", inst->src[i].imm.i); + fprintf(stderr, "%dd", inst->src[i].imm.i); break; case BRW_REGISTER_TYPE_UD: - printf("%uu", inst->src[i].imm.u); + fprintf(stderr, "%uu", inst->src[i].imm.u); break; default: - printf("???"); + fprintf(stderr, "???"); break; } break; case HW_REG: if (inst->src[i].fixed_hw_reg.negate) - printf("-"); + fprintf(stderr, "-"); if (inst->src[i].fixed_hw_reg.abs) - printf("|"); + fprintf(stderr, "|"); if (inst->src[i].fixed_hw_reg.file == BRW_ARCHITECTURE_REGISTER_FILE) { switch (inst->src[i].fixed_hw_reg.nr) { case BRW_ARF_NULL: - printf("null"); + fprintf(stderr, "null"); break; case BRW_ARF_ADDRESS: - printf("a0.%d", inst->src[i].fixed_hw_reg.subnr); + fprintf(stderr, "a0.%d", inst->src[i].fixed_hw_reg.subnr); break; case BRW_ARF_ACCUMULATOR: - printf("acc%d", inst->src[i].fixed_hw_reg.subnr); + fprintf(stderr, "acc%d", inst->src[i].fixed_hw_reg.subnr); break; case BRW_ARF_FLAG: - printf("f%d.%d", inst->src[i].fixed_hw_reg.nr & 0xf, + fprintf(stderr, "f%d.%d", inst->src[i].fixed_hw_reg.nr & 0xf, inst->src[i].fixed_hw_reg.subnr); break; default: - printf("arf%d.%d", inst->src[i].fixed_hw_reg.nr & 0xf, + fprintf(stderr, "arf%d.%d", inst->src[i].fixed_hw_reg.nr & 0xf, inst->src[i].fixed_hw_reg.subnr); break; } } else { - printf("hw_reg%d", inst->src[i].fixed_hw_reg.nr); + fprintf(stderr, "hw_reg%d", inst->src[i].fixed_hw_reg.nr); } if (inst->src[i].fixed_hw_reg.subnr) - printf("+%d", inst->src[i].fixed_hw_reg.subnr); + fprintf(stderr, "+%d", inst->src[i].fixed_hw_reg.subnr); if (inst->src[i].fixed_hw_reg.abs) - printf("|"); + fprintf(stderr, "|"); break; default: - printf("???"); + fprintf(stderr, "???"); break; } if (inst->src[i].abs) - printf("|"); + fprintf(stderr, "|"); if (inst->src[i].file != IMM) { - printf(":%s", brw_reg_type_letters(inst->src[i].type)); + fprintf(stderr, ":%s", brw_reg_type_letters(inst->src[i].type)); } if (i < 2 && inst->src[i + 1].file != BAD_FILE) - printf(", "); + fprintf(stderr, ", "); } - printf(" "); + fprintf(stderr, " "); if (inst->force_uncompressed) - printf("1sthalf "); + fprintf(stderr, "1sthalf "); if (inst->force_sechalf) - printf("2ndhalf "); + fprintf(stderr, "2ndhalf "); - printf("\n"); + fprintf(stderr, "\n"); } /** diff --git a/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp b/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp index e154441279c..ae5bc566606 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp @@ -307,8 +307,8 @@ ir_channel_expressions_visitor::visit_leave(ir_assignment *ir) case ir_binop_logic_and: case ir_binop_logic_xor: case ir_binop_logic_or: - ir->print(); - printf("\n"); + ir->fprint(stderr); + fprintf(stderr, "\n"); assert(!"not reached: expression operates on scalars only"); break; case ir_binop_all_equal: diff --git a/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp b/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp index a145923396d..2816d3c14ee 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp @@ -250,26 +250,26 @@ fs_copy_prop_dataflow::dump_block_data() const { for (int b = 0; b < cfg->num_blocks; b++) { bblock_t *block = cfg->blocks[b]; - printf("Block %d [%d, %d] (parents ", block->block_num, + fprintf(stderr, "Block %d [%d, %d] (parents ", block->block_num, block->start_ip, block->end_ip); foreach_list(block_node, &block->parents) { bblock_t *parent = ((bblock_link *) block_node)->block; - printf("%d ", parent->block_num); + fprintf(stderr, "%d ", parent->block_num); } - printf("):\n"); - printf(" livein = 0x"); + fprintf(stderr, "):\n"); + fprintf(stderr, " livein = 0x"); for (int i = 0; i < bitset_words; i++) - printf("%08x", bd[b].livein[i]); - printf(", liveout = 0x"); + fprintf(stderr, "%08x", bd[b].livein[i]); + fprintf(stderr, ", liveout = 0x"); for (int i = 0; i < bitset_words; i++) - printf("%08x", bd[b].liveout[i]); - printf(",\n copy = 0x"); + fprintf(stderr, "%08x", bd[b].liveout[i]); + fprintf(stderr, ",\n copy = 0x"); for (int i = 0; i < bitset_words; i++) - printf("%08x", bd[b].copy[i]); - printf(", kill = 0x"); + fprintf(stderr, "%08x", bd[b].copy[i]); + fprintf(stderr, ", kill = 0x"); for (int i = 0; i < bitset_words; i++) - printf("%08x", bd[b].kill[i]); - printf("\n"); + fprintf(stderr, "%08x", bd[b].kill[i]); + fprintf(stderr, "\n"); } } diff --git a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp index 104c0693b81..748a2e2db12 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp @@ -1326,15 +1326,17 @@ fs_generator::generate_code(exec_list *instructions, FILE *dump_file) if (unlikely(INTEL_DEBUG & DEBUG_WM)) { if (prog) { - printf("Native code for %s fragment shader %d (SIMD%d dispatch):\n", - prog->Label ? prog->Label : "unnamed", - prog->Name, dispatch_width); + fprintf(stderr, + "Native code for %s fragment shader %d (SIMD%d dispatch):\n", + prog->Label ? prog->Label : "unnamed", + prog->Name, dispatch_width); } else if (fp) { - printf("Native code for fragment program %d (SIMD%d dispatch):\n", - fp->Base.Id, dispatch_width); + fprintf(stderr, + "Native code for fragment program %d (SIMD%d dispatch):\n", + fp->Base.Id, dispatch_width); } else { - printf("Native code for blorp program (SIMD%d dispatch):\n", - dispatch_width); + fprintf(stderr, "Native code for blorp program (SIMD%d dispatch):\n", + dispatch_width); } } @@ -1352,38 +1354,39 @@ fs_generator::generate_code(exec_list *instructions, FILE *dump_file) bblock_t *block = link->block; if (block->start == inst) { - printf(" START B%d", block->block_num); + fprintf(stderr, " START B%d", block->block_num); foreach_list(predecessor_node, &block->parents) { bblock_link *predecessor_link = (bblock_link *)predecessor_node; bblock_t *predecessor_block = predecessor_link->block; - printf(" <-B%d", predecessor_block->block_num); + fprintf(stderr, " <-B%d", predecessor_block->block_num); } - printf("\n"); + fprintf(stderr, "\n"); } } if (last_annotation_ir != inst->ir) { last_annotation_ir = inst->ir; if (last_annotation_ir) { - printf(" "); + fprintf(stderr, " "); if (prog) - ((ir_instruction *)inst->ir)->print(); + ((ir_instruction *)inst->ir)->fprint(stderr); else { const prog_instruction *fpi; fpi = (const prog_instruction *)inst->ir; - printf("%d: ", (int)(fpi - (fp ? fp->Base.Instructions : 0))); - _mesa_fprint_instruction_opt(stdout, + fprintf(stderr, "%d: ", + (int)(fpi - (fp ? fp->Base.Instructions : 0))); + _mesa_fprint_instruction_opt(stderr, fpi, 0, PROG_PRINT_DEBUG, NULL); } - printf("\n"); + fprintf(stderr, "\n"); } } if (last_annotation_string != inst->annotation) { last_annotation_string = inst->annotation; if (last_annotation_string) - printf(" %s\n", last_annotation_string); + fprintf(stderr, " %s\n", last_annotation_string); } } @@ -1801,7 +1804,7 @@ fs_generator::generate_code(exec_list *instructions, FILE *dump_file) } if (unlikely(INTEL_DEBUG & DEBUG_WM)) { - brw_dump_compile(p, stdout, + brw_dump_compile(p, stderr, last_native_insn_offset, p->next_insn_offset); foreach_list(node, &cfg->block_list) { @@ -1809,14 +1812,14 @@ fs_generator::generate_code(exec_list *instructions, FILE *dump_file) bblock_t *block = link->block; if (block->end == inst) { - printf(" END B%d", block->block_num); + fprintf(stderr, " END B%d", block->block_num); foreach_list(successor_node, &block->children) { bblock_link *successor_link = (bblock_link *)successor_node; bblock_t *successor_block = successor_link->block; - printf(" ->B%d", successor_block->block_num); + fprintf(stderr, " ->B%d", successor_block->block_num); } - printf("\n"); + fprintf(stderr, "\n"); } } } @@ -1825,7 +1828,7 @@ fs_generator::generate_code(exec_list *instructions, FILE *dump_file) } if (unlikely(INTEL_DEBUG & DEBUG_WM)) { - printf("\n"); + fprintf(stderr, "\n"); } brw_set_uip_jip(p); diff --git a/src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp b/src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp index ff7aa805512..78dcc3e2d84 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp @@ -318,7 +318,7 @@ ir_vector_splitting_visitor::visit_leave(ir_assignment *ir) elem = 3; break; default: - ir->print(); + ir->fprint(stderr); assert(!"not reached: non-channelwise dereference of LHS."); } @@ -347,9 +347,9 @@ brw_do_vector_splitting(exec_list *instructions) variable_entry *entry = (variable_entry *)node; if (debug) { - printf("vector %s@%p: decl %d, whole_access %d\n", - entry->var->name, (void *) entry->var, entry->declaration, - entry->whole_vector_access); + fprintf(stderr, "vector %s@%p: decl %d, whole_access %d\n", + entry->var->name, (void *) entry->var, entry->declaration, + entry->whole_vector_access); } if (!entry->declaration || entry->whole_vector_access) { diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp index 9b090be7bde..6dcdd28bcac 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp @@ -349,8 +349,8 @@ fs_visitor::visit(ir_expression *ir) ir->operands[operand]->accept(this); if (this->result.file == BAD_FILE) { fail("Failed to get tree for expression operand:\n"); - ir->operands[operand]->print(); - printf("\n"); + ir->operands[operand]->fprint(stderr); + fprintf(stderr, "\n"); } assert(this->result.is_valid_3src()); op[operand] = this->result; diff --git a/src/mesa/drivers/dri/i965/brw_gs.c b/src/mesa/drivers/dri/i965/brw_gs.c index 3e1ed730b60..bd5bf14cde1 100644 --- a/src/mesa/drivers/dri/i965/brw_gs.c +++ b/src/mesa/drivers/dri/i965/brw_gs.c @@ -135,11 +135,11 @@ static void compile_ff_gs_prog(struct brw_context *brw, if (unlikely(INTEL_DEBUG & DEBUG_GS)) { int i; - printf("gs:\n"); + fprintf(stderr, "gs:\n"); for (i = 0; i < program_size / sizeof(struct brw_instruction); i++) - brw_disasm(stdout, &((struct brw_instruction *)program)[i], + brw_disasm(stderr, &((struct brw_instruction *)program)[i], brw->gen); - printf("\n"); + fprintf(stderr, "\n"); } brw_upload_cache(&brw->cache, BRW_FF_GS_PROG, diff --git a/src/mesa/drivers/dri/i965/brw_program.c b/src/mesa/drivers/dri/i965/brw_program.c index 4a86e802089..447e95406ce 100644 --- a/src/mesa/drivers/dri/i965/brw_program.c +++ b/src/mesa/drivers/dri/i965/brw_program.c @@ -592,12 +592,13 @@ brw_dump_ir(struct brw_context *brw, const char *stage, struct gl_shader *shader, struct gl_program *prog) { if (shader_prog) { - printf("GLSL IR for native %s shader %d:\n", stage, shader_prog->Name); - _mesa_print_ir(stdout, shader->ir, NULL); - printf("\n\n"); + fprintf(stderr, + "GLSL IR for native %s shader %d:\n", stage, shader_prog->Name); + _mesa_print_ir(stderr, shader->ir, NULL); + fprintf(stderr, "\n\n"); } else { - printf("ARB_%s_program %d ir for native %s shader\n", - stage, prog->Id, stage); + fprintf(stderr, "ARB_%s_program %d ir for native %s shader\n", + stage, prog->Id, stage); _mesa_print_program(prog); } } diff --git a/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp b/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp index a61bbab613b..32f30ba33d9 100644 --- a/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp +++ b/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp @@ -1320,7 +1320,7 @@ instruction_scheduler::schedule_instructions(backend_instruction *next_block_hea time = MAX2(time, chosen->unblocked_time); if (debug) { - printf("clock %4d, scheduled: ", time); + fprintf(stderr, "clock %4d, scheduled: ", time); bv->dump_instruction(chosen->inst); } @@ -1336,7 +1336,7 @@ instruction_scheduler::schedule_instructions(backend_instruction *next_block_hea time + chosen->child_latency[i]); if (debug) { - printf("\tchild %d, %d parents: ", i, child->parent_count); + fprintf(stderr, "\tchild %d, %d parents: ", i, child->parent_count); bv->dump_instruction(child->inst); } @@ -1344,7 +1344,7 @@ instruction_scheduler::schedule_instructions(backend_instruction *next_block_hea child->parent_count--; if (child->parent_count == 0) { if (debug) { - printf("\t\tnow available\n"); + fprintf(stderr, "\t\tnow available\n"); } instructions.push_head(child); } @@ -1377,7 +1377,8 @@ instruction_scheduler::run(exec_list *all_instructions) (backend_instruction *)all_instructions->head; if (debug) { - printf("\nInstructions before scheduling (reg_alloc %d)\n", post_reg_alloc); + fprintf(stderr, "\nInstructions before scheduling (reg_alloc %d)\n", + post_reg_alloc); bv->dump_instructions(); } @@ -1411,7 +1412,8 @@ instruction_scheduler::run(exec_list *all_instructions) } if (debug) { - printf("\nInstructions after scheduling (reg_alloc %d)\n", post_reg_alloc); + fprintf(stderr, "\nInstructions after scheduling (reg_alloc %d)\n", + post_reg_alloc); bv->dump_instructions(); } } @@ -1429,7 +1431,7 @@ fs_visitor::schedule_instructions(instruction_scheduler_mode mode) sched.run(&instructions); if (unlikely(INTEL_DEBUG & DEBUG_WM) && mode == SCHEDULE_POST) { - printf("fs%d estimated execution time: %d cycles\n", + fprintf(stderr, "fs%d estimated execution time: %d cycles\n", dispatch_width, sched.time); } @@ -1443,7 +1445,7 @@ vec4_visitor::opt_schedule_instructions() sched.run(&instructions); if (unlikely(debug_flag)) { - printf("vec4 estimated execution time: %d cycles\n", sched.time); + fprintf(stderr, "vec4 estimated execution time: %d cycles\n", sched.time); } invalidate_live_intervals(); diff --git a/src/mesa/drivers/dri/i965/brw_sf.c b/src/mesa/drivers/dri/i965/brw_sf.c index 29838f53a23..7714aaed9a2 100644 --- a/src/mesa/drivers/dri/i965/brw_sf.c +++ b/src/mesa/drivers/dri/i965/brw_sf.c @@ -115,11 +115,11 @@ static void compile_sf_prog( struct brw_context *brw, program = brw_get_program(&c.func, &program_size); if (unlikely(INTEL_DEBUG & DEBUG_SF)) { - printf("sf:\n"); + fprintf(stderr, "sf:\n"); for (i = 0; i < program_size / sizeof(struct brw_instruction); i++) - brw_disasm(stdout, &((struct brw_instruction *)program)[i], + brw_disasm(stderr, &((struct brw_instruction *)program)[i], brw->gen); - printf("\n"); + fprintf(stderr, "\n"); } brw_upload_cache(&brw->cache, BRW_SF_PROG, diff --git a/src/mesa/drivers/dri/i965/brw_shader.cpp b/src/mesa/drivers/dri/i965/brw_shader.cpp index 48ad8ac12d6..643c140aa7c 100644 --- a/src/mesa/drivers/dri/i965/brw_shader.cpp +++ b/src/mesa/drivers/dri/i965/brw_shader.cpp @@ -251,12 +251,12 @@ brw_link_shader(struct gl_context *ctx, struct gl_shader_program *shProg) _mesa_reference_program(ctx, &prog, NULL); if (ctx->Shader.Flags & GLSL_DUMP) { - printf("\n"); - printf("GLSL IR for linked %s program %d:\n", - _mesa_shader_stage_to_string(shader->base.Stage), - shProg->Name); - _mesa_print_ir(stdout, shader->base.ir, NULL); - printf("\n"); + fprintf(stderr, "\n"); + fprintf(stderr, "GLSL IR for linked %s program %d:\n", + _mesa_shader_stage_to_string(shader->base.Stage), + shProg->Name); + _mesa_print_ir(stderr, shader->base.ir, NULL); + fprintf(stderr, "\n"); } } @@ -266,12 +266,11 @@ brw_link_shader(struct gl_context *ctx, struct gl_shader_program *shProg) if (!sh) continue; - printf("GLSL %s shader %d source for linked program %d:\n", - _mesa_shader_stage_to_string(sh->Stage), - i, - shProg->Name); - printf("%s", sh->Source); - printf("\n"); + fprintf(stderr, "GLSL %s shader %d source for linked program %d:\n", + _mesa_shader_stage_to_string(sh->Stage), + i, shProg->Name); + fprintf(stderr, "%s", sh->Source); + fprintf(stderr, "\n"); } } @@ -668,7 +667,7 @@ backend_visitor::dump_instructions() int ip = 0; foreach_list(node, &this->instructions) { backend_instruction *inst = (backend_instruction *)node; - printf("%d: ", ip++); + fprintf(stderr, "%d: ", ip++); dump_instruction(inst); } } diff --git a/src/mesa/drivers/dri/i965/brw_vec4.cpp b/src/mesa/drivers/dri/i965/brw_vec4.cpp index 8dda34813a8..fcb7365c5d1 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4.cpp +++ b/src/mesa/drivers/dri/i965/brw_vec4.cpp @@ -1121,161 +1121,161 @@ vec4_visitor::dump_instruction(backend_instruction *be_inst) { vec4_instruction *inst = (vec4_instruction *)be_inst; - printf("%s", brw_instruction_name(inst->opcode)); + fprintf(stderr, "%s", brw_instruction_name(inst->opcode)); if (inst->conditional_mod) { - printf("%s", conditional_modifier[inst->conditional_mod]); + fprintf(stderr, "%s", conditional_modifier[inst->conditional_mod]); } - printf(" "); + fprintf(stderr, " "); switch (inst->dst.file) { case GRF: - printf("vgrf%d.%d", inst->dst.reg, inst->dst.reg_offset); + fprintf(stderr, "vgrf%d.%d", inst->dst.reg, inst->dst.reg_offset); break; case MRF: - printf("m%d", inst->dst.reg); + fprintf(stderr, "m%d", inst->dst.reg); break; case HW_REG: if (inst->dst.fixed_hw_reg.file == BRW_ARCHITECTURE_REGISTER_FILE) { switch (inst->dst.fixed_hw_reg.nr) { case BRW_ARF_NULL: - printf("null"); + fprintf(stderr, "null"); break; case BRW_ARF_ADDRESS: - printf("a0.%d", inst->dst.fixed_hw_reg.subnr); + fprintf(stderr, "a0.%d", inst->dst.fixed_hw_reg.subnr); break; case BRW_ARF_ACCUMULATOR: - printf("acc%d", inst->dst.fixed_hw_reg.subnr); + fprintf(stderr, "acc%d", inst->dst.fixed_hw_reg.subnr); break; case BRW_ARF_FLAG: - printf("f%d.%d", inst->dst.fixed_hw_reg.nr & 0xf, + fprintf(stderr, "f%d.%d", inst->dst.fixed_hw_reg.nr & 0xf, inst->dst.fixed_hw_reg.subnr); break; default: - printf("arf%d.%d", inst->dst.fixed_hw_reg.nr & 0xf, + fprintf(stderr, "arf%d.%d", inst->dst.fixed_hw_reg.nr & 0xf, inst->dst.fixed_hw_reg.subnr); break; } } else { - printf("hw_reg%d", inst->dst.fixed_hw_reg.nr); + fprintf(stderr, "hw_reg%d", inst->dst.fixed_hw_reg.nr); } if (inst->dst.fixed_hw_reg.subnr) - printf("+%d", inst->dst.fixed_hw_reg.subnr); + fprintf(stderr, "+%d", inst->dst.fixed_hw_reg.subnr); break; case BAD_FILE: - printf("(null)"); + fprintf(stderr, "(null)"); break; default: - printf("???"); + fprintf(stderr, "???"); break; } if (inst->dst.writemask != WRITEMASK_XYZW) { - printf("."); + fprintf(stderr, "."); if (inst->dst.writemask & 1) - printf("x"); + fprintf(stderr, "x"); if (inst->dst.writemask & 2) - printf("y"); + fprintf(stderr, "y"); if (inst->dst.writemask & 4) - printf("z"); + fprintf(stderr, "z"); if (inst->dst.writemask & 8) - printf("w"); + fprintf(stderr, "w"); } - printf(":%s, ", brw_reg_type_letters(inst->dst.type)); + fprintf(stderr, ":%s, ", brw_reg_type_letters(inst->dst.type)); for (int i = 0; i < 3 && inst->src[i].file != BAD_FILE; i++) { if (inst->src[i].negate) - printf("-"); + fprintf(stderr, "-"); if (inst->src[i].abs) - printf("|"); + fprintf(stderr, "|"); switch (inst->src[i].file) { case GRF: - printf("vgrf%d", inst->src[i].reg); + fprintf(stderr, "vgrf%d", inst->src[i].reg); break; case ATTR: - printf("attr%d", inst->src[i].reg); + fprintf(stderr, "attr%d", inst->src[i].reg); break; case UNIFORM: - printf("u%d", inst->src[i].reg); + fprintf(stderr, "u%d", inst->src[i].reg); break; case IMM: switch (inst->src[i].type) { case BRW_REGISTER_TYPE_F: - printf("%fF", inst->src[i].imm.f); + fprintf(stderr, "%fF", inst->src[i].imm.f); break; case BRW_REGISTER_TYPE_D: - printf("%dD", inst->src[i].imm.i); + fprintf(stderr, "%dD", inst->src[i].imm.i); break; case BRW_REGISTER_TYPE_UD: - printf("%uU", inst->src[i].imm.u); + fprintf(stderr, "%uU", inst->src[i].imm.u); break; default: - printf("???"); + fprintf(stderr, "???"); break; } break; case HW_REG: if (inst->src[i].fixed_hw_reg.negate) - printf("-"); + fprintf(stderr, "-"); if (inst->src[i].fixed_hw_reg.abs) - printf("|"); + fprintf(stderr, "|"); if (inst->src[i].fixed_hw_reg.file == BRW_ARCHITECTURE_REGISTER_FILE) { switch (inst->src[i].fixed_hw_reg.nr) { case BRW_ARF_NULL: - printf("null"); + fprintf(stderr, "null"); break; case BRW_ARF_ADDRESS: - printf("a0.%d", inst->src[i].fixed_hw_reg.subnr); + fprintf(stderr, "a0.%d", inst->src[i].fixed_hw_reg.subnr); break; case BRW_ARF_ACCUMULATOR: - printf("acc%d", inst->src[i].fixed_hw_reg.subnr); + fprintf(stderr, "acc%d", inst->src[i].fixed_hw_reg.subnr); break; case BRW_ARF_FLAG: - printf("f%d.%d", inst->src[i].fixed_hw_reg.nr & 0xf, + fprintf(stderr, "f%d.%d", inst->src[i].fixed_hw_reg.nr & 0xf, inst->src[i].fixed_hw_reg.subnr); break; default: - printf("arf%d.%d", inst->src[i].fixed_hw_reg.nr & 0xf, + fprintf(stderr, "arf%d.%d", inst->src[i].fixed_hw_reg.nr & 0xf, inst->src[i].fixed_hw_reg.subnr); break; } } else { - printf("hw_reg%d", inst->src[i].fixed_hw_reg.nr); + fprintf(stderr, "hw_reg%d", inst->src[i].fixed_hw_reg.nr); } if (inst->src[i].fixed_hw_reg.subnr) - printf("+%d", inst->src[i].fixed_hw_reg.subnr); + fprintf(stderr, "+%d", inst->src[i].fixed_hw_reg.subnr); if (inst->src[i].fixed_hw_reg.abs) - printf("|"); + fprintf(stderr, "|"); break; case BAD_FILE: - printf("(null)"); + fprintf(stderr, "(null)"); break; default: - printf("???"); + fprintf(stderr, "???"); break; } if (virtual_grf_sizes[inst->src[i].reg] != 1) - printf(".%d", inst->src[i].reg_offset); + fprintf(stderr, ".%d", inst->src[i].reg_offset); if (inst->src[i].file != IMM) { static const char *chans[4] = {"x", "y", "z", "w"}; - printf("."); + fprintf(stderr, "."); for (int c = 0; c < 4; c++) { - printf("%s", chans[BRW_GET_SWZ(inst->src[i].swizzle, c)]); + fprintf(stderr, "%s", chans[BRW_GET_SWZ(inst->src[i].swizzle, c)]); } } if (inst->src[i].abs) - printf("|"); + fprintf(stderr, "|"); if (inst->src[i].file != IMM) { - printf(":%s", reg_encoding[inst->src[i].type]); + fprintf(stderr, ":%s", reg_encoding[inst->src[i].type]); } if (i < 2 && inst->src[i + 1].file != BAD_FILE) - printf(", "); + fprintf(stderr, ", "); } - printf("\n"); + fprintf(stderr, "\n"); } diff --git a/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp b/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp index 23c0542045b..a74514f512c 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp +++ b/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp @@ -1271,11 +1271,11 @@ vec4_generator::generate_code(exec_list *instructions) if (unlikely(debug_flag)) { if (shader_prog) { - printf("Native code for %s vertex shader %d:\n", - shader_prog->Label ? shader_prog->Label : "unnamed", - shader_prog->Name); + fprintf(stderr, "Native code for %s vertex shader %d:\n", + shader_prog->Label ? shader_prog->Label : "unnamed", + shader_prog->Name); } else { - printf("Native code for vertex program %d:\n", prog->Id); + fprintf(stderr, "Native code for vertex program %d:\n", prog->Id); } } @@ -1287,23 +1287,23 @@ vec4_generator::generate_code(exec_list *instructions) if (last_annotation_ir != inst->ir) { last_annotation_ir = inst->ir; if (last_annotation_ir) { - printf(" "); + fprintf(stderr, " "); if (shader_prog) { - ((ir_instruction *) last_annotation_ir)->print(); + ((ir_instruction *) last_annotation_ir)->fprint(stderr); } else { const prog_instruction *vpi; vpi = (const prog_instruction *) inst->ir; - printf("%d: ", (int)(vpi - prog->Instructions)); - _mesa_fprint_instruction_opt(stdout, vpi, 0, + fprintf(stderr, "%d: ", (int)(vpi - prog->Instructions)); + _mesa_fprint_instruction_opt(stderr, vpi, 0, PROG_PRINT_DEBUG, NULL); } - printf("\n"); + fprintf(stderr, "\n"); } } if (last_annotation_string != inst->annotation) { last_annotation_string = inst->annotation; if (last_annotation_string) - printf(" %s\n", last_annotation_string); + fprintf(stderr, " %s\n", last_annotation_string); } } @@ -1336,7 +1336,7 @@ vec4_generator::generate_code(exec_list *instructions) } if (unlikely(debug_flag)) { - brw_dump_compile(p, stdout, + brw_dump_compile(p, stderr, last_native_insn_offset, p->next_insn_offset); } @@ -1344,7 +1344,7 @@ vec4_generator::generate_code(exec_list *instructions) } if (unlikely(debug_flag)) { - printf("\n"); + fprintf(stderr, "\n"); } brw_set_uip_jip(p); @@ -1355,7 +1355,7 @@ vec4_generator::generate_code(exec_list *instructions) * case you're doing that. */ if (0 && unlikely(debug_flag)) { - brw_dump_compile(p, stdout, 0, p->next_insn_offset); + brw_dump_compile(p, stderr, 0, p->next_insn_offset); } } diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp index 601b364b295..a2f79228da0 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp +++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp @@ -1166,8 +1166,8 @@ vec4_visitor::visit(ir_expression *ir) this->result.file = BAD_FILE; ir->operands[operand]->accept(this); if (this->result.file == BAD_FILE) { - printf("Failed to get tree for expression operand:\n"); - ir->operands[operand]->print(); + fprintf(stderr, "Failed to get tree for expression operand:\n"); + ir->operands[operand]->fprint(stderr); exit(1); } op[operand] = this->result; diff --git a/src/mesa/drivers/dri/i965/brw_vs.c b/src/mesa/drivers/dri/i965/brw_vs.c index 3e319a650b8..775901f56b0 100644 --- a/src/mesa/drivers/dri/i965/brw_vs.c +++ b/src/mesa/drivers/dri/i965/brw_vs.c @@ -284,7 +284,7 @@ do_vs_prog(struct brw_context *brw, brw_compute_vue_map(brw, &prog_data.base.vue_map, outputs_written); if (0) { - _mesa_fprint_program_opt(stdout, &c.vp->program.Base, PROG_PRINT_DEBUG, + _mesa_fprint_program_opt(stderr, &c.vp->program.Base, PROG_PRINT_DEBUG, true); } diff --git a/src/mesa/drivers/dri/i965/gen8_fs_generator.cpp b/src/mesa/drivers/dri/i965/gen8_fs_generator.cpp index 96e532edf42..bb141485d6e 100644 --- a/src/mesa/drivers/dri/i965/gen8_fs_generator.cpp +++ b/src/mesa/drivers/dri/i965/gen8_fs_generator.cpp @@ -838,15 +838,17 @@ gen8_fs_generator::generate_code(exec_list *instructions) if (unlikely(INTEL_DEBUG & DEBUG_WM)) { if (prog) { - printf("Native code for %s fragment shader %d (SIMD%d dispatch):\n", + fprintf(stderr, + "Native code for %s fragment shader %d (SIMD%d dispatch):\n", shader_prog->Label ? shader_prog->Label : "unnamed", shader_prog->Name, dispatch_width); } else if (fp) { - printf("Native code for fragment program %d (SIMD%d dispatch):\n", - prog->Id, dispatch_width); + fprintf(stderr, + "Native code for fragment program %d (SIMD%d dispatch):\n", + prog->Id, dispatch_width); } else { - printf("Native code for blorp program (SIMD%d dispatch):\n", - dispatch_width); + fprintf(stderr, "Native code for blorp program (SIMD%d dispatch):\n", + dispatch_width); } } @@ -864,38 +866,38 @@ gen8_fs_generator::generate_code(exec_list *instructions) bblock_t *block = link->block; if (block->start == ir) { - printf(" START B%d", block->block_num); + fprintf(stderr, " START B%d", block->block_num); foreach_list(predecessor_node, &block->parents) { bblock_link *predecessor_link = (bblock_link *)predecessor_node; bblock_t *predecessor_block = predecessor_link->block; - printf(" <-B%d", predecessor_block->block_num); + fprintf(stderr, " <-B%d", predecessor_block->block_num); } - printf("\n"); + fprintf(stderr, "\n"); } } if (last_annotation_ir != ir->ir) { last_annotation_ir = ir->ir; if (last_annotation_ir) { - printf(" "); + fprintf(stderr, " "); if (prog) { - ((ir_instruction *) ir->ir)->print(); + ((ir_instruction *) ir->ir)->fprint(stderr); } else if (prog) { const prog_instruction *fpi; fpi = (const prog_instruction *) ir->ir; - printf("%d: ", (int)(fpi - prog->Instructions)); - _mesa_fprint_instruction_opt(stdout, + fprintf(stderr, "%d: ", (int)(fpi - prog->Instructions)); + _mesa_fprint_instruction_opt(stderr, fpi, 0, PROG_PRINT_DEBUG, NULL); } - printf("\n"); + fprintf(stderr, "\n"); } } if (last_annotation_string != ir->annotation) { last_annotation_string = ir->annotation; if (last_annotation_string) - printf(" %s\n", last_annotation_string); + fprintf(stderr, " %s\n", last_annotation_string); } } @@ -1239,21 +1241,21 @@ gen8_fs_generator::generate_code(exec_list *instructions) } if (unlikely(INTEL_DEBUG & DEBUG_WM)) { - disassemble(stdout, last_native_inst_offset, next_inst_offset); + disassemble(stderr, last_native_inst_offset, next_inst_offset); foreach_list(node, &cfg->block_list) { bblock_link *link = (bblock_link *)node; bblock_t *block = link->block; if (block->end == ir) { - printf(" END B%d", block->block_num); + fprintf(stderr, " END B%d", block->block_num); foreach_list(successor_node, &block->children) { bblock_link *successor_link = (bblock_link *)successor_node; bblock_t *successor_block = successor_link->block; - printf(" ->B%d", successor_block->block_num); + fprintf(stderr, " ->B%d", successor_block->block_num); } - printf("\n"); + fprintf(stderr, "\n"); } } } @@ -1262,7 +1264,7 @@ gen8_fs_generator::generate_code(exec_list *instructions) } if (unlikely(INTEL_DEBUG & DEBUG_WM)) { - printf("\n"); + fprintf(stderr, "\n"); } patch_jump_targets(); diff --git a/src/mesa/drivers/dri/i965/gen8_generator.cpp b/src/mesa/drivers/dri/i965/gen8_generator.cpp index ca38af61072..b0820087036 100644 --- a/src/mesa/drivers/dri/i965/gen8_generator.cpp +++ b/src/mesa/drivers/dri/i965/gen8_generator.cpp @@ -626,16 +626,16 @@ gen8_generator::disassemble(FILE *out, int start, int end) for (int offset = start; offset < end; offset += 16) { gen8_instruction *inst = &store[offset / 16]; - printf("0x%08x: ", offset); + fprintf(stderr, "0x%08x: ", offset); if (dump_hex) { - printf("0x%08x 0x%08x 0x%08x 0x%08x ", - ((uint32_t *) inst)[3], - ((uint32_t *) inst)[2], - ((uint32_t *) inst)[1], - ((uint32_t *) inst)[0]); + fprintf(stderr, "0x%08x 0x%08x 0x%08x 0x%08x ", + ((uint32_t *) inst)[3], + ((uint32_t *) inst)[2], + ((uint32_t *) inst)[1], + ((uint32_t *) inst)[0]); } - gen8_disassemble(stdout, inst, brw->gen); + gen8_disassemble(stderr, inst, brw->gen); } } diff --git a/src/mesa/drivers/dri/i965/gen8_vec4_generator.cpp b/src/mesa/drivers/dri/i965/gen8_vec4_generator.cpp index 45393b536d7..b854db542d0 100644 --- a/src/mesa/drivers/dri/i965/gen8_vec4_generator.cpp +++ b/src/mesa/drivers/dri/i965/gen8_vec4_generator.cpp @@ -801,11 +801,11 @@ gen8_vec4_generator::generate_code(exec_list *instructions) if (unlikely(debug_flag)) { if (shader_prog) { - printf("Native code for %s vertex shader %d:\n", - shader_prog->Label ? shader_prog->Label : "unnamed", - shader_prog->Name); + fprintf(stderr, "Native code for %s vertex shader %d:\n", + shader_prog->Label ? shader_prog->Label : "unnamed", + shader_prog->Name); } else { - printf("Native code for vertex program %d:\n", prog->Id); + fprintf(stderr, "Native code for vertex program %d:\n", prog->Id); } } @@ -817,23 +817,23 @@ gen8_vec4_generator::generate_code(exec_list *instructions) if (last_annotation_ir != ir->ir) { last_annotation_ir = ir->ir; if (last_annotation_ir) { - printf(" "); + fprintf(stderr, " "); if (shader_prog) { - ((ir_instruction *) last_annotation_ir)->print(); + ((ir_instruction *) last_annotation_ir)->fprint(stderr); } else { const prog_instruction *vpi; vpi = (const prog_instruction *) ir->ir; - printf("%d: ", (int)(vpi - prog->Instructions)); - _mesa_fprint_instruction_opt(stdout, vpi, 0, + fprintf(stderr, "%d: ", (int)(vpi - prog->Instructions)); + _mesa_fprint_instruction_opt(stderr, vpi, 0, PROG_PRINT_DEBUG, NULL); } - printf("\n"); + fprintf(stderr, "\n"); } } if (last_annotation_string != ir->annotation) { last_annotation_string = ir->annotation; if (last_annotation_string) - printf(" %s\n", last_annotation_string); + fprintf(stderr, " %s\n", last_annotation_string); } } @@ -862,14 +862,14 @@ gen8_vec4_generator::generate_code(exec_list *instructions) } if (unlikely(debug_flag)) { - disassemble(stdout, last_native_inst_offset, next_inst_offset); + disassemble(stderr, last_native_inst_offset, next_inst_offset); } last_native_inst_offset = next_inst_offset; } if (unlikely(debug_flag)) { - printf("\n"); + fprintf(stderr, "\n"); } patch_jump_targets(); @@ -880,7 +880,7 @@ gen8_vec4_generator::generate_code(exec_list *instructions) * case you're doing that. */ if (0 && unlikely(debug_flag)) { - disassemble(stdout, 0, next_inst_offset); + disassemble(stderr, 0, next_inst_offset); } } -- 2.30.2