diff options
author | Alyssa Rosenzweig <[email protected]> | 2019-12-13 15:13:02 -0500 |
---|---|---|
committer | Marge Bot <[email protected]> | 2019-12-17 17:42:57 +0000 |
commit | 271726eacafa1ca2df4e15ae910626be19099cb5 (patch) | |
tree | 4cae0229df67a1c183f22e088b6dcbebb4bc8bbf /src/gallium/drivers/panfrost | |
parent | 2c8742ed858c6446c93bddec117abf467a393c35 (diff) |
panfrost: Add PAN_MESA_DEBUG=precompile for shader-db
We would like to use run.c for shader-db runs (rather than capturing in
real-time, which is limiting).
Signed-off-by: Alyssa Rosenzweig <[email protected]>
Reviewed-by: Tomeu Vizoso <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3125>
Diffstat (limited to 'src/gallium/drivers/panfrost')
-rw-r--r-- | src/gallium/drivers/panfrost/pan_context.c | 34 | ||||
-rw-r--r-- | src/gallium/drivers/panfrost/pan_screen.c | 1 | ||||
-rw-r--r-- | src/gallium/drivers/panfrost/pan_util.h | 1 |
3 files changed, 33 insertions, 3 deletions
diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c index b446a4afb01..ea87bbbdbd5 100644 --- a/src/gallium/drivers/panfrost/pan_context.c +++ b/src/gallium/drivers/panfrost/pan_context.c @@ -1700,7 +1700,8 @@ panfrost_bind_vertex_elements_state( static void * panfrost_create_shader_state( struct pipe_context *pctx, - const struct pipe_shader_state *cso) + const struct pipe_shader_state *cso, + enum pipe_shader_type stage) { struct panfrost_shader_variants *so = CALLOC_STRUCT(panfrost_shader_variants); so->base = *cso; @@ -1710,6 +1711,21 @@ panfrost_create_shader_state( if (cso->type == PIPE_SHADER_IR_TGSI) so->base.tokens = tgsi_dup_tokens(so->base.tokens); + /* Precompile for shader-db if we need to */ + if (unlikely((pan_debug & PAN_DBG_PRECOMPILE) && cso->type == PIPE_SHADER_IR_NIR)) { + struct panfrost_context *ctx = pan_context(pctx); + + struct mali_shader_meta meta; + struct panfrost_shader_state state; + uint64_t outputs_written; + + panfrost_shader_compile(ctx, &meta, + PIPE_SHADER_IR_NIR, + so->base.ir.nir, + tgsi_processor_to_shader_stage(stage), &state, + &outputs_written); + } + return so; } @@ -1976,6 +1992,18 @@ panfrost_bind_shader_state( } } +static void * +panfrost_create_vs_state(struct pipe_context *pctx, const struct pipe_shader_state *hwcso) +{ + return panfrost_create_shader_state(pctx, hwcso, PIPE_SHADER_VERTEX); +} + +static void * +panfrost_create_fs_state(struct pipe_context *pctx, const struct pipe_shader_state *hwcso) +{ + return panfrost_create_shader_state(pctx, hwcso, PIPE_SHADER_FRAGMENT); +} + static void panfrost_bind_vs_state(struct pipe_context *pctx, void *hwcso) { @@ -2595,11 +2623,11 @@ panfrost_create_context(struct pipe_screen *screen, void *priv, unsigned flags) gallium->bind_vertex_elements_state = panfrost_bind_vertex_elements_state; gallium->delete_vertex_elements_state = panfrost_generic_cso_delete; - gallium->create_fs_state = panfrost_create_shader_state; + gallium->create_fs_state = panfrost_create_fs_state; gallium->delete_fs_state = panfrost_delete_shader_state; gallium->bind_fs_state = panfrost_bind_fs_state; - gallium->create_vs_state = panfrost_create_shader_state; + gallium->create_vs_state = panfrost_create_vs_state; gallium->delete_vs_state = panfrost_delete_shader_state; gallium->bind_vs_state = panfrost_bind_vs_state; diff --git a/src/gallium/drivers/panfrost/pan_screen.c b/src/gallium/drivers/panfrost/pan_screen.c index e237f36e491..ff71170524b 100644 --- a/src/gallium/drivers/panfrost/pan_screen.c +++ b/src/gallium/drivers/panfrost/pan_screen.c @@ -60,6 +60,7 @@ static const struct debug_named_value debug_options[] = { {"deqp", PAN_DBG_DEQP, "Hacks for dEQP"}, {"afbc", PAN_DBG_AFBC, "Enable non-conformant AFBC impl"}, {"sync", PAN_DBG_SYNC, "Wait for each job's completion and check for any GPU fault"}, + {"precompile", PAN_DBG_PRECOMPILE, "Precompile shaders for shader-db"}, DEBUG_NAMED_VALUE_END }; diff --git a/src/gallium/drivers/panfrost/pan_util.h b/src/gallium/drivers/panfrost/pan_util.h index b51b88d2e1a..c74e0fb7fd3 100644 --- a/src/gallium/drivers/panfrost/pan_util.h +++ b/src/gallium/drivers/panfrost/pan_util.h @@ -33,6 +33,7 @@ #define PAN_DBG_DEQP 0x0004 #define PAN_DBG_AFBC 0x0008 #define PAN_DBG_SYNC 0x0010 +#define PAN_DBG_PRECOMPILE 0x0020 extern int pan_debug; |