From: Tom Stellard Date: Wed, 12 Jun 2013 19:36:08 +0000 (-0700) Subject: r600g/compute: Move compute_shader_create() function into evergreen_compute.c X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2639fca1f017907af7ce446fba60b520aa376abc;p=mesa.git r600g/compute: Move compute_shader_create() function into evergreen_compute.c Tested-by: Aaron Watry --- diff --git a/src/gallium/drivers/r600/evergreen_compute.c b/src/gallium/drivers/r600/evergreen_compute.c index c993c0959d5..b16c9d933c2 100644 --- a/src/gallium/drivers/r600/evergreen_compute.c +++ b/src/gallium/drivers/r600/evergreen_compute.c @@ -46,6 +46,7 @@ #include "evergreen_compute.h" #include "evergreen_compute_internal.h" #include "compute_memory_pool.h" +#include "sb/sb_public.h" #ifdef HAVE_OPENCL #include "radeon_llvm_util.h" #endif @@ -522,7 +523,27 @@ static void evergreen_launch_grid( if (!shader->kernels[pc].code_bo) { void *p; struct r600_kernel *kernel = &shader->kernels[pc]; - r600_compute_shader_create(ctx_, kernel->llvm_module, &kernel->bc); + struct r600_bytecode *bc = &kernel->bc; + LLVMModuleRef mod = kernel->llvm_module; + boolean use_kill = false; + bool dump = (ctx->screen->debug_flags & DBG_CS) != 0; + unsigned use_sb = ctx->screen->debug_flags & DBG_SB_CS; + unsigned sb_disasm = use_sb || + (ctx->screen->debug_flags & DBG_SB_DISASM); + + r600_bytecode_init(bc, ctx->chip_class, ctx->family, + ctx->screen->has_compressed_msaa_texturing); + bc->type = TGSI_PROCESSOR_COMPUTE; + bc->isa = ctx->isa; + r600_llvm_compile(mod, ctx->family, bc, &use_kill, dump); + + if (dump && !sb_disasm) { + r600_bytecode_disasm(bc); + } else if ((dump && sb_disasm) || use_sb) { + if (r600_sb_bytecode_process(ctx, bc, NULL, dump, use_sb)) + R600_ERR("r600_sb_bytecode_process failed!\n"); + } + kernel->code_bo = r600_compute_buffer_alloc_vram(ctx->screen, kernel->bc.ndw * 4); p = r600_buffer_mmap_sync_with_rings(ctx, kernel->code_bo, PIPE_TRANSFER_WRITE); diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h index 1dc346f049f..8485cce732c 100644 --- a/src/gallium/drivers/r600/r600_pipe.h +++ b/src/gallium/drivers/r600/r600_pipe.h @@ -756,10 +756,7 @@ void r600_init_context_resource_functions(struct r600_context *r600); int r600_pipe_shader_create(struct pipe_context *ctx, struct r600_pipe_shader *shader, struct r600_shader_key key); -#ifdef HAVE_OPENCL -int r600_compute_shader_create(struct pipe_context * ctx, - LLVMModuleRef mod, struct r600_bytecode * bytecode); -#endif + void r600_pipe_shader_destroy(struct pipe_context *ctx, struct r600_pipe_shader *shader); /* r600_state.c */ diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index 3a734bc78b7..3af4ed93289 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -291,38 +291,6 @@ static int tgsi_bgnloop(struct r600_shader_ctx *ctx); static int tgsi_endloop(struct r600_shader_ctx *ctx); static int tgsi_loop_brk_cont(struct r600_shader_ctx *ctx); -#ifdef HAVE_OPENCL -int r600_compute_shader_create(struct pipe_context * ctx, - LLVMModuleRef mod, struct r600_bytecode * bytecode) -{ - struct r600_context *r600_ctx = (struct r600_context *)ctx; - struct r600_shader_ctx shader_ctx; - boolean use_kill = false; - bool dump = (r600_ctx->screen->debug_flags & DBG_CS) != 0; - unsigned use_sb = r600_ctx->screen->debug_flags & DBG_SB_CS; - unsigned sb_disasm = use_sb || - (r600_ctx->screen->debug_flags & DBG_SB_DISASM); - - shader_ctx.bc = bytecode; - r600_bytecode_init(shader_ctx.bc, r600_ctx->chip_class, r600_ctx->family, - r600_ctx->screen->has_compressed_msaa_texturing); - shader_ctx.bc->type = TGSI_PROCESSOR_COMPUTE; - shader_ctx.bc->isa = r600_ctx->isa; - r600_llvm_compile(mod, r600_ctx->family, - shader_ctx.bc, &use_kill, dump); - - if (dump && !sb_disasm) { - r600_bytecode_disasm(shader_ctx.bc); - } else if ((dump && sb_disasm) || use_sb) { - if (r600_sb_bytecode_process(r600_ctx, shader_ctx.bc, NULL, dump, use_sb)) - R600_ERR("r600_sb_bytecode_process failed!\n"); - } - - return 1; -} - -#endif /* HAVE_OPENCL */ - static int tgsi_is_supported(struct r600_shader_ctx *ctx) { struct tgsi_full_instruction *i = &ctx->parse.FullToken.FullInstruction;