zink: discard pending clears during blit/copy if we'll overwrite the data

these operations are redundant, so there's no point in forcing them through
since they'll never be visible

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9206>
This commit is contained in:
Mike Blumenkrantz 2020-09-17 09:21:07 -04:00 committed by Marge Bot
parent 031e3e68ee
commit a8e047e8f4
2 changed files with 5 additions and 3 deletions

View file

@ -38,7 +38,7 @@ blit_resolve(struct zink_context *ctx, const struct pipe_blit_info *info)
util_range_add(info->dst.resource, &dst->valid_buffer_range,
info->dst.box.x, info->dst.box.x + info->dst.box.width);
zink_fb_clears_apply(ctx, info->dst.resource);
zink_fb_clears_apply_or_discard(ctx, info->dst.resource, zink_rect_from_box(&info->dst.box), false);
zink_fb_clears_apply(ctx, info->src.resource);
struct zink_batch *batch = zink_batch_no_rp(ctx);
@ -120,7 +120,7 @@ blit_native(struct zink_context *ctx, const struct pipe_blit_info *info)
dst->format != zink_get_format(screen, info->dst.format))
return false;
zink_fb_clears_apply(ctx, info->dst.resource);
zink_fb_clears_apply_or_discard(ctx, info->dst.resource, zink_rect_from_box(&info->dst.box), false);
zink_fb_clears_apply(ctx, info->src.resource);
struct zink_batch *batch = zink_batch_no_rp(ctx);
zink_batch_reference_resource_rw(batch, src, false);
@ -213,6 +213,8 @@ zink_blit(struct pipe_context *pctx,
return;
}
zink_fb_clears_apply_or_discard(ctx, info->dst.resource, zink_rect_from_box(&info->dst.box), true);
if (info->dst.resource->target == PIPE_BUFFER)
util_range_add(info->dst.resource, &dst->valid_buffer_range,
info->dst.box.x, info->dst.box.x + info->dst.box.width);

View file

@ -1591,7 +1591,7 @@ zink_resource_copy_region(struct pipe_context *pctx,
} else
unreachable("planar formats not yet handled");
zink_fb_clears_apply(ctx, pdst);
zink_fb_clears_apply_or_discard(ctx, pdst, (struct u_rect){dstx, dstx + src_box->width, dsty, dsty + src_box->height}, false);
zink_fb_clears_apply(ctx, psrc);
region.srcSubresource.aspectMask = src->aspect;