panfrost: Bake the initial tag into the shader pointer
No need to do this at draw-time. Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6440>
This commit is contained in:
committed by
Tomeu Vizoso
parent
606f05b9ab
commit
9f83217bc8
@@ -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);
|
||||
|
||||
@@ -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];
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user