[Mesa-dev] [PATCH 1/2] r600g/compute: Move compute_shader_create() function into evergreen_compute.c
Aaron Watry
awatry at gmail.com
Thu Jun 13 15:51:49 PDT 2013
On Wed, Jun 12, 2013 at 7:34 PM, Tom Stellard <tom at stellard.net> wrote:
> From: Tom Stellard <thomas.stellard at amd.com>
>
> ---
> src/gallium/drivers/r600/evergreen_compute.c | 23 +++++++++++++++++++-
> src/gallium/drivers/r600/r600_shader.c | 32 ----------------------------
> 2 files changed, 22 insertions(+), 33 deletions(-)
>
> diff --git a/src/gallium/drivers/r600/evergreen_compute.c b/src/gallium/drivers/r600/evergreen_compute.c
> index c993c09..b16c9d9 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_shader.c b/src/gallium/drivers/r600/r600_shader.c
> index 81ed3ce..97c625c 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)
> -{
There's an associated declaration of this function in r600_pipe.h that
is now unused... should this be removed? Otherwise, this looks good to
me.
FYI: Tested on CEDAR (HD5400).
--Aaron
> - 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;
> --
> 1.7.11.4
>
> _______________________________________________
> 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