radv: Add function to determine if SDMA supports an image.
The following are not supported by SDMA: - Sparse images (aka. PRT) on older GPUs - Multisampled images Signed-off-by: Timur Kristóf <timur.kristof@gmail.com> Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com> Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39057>
This commit is contained in:
@@ -81,6 +81,10 @@ transfer_copy_memory_image(struct radv_cmd_buffer *cmd_buffer, uint64_t buffer_v
|
||||
const struct radv_device *device = radv_cmd_buffer_device(cmd_buffer);
|
||||
struct radv_cmd_stream *cs = cmd_buffer->cs;
|
||||
|
||||
if (!radv_sdma_supports_image(device, image)) {
|
||||
return;
|
||||
}
|
||||
|
||||
struct radv_sdma_surf buf = radv_sdma_get_buf_surf(buffer_va, image, region);
|
||||
const struct radv_sdma_surf img = radv_sdma_get_surf(device, image, region->imageSubresource, region->imageOffset);
|
||||
const VkExtent3D extent = radv_sdma_get_copy_extent(image, region->imageSubresource, region->imageExtent);
|
||||
@@ -381,6 +385,10 @@ transfer_copy_image(struct radv_cmd_buffer *cmd_buffer, struct radv_image *src_i
|
||||
struct radv_cmd_stream *cs = cmd_buffer->cs;
|
||||
unsigned int dst_aspect_mask_remaining = region->dstSubresource.aspectMask;
|
||||
|
||||
if (!radv_sdma_supports_image(device, src_image) || !radv_sdma_supports_image(device, dst_image)) {
|
||||
return;
|
||||
}
|
||||
|
||||
VkImageSubresourceLayers src_subresource = region->srcSubresource;
|
||||
VkImageSubresourceLayers dst_subresource = region->dstSubresource;
|
||||
|
||||
|
||||
@@ -708,3 +708,20 @@ radv_sdma_copy_image_t2t_scanline(const struct radv_device *device, struct radv_
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
radv_sdma_supports_image(const struct radv_device *device, const struct radv_image *image)
|
||||
{
|
||||
const struct radv_physical_device *pdev = radv_device_physical(device);
|
||||
|
||||
/* TODO: Handle emulated formats and verify sparse image support. */
|
||||
|
||||
if (!pdev->info.sdma_supports_sparse &&
|
||||
(image->vk.create_flags & VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT))
|
||||
return false;
|
||||
|
||||
if (image->vk.samples != VK_SAMPLE_COUNT_1_BIT)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -82,6 +82,7 @@ void radv_sdma_copy_memory(const struct radv_device *device, struct radv_cmd_str
|
||||
uint64_t dst_va, uint64_t size);
|
||||
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);
|
||||
|
||||
void radv_sdma_emit_nop(const struct radv_device *device, struct radv_cmd_stream *cs);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user