Mesa (main): panfrost: Don't take ctx in panfrost_shader_compile
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed May 26 18:19:23 UTC 2021
Module: Mesa
Branch: main
Commit: 4b984c494ca1e74e3c3d0ea100a7686b3b5e36cd
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=4b984c494ca1e74e3c3d0ea100a7686b3b5e36cd
Author: Alyssa Rosenzweig <alyssa at collabora.com>
Date: Mon May 24 17:29:18 2021 -0400
panfrost: Don't take ctx in panfrost_shader_compile
Complicates validation of PIPE_CAP_SHAREABLE_SHADERS.
Signed-off-by: Alyssa Rosenzweig <alyssa at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10976>
---
src/gallium/drivers/panfrost/pan_assemble.c | 16 +++++++++-------
src/gallium/drivers/panfrost/pan_compute.c | 5 +++--
src/gallium/drivers/panfrost/pan_context.c | 8 ++++++--
src/gallium/drivers/panfrost/pan_context.h | 4 +++-
4 files changed, 21 insertions(+), 12 deletions(-)
diff --git a/src/gallium/drivers/panfrost/pan_assemble.c b/src/gallium/drivers/panfrost/pan_assemble.c
index de9cbc76bd5..09f748ed632 100644
--- a/src/gallium/drivers/panfrost/pan_assemble.c
+++ b/src/gallium/drivers/panfrost/pan_assemble.c
@@ -40,13 +40,15 @@
#include "tgsi/tgsi_dump.h"
void
-panfrost_shader_compile(struct panfrost_context *ctx,
+panfrost_shader_compile(struct pipe_screen *pscreen,
+ struct pan_pool *shader_pool,
+ struct pan_pool *desc_pool,
enum pipe_shader_ir ir_type,
const void *ir,
gl_shader_stage stage,
struct panfrost_shader_state *state)
{
- struct panfrost_device *dev = pan_device(ctx->base.screen);
+ struct panfrost_device *dev = pan_device(pscreen);
nir_shader *s;
@@ -54,7 +56,7 @@ panfrost_shader_compile(struct panfrost_context *ctx,
s = nir_shader_clone(NULL, ir);
} else {
assert (ir_type == PIPE_SHADER_IR_TGSI);
- s = tgsi_to_nir(ir, ctx->base.screen, false);
+ s = tgsi_to_nir(ir, pscreen, false);
}
/* Lower this early so the backends don't have to worry about it */
@@ -77,8 +79,8 @@ panfrost_shader_compile(struct panfrost_context *ctx,
pan_shader_compile(dev, s, &inputs, &binary, &state->info);
if (binary.size) {
- state->bin = pan_take_ref(&ctx->shaders,
- panfrost_pool_upload_aligned(&ctx->shaders,
+ state->bin = pan_take_ref(shader_pool,
+ panfrost_pool_upload_aligned(shader_pool,
binary.data, binary.size, 128));
}
@@ -88,9 +90,9 @@ panfrost_shader_compile(struct panfrost_context *ctx,
* time finalization based on the renderer state. */
if (stage != MESA_SHADER_FRAGMENT) {
struct panfrost_ptr ptr =
- panfrost_pool_alloc_desc(&ctx->descs, RENDERER_STATE);
+ panfrost_pool_alloc_desc(desc_pool, RENDERER_STATE);
- state->state = pan_take_ref(&ctx->descs, ptr.gpu);
+ state->state = pan_take_ref(desc_pool, ptr.gpu);
out = ptr.cpu;
}
diff --git a/src/gallium/drivers/panfrost/pan_compute.c b/src/gallium/drivers/panfrost/pan_compute.c
index a2023ac8e8c..ad473b34a9d 100644
--- a/src/gallium/drivers/panfrost/pan_compute.c
+++ b/src/gallium/drivers/panfrost/pan_compute.c
@@ -71,8 +71,9 @@ panfrost_create_compute_state(
so->cbase.ir_type = PIPE_SHADER_IR_NIR;
}
- panfrost_shader_compile(ctx, so->cbase.ir_type, so->cbase.prog,
- MESA_SHADER_COMPUTE, v);
+ panfrost_shader_compile(pctx->screen, &ctx->shaders, &ctx->descs,
+ so->cbase.ir_type, so->cbase.prog, MESA_SHADER_COMPUTE,
+ v);
return so;
}
diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c
index 74f12bcecd8..b638e8d23c6 100644
--- a/src/gallium/drivers/panfrost/pan_context.c
+++ b/src/gallium/drivers/panfrost/pan_context.c
@@ -953,7 +953,9 @@ panfrost_create_shader_state(
struct panfrost_shader_state state = { 0 };
- panfrost_shader_compile(ctx, PIPE_SHADER_IR_NIR,
+ panfrost_shader_compile(pctx->screen,
+ &ctx->shaders, &ctx->descs,
+ PIPE_SHADER_IR_NIR,
so->base.ir.nir,
tgsi_processor_to_shader_stage(stage),
&state);
@@ -1177,7 +1179,9 @@ panfrost_bind_shader_state(
/* We finally have a variant, so compile it */
if (!shader_state->compiled) {
- panfrost_shader_compile(ctx, variants->base.type,
+ panfrost_shader_compile(ctx->base.screen,
+ &ctx->shaders, &ctx->descs,
+ variants->base.type,
variants->base.type == PIPE_SHADER_IR_NIR ?
variants->base.ir.nir :
variants->base.tokens,
diff --git a/src/gallium/drivers/panfrost/pan_context.h b/src/gallium/drivers/panfrost/pan_context.h
index 1b783834a76..cb279aecee3 100644
--- a/src/gallium/drivers/panfrost/pan_context.h
+++ b/src/gallium/drivers/panfrost/pan_context.h
@@ -380,7 +380,9 @@ bool
panfrost_render_condition_check(struct panfrost_context *ctx);
void
-panfrost_shader_compile(struct panfrost_context *ctx,
+panfrost_shader_compile(struct pipe_screen *pscreen,
+ struct pan_pool *shader_pool,
+ struct pan_pool *desc_pool,
enum pipe_shader_ir ir_type,
const void *ir,
gl_shader_stage stage,
More information about the mesa-commit
mailing list