radv: do not allocate CMASK or DCC for small surfaces
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Wed, 29 Nov 2017 13:48:32 +0000 (14:48 +0100)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Thu, 30 Nov 2017 20:38:30 +0000 (21:38 +0100)
The idea is ported from RadeonSI, but using 512x512 instead of
256x256 seems slightly better. This improves dota2 performance
by +2%.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
src/amd/vulkan/radv_image.c

index b145e81f826313e73133820b96b1c84081eb7e73..ee03a1dc6a94e3677b5d9f2ebdf0514aa40d4d1c 100644 (file)
@@ -806,6 +806,16 @@ radv_image_alloc_htile(struct radv_image *image)
 static inline bool
 radv_image_can_enable_dcc_or_cmask(struct radv_image *image)
 {
+       if (image->info.samples <= 1 &&
+           image->info.width <= 512 && image->info.height <= 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);
 }