From: Alyssa Rosenzweig Date: Wed, 19 Aug 2020 14:13:59 +0000 (-0400) Subject: panfrost: Bake the initial tag into the shader pointer X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9f83217bc8c1561cb8e5d3941ebce9e9a61ee769;p=mesa.git panfrost: Bake the initial tag into the shader pointer No need to do this at draw-time. Signed-off-by: Alyssa Rosenzweig Reviewed-by: Tomeu Vizoso Part-of: --- diff --git a/src/gallium/drivers/panfrost/pan_assemble.c b/src/gallium/drivers/panfrost/pan_assemble.c index 7a7200da425..461f4b06a10 100644 --- a/src/gallium/drivers/panfrost/pan_assemble.c +++ b/src/gallium/drivers/panfrost/pan_assemble.c @@ -146,7 +146,6 @@ panfrost_shader_compile(struct panfrost_context *ctx, uint64_t *outputs_written) { struct panfrost_device *dev = pan_device(ctx->base.screen); - uint8_t *dst; nir_shader *s; @@ -172,21 +171,22 @@ panfrost_shader_compile(struct panfrost_context *ctx, /* Prepare the compiled binary for upload */ int size = program.compiled.size; - dst = program.compiled.data; - - /* Upload the shader. The lookahead tag is ORed on as a tagged pointer. - * I bet someone just thought that would be a cute pun. At least, - * that's how I'd do it. */ if (size) { state->bo = panfrost_bo_create(dev, size, PAN_BO_EXECUTE); - memcpy(state->bo->cpu, dst, size); + memcpy(state->bo->cpu, program.compiled.data, size); + state->shader = state->bo->gpu; } + /* Midgard needs the first tag on the bottom nibble */ + if (!(dev->quirks & IS_BIFROST)) { - /* If size = 0, no shader. Use dummy tag to avoid - * INSTR_INVALID_ENC */ - state->first_tag = size ? program.first_tag : 1; + /* If size = 0, we tag as "end-of-shader" */ + + if (size) + state->shader |= program.first_tag; + else + state->shader = 0x1; } util_dynarray_fini(&program.compiled); diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.c b/src/gallium/drivers/panfrost/pan_cmdstream.c index 155f480f18e..45465a5413e 100644 --- a/src/gallium/drivers/panfrost/pan_cmdstream.c +++ b/src/gallium/drivers/panfrost/pan_cmdstream.c @@ -315,7 +315,7 @@ panfrost_shader_meta_init(struct panfrost_context *ctx, struct panfrost_shader_state *ss = panfrost_get_shader_state(ctx, st); memset(meta, 0, sizeof(*meta)); - meta->shader = (ss->bo ? ss->bo->gpu : 0) | ss->first_tag; + meta->shader = ss->shader; meta->attribute_count = ss->attribute_count; meta->varying_count = ss->varying_count; meta->texture_count = ctx->sampler_view_count[st]; diff --git a/src/gallium/drivers/panfrost/pan_context.h b/src/gallium/drivers/panfrost/pan_context.h index 6e655b3d472..fee465fb727 100644 --- a/src/gallium/drivers/panfrost/pan_context.h +++ b/src/gallium/drivers/panfrost/pan_context.h @@ -221,7 +221,9 @@ struct panfrost_shader_state { /* Should we enable helper invocations */ bool helper_invocations; - unsigned first_tag; + /* Pointer to GPU-executable memory formatted for the hardware. bo->gpu + * on Bifrost, bo->gpu | initial_tag on Midgard */ + mali_ptr shader; struct panfrost_bo *bo; BITSET_WORD outputs_read;