[Mesa-dev] [PATCH 1/2] radv: record if the framebuffer has CB/DB metadata

Samuel Pitoiset samuel.pitoiset at gmail.com
Thu Aug 23 14:04:35 UTC 2018


For further optimizations.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
---
 src/amd/vulkan/radv_device.c  | 7 +++++++
 src/amd/vulkan/radv_private.h | 3 +++
 2 files changed, 10 insertions(+)

diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
index 79dbbd886d..be4c9719c1 100644
--- a/src/amd/vulkan/radv_device.c
+++ b/src/amd/vulkan/radv_device.c
@@ -4201,14 +4201,21 @@ VkResult radv_CreateFramebuffer(
 	framebuffer->width = pCreateInfo->width;
 	framebuffer->height = pCreateInfo->height;
 	framebuffer->layers = pCreateInfo->layers;
+	framebuffer->has_CB_metadata = false;
+	framebuffer->has_DB_metadata = false;
+
 	for (uint32_t i = 0; i < pCreateInfo->attachmentCount; i++) {
 		VkImageView _iview = pCreateInfo->pAttachments[i];
 		struct radv_image_view *iview = radv_image_view_from_handle(_iview);
 		framebuffer->attachments[i].attachment = iview;
 		if (iview->aspect_mask & VK_IMAGE_ASPECT_COLOR_BIT) {
 			radv_initialise_color_surface(device, &framebuffer->attachments[i].cb, iview);
+			if (radv_image_has_CB_metadata(iview->image))
+				framebuffer->has_CB_metadata = true;
 		} else if (iview->aspect_mask & (VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT)) {
 			radv_initialise_ds_surface(device, &framebuffer->attachments[i].ds, iview);
+			if (radv_image_has_htile(iview->image))
+				framebuffer->has_DB_metadata = true;
 		}
 		framebuffer->width = MIN2(framebuffer->width, iview->extent.width);
 		framebuffer->height = MIN2(framebuffer->height, iview->extent.height);
diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h
index 01a5a698a0..17660439d5 100644
--- a/src/amd/vulkan/radv_private.h
+++ b/src/amd/vulkan/radv_private.h
@@ -1715,6 +1715,9 @@ struct radv_framebuffer {
 	uint32_t                                     height;
 	uint32_t                                     layers;
 
+	bool                                         has_CB_metadata;
+	bool                                         has_DB_metadata;
+
 	uint32_t                                     attachment_count;
 	struct radv_attachment_info                  attachments[0];
 };
-- 
2.18.0



More information about the mesa-dev mailing list