diff options
author | Marek Olšák <marek.olsak@amd.com> | 2013-09-22 15:34:12 +0200 |
---|---|---|
committer | Marek Olšák <marek.olsak@amd.com> | 2013-09-29 15:18:09 +0200 |
commit | 0cb9de1dd078395d541c32c0de81ea4f05147baa (patch) | |
tree | e6564dc7b0f5b9d058b64bec4074e0f971769f18 | |
parent | ba650ccf91a103d90d45b5927a8a9220e222cfc5 (diff) |
radeonsi: move debug options to R600_DEBUG
-rw-r--r-- | src/gallium/drivers/r600/r600_shader.c | 31 | ||||
-rw-r--r-- | src/gallium/drivers/radeon/r600_pipe_common.c | 29 | ||||
-rw-r--r-- | src/gallium/drivers/radeon/r600_pipe_common.h | 2 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/r600_texture.c | 4 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/radeonsi_pipe.c | 5 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/radeonsi_shader.c | 8 |
6 files changed, 41 insertions, 38 deletions
diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index a5d330e5f34..71818c7f0dc 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -84,33 +84,6 @@ static void r600_add_gpr_array(struct r600_shader *ps, int start_gpr, ps->arrays[n].gpr_count = size; } -static unsigned tgsi_get_processor_type(const struct tgsi_token *tokens) -{ - struct tgsi_parse_context parse; - - if (tgsi_parse_init( &parse, tokens ) != TGSI_PARSE_OK) { - debug_printf("tgsi_parse_init() failed in %s:%i!\n", __func__, __LINE__); - return ~0; - } - return parse.FullHeader.Processor.Processor; -} - -static bool r600_can_dump_shader(struct r600_screen *rscreen, unsigned processor_type) -{ - switch (processor_type) { - case TGSI_PROCESSOR_VERTEX: - return (rscreen->b.debug_flags & DBG_VS) != 0; - case TGSI_PROCESSOR_GEOMETRY: - return (rscreen->b.debug_flags & DBG_GS) != 0; - case TGSI_PROCESSOR_FRAGMENT: - return (rscreen->b.debug_flags & DBG_PS) != 0; - case TGSI_PROCESSOR_COMPUTE: - return (rscreen->b.debug_flags & DBG_CS) != 0; - default: - return false; - } -} - static void r600_dump_streamout(struct pipe_stream_output_info *so) { unsigned i; @@ -139,7 +112,7 @@ int r600_pipe_shader_create(struct pipe_context *ctx, struct r600_pipe_shader_selector *sel = shader->selector; int r, i; uint32_t *ptr; - bool dump = r600_can_dump_shader(rctx->screen, tgsi_get_processor_type(sel->tokens)); + bool dump = r600_can_dump_shader(&rctx->screen->b, sel->tokens); unsigned use_sb = !(rctx->screen->b.debug_flags & DBG_NO_SB); unsigned sb_disasm = use_sb || (rctx->screen->b.debug_flags & DBG_SB_DISASM); @@ -1122,7 +1095,7 @@ static int r600_shader_from_tgsi(struct r600_screen *rscreen, if (use_llvm) { struct radeon_llvm_context radeon_llvm_ctx; LLVMModuleRef mod; - bool dump = r600_can_dump_shader(rscreen, ctx.type); + bool dump = r600_can_dump_shader(&rscreen->b, tokens); boolean use_kill = false; memset(&radeon_llvm_ctx, 0, sizeof(radeon_llvm_ctx)); diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c b/src/gallium/drivers/radeon/r600_pipe_common.c index 9d68f4ba7ab..0a9081b821e 100644 --- a/src/gallium/drivers/radeon/r600_pipe_common.c +++ b/src/gallium/drivers/radeon/r600_pipe_common.c @@ -25,6 +25,7 @@ */ #include "r600_pipe_common.h" +#include "tgsi/tgsi_parse.h" static const struct debug_named_value common_debug_options[] = { /* logging */ @@ -101,3 +102,31 @@ void r600_context_add_resource_size(struct pipe_context *ctx, struct pipe_resour rctx->vram += rr->buf->size; } } + +static unsigned tgsi_get_processor_type(const struct tgsi_token *tokens) +{ + struct tgsi_parse_context parse; + + if (tgsi_parse_init( &parse, tokens ) != TGSI_PARSE_OK) { + debug_printf("tgsi_parse_init() failed in %s:%i!\n", __func__, __LINE__); + return ~0; + } + return parse.FullHeader.Processor.Processor; +} + +bool r600_can_dump_shader(struct r600_common_screen *rscreen, + const struct tgsi_token *tokens) +{ + switch (tgsi_get_processor_type(tokens)) { + case TGSI_PROCESSOR_VERTEX: + return (rscreen->debug_flags & DBG_VS) != 0; + case TGSI_PROCESSOR_GEOMETRY: + return (rscreen->debug_flags & DBG_GS) != 0; + case TGSI_PROCESSOR_FRAGMENT: + return (rscreen->debug_flags & DBG_PS) != 0; + case TGSI_PROCESSOR_COMPUTE: + return (rscreen->debug_flags & DBG_CS) != 0; + default: + return false; + } +} diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h b/src/gallium/drivers/radeon/r600_pipe_common.h index 63bc9b1fade..f2510b408ea 100644 --- a/src/gallium/drivers/radeon/r600_pipe_common.h +++ b/src/gallium/drivers/radeon/r600_pipe_common.h @@ -237,6 +237,8 @@ bool r600_common_context_init(struct r600_common_context *rctx, struct r600_common_screen *rscreen); void r600_common_context_cleanup(struct r600_common_context *rctx); void r600_context_add_resource_size(struct pipe_context *ctx, struct pipe_resource *r); +bool r600_can_dump_shader(struct r600_common_screen *rscreen, + const struct tgsi_token *tokens); /* r600_streamout.c */ void r600_streamout_buffers_dirty(struct r600_common_context *rctx); diff --git a/src/gallium/drivers/radeonsi/r600_texture.c b/src/gallium/drivers/radeonsi/r600_texture.c index 69ca892b5f8..aa307fb1a22 100644 --- a/src/gallium/drivers/radeonsi/r600_texture.c +++ b/src/gallium/drivers/radeonsi/r600_texture.c @@ -291,8 +291,6 @@ static void r600_texture_destroy(struct pipe_screen *screen, static const struct u_resource_vtbl r600_texture_vtbl; -DEBUG_GET_ONCE_BOOL_OPTION(print_texdepth, "RADEON_PRINT_TEXDEPTH", FALSE); - /* The number of samples can be specified independently of the texture. */ static void r600_texture_get_fmask_info(struct r600_screen *rscreen, struct r600_texture *rtex, @@ -468,7 +466,7 @@ r600_texture_create_object(struct pipe_screen *screen, memset(map + rtex->cmask.offset, 0xCC, rtex->cmask.size); } - if (debug_get_option_print_texdepth() && rtex->is_depth) { + if (rscreen->b.debug_flags & DBG_TEX_DEPTH && rtex->is_depth) { printf("Texture: npix_x=%u, npix_y=%u, npix_z=%u, blk_w=%u, " "blk_h=%u, blk_d=%u, array_size=%u, last_level=%u, " "bpe=%u, nsamples=%u, flags=%u\n", diff --git a/src/gallium/drivers/radeonsi/radeonsi_pipe.c b/src/gallium/drivers/radeonsi/radeonsi_pipe.c index 5275c6f41e9..5528e1968a3 100644 --- a/src/gallium/drivers/radeonsi/radeonsi_pipe.c +++ b/src/gallium/drivers/radeonsi/radeonsi_pipe.c @@ -825,6 +825,11 @@ struct pipe_screen *radeonsi_screen_create(struct radeon_winsys *ws) r600_common_screen_init(&rscreen->b, ws); + if (debug_get_bool_option("RADEON_PRINT_TEXDEPTH", FALSE)) + rscreen->b.debug_flags |= DBG_TEX_DEPTH; + if (debug_get_bool_option("RADEON_DUMP_SHADERS", FALSE)) + rscreen->b.debug_flags |= DBG_FS | DBG_VS | DBG_GS | DBG_PS | DBG_CS; + if (r600_init_tiling(rscreen)) { FREE(rscreen); return NULL; diff --git a/src/gallium/drivers/radeonsi/radeonsi_shader.c b/src/gallium/drivers/radeonsi/radeonsi_shader.c index 8d8cc4da8ec..7ed3d2634c9 100644 --- a/src/gallium/drivers/radeonsi/radeonsi_shader.c +++ b/src/gallium/drivers/radeonsi/radeonsi_shader.c @@ -1758,10 +1758,8 @@ int si_compile_llvm(struct r600_context *rctx, struct si_pipe_shader *shader, { unsigned i; uint32_t *ptr; - bool dump; struct radeon_llvm_binary binary; - - dump = debug_get_bool_option("RADEON_DUMP_SHADERS", FALSE); + bool dump = r600_can_dump_shader(&rctx->screen->b, shader->selector->tokens); memset(&binary, 0, sizeof(binary)); radeon_llvm_compile(mod, &binary, @@ -1839,10 +1837,8 @@ int si_pipe_shader_create( struct tgsi_shader_info shader_info; struct lp_build_tgsi_context * bld_base; LLVMModuleRef mod; - bool dump; int r = 0; - - dump = debug_get_bool_option("RADEON_DUMP_SHADERS", FALSE); + bool dump = r600_can_dump_shader(&rctx->screen->b, shader->selector->tokens); assert(shader->shader.noutput == 0); assert(shader->shader.ninterp == 0); |