radv: allow HTILE for very small images if VRS attachment is used
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Mon, 12 Apr 2021 13:01:24 +0000 (15:01 +0200)
committerMarge Bot <eric+marge@anholt.net>
Wed, 14 Apr 2021 09:31:13 +0000 (09:31 +0000)
We need a HTILE buffer to store the VRS rates.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10187>

src/amd/vulkan/radv_image.c

index 13db821..7e47315 100644 (file)
@@ -316,9 +316,15 @@ radv_use_htile_for_image(const struct radv_device *device, const struct radv_ima
    bool use_htile_for_mips =
       image->info.array_size == 1 && device->physical_device->rad_info.chip_class >= GFX10;
 
-   return (image->info.levels == 1 || use_htile_for_mips) && !image->shareable &&
-          ((image->info.width * image->info.height >= 8 * 8) ||
-           (device->instance->debug_flags & RADV_DEBUG_FORCE_COMPRESS));
+   /* Do not enable HTILE for very small images because it seems less performant but make sure it's
+    * allowed with VRS attachments because we need HTILE.
+    */
+   if (image->info.width * image->info.height < 8 * 8 &&
+       !(device->instance->debug_flags & RADV_DEBUG_FORCE_COMPRESS) &&
+       !device->attachment_vrs_enabled)
+      return false;
+
+   return (image->info.levels == 1 || use_htile_for_mips) && !image->shareable;
 }
 
 static bool