freedreno/ir3: move finalize_nir to pscreen hook
authorRob Clark <robdclark@chromium.org>
Mon, 15 Jun 2020 21:37:24 +0000 (14:37 -0700)
committerRob Clark <robdclark@chromium.org>
Fri, 26 Jun 2020 15:43:22 +0000 (08:43 -0700)
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5372>

src/freedreno/ir3/ir3_shader.c
src/freedreno/vulkan/tu_shader.c
src/gallium/drivers/freedreno/a3xx/fd3_screen.c
src/gallium/drivers/freedreno/a4xx/fd4_screen.c
src/gallium/drivers/freedreno/a5xx/fd5_screen.c
src/gallium/drivers/freedreno/a6xx/fd6_screen.c
src/gallium/drivers/freedreno/ir3/ir3_gallium.c
src/gallium/drivers/freedreno/ir3/ir3_gallium.h

index afdce9d0f828d5401e0bd3ee2fa878cae29f5e9e..76d3946c701b7a1629ab8ce1d6ae80211f3674bf 100644 (file)
@@ -411,8 +411,6 @@ ir3_shader_from_nir(struct ir3_compiler *compiler, nir_shader *nir,
 
        ir3_nir_post_finalize(compiler, nir);
 
-       ir3_finalize_nir(compiler, nir);
-
        shader->nir = nir;
 
        if (ir3_shader_debug & IR3_DBG_DISASM) {
index 930d10b6985d2f10f78b9d06921d77f014364b01..0fe4f63b3153c456a9d071f3c8dace12e5fb5f8f 100644 (file)
@@ -634,6 +634,8 @@ tu_shader_create(struct tu_device *dev,
 
    nir_shader_gather_info(nir, nir_shader_get_entrypoint(nir));
 
+   ir3_finalize_nir(dev->compiler, nir);
+
    shader->ir3_shader =
       ir3_shader_from_nir(dev->compiler, nir,
                           align(shader->push_consts.count, 4),
index 772426c82f32c59ff9a80f4541ffa3a7b44ac555..64b806dc8fd1f288f8ec5a64c053411da97a36da 100644 (file)
@@ -109,6 +109,7 @@ fd3_screen_init(struct pipe_screen *pscreen)
        pscreen->context_create = fd3_context_create;
        pscreen->is_format_supported = fd3_screen_is_format_supported;
        fd3_emit_init_screen(pscreen);
+       ir3_screen_init(pscreen);
 
        screen->setup_slices = fd3_setup_slices;
        if (fd_mesa_debug & FD_DBG_TTILE)
index 7f7c36da9b7462a3c3a69eb91d584bf07a9208d2..8f60b51bf8f25f0a63fa5a57cea67e7be3e33327 100644 (file)
@@ -114,4 +114,5 @@ fd4_screen_init(struct pipe_screen *pscreen)
        pscreen->context_create = fd4_context_create;
        pscreen->is_format_supported = fd4_screen_is_format_supported;
        fd4_emit_init_screen(pscreen);
+       ir3_screen_init(pscreen);
 }
index 9a4df4d26fbc5bcbfb4d12043b0ce81b2ebf39cc..799765a956a02a529b2e4cb12e00d1b3b677d95f 100644 (file)
@@ -135,4 +135,5 @@ fd5_screen_init(struct pipe_screen *pscreen)
                screen->tile_mode = fd5_tile_mode;
 
        fd5_emit_init_screen(pscreen);
+       ir3_screen_init(pscreen);
 }
index bb467112ed02dfe52f98f57e628a982b755c99e1..9db4ce15e9659210e4953b40dbaf286c7d520b2f 100644 (file)
@@ -140,4 +140,5 @@ fd6_screen_init(struct pipe_screen *pscreen)
 
        fd6_resource_screen_init(pscreen);
        fd6_emit_init_screen(pscreen);
+       ir3_screen_init(pscreen);
 }
index 2a6bc936a31b9cd031bb272c530659e44d52bc49..a660a916d990681cdb37817460de68c33f19c193 100644 (file)
@@ -294,6 +294,14 @@ ir3_shader_state_delete(struct pipe_context *pctx, void *hwcso)
        ir3_shader_destroy(so);
 }
 
+static void
+ir3_screen_finalize_nir(struct pipe_screen *pscreen, void *nir, bool optimize)
+{
+       struct fd_screen *screen = fd_screen(pscreen);
+
+       ir3_finalize_nir(screen->compiler, nir);
+}
+
 void
 ir3_prog_init(struct pipe_context *pctx)
 {
@@ -312,3 +320,9 @@ ir3_prog_init(struct pipe_context *pctx)
        pctx->create_fs_state = ir3_shader_state_create;
        pctx->delete_fs_state = ir3_shader_state_delete;
 }
+
+void
+ir3_screen_init(struct pipe_screen *pscreen)
+{
+       pscreen->finalize_nir = ir3_screen_finalize_nir;
+}
index 655fb913e78ec9b273a46d9bac938dcb0f264c6f..10445069916fb68d61495b883f2eb88c24dbd5a9 100644 (file)
@@ -48,6 +48,7 @@ void * ir3_shader_state_create(struct pipe_context *pctx, const struct pipe_shad
 void ir3_shader_state_delete(struct pipe_context *pctx, void *hwcso);
 
 void ir3_prog_init(struct pipe_context *pctx);
+void ir3_screen_init(struct pipe_screen *pscreen);
 
 /**
  * A helper to determine if a fs input 'i' is point/sprite coord, given