diff options
author | Alyssa Rosenzweig <[email protected]> | 2019-07-11 11:39:33 -0700 |
---|---|---|
committer | Alyssa Rosenzweig <[email protected]> | 2019-07-12 15:31:47 -0700 |
commit | 718ebfa2259cb50efc05541af205842b6630cf43 (patch) | |
tree | f43426200c5dda6a0e402357ba0f11908a2df50e /src/gallium | |
parent | 085004cc2caa4fd3db9fadf57f6004b11ef5866a (diff) |
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 <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/drivers/panfrost/pan_context.c | 20 |
1 files changed, 15 insertions, 5 deletions
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); } } |