panfrost: legalize afbc before zs and rt clears
In panfrost_clear_depth_stencil and panfrost_clear_render_target, we
start the blit context before binding the clear targets. If we don't
legalize AFBC beforehand, we get a recursive blit crash. panfrost_clear
does not need this because the resource should already be legalized in
panfrost_batch_add_surface.
Fixes the following piglit tests with pan_force_afbc_packing:
- spec@arb_clear_texture@arb_clear_texture-base-formats
- spec@arb_clear_texture@arb_clear_texture-simple
- spec@arb_clear_texture@arb_clear_texture-sized-formats
Fixes: 17a62ff993 ("panfrost: legalize afbc before blitting")
Signed-off-by: Olivia Lee <olivia.lee@collabora.com>
Reviewed-by: Eric R. Smith <eric.smith@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34992>
This commit is contained in:
@@ -70,6 +70,11 @@ panfrost_clear_depth_stencil(struct pipe_context *pipe,
|
||||
if (render_condition_enabled && !panfrost_render_condition_check(ctx))
|
||||
return;
|
||||
|
||||
/* Legalize here because it could trigger a recursive blit otherwise */
|
||||
struct panfrost_resource *rdst = pan_resource(dst->texture);
|
||||
enum pipe_format dst_view_format = util_format_linear(dst->format);
|
||||
pan_legalize_format(ctx, rdst, dst_view_format, true, false);
|
||||
|
||||
panfrost_blitter_save(
|
||||
ctx, render_condition_enabled ? PAN_RENDER_COND : PAN_RENDER_BASE);
|
||||
util_blitter_clear_depth_stencil(ctx->blitter, dst, clear_flags, depth,
|
||||
@@ -88,6 +93,11 @@ panfrost_clear_render_target(struct pipe_context *pipe,
|
||||
if (render_condition_enabled && !panfrost_render_condition_check(ctx))
|
||||
return;
|
||||
|
||||
/* Legalize here because it could trigger a recursive blit otherwise */
|
||||
struct panfrost_resource *rdst = pan_resource(dst->texture);
|
||||
enum pipe_format dst_view_format = util_format_linear(dst->format);
|
||||
pan_legalize_format(ctx, rdst, dst_view_format, true, false);
|
||||
|
||||
panfrost_blitter_save(
|
||||
ctx, (render_condition_enabled ? PAN_RENDER_COND : PAN_RENDER_BASE) | PAN_SAVE_FRAGMENT_CONSTANT);
|
||||
util_blitter_clear_render_target(ctx->blitter, dst, color, dstx, dsty, width,
|
||||
|
||||
@@ -137,6 +137,9 @@ enum {
|
||||
PAN_RENDER_CLEAR = PAN_SAVE_FRAGMENT_STATE | PAN_SAVE_FRAGMENT_CONSTANT,
|
||||
};
|
||||
|
||||
/* Callers should ensure that all AFBC/AFRC resources that will be used in the
|
||||
* blit operation are legalized before calling blitter operations, otherwise
|
||||
* we may trigger a recursive blit */
|
||||
void panfrost_blitter_save(struct panfrost_context *ctx,
|
||||
const enum panfrost_blitter_op blitter_op);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user