From 5d0d8faaa641c7720b33a3d8e02c798fdd93af7b Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Wed, 15 Jul 2020 17:35:58 -0400 Subject: [PATCH] panfrost: Track surfaces drawn per-batch Signed-off-by: Alyssa Rosenzweig Part-of: --- src/gallium/drivers/panfrost/pan_cmdstream.c | 4 ++++ src/gallium/drivers/panfrost/pan_job.c | 7 ++++++- src/gallium/drivers/panfrost/pan_job.h | 3 +++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.c b/src/gallium/drivers/panfrost/pan_cmdstream.c index 8fecdde0066..6e31d9bc4b9 100644 --- a/src/gallium/drivers/panfrost/pan_cmdstream.c +++ b/src/gallium/drivers/panfrost/pan_cmdstream.c @@ -668,6 +668,7 @@ panfrost_frag_meta_blend_update(struct panfrost_context *ctx, struct mali_shader_meta *fragmeta, void *rts) { + struct panfrost_batch *batch = panfrost_get_batch_for_fbo(ctx); const struct panfrost_device *dev = pan_device(ctx->base.screen); struct panfrost_shader_state *fs; fs = panfrost_get_shader_state(ctx, PIPE_SHADER_FRAGMENT); @@ -749,6 +750,8 @@ panfrost_frag_meta_blend_update(struct panfrost_context *ctx, SET_BIT(fragmeta->unknown2_3, MALI_CAN_DISCARD, !blend[0].no_blending || fs->can_discard); + + batch->draws |= PIPE_CLEAR_COLOR0; return; } @@ -769,6 +772,7 @@ panfrost_frag_meta_blend_update(struct panfrost_context *ctx, if (ctx->pipe_framebuffer.nr_cbufs > i && !blend[i].no_colour) { flags = 0x200; + batch->draws |= (PIPE_CLEAR_COLOR0 << i); bool is_srgb = (ctx->pipe_framebuffer.nr_cbufs > i) && (ctx->pipe_framebuffer.cbufs[i]) && diff --git a/src/gallium/drivers/panfrost/pan_job.c b/src/gallium/drivers/panfrost/pan_job.c index f83cbeaf483..bc9dab58cf2 100644 --- a/src/gallium/drivers/panfrost/pan_job.c +++ b/src/gallium/drivers/panfrost/pan_job.c @@ -1182,8 +1182,13 @@ panfrost_batch_set_requirements(struct panfrost_batch *batch) if (ctx->rasterizer && ctx->rasterizer->base.multisample) batch->requirements |= PAN_REQ_MSAA; - if (ctx->depth_stencil && ctx->depth_stencil->depth.writemask) + if (ctx->depth_stencil && ctx->depth_stencil->depth.writemask) { batch->requirements |= PAN_REQ_DEPTH_WRITE; + batch->draws |= PIPE_CLEAR_DEPTH; + } + + if (ctx->depth_stencil && ctx->depth_stencil->stencil[0].enabled) + batch->draws |= PIPE_CLEAR_STENCIL; } void diff --git a/src/gallium/drivers/panfrost/pan_job.h b/src/gallium/drivers/panfrost/pan_job.h index b5f639894e0..409644d2cfd 100644 --- a/src/gallium/drivers/panfrost/pan_job.h +++ b/src/gallium/drivers/panfrost/pan_job.h @@ -75,6 +75,9 @@ struct panfrost_batch { /* Buffers cleared (PIPE_CLEAR_* bitmask) */ unsigned clear; + /* Buffers drawn */ + unsigned draws; + /* Packed clear values, indexed by both render target as well as word. * Essentially, a single pixel is packed, with some padding to bring it * up to a 32-bit interval; that pixel is then duplicated over to fill -- 2.30.2