anv: Propagate protected information to blorp_batch_isl_copy_usage()

This fixes protected tests that uses vkCmdCopyBuffer().

Cc: mesa-stable
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30369>
This commit is contained in:
José Roberto de Souza
2024-07-26 09:07:15 -07:00
committed by Marge Bot
parent 79f95a3711
commit 5fdacb56ed
2 changed files with 16 additions and 6 deletions

View File

@@ -148,14 +148,22 @@ void blorp_batch_init(struct blorp_context *blorp, struct blorp_batch *batch,
void blorp_batch_finish(struct blorp_batch *batch);
static inline isl_surf_usage_flags_t
blorp_batch_isl_copy_usage(const struct blorp_batch *batch, bool is_dest)
blorp_batch_isl_copy_usage(const struct blorp_batch *batch, bool is_dest,
bool _protected)
{
isl_surf_usage_flags_t usage;
if (batch->flags & BLORP_BATCH_USE_COMPUTE)
return is_dest ? ISL_SURF_USAGE_STORAGE_BIT : ISL_SURF_USAGE_TEXTURE_BIT;
usage = is_dest ? ISL_SURF_USAGE_STORAGE_BIT : ISL_SURF_USAGE_TEXTURE_BIT;
else if (batch->flags & BLORP_BATCH_USE_BLITTER)
return is_dest ? ISL_SURF_USAGE_BLITTER_DST_BIT : ISL_SURF_USAGE_BLITTER_SRC_BIT;
usage = is_dest ? ISL_SURF_USAGE_BLITTER_DST_BIT : ISL_SURF_USAGE_BLITTER_SRC_BIT;
else
return is_dest ? ISL_SURF_USAGE_RENDER_TARGET_BIT : ISL_SURF_USAGE_TEXTURE_BIT;
usage = is_dest ? ISL_SURF_USAGE_RENDER_TARGET_BIT : ISL_SURF_USAGE_TEXTURE_BIT;
if (_protected)
usage |= ISL_SURF_USAGE_PROTECTED_BIT;
return usage;
}
struct blorp_address {

View File

@@ -1043,13 +1043,15 @@ copy_buffer(struct anv_device *device,
.buffer = src_buffer->address.bo,
.offset = src_buffer->address.offset + region->srcOffset,
.mocs = anv_mocs(device, src_buffer->address.bo,
blorp_batch_isl_copy_usage(batch, false /* is_dest */)),
blorp_batch_isl_copy_usage(batch, false /* is_dest */,
anv_buffer_is_protected(src_buffer))),
};
struct blorp_address dst = {
.buffer = dst_buffer->address.bo,
.offset = dst_buffer->address.offset + region->dstOffset,
.mocs = anv_mocs(device, dst_buffer->address.bo,
blorp_batch_isl_copy_usage(batch, true /* is_dest */)),
blorp_batch_isl_copy_usage(batch, true /* is_dest */,
anv_buffer_is_protected(dst_buffer))),
};
blorp_buffer_copy(batch, src, dst, region->size);