From 5fdacb56ed22406a3628e506ebb00ec136f15c2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Roberto=20de=20Souza?= Date: Fri, 26 Jul 2024 09:07:15 -0700 Subject: [PATCH] anv: Propagate protected information to blorp_batch_isl_copy_usage() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes protected tests that uses vkCmdCopyBuffer(). Cc: mesa-stable Reviewed-by: Lionel Landwerlin Signed-off-by: José Roberto de Souza Part-of: --- src/intel/blorp/blorp.h | 16 ++++++++++++---- src/intel/vulkan/anv_blorp.c | 6 ++++-- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/intel/blorp/blorp.h b/src/intel/blorp/blorp.h index 3d29d1617d0..2d01fbcb0da 100644 --- a/src/intel/blorp/blorp.h +++ b/src/intel/blorp/blorp.h @@ -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 { diff --git a/src/intel/vulkan/anv_blorp.c b/src/intel/vulkan/anv_blorp.c index 8751dc044be..09f4551af6b 100644 --- a/src/intel/vulkan/anv_blorp.c +++ b/src/intel/vulkan/anv_blorp.c @@ -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);