Mesa (master): radv: provide a helper for comparing an image extents.

Dave Airlie airlied at kemper.freedesktop.org
Tue May 2 20:09:01 UTC 2017


Module: Mesa
Branch: master
Commit: d5400a5ec2afdbca1c2745183f171ac72d6f0647
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=d5400a5ec2afdbca1c2745183f171ac72d6f0647

Author: Dave Airlie <airlied at redhat.com>
Date:   Tue May  2 09:40:36 2017 +1000

radv: provide a helper for comparing an image extents.

This just makes it easier to do the follow in cleanups of the surface.

Reviewed-by: Timothy Arceri <tarceri at itsqueeze.com>
Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied at redhat.com>

---

 src/amd/vulkan/radv_meta_clear.c | 4 ++--
 src/amd/vulkan/radv_private.h    | 9 +++++++++
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/amd/vulkan/radv_meta_clear.c b/src/amd/vulkan/radv_meta_clear.c
index 3e79cd8c11..d72f4c858d 100644
--- a/src/amd/vulkan/radv_meta_clear.c
+++ b/src/amd/vulkan/radv_meta_clear.c
@@ -614,7 +614,7 @@ static bool depth_view_can_fast_clear(const struct radv_image_view *iview,
 	    iview->base_mip == 0 &&
 	    iview->base_layer == 0 &&
 	    radv_layout_can_expclear(iview->image, layout) &&
-	    memcmp(&iview->extent, &iview->image->extent, sizeof(iview->extent)) == 0)
+	    !radv_image_extent_compare(iview->image, &iview->extent))
 		return true;
 	return false;
 }
@@ -858,7 +858,7 @@ emit_fast_color_clear(struct radv_cmd_buffer *cmd_buffer,
 	if (iview->image->surface.level[0].mode < RADEON_SURF_MODE_1D)
 		goto fail;
 
-	if (memcmp(&iview->extent, &iview->image->extent, sizeof(iview->extent)))
+	if (!radv_image_extent_compare(iview->image, &iview->extent))
 		goto fail;
 
 	if (clear_rect->rect.offset.x || clear_rect->rect.offset.y ||
diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h
index 045bb647d6..48d0f443e1 100644
--- a/src/amd/vulkan/radv_private.h
+++ b/src/amd/vulkan/radv_private.h
@@ -1284,6 +1284,15 @@ radv_sanitize_image_offset(const VkImageType imageType,
 	}
 }
 
+static inline bool
+radv_image_extent_compare(const struct radv_image *image,
+			  const VkExtent3D *extent)
+{
+	if (memcmp(extent, &image->extent, sizeof(*extent)))
+		return false;
+	return true;
+}
+
 struct radv_sampler {
 	uint32_t state[4];
 };




More information about the mesa-commit mailing list