freedreno/a6xx: Also validate format in blitter path

Since we can be blitting using a format that is different from the
resource's native format, we also need to validate and demote if
necessary, similar to sampler-views, image-views, and fb state.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11371>
This commit is contained in:
Rob Clark 2021-06-13 13:34:27 -07:00 committed by Marge Bot
parent b97e3bb2e1
commit de91d07927
1 changed files with 11 additions and 5 deletions

View File

@ -906,12 +906,18 @@ handle_rgba_blit(struct fd_context *ctx,
if (!can_do_blit(info))
return false;
struct fd_resource *src = fd_resource(info->src.resource);
struct fd_resource *dst = fd_resource(info->dst.resource);
fd6_validate_format(ctx, src, info->src.format);
fd6_validate_format(ctx, dst, info->dst.format);
batch = fd_bc_alloc_batch(&ctx->screen->batch_cache, ctx, true);
fd_screen_lock(ctx->screen);
fd_batch_resource_read(batch, fd_resource(info->src.resource));
fd_batch_resource_write(batch, fd_resource(info->dst.resource));
fd_batch_resource_read(batch, src);
fd_batch_resource_write(batch, dst);
fd_screen_unlock(ctx->screen);
@ -937,8 +943,8 @@ handle_rgba_blit(struct fd_context *ctx,
if ((info->src.resource->target == PIPE_BUFFER) &&
(info->dst.resource->target == PIPE_BUFFER)) {
assert(fd_resource(info->src.resource)->layout.tile_mode == TILE6_LINEAR);
assert(fd_resource(info->dst.resource)->layout.tile_mode == TILE6_LINEAR);
assert(src->layout.tile_mode == TILE6_LINEAR);
assert(dst->layout.tile_mode == TILE6_LINEAR);
emit_blit_buffer(ctx, batch->draw, info);
} else {
/* I don't *think* we need to handle blits between buffer <-> !buffer */
@ -956,7 +962,7 @@ handle_rgba_blit(struct fd_context *ctx,
fd_batch_unlock_submit(batch);
fd_resource(info->dst.resource)->valid = true;
dst->valid = true;
fd_batch_flush(batch);
fd_batch_reference(&batch, NULL);