diff options
author | Rob Clark <[email protected]> | 2016-04-24 16:59:16 -0400 |
---|---|---|
committer | Rob Clark <[email protected]> | 2016-04-30 14:56:20 -0400 |
commit | 663c0e5155e9916b10163c102f0ece4eda5c3154 (patch) | |
tree | 6676d755d5c329c427b15363b13af7badc6c0ad5 /src/gallium/drivers/freedreno/ir3 | |
parent | 2578e3edcb83511d46427591343369b1bdfbcaf3 (diff) |
freedreno/ir3: use pipe_debug_callback for shader-db traces
For multi-threaded shader-db support.
Signed-off-by: Rob Clark <[email protected]>
Diffstat (limited to 'src/gallium/drivers/freedreno/ir3')
-rw-r--r-- | src/gallium/drivers/freedreno/ir3/ir3_shader.c | 53 | ||||
-rw-r--r-- | src/gallium/drivers/freedreno/ir3/ir3_shader.h | 5 |
2 files changed, 33 insertions, 25 deletions
diff --git a/src/gallium/drivers/freedreno/ir3/ir3_shader.c b/src/gallium/drivers/freedreno/ir3/ir3_shader.c index 435a565e61e..8019a1286c0 100644 --- a/src/gallium/drivers/freedreno/ir3/ir3_shader.c +++ b/src/gallium/drivers/freedreno/ir3/ir3_shader.c @@ -147,25 +147,6 @@ assemble_variant(struct ir3_shader_variant *v) ir3_shader_disasm(v, bin); } - if (fd_mesa_debug & FD_DBG_SHADERDB) { - /* print generic shader info: */ - fprintf(stderr, "SHADER-DB: %s prog %d/%d: %u instructions, %u dwords\n", - ir3_shader_stage(v->shader), - v->shader->id, v->id, - v->info.instrs_count, - v->info.sizedwords); - fprintf(stderr, "SHADER-DB: %s prog %d/%d: %u half, %u full\n", - ir3_shader_stage(v->shader), - v->shader->id, v->id, - v->info.max_half_reg + 1, - v->info.max_reg + 1); - fprintf(stderr, "SHADER-DB: %s prog %d/%d: %u const, %u constlen\n", - ir3_shader_stage(v->shader), - v->shader->id, v->id, - v->info.max_const + 1, - v->constlen); - } - free(bin); /* no need to keep the ir around beyond this point: */ @@ -173,6 +154,30 @@ assemble_variant(struct ir3_shader_variant *v) v->ir = NULL; } +static void +dump_shader_info(struct ir3_shader_variant *v, struct pipe_debug_callback *debug) +{ + if (!unlikely(fd_mesa_debug & FD_DBG_SHADERDB)) + return; + + pipe_debug_message(debug, SHADER_INFO, "\n" + "SHADER-DB: %s prog %d/%d: %u instructions, %u dwords\n" + "SHADER-DB: %s prog %d/%d: %u half, %u full\n" + "SHADER-DB: %s prog %d/%d: %u const, %u constlen\n", + ir3_shader_stage(v->shader), + v->shader->id, v->id, + v->info.instrs_count, + v->info.sizedwords, + ir3_shader_stage(v->shader), + v->shader->id, v->id, + v->info.max_half_reg + 1, + v->info.max_reg + 1, + ir3_shader_stage(v->shader), + v->shader->id, v->id, + v->info.max_const + 1, + v->constlen); +} + static struct ir3_shader_variant * create_variant(struct ir3_shader *shader, struct ir3_shader_key key) { @@ -207,7 +212,8 @@ fail: } struct ir3_shader_variant * -ir3_shader_variant(struct ir3_shader *shader, struct ir3_shader_key key) +ir3_shader_variant(struct ir3_shader *shader, struct ir3_shader_key key, + struct pipe_debug_callback *debug) { struct ir3_shader_variant *v; @@ -248,6 +254,7 @@ ir3_shader_variant(struct ir3_shader *shader, struct ir3_shader_key key) if (v) { v->next = shader->variants; shader->variants = v; + dump_shader_info(v, debug); } return v; @@ -269,8 +276,8 @@ ir3_shader_destroy(struct ir3_shader *shader) struct ir3_shader * ir3_shader_create(struct ir3_compiler *compiler, - const struct pipe_shader_state *cso, - enum shader_t type) + const struct pipe_shader_state *cso, enum shader_t type, + struct pipe_debug_callback *debug) { struct ir3_shader *shader = CALLOC_STRUCT(ir3_shader); shader->compiler = compiler; @@ -294,7 +301,7 @@ ir3_shader_create(struct ir3_compiler *compiler, * actually compiled) */ static struct ir3_shader_key key = {0}; - ir3_shader_variant(shader, key); + ir3_shader_variant(shader, key, debug); } return shader; } diff --git a/src/gallium/drivers/freedreno/ir3/ir3_shader.h b/src/gallium/drivers/freedreno/ir3/ir3_shader.h index ff6bf1d67b8..077ba5db379 100644 --- a/src/gallium/drivers/freedreno/ir3/ir3_shader.h +++ b/src/gallium/drivers/freedreno/ir3/ir3_shader.h @@ -263,10 +263,11 @@ struct ir3_shader { void * ir3_shader_assemble(struct ir3_shader_variant *v, uint32_t gpu_id); struct ir3_shader * ir3_shader_create(struct ir3_compiler *compiler, - const struct pipe_shader_state *cso, enum shader_t type); + const struct pipe_shader_state *cso, enum shader_t type, + struct pipe_debug_callback *debug); void ir3_shader_destroy(struct ir3_shader *shader); struct ir3_shader_variant * ir3_shader_variant(struct ir3_shader *shader, - struct ir3_shader_key key); + struct ir3_shader_key key, struct pipe_debug_callback *debug); void ir3_shader_disasm(struct ir3_shader_variant *so, uint32_t *bin); struct fd_ringbuffer; |