freedreno/ir3: Reshuffle compute state creation
authorRob Clark <robdclark@chromium.org>
Sat, 6 Feb 2021 19:30:00 +0000 (11:30 -0800)
committerMarge Bot <eric+marge@anholt.net>
Tue, 16 Feb 2021 23:43:44 +0000 (23:43 +0000)
There was just a single remaining caller of ir3_shader_create_compute(),
so fold that into ir3_shader_compute_state_create().

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8795>

src/gallium/drivers/freedreno/ir3/ir3_gallium.c

index ef76628..130bfb4 100644 (file)
@@ -239,13 +239,26 @@ create_initial_variants(struct ir3_shader_state *hwcso,
 /* a bit annoying that compute-shader and normal shader state objects
  * aren't a bit more aligned.
  */
-static struct ir3_shader_state *
-ir3_shader_create_compute(struct ir3_compiler *compiler,
-               const struct pipe_compute_state *cso,
-               struct pipe_debug_callback *debug,
-               struct pipe_screen *screen)
+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;
        nir_shader *nir;
+
        if (cso->ir_type == PIPE_SHADER_IR_NIR) {
                /* we take ownership of the reference: */
                nir = (nir_shader *)cso->prog;
@@ -254,7 +267,7 @@ ir3_shader_create_compute(struct ir3_compiler *compiler,
                if (ir3_shader_debug & IR3_DBG_DISASM) {
                        tgsi_dump(cso->prog, 0);
                }
-               nir = tgsi_to_nir(cso->prog, screen, false);
+               nir = tgsi_to_nir(cso->prog, pctx->screen, false);
        }
 
        struct ir3_shader *shader = ir3_shader_from_nir(compiler, nir, 0, NULL);
@@ -264,7 +277,7 @@ ir3_shader_create_compute(struct ir3_compiler *compiler,
         * is also how we get data from shader-db's ./run)
         */
        static struct ir3_shader_key key; /* static is implicitly zeroed */
-       ir3_shader_variant(shader, key, false, debug);
+       ir3_shader_variant(shader, key, false, &ctx->debug);
 
        shader->initial_variants_done = true;
 
@@ -275,27 +288,6 @@ ir3_shader_create_compute(struct ir3_compiler *compiler,
 }
 
 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)
 {
        struct fd_context *ctx = fd_context(pctx);