From cd1c1d302b60bdcc131d0feb048c9bc03896ee2f Mon Sep 17 00:00:00 2001 From: Matt Turner Date: Wed, 14 May 2014 15:05:09 -0700 Subject: [PATCH] i965/fs: Don't hardcode DEBUG_WM in generic fs code. Similar to Paul's commit e9fa3a944 except brw_fs_generator's debug_flag is for DEBUG_WM and DEBUG_BLORP. Reviewed-by: Eric Anholt --- src/mesa/drivers/dri/i965/brw_blorp_blit.cpp | 10 ++++++---- src/mesa/drivers/dri/i965/brw_blorp_blit_eu.cpp | 17 ++++------------- src/mesa/drivers/dri/i965/brw_blorp_blit_eu.h | 2 +- src/mesa/drivers/dri/i965/brw_fs.cpp | 3 ++- src/mesa/drivers/dri/i965/brw_fs.h | 4 +++- src/mesa/drivers/dri/i965/brw_fs_generator.cpp | 16 +++++++++------- 6 files changed, 25 insertions(+), 27 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp index a70865a9345..c3280a8b80d 100644 --- a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp +++ b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp @@ -517,7 +517,7 @@ class brw_blorp_blit_program : public brw_blorp_eu_emitter { public: brw_blorp_blit_program(struct brw_context *brw, - const brw_blorp_blit_prog_key *key); + const brw_blorp_blit_prog_key *key, bool debug_flag); const GLuint *compile(struct brw_context *brw, GLuint *program_size, FILE *dump_file = stderr); @@ -624,8 +624,9 @@ private: brw_blorp_blit_program::brw_blorp_blit_program( struct brw_context *brw, - const brw_blorp_blit_prog_key *key) - : brw_blorp_eu_emitter(brw), + const brw_blorp_blit_prog_key *key, + bool debug_flag) + : brw_blorp_eu_emitter(brw, debug_flag), brw(brw), key(key) { @@ -2142,7 +2143,8 @@ brw_blorp_blit_params::get_wm_prog(struct brw_context *brw, if (!brw_search_cache(&brw->cache, BRW_BLORP_BLIT_PROG, &this->wm_prog_key, sizeof(this->wm_prog_key), &prog_offset, prog_data)) { - brw_blorp_blit_program prog(brw, &this->wm_prog_key); + brw_blorp_blit_program prog(brw, &this->wm_prog_key, + INTEL_DEBUG & DEBUG_BLORP); GLuint program_size; const GLuint *program = prog.compile(brw, &program_size, stderr); brw_upload_cache(&brw->cache, BRW_BLORP_BLIT_PROG, 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 35491733946..4910b6c4e59 100644 --- a/src/mesa/drivers/dri/i965/brw_blorp_blit_eu.cpp +++ b/src/mesa/drivers/dri/i965/brw_blorp_blit_eu.cpp @@ -25,12 +25,13 @@ #include "brw_blorp_blit_eu.h" #include "brw_blorp.h" -brw_blorp_eu_emitter::brw_blorp_eu_emitter(struct brw_context *brw) +brw_blorp_eu_emitter::brw_blorp_eu_emitter(struct brw_context *brw, + bool debug_flag) : mem_ctx(ralloc_context(NULL)), generator(brw, mem_ctx, rzalloc(mem_ctx, struct brw_wm_prog_key), rzalloc(mem_ctx, struct brw_wm_prog_data), - NULL, NULL, false) + NULL, NULL, false, debug_flag) { } @@ -42,17 +43,7 @@ brw_blorp_eu_emitter::~brw_blorp_eu_emitter() const unsigned * brw_blorp_eu_emitter::get_program(unsigned *program_size, FILE *dump_file) { - const unsigned *res; - - if (unlikely(INTEL_DEBUG & DEBUG_BLORP)) { - fprintf(stderr, "Native code for BLORP blit:\n"); - res = generator.generate_assembly(NULL, &insts, program_size, dump_file); - fprintf(stderr, "\n"); - } else { - res = generator.generate_assembly(NULL, &insts, program_size); - } - - return res; + return generator.generate_assembly(NULL, &insts, program_size, dump_file); } /** diff --git a/src/mesa/drivers/dri/i965/brw_blorp_blit_eu.h b/src/mesa/drivers/dri/i965/brw_blorp_blit_eu.h index e68f925b2fd..8a93f0554e8 100644 --- a/src/mesa/drivers/dri/i965/brw_blorp_blit_eu.h +++ b/src/mesa/drivers/dri/i965/brw_blorp_blit_eu.h @@ -30,7 +30,7 @@ class brw_blorp_eu_emitter { protected: - explicit brw_blorp_eu_emitter(struct brw_context *brw); + explicit brw_blorp_eu_emitter(struct brw_context *brw, bool debug_flag); ~brw_blorp_eu_emitter(); const unsigned *get_program(unsigned *program_size, FILE *dump_file); diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 741040b9bf3..0116c4efc3b 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -3166,7 +3166,8 @@ brw_wm_fs_emit(struct brw_context *brw, assembly = g.generate_assembly(&v.instructions, simd16_instructions, final_assembly_size); } else { - fs_generator g(brw, mem_ctx, key, prog_data, prog, fp, v.do_dual_src); + fs_generator g(brw, mem_ctx, key, prog_data, prog, fp, v.do_dual_src, + INTEL_DEBUG & DEBUG_WM); assembly = g.generate_assembly(&v.instructions, simd16_instructions, final_assembly_size); } diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h index 1c77a93d85f..7a87aed16fe 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.h +++ b/src/mesa/drivers/dri/i965/brw_fs.h @@ -602,7 +602,8 @@ public: struct brw_wm_prog_data *prog_data, struct gl_shader_program *prog, struct gl_fragment_program *fp, - bool dual_source_output); + bool dual_source_output, + bool debug_flag); ~fs_generator(); const unsigned *generate_assembly(exec_list *simd8_instructions, @@ -712,6 +713,7 @@ private: exec_list discard_halt_patches; bool dual_source_output; + const bool debug_flag; void *mem_ctx; }; diff --git a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp index 9518e728ab7..878b0e0c06d 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp @@ -42,10 +42,12 @@ fs_generator::fs_generator(struct brw_context *brw, struct brw_wm_prog_data *prog_data, struct gl_shader_program *prog, struct gl_fragment_program *fp, - bool dual_source_output) + bool dual_source_output, + bool debug_flag) : brw(brw), key(key), prog_data(prog_data), prog(prog), fp(fp), - dual_source_output(dual_source_output), mem_ctx(mem_ctx) + dual_source_output(dual_source_output), debug_flag(debug_flag), + mem_ctx(mem_ctx) { ctx = &brw->ctx; @@ -1325,7 +1327,7 @@ fs_generator::generate_code(exec_list *instructions, FILE *dump_file) const char *last_annotation_string = NULL; const void *last_annotation_ir = NULL; - if (unlikely(INTEL_DEBUG & DEBUG_WM)) { + if (unlikely(debug_flag)) { if (prog) { fprintf(stderr, "Native code for %s fragment shader %d (SIMD%d dispatch):\n", @@ -1342,14 +1344,14 @@ fs_generator::generate_code(exec_list *instructions, FILE *dump_file) } cfg_t *cfg = NULL; - if (unlikely(INTEL_DEBUG & DEBUG_WM)) + if (unlikely(debug_flag)) cfg = new(mem_ctx) cfg_t(instructions); foreach_list(node, instructions) { fs_inst *inst = (fs_inst *)node; struct brw_reg src[3], dst; - if (unlikely(INTEL_DEBUG & DEBUG_WM)) { + if (unlikely(debug_flag)) { foreach_list(node, &cfg->block_list) { bblock_link *link = (bblock_link *)node; bblock_t *block = link->block; @@ -1802,7 +1804,7 @@ fs_generator::generate_code(exec_list *instructions, FILE *dump_file) abort(); } - if (unlikely(INTEL_DEBUG & DEBUG_WM)) { + if (unlikely(debug_flag)) { brw_disassemble(brw, p->store, last_native_insn_offset, p->next_insn_offset, stderr); foreach_list(node, &cfg->block_list) { @@ -1825,7 +1827,7 @@ fs_generator::generate_code(exec_list *instructions, FILE *dump_file) last_native_insn_offset = p->next_insn_offset; } - if (unlikely(INTEL_DEBUG & DEBUG_WM)) { + if (unlikely(debug_flag)) { fprintf(stderr, "\n"); } -- 2.30.2