diff --git a/.pick_status.json b/.pick_status.json index a81695c3e53..cd5ac37f406 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -934,7 +934,7 @@ "description": "panfrost: add can_discard flag to pan_legalize_afbc_format", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "33b48a55857b15f7e7b892a89cad2f0ad2399ba6", "notes": null diff --git a/src/gallium/drivers/panfrost/pan_blit.c b/src/gallium/drivers/panfrost/pan_blit.c index 8347c0cdaee..1933c818ef5 100644 --- a/src/gallium/drivers/panfrost/pan_blit.c +++ b/src/gallium/drivers/panfrost/pan_blit.c @@ -106,11 +106,11 @@ panfrost_blit(struct pipe_context *pipe, const struct pipe_blit_info *info) /* Legalize here because it could trigger a recursive blit otherwise */ struct panfrost_resource *src = pan_resource(info->src.resource); enum pipe_format src_view_format = util_format_linear(info->src.format); - pan_legalize_afbc_format(ctx, src, src_view_format, false); + pan_legalize_afbc_format(ctx, src, src_view_format, false, false); struct panfrost_resource *dst = pan_resource(info->dst.resource); enum pipe_format dst_view_format = util_format_linear(info->dst.format); - pan_legalize_afbc_format(ctx, dst, dst_view_format, true); + pan_legalize_afbc_format(ctx, dst, dst_view_format, true, false); panfrost_blit_no_afbc_legalization(pipe, info); } diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.c b/src/gallium/drivers/panfrost/pan_cmdstream.c index a2feed16efa..2930a546d51 100644 --- a/src/gallium/drivers/panfrost/pan_cmdstream.c +++ b/src/gallium/drivers/panfrost/pan_cmdstream.c @@ -3374,7 +3374,7 @@ panfrost_create_sampler_view(struct pipe_context *pctx, rzalloc(pctx, struct panfrost_sampler_view); pan_legalize_afbc_format(ctx, pan_resource(texture), template->format, - false); + false, false); pipe_reference(NULL, &texture->reference); diff --git a/src/gallium/drivers/panfrost/pan_job.c b/src/gallium/drivers/panfrost/pan_job.c index d322a0741b9..26f9be55060 100644 --- a/src/gallium/drivers/panfrost/pan_job.c +++ b/src/gallium/drivers/panfrost/pan_job.c @@ -65,7 +65,7 @@ panfrost_batch_add_surface(struct panfrost_batch *batch, { if (surf) { struct panfrost_resource *rsrc = pan_resource(surf->texture); - pan_legalize_afbc_format(batch->ctx, rsrc, surf->format, true); + pan_legalize_afbc_format(batch->ctx, rsrc, surf->format, true, false); panfrost_batch_write_rsrc(batch, rsrc, PIPE_SHADER_FRAGMENT); } } diff --git a/src/gallium/drivers/panfrost/pan_resource.c b/src/gallium/drivers/panfrost/pan_resource.c index ef9367bfd1d..2d59c7c7a7f 100644 --- a/src/gallium/drivers/panfrost/pan_resource.c +++ b/src/gallium/drivers/panfrost/pan_resource.c @@ -1378,7 +1378,7 @@ pan_resource_modifier_convert(struct panfrost_context *ctx, void pan_legalize_afbc_format(struct panfrost_context *ctx, struct panfrost_resource *rsrc, - enum pipe_format format, bool write) + enum pipe_format format, bool write, bool discard) { struct panfrost_device *dev = pan_device(ctx->base.screen); @@ -1388,7 +1388,7 @@ pan_legalize_afbc_format(struct panfrost_context *ctx, if (panfrost_afbc_format(dev->arch, rsrc->base.format) != panfrost_afbc_format(dev->arch, format)) { pan_resource_modifier_convert( - ctx, rsrc, DRM_FORMAT_MOD_ARM_16X16_BLOCK_U_INTERLEAVED, true, + ctx, rsrc, DRM_FORMAT_MOD_ARM_16X16_BLOCK_U_INTERLEAVED, !discard, "Reinterpreting AFBC surface as incompatible format"); return; } @@ -1396,7 +1396,7 @@ pan_legalize_afbc_format(struct panfrost_context *ctx, if (write && (rsrc->image.layout.modifier & AFBC_FORMAT_MOD_SPARSE) == 0) pan_resource_modifier_convert( ctx, rsrc, rsrc->image.layout.modifier | AFBC_FORMAT_MOD_SPARSE, - true, "Legalizing resource to allow writing"); + !discard, "Legalizing resource to allow writing"); } static bool diff --git a/src/gallium/drivers/panfrost/pan_resource.h b/src/gallium/drivers/panfrost/pan_resource.h index 5a5e35f8f0c..570b2a99c44 100644 --- a/src/gallium/drivers/panfrost/pan_resource.h +++ b/src/gallium/drivers/panfrost/pan_resource.h @@ -194,7 +194,8 @@ void pan_resource_modifier_convert(struct panfrost_context *ctx, void pan_legalize_afbc_format(struct panfrost_context *ctx, struct panfrost_resource *rsrc, - enum pipe_format format, bool write); + enum pipe_format format, bool write, + bool discard); void pan_dump_resource(struct panfrost_context *ctx, struct panfrost_resource *rsc);