Module: Mesa Branch: main Commit: ed21f1c96257f1fc7fded5db636707dd443779f9 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=ed21f1c96257f1fc7fded5db636707dd443779f9
Author: Timur Kristóf <timur.kris...@gmail.com> Date: Thu Oct 26 12:00:31 2023 +0200 radv: Expose radv_get_dcc_max_uncompressed_block_size function. Signed-off-by: Timur Kristóf <timur.kris...@gmail.com> Reviewed-by: Samuel Pitoiset <samuel.pitoi...@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25831> --- src/amd/vulkan/radv_device.c | 12 ++++++------ src/amd/vulkan/radv_private.h | 2 ++ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c index 73783403f5b..f3c92ed7197 100644 --- a/src/amd/vulkan/radv_device.c +++ b/src/amd/vulkan/radv_device.c @@ -1433,13 +1433,13 @@ radv_surface_max_layer_count(struct radv_image_view *iview) : (iview->vk.base_array_layer + iview->vk.layer_count); } -static unsigned -get_dcc_max_uncompressed_block_size(const struct radv_device *device, const struct radv_image_view *iview) +unsigned +radv_get_dcc_max_uncompressed_block_size(const struct radv_device *device, const struct radv_image *image) { - if (device->physical_device->rad_info.gfx_level < GFX10 && iview->image->vk.samples > 1) { - if (iview->image->planes[0].surface.bpe == 1) + if (device->physical_device->rad_info.gfx_level < GFX10 && image->vk.samples > 1) { + if (image->planes[0].surface.bpe == 1) return V_028C78_MAX_BLOCK_SIZE_64B; - else if (iview->image->planes[0].surface.bpe == 2) + else if (image->planes[0].surface.bpe == 2) return V_028C78_MAX_BLOCK_SIZE_128B; } @@ -1464,7 +1464,7 @@ get_dcc_min_compressed_block_size(const struct radv_device *device) static uint32_t radv_init_dcc_control_reg(struct radv_device *device, struct radv_image_view *iview) { - unsigned max_uncompressed_block_size = get_dcc_max_uncompressed_block_size(device, iview); + unsigned max_uncompressed_block_size = radv_get_dcc_max_uncompressed_block_size(device, iview->image); unsigned min_compressed_block_size = get_dcc_min_compressed_block_size(device); unsigned max_compressed_block_size; unsigned independent_128b_blocks; diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h index ccfb1549401..7fd3583337e 100644 --- a/src/amd/vulkan/radv_private.h +++ b/src/amd/vulkan/radv_private.h @@ -2932,6 +2932,8 @@ bool radv_are_formats_dcc_compatible(const struct radv_physical_device *pdev, co bool vi_alpha_is_on_msb(const struct radv_device *device, const VkFormat format); +unsigned radv_get_dcc_max_uncompressed_block_size(const struct radv_device *device, const struct radv_image *image); + VkResult radv_image_from_gralloc(VkDevice device_h, const VkImageCreateInfo *base_info, const VkNativeBufferANDROID *gralloc_info, const VkAllocationCallbacks *alloc, VkImage *out_image_h);