mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 09:18:04 +02:00
radv: set TMZ bit in sdma_copy packet
Pass secure and set TMZ bit in sdma_copy packet for protected image Signed-off-by: Julia Zhang <Julia.Zhang@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40619>
This commit is contained in:
parent
bfc54d444d
commit
0e36d7112c
5 changed files with 18 additions and 7 deletions
|
|
@ -34,6 +34,7 @@ struct ac_sdma_surf {
|
|||
} offset;
|
||||
|
||||
bool is_compressed;
|
||||
bool is_secure;
|
||||
|
||||
/* Linear */
|
||||
struct {
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@
|
|||
|
||||
#include "radv_cs.h"
|
||||
|
||||
#include "vk_command_pool.h"
|
||||
|
||||
struct fill_constants {
|
||||
uint64_t addr;
|
||||
uint32_t max_offset;
|
||||
|
|
@ -361,7 +363,8 @@ radv_copy_memory(struct radv_cmd_buffer *cmd_buffer, uint64_t src_va, uint64_t d
|
|||
radv_prefer_compute_or_cp_dma(device, size, src_copy_flags, dst_copy_flags));
|
||||
|
||||
if (cmd_buffer->qf == RADV_QUEUE_TRANSFER) {
|
||||
radv_sdma_copy_memory(device, cmd_buffer->cs, src_va, dst_va, size);
|
||||
radv_sdma_copy_memory(device, cmd_buffer->cs, src_va, dst_va, size,
|
||||
cmd_buffer->vk.pool->flags & VK_COMMAND_POOL_CREATE_PROTECTED_BIT);
|
||||
} else if (use_compute) {
|
||||
radv_compute_copy_memory(cmd_buffer, src_va, dst_va, size);
|
||||
} else if (size) {
|
||||
|
|
|
|||
|
|
@ -117,6 +117,7 @@ radv_sdma_get_buf_surf(const struct radv_image *const image, const VkDeviceMemor
|
|||
.pitch = pitch,
|
||||
.slice_pitch = slice_pitch,
|
||||
.bpp = bpe,
|
||||
.is_secure = image->vk.create_flags & VK_IMAGE_CREATE_PROTECTED_BIT,
|
||||
};
|
||||
|
||||
return info;
|
||||
|
|
@ -151,6 +152,7 @@ radv_sdma_get_surf(struct radv_cmd_buffer *cmd_buffer, const struct radv_image *
|
|||
.first_level = subresource.mipLevel,
|
||||
.num_levels = image->vk.mip_levels,
|
||||
.is_stencil = subresource.aspectMask == VK_IMAGE_ASPECT_STENCIL_BIT,
|
||||
.is_secure = image->vk.create_flags & VK_IMAGE_CREATE_PROTECTED_BIT,
|
||||
};
|
||||
|
||||
info.offset.x = offset.x * radv_sdma_get_texel_scale(image);
|
||||
|
|
@ -214,13 +216,13 @@ radv_sdma_emit_nop(const struct radv_device *device, struct radv_cmd_stream *cs)
|
|||
|
||||
void
|
||||
radv_sdma_copy_memory(const struct radv_device *device, struct radv_cmd_stream *cs, uint64_t src_va, uint64_t dst_va,
|
||||
uint64_t size)
|
||||
uint64_t size, bool tmz)
|
||||
{
|
||||
const struct radv_physical_device *pdev = radv_device_physical(device);
|
||||
|
||||
while (size > 0) {
|
||||
radeon_check_space(device->ws, cs->b, 7);
|
||||
uint64_t bytes_written = ac_emit_sdma_copy_linear(cs->b, pdev->info.sdma_ip_version, src_va, dst_va, size, false);
|
||||
uint64_t bytes_written = ac_emit_sdma_copy_linear(cs->b, pdev->info.sdma_ip_version, src_va, dst_va, size, tmz);
|
||||
|
||||
size -= bytes_written;
|
||||
src_va += bytes_written;
|
||||
|
|
@ -261,10 +263,12 @@ radv_sdma_emit_copy_tiled_sub_window(const struct radv_device *device, struct ra
|
|||
const VkExtent3D extent, const bool detile)
|
||||
{
|
||||
const struct radv_physical_device *pdev = radv_device_physical(device);
|
||||
bool tmz = tiled->is_secure;
|
||||
assert(!tmz || linear->is_secure);
|
||||
|
||||
radeon_check_space(device->ws, cs->b, 17);
|
||||
ac_emit_sdma_copy_tiled_sub_window(cs->b, &pdev->info, linear, tiled, detile, extent.width, extent.height,
|
||||
extent.depth, false);
|
||||
extent.depth, tmz);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -325,6 +329,9 @@ radv_sdma_copy_buffer_image_unaligned(const struct radv_device *device, struct r
|
|||
.slice_pitch = info.aligned_row_pitch * info.extent_vertical_blocks,
|
||||
};
|
||||
|
||||
bool tmz = buf->is_secure;
|
||||
assert(!tmz || img_in->is_secure);
|
||||
|
||||
VkExtent3D extent = base_extent;
|
||||
extent.depth = 1;
|
||||
|
||||
|
|
@ -355,7 +362,7 @@ radv_sdma_copy_buffer_image_unaligned(const struct radv_device *device, struct r
|
|||
const uint64_t buf_va = buf->va + slice * buf->slice_pitch * img.bpp + (row + r) * buf->pitch * img.bpp;
|
||||
const uint64_t tmp_va = tmp.va + r * info.aligned_row_pitch * img.bpp;
|
||||
radv_sdma_copy_memory(device, cs, to_image ? buf_va : tmp_va, to_image ? tmp_va : buf_va,
|
||||
info.extent_horizontal_blocks * img.bpp);
|
||||
info.extent_horizontal_blocks * img.bpp, tmz);
|
||||
}
|
||||
|
||||
/* Wait for the copy to finish. */
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ void radv_sdma_copy_image_t2t_scanline(const struct radv_device *device, struct
|
|||
const struct ac_sdma_surf *src, const struct ac_sdma_surf *dst,
|
||||
const VkExtent3D extent, struct radeon_winsys_bo *temp_bo);
|
||||
void radv_sdma_copy_memory(const struct radv_device *device, struct radv_cmd_stream *cs, uint64_t src_va,
|
||||
uint64_t dst_va, uint64_t size);
|
||||
uint64_t dst_va, uint64_t size, bool tmz);
|
||||
void radv_sdma_fill_memory(const struct radv_device *device, struct radv_cmd_stream *cs, const uint64_t va,
|
||||
const uint64_t size, const uint32_t value);
|
||||
bool radv_sdma_supports_image(const struct radv_device *device, const struct radv_image *image);
|
||||
|
|
|
|||
|
|
@ -2725,7 +2725,7 @@ radv_shader_dma_get_submission(struct radv_device *device, struct radeon_winsys_
|
|||
goto fail;
|
||||
}
|
||||
|
||||
radv_sdma_copy_memory(device, cs, radv_buffer_get_va(submission->bo), va, size);
|
||||
radv_sdma_copy_memory(device, cs, radv_buffer_get_va(submission->bo), va, size, false);
|
||||
radv_cs_add_buffer(ws, cs->b, submission->bo);
|
||||
radv_cs_add_buffer(ws, cs->b, bo);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue