From f1ab57359c7a98ecd45ba3da905dd44c4d7cae5b Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Mon, 15 Jun 2020 14:37:24 -0700 Subject: [PATCH] freedreno/ir3: move finalize_nir to pscreen hook Signed-off-by: Rob Clark Part-of: --- src/freedreno/ir3/ir3_shader.c | 2 -- src/freedreno/vulkan/tu_shader.c | 2 ++ src/gallium/drivers/freedreno/a3xx/fd3_screen.c | 1 + src/gallium/drivers/freedreno/a4xx/fd4_screen.c | 1 + src/gallium/drivers/freedreno/a5xx/fd5_screen.c | 1 + src/gallium/drivers/freedreno/a6xx/fd6_screen.c | 1 + src/gallium/drivers/freedreno/ir3/ir3_gallium.c | 14 ++++++++++++++ src/gallium/drivers/freedreno/ir3/ir3_gallium.h | 1 + 8 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/freedreno/ir3/ir3_shader.c b/src/freedreno/ir3/ir3_shader.c index afdce9d0f82..76d3946c701 100644 --- a/src/freedreno/ir3/ir3_shader.c +++ b/src/freedreno/ir3/ir3_shader.c @@ -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) { diff --git a/src/freedreno/vulkan/tu_shader.c b/src/freedreno/vulkan/tu_shader.c index 930d10b6985..0fe4f63b315 100644 --- a/src/freedreno/vulkan/tu_shader.c +++ b/src/freedreno/vulkan/tu_shader.c @@ -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), diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_screen.c b/src/gallium/drivers/freedreno/a3xx/fd3_screen.c index 772426c82f3..64b806dc8fd 100644 --- a/src/gallium/drivers/freedreno/a3xx/fd3_screen.c +++ b/src/gallium/drivers/freedreno/a3xx/fd3_screen.c @@ -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) diff --git a/src/gallium/drivers/freedreno/a4xx/fd4_screen.c b/src/gallium/drivers/freedreno/a4xx/fd4_screen.c index 7f7c36da9b7..8f60b51bf8f 100644 --- a/src/gallium/drivers/freedreno/a4xx/fd4_screen.c +++ b/src/gallium/drivers/freedreno/a4xx/fd4_screen.c @@ -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); } diff --git a/src/gallium/drivers/freedreno/a5xx/fd5_screen.c b/src/gallium/drivers/freedreno/a5xx/fd5_screen.c index 9a4df4d26fb..799765a956a 100644 --- a/src/gallium/drivers/freedreno/a5xx/fd5_screen.c +++ b/src/gallium/drivers/freedreno/a5xx/fd5_screen.c @@ -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); } diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_screen.c b/src/gallium/drivers/freedreno/a6xx/fd6_screen.c index bb467112ed0..9db4ce15e96 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_screen.c +++ b/src/gallium/drivers/freedreno/a6xx/fd6_screen.c @@ -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); } diff --git a/src/gallium/drivers/freedreno/ir3/ir3_gallium.c b/src/gallium/drivers/freedreno/ir3/ir3_gallium.c index 2a6bc936a31..a660a916d99 100644 --- a/src/gallium/drivers/freedreno/ir3/ir3_gallium.c +++ b/src/gallium/drivers/freedreno/ir3/ir3_gallium.c @@ -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; +} diff --git a/src/gallium/drivers/freedreno/ir3/ir3_gallium.h b/src/gallium/drivers/freedreno/ir3/ir3_gallium.h index 655fb913e78..10445069916 100644 --- a/src/gallium/drivers/freedreno/ir3/ir3_gallium.h +++ b/src/gallium/drivers/freedreno/ir3/ir3_gallium.h @@ -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 -- 2.30.2