radv: add radv_vi_dcc_enabled() helper
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Thu, 28 Sep 2017 08:24:09 +0000 (10:24 +0200)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Mon, 2 Oct 2017 09:56:20 +0000 (11:56 +0200)
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
src/amd/vulkan/radv_device.c
src/amd/vulkan/radv_image.c
src/amd/vulkan/radv_private.h

index 28a941e219c3c1b11a1c5e2d9d04271f8b54c3cd..402c948e5231039cbac40c03e8380befcc54c3f5 100644 (file)
@@ -3140,7 +3140,7 @@ radv_initialise_color_surface(struct radv_device *device,
            !(device->debug_flags & RADV_DEBUG_NO_FAST_CLEARS))
                cb->cb_color_info |= S_028C70_FAST_CLEAR(1);
 
-       if (iview->image->surface.dcc_size && iview->base_mip < surf->num_dcc_levels)
+       if (radv_vi_dcc_enabled(iview->image, iview->base_mip))
                cb->cb_color_info |= S_028C70_DCC_ENABLE(1);
 
        if (device->physical_device->rad_info.chip_class >= VI) {
index e28aba060b27c933538cc6cc6fd574f80aad2783..35c58f45ab586d63c3d13711bb762a6e2c760bf4 100644 (file)
@@ -251,7 +251,7 @@ si_set_mutable_tex_desc_fields(struct radv_device *device,
        if (chip_class >= VI) {
                state[6] &= C_008F28_COMPRESSION_EN;
                state[7] = 0;
-               if (image->surface.dcc_size && first_level < image->surface.num_dcc_levels) {
+               if (radv_vi_dcc_enabled(image, first_level)) {
                        meta_va = gpu_address + image->dcc_offset;
                        if (chip_class <= VI)
                                meta_va += base_level_info->dcc_offset;
index 93898a6ad1329b7b8f843b42cea7fb5ac844e273..a44e0b20faf914936bcf7ab815773f38332c7314 100644 (file)
@@ -1251,6 +1251,11 @@ bool radv_layout_can_fast_clear(const struct radv_image *image,
                                VkImageLayout layout,
                                unsigned queue_mask);
 
+static inline bool
+radv_vi_dcc_enabled(const struct radv_image *image, unsigned level)
+{
+       return image->surface.dcc_size && level < image->surface.num_dcc_levels;
+}
 
 unsigned radv_image_queue_family_mask(const struct radv_image *image, uint32_t family, uint32_t queue_family);