From e5c77cbead98cfed0cd84723c7cac8796a2bfa66 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Tue, 25 Aug 2020 13:37:22 -0400 Subject: [PATCH] panfrost: Detangle postfix from varying emits Signed-off-by: Alyssa Rosenzweig Part-of: --- src/gallium/drivers/panfrost/pan_cmdstream.c | 20 ++++++++++---------- src/gallium/drivers/panfrost/pan_cmdstream.h | 8 +++++--- src/gallium/drivers/panfrost/pan_context.c | 11 +++++++++-- 3 files changed, 24 insertions(+), 15 deletions(-) diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.c b/src/gallium/drivers/panfrost/pan_cmdstream.c index a11290187e2..229394599b7 100644 --- a/src/gallium/drivers/panfrost/pan_cmdstream.c +++ b/src/gallium/drivers/panfrost/pan_cmdstream.c @@ -1694,9 +1694,11 @@ pan_emit_special_input(struct mali_attribute_buffer_packed *out, void panfrost_emit_varying_descriptor(struct panfrost_batch *batch, unsigned vertex_count, - struct mali_vertex_tiler_postfix *vertex_postfix, - struct mali_vertex_tiler_postfix *tiler_postfix, - union midgard_primitive_size *primitive_size) + mali_ptr *vs_attribs, + mali_ptr *fs_attribs, + mali_ptr *buffers, + mali_ptr *position, + mali_ptr *psiz) { /* Load the shaders */ struct panfrost_context *ctx = batch->ctx; @@ -1782,12 +1784,12 @@ panfrost_emit_varying_descriptor(struct panfrost_batch *batch, gen_stride, vertex_count); /* fp32 vec4 gl_Position */ - tiler_postfix->position_varying = panfrost_emit_varyings(batch, + *position = panfrost_emit_varyings(batch, &varyings[pan_varying_index(present, PAN_VARY_POSITION)], sizeof(float) * 4, vertex_count); if (present & (1 << PAN_VARY_PSIZ)) { - primitive_size->pointer = panfrost_emit_varyings(batch, + *psiz = panfrost_emit_varyings(batch, &varyings[pan_varying_index(present, PAN_VARY_PSIZ)], 2, vertex_count); } @@ -1796,11 +1798,9 @@ panfrost_emit_varying_descriptor(struct panfrost_batch *batch, pan_emit_special_input(varyings, present, PAN_VARY_FACE, MALI_ATTRIBUTE_SPECIAL_FRONT_FACING); pan_emit_special_input(varyings, present, PAN_VARY_FRAGCOORD, MALI_ATTRIBUTE_SPECIAL_FRAG_COORD); - vertex_postfix->varyings = T.gpu; - tiler_postfix->varyings = T.gpu; - - vertex_postfix->varying_meta = trans.gpu; - tiler_postfix->varying_meta = trans.gpu + vs_size; + *buffers = T.gpu; + *vs_attribs = trans.gpu; + *fs_attribs = trans.gpu + vs_size; } void diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.h b/src/gallium/drivers/panfrost/pan_cmdstream.h index 1f390024767..371188d818e 100644 --- a/src/gallium/drivers/panfrost/pan_cmdstream.h +++ b/src/gallium/drivers/panfrost/pan_cmdstream.h @@ -79,9 +79,11 @@ panfrost_get_index_buffer_bounded(struct panfrost_context *ctx, void panfrost_emit_varying_descriptor(struct panfrost_batch *batch, unsigned vertex_count, - struct mali_vertex_tiler_postfix *vertex_postfix, - struct mali_vertex_tiler_postfix *tiler_postfix, - union midgard_primitive_size *primitive_size); + mali_ptr *vs_attribs, + mali_ptr *fs_attribs, + mali_ptr *buffers, + mali_ptr *position, + mali_ptr *psiz); void panfrost_emit_vertex_tiler_jobs(struct panfrost_batch *batch, diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c index 7b433a51d77..58f08fae0ea 100644 --- a/src/gallium/drivers/panfrost/pan_context.c +++ b/src/gallium/drivers/panfrost/pan_context.c @@ -391,14 +391,20 @@ panfrost_draw_vbo( /* Emit all sort of descriptors. */ mali_ptr push_vert = 0, push_frag = 0, attribs = 0; + mali_ptr varyings = 0, vs_vary = 0, fs_vary = 0, pos = 0, psiz = 0; vertex_postfix.attribute_meta = panfrost_emit_vertex_data(batch, &attribs); vertex_postfix.attributes = attribs; panfrost_emit_varying_descriptor(batch, ctx->padded_count * ctx->instance_count, - &vertex_postfix, &tiler_postfix, - &primitive_size); + &vs_vary, &fs_vary, &varyings, + &pos, &psiz); + vertex_postfix.varyings = varyings; + tiler_postfix.varyings = varyings; + vertex_postfix.varying_meta = vs_vary; + tiler_postfix.varying_meta = fs_vary; + tiler_postfix.position_varying = pos; vertex_postfix.sampler_descriptor = panfrost_emit_sampler_descriptors(batch, PIPE_SHADER_VERTEX); tiler_postfix.sampler_descriptor = panfrost_emit_sampler_descriptors(batch, PIPE_SHADER_FRAGMENT); vertex_postfix.textures = panfrost_emit_texture_descriptors(batch, PIPE_SHADER_VERTEX); @@ -412,6 +418,7 @@ panfrost_draw_vbo( vertex_postfix.shader = panfrost_emit_compute_shader_meta(batch, PIPE_SHADER_VERTEX); tiler_postfix.shader = panfrost_emit_frag_shader_meta(batch); + primitive_size.pointer = psiz; panfrost_vt_update_primitive_size(ctx, &tiler_prefix, &primitive_size); /* Fire off the draw itself */ -- 2.30.2