summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/radeonsi/si_debug.c
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2019-07-02 18:43:40 -0400
committerMarek Olšák <[email protected]>2019-07-09 17:24:16 -0400
commit3be4ed2fe1ee8629a486156a764b451513d34aac (patch)
tree8a4b395a6da52384ee7a5f9749ab5ccebb082528 /src/gallium/drivers/radeonsi/si_debug.c
parent37b26671a75d8d6e9fa293b1bdb8df78763f3c03 (diff)
radeonsi: fix and clean up shader_type passing
- don't pass it via a parameter if it can be derived from other parameters - set shader_type for ac_rtld_open - use enum pipe_shader_type instead of unsigned Acked-by: Pierre-Eric Pelloux-Prayer <[email protected]> Acked-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/gallium/drivers/radeonsi/si_debug.c')
-rw-r--r--src/gallium/drivers/radeonsi/si_debug.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/src/gallium/drivers/radeonsi/si_debug.c b/src/gallium/drivers/radeonsi/si_debug.c
index 8265159c0d0..7d2f492fcc8 100644
--- a/src/gallium/drivers/radeonsi/si_debug.c
+++ b/src/gallium/drivers/radeonsi/si_debug.c
@@ -26,6 +26,7 @@
#include "si_compute.h"
#include "sid.h"
#include "sid_tables.h"
+#include "tgsi/tgsi_from_mesa.h"
#include "driver_ddebug/dd_util.h"
#include "util/u_dump.h"
#include "util/u_log.h"
@@ -98,13 +99,12 @@ void si_destroy_saved_cs(struct si_saved_cs *scs)
}
static void si_dump_shader(struct si_screen *sscreen,
- enum pipe_shader_type processor,
struct si_shader *shader, FILE *f)
{
if (shader->shader_log)
fwrite(shader->shader_log, shader->shader_log_size, 1, f);
else
- si_shader_dump(sscreen, shader, NULL, processor, f, false);
+ si_shader_dump(sscreen, shader, NULL, f, false);
if (shader->bo && sscreen->options.dump_shader_binary) {
unsigned size = shader->bo->b.b.width0;
@@ -136,7 +136,6 @@ struct si_log_chunk_shader {
*/
struct si_context *ctx;
struct si_shader *shader;
- enum pipe_shader_type processor;
/* For keep-alive reference counts */
struct si_shader_selector *sel;
@@ -157,8 +156,7 @@ si_log_chunk_shader_print(void *data, FILE *f)
{
struct si_log_chunk_shader *chunk = data;
struct si_screen *sscreen = chunk->ctx->screen;
- si_dump_shader(sscreen, chunk->processor,
- chunk->shader, f);
+ si_dump_shader(sscreen, chunk->shader, f);
}
static struct u_log_chunk_type si_log_chunk_type_shader = {
@@ -177,7 +175,6 @@ static void si_dump_gfx_shader(struct si_context *ctx,
struct si_log_chunk_shader *chunk = CALLOC_STRUCT(si_log_chunk_shader);
chunk->ctx = ctx;
- chunk->processor = state->cso->info.processor;
chunk->shader = current;
si_shader_selector_reference(ctx, &chunk->sel, current->selector);
u_log_chunk(log, &si_log_chunk_type_shader, chunk);
@@ -193,7 +190,6 @@ static void si_dump_compute_shader(struct si_context *ctx,
struct si_log_chunk_shader *chunk = CALLOC_STRUCT(si_log_chunk_shader);
chunk->ctx = ctx;
- chunk->processor = PIPE_SHADER_COMPUTE;
chunk->shader = &state->program->shader;
si_compute_reference(&chunk->program, state->program);
u_log_chunk(log, &si_log_chunk_type_shader, chunk);
@@ -942,10 +938,12 @@ static void si_add_split_disasm(struct si_screen *screen,
struct si_shader_binary *binary,
uint64_t *addr,
unsigned *num,
- struct si_shader_inst *instructions)
+ struct si_shader_inst *instructions,
+ enum pipe_shader_type shader_type)
{
if (!ac_rtld_open(rtld_binary, (struct ac_rtld_open_info){
.info = &screen->info,
+ .shader_type = tgsi_processor_to_shader_stage(shader_type),
.num_parts = 1,
.elf_ptrs = &binary->elf_buffer,
.elf_sizes = &binary->elf_size }))
@@ -995,6 +993,7 @@ static void si_print_annotated_shader(struct si_shader *shader,
return;
struct si_screen *screen = shader->selector->screen;
+ enum pipe_shader_type shader_type = shader->selector->type;
uint64_t start_addr = shader->bo->gpu_address;
uint64_t end_addr = start_addr + shader->bo->b.b.width0;
unsigned i;
@@ -1022,25 +1021,25 @@ static void si_print_annotated_shader(struct si_shader *shader,
if (shader->prolog) {
si_add_split_disasm(screen, &rtld_binaries[0], &shader->prolog->binary,
- &inst_addr, &num_inst, instructions);
+ &inst_addr, &num_inst, instructions, shader_type);
}
if (shader->previous_stage) {
si_add_split_disasm(screen, &rtld_binaries[1], &shader->previous_stage->binary,
- &inst_addr, &num_inst, instructions);
+ &inst_addr, &num_inst, instructions, shader_type);
}
if (shader->prolog2) {
si_add_split_disasm(screen, &rtld_binaries[2], &shader->prolog2->binary,
- &inst_addr, &num_inst, instructions);
+ &inst_addr, &num_inst, instructions, shader_type);
}
si_add_split_disasm(screen, &rtld_binaries[3], &shader->binary,
- &inst_addr, &num_inst, instructions);
+ &inst_addr, &num_inst, instructions, shader_type);
if (shader->epilog) {
si_add_split_disasm(screen, &rtld_binaries[4], &shader->epilog->binary,
- &inst_addr, &num_inst, instructions);
+ &inst_addr, &num_inst, instructions, shader_type);
}
fprintf(f, COLOR_YELLOW "%s - annotated disassembly:" COLOR_RESET "\n",
- si_get_shader_name(shader, shader->selector->type));
+ si_get_shader_name(shader));
/* Print instructions with annotations. */
for (i = 0; i < num_inst; i++) {