[Mesa-dev] [PATCH 1/2] radv/gfx9: don't allocate cmask for single sampled surfaces.

Dave Airlie airlied at gmail.com
Wed Dec 27 00:44:29 UTC 2017


From: Dave Airlie <airlied at redhat.com>

>From AMDVLK fast clears don't work with cmask on gfx9, only with
dcc, so we don't need to allocate cmask for single sampled surfaces.

Signed-off-by: Dave Airlie <airlied at redhat.com>
---
 src/amd/vulkan/radv_image.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/amd/vulkan/radv_image.c b/src/amd/vulkan/radv_image.c
index efd17e4889..612fb1d791 100644
--- a/src/amd/vulkan/radv_image.c
+++ b/src/amd/vulkan/radv_image.c
@@ -834,7 +834,7 @@ radv_image_can_enable_dcc(struct radv_image *image)
 }
 
 static inline bool
-radv_image_can_enable_cmask(struct radv_image *image)
+radv_image_can_enable_cmask(struct radv_image *image, bool is_gfx9)
 {
 	if (image->surface.bpe > 8 && image->info.samples == 1) {
 		/* Do not enable CMASK for non-MSAA images (fast color clear)
@@ -844,6 +844,12 @@ radv_image_can_enable_cmask(struct radv_image *image)
 		return false;
 	}
 
+	if (is_gfx9 && image->info.samples == 1) {
+		/* amdvlk - GFX9 only supports fast color clears using DCC memory; having cMask does nothing for fast-clears.
+		   - we just enable it for multisample cases then. */
+		return false;
+	}
+
 	return radv_image_can_enable_dcc_or_cmask(image) &&
 	       image->info.levels == 1 &&
 	       image->info.depth == 1 &&
@@ -926,7 +932,7 @@ radv_image_create(VkDevice _device,
 	} else {
 		/* When DCC cannot be enabled, try CMASK. */
 		image->surface.dcc_size = 0;
-		if (radv_image_can_enable_cmask(image)) {
+		if (radv_image_can_enable_cmask(image, device->physical_device->rad_info.chip_class >= GFX9)) {
 			radv_image_alloc_cmask(device, image);
 		}
 	}
-- 
2.14.3



More information about the mesa-dev mailing list