[Mesa-dev] [PATCH] radeonsi/compute: Fix segfault caused by recent refactoring
Marek Olšák
maraeo at gmail.com
Thu Oct 3 15:31:32 PDT 2013
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Marek
On Thu, Oct 3, 2013 at 11:39 PM, Tom Stellard <tom at stellard.net> wrote:
> From: Tom Stellard <thomas.stellard at amd.com>
>
> ---
> src/gallium/drivers/radeon/r600_pipe_common.c | 4 ++++
> src/gallium/drivers/radeonsi/radeonsi_shader.c | 4 ++--
> 2 files changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c b/src/gallium/drivers/radeon/r600_pipe_common.c
> index 852993c..b038740 100644
> --- a/src/gallium/drivers/radeon/r600_pipe_common.c
> +++ b/src/gallium/drivers/radeon/r600_pipe_common.c
> @@ -249,6 +249,10 @@ static unsigned tgsi_get_processor_type(const struct tgsi_token *tokens)
> bool r600_can_dump_shader(struct r600_common_screen *rscreen,
> const struct tgsi_token *tokens)
> {
> + /* Compute shader don't have tgsi_tokens */
> + if (!tokens)
> + return (rscreen->debug_flags & DBG_CS) != 0;
> +
> switch (tgsi_get_processor_type(tokens)) {
> case TGSI_PROCESSOR_VERTEX:
> return (rscreen->debug_flags & DBG_VS) != 0;
> diff --git a/src/gallium/drivers/radeonsi/radeonsi_shader.c b/src/gallium/drivers/radeonsi/radeonsi_shader.c
> index 7ed3d26..97ed4e3 100644
> --- a/src/gallium/drivers/radeonsi/radeonsi_shader.c
> +++ b/src/gallium/drivers/radeonsi/radeonsi_shader.c
> @@ -1759,8 +1759,8 @@ int si_compile_llvm(struct r600_context *rctx, struct si_pipe_shader *shader,
> unsigned i;
> uint32_t *ptr;
> struct radeon_llvm_binary binary;
> - bool dump = r600_can_dump_shader(&rctx->screen->b, shader->selector->tokens);
> -
> + bool dump = r600_can_dump_shader(&rctx->screen->b,
> + shader->selector ? shader->selector->tokens : NULL);
> memset(&binary, 0, sizeof(binary));
> radeon_llvm_compile(mod, &binary,
> r600_get_llvm_processor_name(rctx->screen->b.family), dump);
> --
> 1.8.1.5
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list