From: Rob Clark Date: Fri, 5 Jun 2020 19:41:29 +0000 (-0700) Subject: freedreno/ir3: unify shader create/delete paths X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=43e0062c5b3762ec6a07398d0872b174404ef0ab;p=mesa.git freedreno/ir3: unify shader create/delete paths In particular, to move the fd_bo create/delete (which is unneeded by turnip) out of the shared ir3 code, it is useful to have a single delete path. Signed-off-by: Rob Clark Part-of: --- diff --git a/src/gallium/drivers/freedreno/a5xx/fd5_compute.c b/src/gallium/drivers/freedreno/a5xx/fd5_compute.c index cbc265eb3d3..468070770db 100644 --- a/src/gallium/drivers/freedreno/a5xx/fd5_compute.c +++ b/src/gallium/drivers/freedreno/a5xx/fd5_compute.c @@ -64,7 +64,7 @@ static void fd5_delete_compute_state(struct pipe_context *pctx, void *hwcso) { struct fd5_compute_stateobj *so = hwcso; - ir3_shader_destroy(so->shader); + ir3_shader_state_delete(pctx, so->shader); free(so); } diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_compute.c b/src/gallium/drivers/freedreno/a6xx/fd6_compute.c index 613291280e2..508a85d0688 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_compute.c +++ b/src/gallium/drivers/freedreno/a6xx/fd6_compute.c @@ -67,7 +67,7 @@ static void fd6_delete_compute_state(struct pipe_context *pctx, void *hwcso) { struct fd6_compute_stateobj *so = hwcso; - ir3_shader_destroy(so->shader); + ir3_shader_state_delete(pctx, so->shader); free(so); } diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_program.c b/src/gallium/drivers/freedreno/a6xx/fd6_program.c index 4cb1eaae678..9faa11bd384 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_program.c +++ b/src/gallium/drivers/freedreno/a6xx/fd6_program.c @@ -1045,10 +1045,7 @@ static const struct ir3_cache_funcs cache_funcs = { static void * fd6_shader_state_create(struct pipe_context *pctx, const struct pipe_shader_state *cso) { - struct fd_context *ctx = fd_context(pctx); - struct ir3_compiler *compiler = ctx->screen->compiler; - struct ir3_shader *shader = - ir3_shader_create(compiler, cso, &ctx->debug, pctx->screen); + struct ir3_shader *shader = ir3_shader_state_create(pctx, cso); unsigned packets, size; /* pre-calculate size required for userconst stateobj: */ @@ -1067,10 +1064,9 @@ fd6_shader_state_create(struct pipe_context *pctx, const struct pipe_shader_stat static void fd6_shader_state_delete(struct pipe_context *pctx, void *hwcso) { - struct ir3_shader *so = hwcso; struct fd_context *ctx = fd_context(pctx); ir3_cache_invalidate(fd6_context(ctx)->shader_cache, hwcso); - ir3_shader_destroy(so); + ir3_shader_state_delete(pctx, hwcso); } void diff --git a/src/gallium/drivers/freedreno/ir3/ir3_gallium.c b/src/gallium/drivers/freedreno/ir3/ir3_gallium.c index 720c87a72b8..6c0aa9f4b80 100644 --- a/src/gallium/drivers/freedreno/ir3/ir3_gallium.c +++ b/src/gallium/drivers/freedreno/ir3/ir3_gallium.c @@ -225,7 +225,7 @@ ir3_shader_create_compute(struct ir3_compiler *compiler, return shader; } -static void * +void * ir3_shader_state_create(struct pipe_context *pctx, const struct pipe_shader_state *cso) { struct fd_context *ctx = fd_context(pctx); @@ -233,7 +233,7 @@ ir3_shader_state_create(struct pipe_context *pctx, const struct pipe_shader_stat return ir3_shader_create(compiler, cso, &ctx->debug, pctx->screen); } -static void +void ir3_shader_state_delete(struct pipe_context *pctx, void *hwcso) { struct ir3_shader *so = hwcso; diff --git a/src/gallium/drivers/freedreno/ir3/ir3_gallium.h b/src/gallium/drivers/freedreno/ir3/ir3_gallium.h index da83eb7c00c..0f103388b67 100644 --- a/src/gallium/drivers/freedreno/ir3/ir3_gallium.h +++ b/src/gallium/drivers/freedreno/ir3/ir3_gallium.h @@ -44,6 +44,9 @@ struct ir3_shader_variant * ir3_shader_variant(struct ir3_shader *shader, struct ir3_shader_key key, bool binning_pass, struct pipe_debug_callback *debug); +void * ir3_shader_state_create(struct pipe_context *pctx, const struct pipe_shader_state *cso); +void ir3_shader_state_delete(struct pipe_context *pctx, void *hwcso); + void ir3_prog_init(struct pipe_context *pctx); #endif /* IR3_GALLIUM_H_ */