- image->alignment = align64(image->alignment, image->planes[0].surface.htile_alignment);
-}
-
-static inline bool
-radv_image_can_enable_dcc_or_cmask(struct radv_image *image)
-{
- if (image->info.samples <= 1 &&
- image->info.width * image->info.height <= 512 * 512) {
- /* Do not enable CMASK or DCC for small surfaces where the cost
- * of the eliminate pass can be higher than the benefit of fast
- * clear. RadeonSI does this, but the image threshold is
- * different.
- */
- return false;
- }
-
- return image->usage & VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT &&
- (image->exclusive || image->queue_family_mask == 1);
-}
-
-static inline bool
-radv_image_can_enable_dcc(struct radv_device *device, struct radv_image *image)
-{
- if (!radv_image_can_enable_dcc_or_cmask(image) ||
- !radv_image_has_dcc(image))
- return false;
-
- /* On GFX8, DCC layers can be interleaved and it's currently only
- * enabled if slice size is equal to the per slice fast clear size
- * because the driver assumes that portions of multiple layers are
- * contiguous during fast clears.
- */
- if (image->info.array_size > 1) {
- const struct legacy_surf_level *surf_level =
- &image->planes[0].surface.u.legacy.level[0];
-
- assert(device->physical_device->rad_info.chip_class == GFX8);
-
- if (image->planes[0].surface.dcc_slice_size != surf_level->dcc_fast_clear_size)
- return false;
- }
-
- return true;
-}
-
-static inline bool
-radv_image_can_enable_cmask(struct radv_image *image)
-{
- if (image->planes[0].surface.bpe > 8 && image->info.samples == 1) {
- /* Do not enable CMASK for non-MSAA images (fast color clear)
- * because 128 bit formats are not supported, but FMASK might
- * still be used.
- */
- return false;
- }
-
- return radv_image_can_enable_dcc_or_cmask(image) &&
- image->info.levels == 1 &&
- image->info.depth == 1 &&
- !image->planes[0].surface.is_linear;
-}
-
-static inline bool
-radv_image_can_enable_fmask(struct radv_image *image)
-{
- return image->info.samples > 1 &&
- image->usage & VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
-}
-
-static inline bool
-radv_image_can_enable_htile(struct radv_image *image)
-{
- return radv_image_has_htile(image) &&
- image->info.levels == 1 &&
- image->info.width * image->info.height >= 8 * 8;
-}
-
-static void radv_image_disable_dcc(struct radv_image *image)
-{
- for (unsigned i = 0; i < image->plane_count; ++i)
- image->planes[i].surface.dcc_size = 0;
-}
-
-static void radv_image_disable_htile(struct radv_image *image)
-{
- for (unsigned i = 0; i < image->plane_count; ++i)
- image->planes[i].surface.htile_size = 0;