panfrost: Drop blend indirection
We don't need to ralloc/memcpy/free, we can emit all at once when we have proper write ordering gaurantees. Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6476>
This commit is contained in:

committed by
Marge Bot

parent
87e35102dd
commit
45c59db732
@@ -719,7 +719,6 @@ panfrost_emit_frag_shader_meta(struct panfrost_batch *batch)
|
|||||||
|
|
||||||
struct panfrost_device *dev = pan_device(ctx->base.screen);
|
struct panfrost_device *dev = pan_device(ctx->base.screen);
|
||||||
unsigned rt_count = MAX2(ctx->pipe_framebuffer.nr_cbufs, 1);
|
unsigned rt_count = MAX2(ctx->pipe_framebuffer.nr_cbufs, 1);
|
||||||
void *rts = NULL;
|
|
||||||
struct panfrost_transfer xfer;
|
struct panfrost_transfer xfer;
|
||||||
unsigned rt_size;
|
unsigned rt_size;
|
||||||
|
|
||||||
@@ -731,28 +730,19 @@ panfrost_emit_frag_shader_meta(struct panfrost_batch *batch)
|
|||||||
rt_size = sizeof(struct midgard_blend_rt);
|
rt_size = sizeof(struct midgard_blend_rt);
|
||||||
|
|
||||||
unsigned desc_size = MALI_STATE_LENGTH + rt_size * rt_count;
|
unsigned desc_size = MALI_STATE_LENGTH + rt_size * rt_count;
|
||||||
|
xfer = panfrost_pool_alloc_aligned(&batch->pool, desc_size, MALI_STATE_LENGTH);
|
||||||
if (rt_size)
|
|
||||||
rts = rzalloc_size(ctx, rt_size * rt_count);
|
|
||||||
|
|
||||||
struct panfrost_blend_final blend[PIPE_MAX_COLOR_BUFS];
|
struct panfrost_blend_final blend[PIPE_MAX_COLOR_BUFS];
|
||||||
|
|
||||||
for (unsigned c = 0; c < ctx->pipe_framebuffer.nr_cbufs; ++c)
|
for (unsigned c = 0; c < ctx->pipe_framebuffer.nr_cbufs; ++c)
|
||||||
blend[c] = panfrost_get_blend_for_context(ctx, c);
|
blend[c] = panfrost_get_blend_for_context(ctx, c);
|
||||||
|
|
||||||
if (!(dev->quirks & MIDGARD_SFBD))
|
|
||||||
panfrost_emit_blend(batch, rts, blend);
|
|
||||||
else
|
|
||||||
batch->draws |= PIPE_CLEAR_COLOR0;
|
|
||||||
|
|
||||||
xfer = panfrost_pool_alloc_aligned(&batch->pool, desc_size, MALI_STATE_LENGTH);
|
|
||||||
|
|
||||||
panfrost_emit_frag_shader(ctx, (struct mali_state_packed *) xfer.cpu, blend);
|
panfrost_emit_frag_shader(ctx, (struct mali_state_packed *) xfer.cpu, blend);
|
||||||
|
|
||||||
memcpy(xfer.cpu + MALI_STATE_LENGTH, rts, rt_size * rt_count);
|
if (!(dev->quirks & MIDGARD_SFBD))
|
||||||
|
panfrost_emit_blend(batch, xfer.cpu + MALI_STATE_LENGTH, blend);
|
||||||
if (rt_size)
|
else
|
||||||
ralloc_free(rts);
|
batch->draws |= PIPE_CLEAR_COLOR0;
|
||||||
|
|
||||||
return xfer.gpu;
|
return xfer.gpu;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user