i965: Make the annotation code take a device_info instead of a context
authorJason Ekstrand <jason.ekstrand@intel.com>
Wed, 15 Apr 2015 22:01:25 +0000 (15:01 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Wed, 22 Apr 2015 23:00:33 +0000 (16:00 -0700)
Reviewed-by: Matt Turner <mattst88@gmail.com>
src/mesa/drivers/dri/i965/brw_fs_generator.cpp
src/mesa/drivers/dri/i965/brw_vec4_generator.cpp
src/mesa/drivers/dri/i965/intel_asm_annotation.c
src/mesa/drivers/dri/i965/intel_asm_annotation.h

index 539619a68b8bca35de9832d1576f3404abc9ad2e..baa83a15e1cfee1b20af1c6a229c61e5ba878fcb 100644 (file)
@@ -1573,7 +1573,7 @@ fs_generator::generate_code(const cfg_t *cfg, int dispatch_width)
       bool multiple_instructions_emitted = false;
 
       if (unlikely(debug_flag))
-         annotate(brw, &annotation, cfg, inst, p->next_insn_offset);
+         annotate(p->devinfo, &annotation, cfg, inst, p->next_insn_offset);
 
       for (unsigned int i = 0; i < inst->sources; i++) {
         src[i] = brw_reg_from_fs_reg(&inst->src[i]);
@@ -2128,7 +2128,8 @@ fs_generator::generate_code(const cfg_t *cfg, int dispatch_width)
               spill_count, fill_count, promoted_constants, before_size, after_size,
               100.0f * (before_size - after_size) / before_size);
 
-      dump_assembly(p->store, annotation.ann_count, annotation.ann, brw, prog);
+      dump_assembly(p->store, annotation.ann_count, annotation.ann,
+                    p->devinfo, prog);
       ralloc_free(annotation.ann);
    }
 
index 94ab32d67d5fe4a512dcf2bf39ee86852fb6c6fc..6e3a6a53aedd20a07615b3965ad265393ecba01b 100644 (file)
@@ -1151,7 +1151,7 @@ vec4_generator::generate_code(const cfg_t *cfg)
       struct brw_reg src[3], dst;
 
       if (unlikely(debug_flag))
-         annotate(brw, &annotation, cfg, inst, p->next_insn_offset);
+         annotate(p->devinfo, &annotation, cfg, inst, p->next_insn_offset);
 
       for (unsigned int i = 0; i < 3; i++) {
         src[i] = inst->get_src(this->prog_data, i);
@@ -1618,7 +1618,8 @@ vec4_generator::generate_code(const cfg_t *cfg)
               before_size / 16, loop_count, before_size, after_size,
               100.0f * (before_size - after_size) / before_size);
 
-      dump_assembly(p->store, annotation.ann_count, annotation.ann, brw, prog);
+      dump_assembly(p->store, annotation.ann_count, annotation.ann,
+                    p->devinfo, prog);
       ralloc_free(annotation.ann);
    }
 
index b4a693f7b5f9a2aa615c8c567acf883a95c2a7b3..bb8bb8d38c993aafaa1f08bd2fe02494622e54df 100644 (file)
@@ -33,7 +33,8 @@
 
 void
 dump_assembly(void *assembly, int num_annotations, struct annotation *annotation,
-              struct brw_context *brw, const struct gl_program *prog)
+              const struct brw_device_info *devinfo,
+              const struct gl_program *prog)
 {
    const char *last_annotation_string = NULL;
    const void *last_annotation_ir = NULL;
@@ -79,7 +80,7 @@ dump_assembly(void *assembly, int num_annotations, struct annotation *annotation
             fprintf(stderr, "   %s\n", last_annotation_string);
       }
 
-      brw_disassemble(brw->intelScreen->devinfo, assembly, start_offset, end_offset, stderr);
+      brw_disassemble(devinfo, assembly, start_offset, end_offset, stderr);
 
       if (annotation[i].block_end) {
          fprintf(stderr, "   END B%d", annotation[i].block_end->num);
@@ -94,7 +95,7 @@ dump_assembly(void *assembly, int num_annotations, struct annotation *annotation
    fprintf(stderr, "\n");
 }
 
-void annotate(struct brw_context *brw,
+void annotate(const struct brw_device_info *devinfo,
               struct annotation_info *annotation, const struct cfg_t *cfg,
               struct backend_instruction *inst, unsigned offset)
 {
@@ -129,7 +130,7 @@ void annotate(struct brw_context *brw,
     * There's also only complication from emitting an annotation without
     * a corresponding hardware instruction to disassemble.
     */
-   if (brw->gen >= 6 && inst->opcode == BRW_OPCODE_DO) {
+   if (devinfo->gen >= 6 && inst->opcode == BRW_OPCODE_DO) {
       annotation->ann_count--;
    }
 
index d80f32052817dc06889caf761328475df99f8bb3..d9c69bc41b0af1103aff0a48d9e2cd0211c831d2 100644 (file)
@@ -60,10 +60,11 @@ struct annotation_info {
 
 void
 dump_assembly(void *assembly, int num_annotations, struct annotation *annotation,
-              struct brw_context *brw, const struct gl_program *prog);
+              const struct brw_device_info *devinfo,
+              const struct gl_program *prog);
 
 void
-annotate(struct brw_context *brw,
+annotate(const struct brw_device_info *devinfo,
          struct annotation_info *annotation, const struct cfg_t *cfg,
          struct backend_instruction *inst, unsigned offset);
 void