freedreno/ir3+a5xx+a6xx: De-duplicate create_compute_state()

These were identical between a5xx and a6xx, so move into shared helper
that can be directly plugged into pctx, similar to the various 3d shader
state creation.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8795>
This commit is contained in:
Rob Clark
2021-02-06 11:20:27 -08:00
committed by Marge Bot
parent f673266191
commit 378c14331b
4 changed files with 26 additions and 50 deletions
@@ -33,27 +33,6 @@
#include "fd5_emit.h"
static void *
fd5_create_compute_state(struct pipe_context *pctx,
const struct pipe_compute_state *cso)
{
struct fd_context *ctx = fd_context(pctx);
/* req_input_mem will only be non-zero for cl kernels (ie. clover).
* This isn't a perfect test because I guess it is possible (but
* uncommon) for none for the kernel parameters to be a global,
* but ctx->set_global_bindings() can't fail, so this is the next
* best place to fail if we need a newer version of kernel driver:
*/
if ((cso->req_input_mem > 0) &&
fd_device_version(ctx->dev) < FD_VERSION_BO_IOVA) {
return NULL;
}
struct ir3_compiler *compiler = ctx->screen->compiler;
return ir3_shader_create_compute(compiler, cso, &ctx->debug, pctx->screen);
}
/* maybe move to fd5_program? */
static void
cs_program_emit(struct fd_ringbuffer *ring, struct ir3_shader_variant *v,
@@ -216,6 +195,6 @@ fd5_compute_init(struct pipe_context *pctx)
{
struct fd_context *ctx = fd_context(pctx);
ctx->launch_grid = fd5_launch_grid;
pctx->create_compute_state = fd5_create_compute_state;
pctx->create_compute_state = ir3_shader_compute_state_create;
pctx->delete_compute_state = ir3_shader_state_delete;
}
@@ -38,27 +38,6 @@
#include "fd6_pack.h"
static void *
fd6_create_compute_state(struct pipe_context *pctx,
const struct pipe_compute_state *cso)
{
struct fd_context *ctx = fd_context(pctx);
/* req_input_mem will only be non-zero for cl kernels (ie. clover).
* This isn't a perfect test because I guess it is possible (but
* uncommon) for none for the kernel parameters to be a global,
* but ctx->set_global_bindings() can't fail, so this is the next
* best place to fail if we need a newer version of kernel driver:
*/
if ((cso->req_input_mem > 0) &&
fd_device_version(ctx->dev) < FD_VERSION_BO_IOVA) {
return NULL;
}
struct ir3_compiler *compiler = ctx->screen->compiler;
return ir3_shader_create_compute(compiler, cso, &ctx->debug, pctx->screen);
}
/* maybe move to fd6_program? */
static void
cs_program_emit(struct fd_context *ctx, struct fd_ringbuffer *ring,
@@ -210,6 +189,6 @@ fd6_compute_init(struct pipe_context *pctx)
{
struct fd_context *ctx = fd_context(pctx);
ctx->launch_grid = fd6_launch_grid;
pctx->create_compute_state = fd6_create_compute_state;
pctx->create_compute_state = ir3_shader_compute_state_create;
pctx->delete_compute_state = ir3_shader_state_delete;
}
@@ -246,7 +246,7 @@ ir3_shader_create(struct ir3_compiler *compiler,
/* a bit annoying that compute-shader and normal shader state objects
* aren't a bit more aligned.
*/
struct ir3_shader *
static struct ir3_shader *
ir3_shader_create_compute(struct ir3_compiler *compiler,
const struct pipe_compute_state *cso,
struct pipe_debug_callback *debug,
@@ -278,6 +278,27 @@ ir3_shader_create_compute(struct ir3_compiler *compiler,
return shader;
}
void *
ir3_shader_compute_state_create(struct pipe_context *pctx,
const struct pipe_compute_state *cso)
{
struct fd_context *ctx = fd_context(pctx);
/* req_input_mem will only be non-zero for cl kernels (ie. clover).
* This isn't a perfect test because I guess it is possible (but
* uncommon) for none for the kernel parameters to be a global,
* but ctx->set_global_bindings() can't fail, so this is the next
* best place to fail if we need a newer version of kernel driver:
*/
if ((cso->req_input_mem > 0) &&
fd_device_version(ctx->dev) < FD_VERSION_BO_IOVA) {
return NULL;
}
struct ir3_compiler *compiler = ctx->screen->compiler;
return ir3_shader_create_compute(compiler, cso, &ctx->debug, pctx->screen);
}
void *
ir3_shader_state_create(struct pipe_context *pctx, const struct pipe_shader_state *cso)
{
@@ -35,15 +35,12 @@ struct ir3_shader * ir3_shader_create(struct ir3_compiler *compiler,
const struct pipe_shader_state *cso,
struct pipe_debug_callback *debug,
struct pipe_screen *screen);
struct ir3_shader *
ir3_shader_create_compute(struct ir3_compiler *compiler,
const struct pipe_compute_state *cso,
struct pipe_debug_callback *debug,
struct pipe_screen *screen);
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_compute_state_create(struct pipe_context *pctx,
const struct pipe_compute_state *cso);
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);