From: Alyssa Rosenzweig Date: Thu, 11 Jul 2019 18:39:33 +0000 (-0700) Subject: panfrost: Don't upload vertex/tiler twice X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=718ebfa2259cb50efc05541af205842b6630cf43;p=mesa.git panfrost: Don't upload vertex/tiler twice The latter upload is correct, but the former upload is unassociated with any particular FBO and therefore becomes orphaned. We do have to upload at draw-time at the latest, if we haven't by then. Signed-off-by: Alyssa Rosenzweig --- diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c index f9b11b691da..d48747bbc61 100644 --- a/src/gallium/drivers/panfrost/pan_context.c +++ b/src/gallium/drivers/panfrost/pan_context.c @@ -223,8 +223,15 @@ panfrost_attach_vt_sfbd(struct panfrost_context *ctx) } static void -panfrost_attach_vt_framebuffer(struct panfrost_context *ctx) +panfrost_attach_vt_framebuffer(struct panfrost_context *ctx, bool skippable) { + /* Skip the attach if we can */ + + if (skippable && ctx->payload_vertex.postfix.framebuffer) { + assert(ctx->payload_tiler.postfix.framebuffer); + return; + } + mali_ptr framebuffer = ctx->require_sfbd ? panfrost_attach_vt_sfbd(ctx) : panfrost_attach_vt_mfbd(ctx); @@ -251,6 +258,10 @@ panfrost_invalidate_frame(struct panfrost_context *ctx) else ctx->vt_framebuffer_mfbd = panfrost_emit_mfbd(ctx, ~0); + /* The reference is now invalid */ + ctx->payload_vertex.postfix.framebuffer = 0; + ctx->payload_tiler.postfix.framebuffer = 0; + /* Reset varyings allocated */ ctx->varying_height = 0; @@ -260,9 +271,6 @@ panfrost_invalidate_frame(struct panfrost_context *ctx) ctx->transient_pools[ctx->cmdstream_i].entry_index = 0; ctx->transient_pools[ctx->cmdstream_i].entry_offset = 0; - /* Regenerate payloads */ - panfrost_attach_vt_framebuffer(ctx); - if (ctx->rasterizer) ctx->dirty |= PAN_DIRTY_RASTERIZER; @@ -997,6 +1005,8 @@ panfrost_emit_for_draw(struct panfrost_context *ctx, bool with_vertex_data) { struct panfrost_job *job = panfrost_get_job_for_fbo(ctx); + panfrost_attach_vt_framebuffer(ctx, true); + if (with_vertex_data) { panfrost_emit_vertex_data(job); @@ -2374,7 +2384,7 @@ panfrost_set_framebuffer_state(struct pipe_context *pctx, else ctx->vt_framebuffer_mfbd = panfrost_emit_mfbd(ctx, ~0); - panfrost_attach_vt_framebuffer(ctx); + panfrost_attach_vt_framebuffer(ctx, false); } }