i965/fs: Don't hardcode DEBUG_WM in generic fs code.
authorMatt Turner <mattst88@gmail.com>
Wed, 14 May 2014 22:05:09 +0000 (15:05 -0700)
committerMatt Turner <mattst88@gmail.com>
Sun, 25 May 2014 06:03:23 +0000 (23:03 -0700)
Similar to Paul's commit e9fa3a944 except brw_fs_generator's debug_flag
is for DEBUG_WM and DEBUG_BLORP.

Reviewed-by: Eric Anholt <eric@anholt.net>
src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
src/mesa/drivers/dri/i965/brw_blorp_blit_eu.cpp
src/mesa/drivers/dri/i965/brw_blorp_blit_eu.h
src/mesa/drivers/dri/i965/brw_fs.cpp
src/mesa/drivers/dri/i965/brw_fs.h
src/mesa/drivers/dri/i965/brw_fs_generator.cpp

index a70865a934592cf87fd3e42714eadafd6c5dfe22..c3280a8b80d96cd4bc30fd94cb3082a0389996c5 100644 (file)
@@ -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,
index 35491733946811e846a84c62d7bf3c95ad18913e..4910b6c4e5959a34f44684100f4d0d6b18382b26 100644 (file)
 #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);
 }
 
 /**
index e68f925b2fd6f8990c53344f98da2498010873af..8a93f0554e85ab5d275bd8d1d83e28ede7954b44 100644 (file)
@@ -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);
index 741040b9bf327c6c5201a7b99353af64a3eece90..0116c4efc3bb30d8a66e81905cdc525e8c00a41f 100644 (file)
@@ -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);
    }
index 1c77a93d85f012dc3240292beff6078bc31cfbac..7a87aed16feed0e43b939399b18283b358d89ead 100644 (file)
@@ -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;
 };
 
index 9518e728ab753b5dd82959f9a38e9f08e0f94c32..878b0e0c06d52fbf1982db8351a4b9a52e1f2d67 100644 (file)
@@ -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");
    }