From 02a2451e1f2a4af5ef50b61d21e97d0a3d99a4af Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Tue, 10 Feb 2026 12:53:32 +0100 Subject: [PATCH] radv: rename radv_image_use_dcc_image_stores() To radv_image_compress_dcc_on_image_stores() because it seems more informative. Signed-off-by: Samuel Pitoiset Part-of: --- src/amd/vulkan/meta/radv_meta_resolve_cs.c | 2 +- src/amd/vulkan/radv_cmd_buffer.c | 2 +- src/amd/vulkan/radv_image.c | 36 ++++++---------------- src/amd/vulkan/radv_image.h | 18 +++++++++-- src/amd/vulkan/radv_image_view.c | 2 +- 5 files changed, 28 insertions(+), 32 deletions(-) diff --git a/src/amd/vulkan/meta/radv_meta_resolve_cs.c b/src/amd/vulkan/meta/radv_meta_resolve_cs.c index 0fa1b5d9ff5..08ff7da367e 100644 --- a/src/amd/vulkan/meta/radv_meta_resolve_cs.c +++ b/src/amd/vulkan/meta/radv_meta_resolve_cs.c @@ -252,7 +252,7 @@ radv_fixup_resolve_dst_metadata(struct radv_cmd_buffer *cmd_buffer, struct radv_ return; /* Nothing to do when compressed DCC writes are supported. */ - if (radv_image_use_dcc_image_stores(device, image)) + if (radv_image_compress_dcc_on_image_stores(device, image)) return; const bool is_partial_resolve = offset->x || offset->y || offset->z || extent->width != image->vk.extent.width || diff --git a/src/amd/vulkan/radv_cmd_buffer.c b/src/amd/vulkan/radv_cmd_buffer.c index 85f10ed0bdb..1330b655f7e 100644 --- a/src/amd/vulkan/radv_cmd_buffer.c +++ b/src/amd/vulkan/radv_cmd_buffer.c @@ -14482,7 +14482,7 @@ radv_handle_color_image_transition(struct radv_cmd_buffer *cmd_buffer, struct ra if (src_fmask_comp > dst_fmask_comp) { if (src_fmask_comp == RADV_FMASK_COMPRESSION_FULL) { - if (radv_dcc_enabled(image, range->baseMipLevel) && !radv_image_use_dcc_image_stores(device, image)) { + if (radv_dcc_enabled(image, range->baseMipLevel) && !radv_image_compress_dcc_on_image_stores(device, image)) { /* A DCC decompress is required before expanding FMASK when DCC stores aren't supported to * avoid being in a state where DCC is compressed and the main surface is uncompressed. */ diff --git a/src/amd/vulkan/radv_image.c b/src/amd/vulkan/radv_image.c index 43665b18c44..5e2f6de3aa4 100644 --- a/src/amd/vulkan/radv_image.c +++ b/src/amd/vulkan/radv_image.c @@ -166,12 +166,12 @@ radv_image_use_fast_clear_for_image(const struct radv_device *device, const stru if (instance->debug_flags & RADV_DEBUG_FORCE_COMPRESS) return true; - return radv_image_use_fast_clear_for_image_early(device, image) && (image->exclusive || - /* Enable DCC for concurrent images if stores are - * supported because that means we can keep DCC - * compressed on all layouts/queues. - */ - radv_image_use_dcc_image_stores(device, image)); + return radv_image_use_fast_clear_for_image_early(device, image) && + (image->exclusive || + /* Enable DCC for concurrent images if stores are supported because that means we can + * keep DCC compressed on all layouts/queues. + */ + radv_image_compress_dcc_on_image_stores(device, image)); } bool @@ -329,30 +329,12 @@ radv_use_dcc_for_image_late(struct radv_device *device, struct radv_image *image /* TODO: Fix storage images with DCC without DCC image stores. * Disabling it for now. */ - if ((image->vk.usage & VK_IMAGE_USAGE_STORAGE_BIT) && !radv_image_use_dcc_image_stores(device, image)) + if ((image->vk.usage & VK_IMAGE_USAGE_STORAGE_BIT) && !radv_image_compress_dcc_on_image_stores(device, image)) return false; return true; } -/* - * Whether to enable image stores with DCC compression for this image. If - * this function returns false the image subresource should be decompressed - * before using it with image stores. - * - * Note that this can have mixed performance implications, see - * https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6796#note_643299 - * - * This function assumes the image uses DCC compression. - */ -bool -radv_image_use_dcc_image_stores(const struct radv_device *device, const struct radv_image *image) -{ - const struct radv_physical_device *pdev = radv_device_physical(device); - - return ac_surface_supports_dcc_image_stores(pdev->info.gfx_level, &image->planes[0].surface); -} - /* * Whether to use a predicate to determine whether DCC is in a compressed * state. This can be used to avoid decompressing an image multiple times. @@ -360,7 +342,7 @@ radv_image_use_dcc_image_stores(const struct radv_device *device, const struct r bool radv_image_use_dcc_predication(const struct radv_device *device, const struct radv_image *image) { - return radv_image_has_dcc(image) && !radv_image_use_dcc_image_stores(device, image); + return radv_image_has_dcc(image) && !radv_image_compress_dcc_on_image_stores(device, image); } static inline bool @@ -1707,7 +1689,7 @@ radv_layout_dcc_compressed(const struct radv_device *device, const struct radv_i /* Don't compress compute transfer dst when image stores are not supported. */ if ((layout == VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL || layout == VK_IMAGE_LAYOUT_GENERAL) && - (queue_mask & (1u << RADV_QUEUE_COMPUTE)) && !radv_image_use_dcc_image_stores(device, image)) + (queue_mask & (1u << RADV_QUEUE_COMPUTE)) && !radv_image_compress_dcc_on_image_stores(device, image)) return false; /* Don't compress exclusive images used on transfer queues when SDMA doesn't support DCC. diff --git a/src/amd/vulkan/radv_image.h b/src/amd/vulkan/radv_image.h index 8f377bcba70..92a9d7417d0 100644 --- a/src/amd/vulkan/radv_image.h +++ b/src/amd/vulkan/radv_image.h @@ -133,6 +133,22 @@ radv_dcc_enabled(const struct radv_image *image, unsigned level) return radv_image_has_dcc(image) && level < image->planes[0].surface.num_meta_levels; } +/** + * Return whether the image can compress DCC on image stores (GFX10+). + * + * Note that this can have mixed performance implications, see + * https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6796#note_643299 + * + * This function assumes the image uses DCC compression. + */ +static inline bool +radv_image_compress_dcc_on_image_stores(const struct radv_device *device, const struct radv_image *image) +{ + const struct radv_physical_device *pdev = radv_device_physical(device); + + return ac_surface_supports_dcc_image_stores(pdev->info.gfx_level, &image->planes[0].surface); +} + /** * Return whether the image has CB metadata. */ @@ -371,8 +387,6 @@ radv_image_get_iterate256(const struct radv_device *device, struct radv_image *i bool radv_are_formats_dcc_compatible(const struct radv_physical_device *pdev, const void *pNext, VkFormat format, VkImageCreateFlags flags, bool *sign_reinterpret); -bool radv_image_use_dcc_image_stores(const struct radv_device *device, const struct radv_image *image); - bool radv_image_use_dcc_predication(const struct radv_device *device, const struct radv_image *image); void radv_compose_swizzle(const struct util_format_description *desc, const VkComponentMapping *mapping, diff --git a/src/amd/vulkan/radv_image_view.c b/src/amd/vulkan/radv_image_view.c index a0f41dc2884..e2c5498969c 100644 --- a/src/amd/vulkan/radv_image_view.c +++ b/src/amd/vulkan/radv_image_view.c @@ -450,7 +450,7 @@ radv_image_view_make_descriptor(struct radv_image_view *iview, struct radv_devic base_level_info = &plane->surface.u.legacy.level[force_zero_base_mip ? iview->vk.base_mip_level : 0]; } - bool enable_write_compression = radv_image_use_dcc_image_stores(device, image); + bool enable_write_compression = radv_image_compress_dcc_on_image_stores(device, image); bool decompress_htile_on_image_stores = radv_image_decompress_htile_on_image_stores(device, image); if (is_storage_image && !(enable_write_compression || enable_compression || decompress_htile_on_image_stores))