[Mesa-dev] [PATCH] radv: handle VK_QUEUE_FAMILY_IGNORED in image transitions (v2)
Dave Airlie
airlied at gmail.com
Tue Jan 31 23:48:50 UTC 2017
From: Dave Airlie <airlied at redhat.com>
The CTS tests at least are using this, and we were totally
ignoring it.
This hopefully fixes the bouncing multisample CTS tests.
v2: get family mask in ignored case from command buffer.
Signed-off-by: Dave Airlie <airlied at redhat.com>
---
src/amd/vulkan/radv_cmd_buffer.c | 39 +++++++++++++++++++++++++++++----------
src/amd/vulkan/radv_image.c | 2 +-
src/amd/vulkan/radv_private.h | 2 +-
3 files changed, 31 insertions(+), 12 deletions(-)
diff --git a/src/amd/vulkan/radv_cmd_buffer.c b/src/amd/vulkan/radv_cmd_buffer.c
index 7dd4aeb..2f94d3b 100644
--- a/src/amd/vulkan/radv_cmd_buffer.c
+++ b/src/amd/vulkan/radv_cmd_buffer.c
@@ -38,8 +38,8 @@ static void radv_handle_image_transition(struct radv_cmd_buffer *cmd_buffer,
struct radv_image *image,
VkImageLayout src_layout,
VkImageLayout dst_layout,
- int src_family,
- int dst_family,
+ uint32_t src_family,
+ uint32_t dst_family,
VkImageSubresourceRange range,
VkImageAspectFlags pending_clears);
@@ -2688,6 +2688,16 @@ void radv_initialise_cmask(struct radv_cmd_buffer *cmd_buffer,
RADV_CMD_FLAG_INV_GLOBAL_L2;
}
+static bool radv_cmd_layout_can_fast_clear(struct radv_cmd_buffer *cmd_buffer,
+ struct radv_image *image,
+ VkImageLayout layout,
+ unsigned queue_mask)
+{
+ if (queue_mask == VK_QUEUE_FAMILY_IGNORED)
+ queue_mask = 1u << cmd_buffer->queue_family_index;
+ return radv_layout_can_fast_clear(image, layout, queue_mask);
+}
+
static void radv_handle_cmask_image_transition(struct radv_cmd_buffer *cmd_buffer,
struct radv_image *image,
VkImageLayout src_layout,
@@ -2702,8 +2712,8 @@ static void radv_handle_cmask_image_transition(struct radv_cmd_buffer *cmd_buffe
radv_initialise_cmask(cmd_buffer, image, 0xccccccccu);
else
radv_initialise_cmask(cmd_buffer, image, 0xffffffffu);
- } else if (radv_layout_can_fast_clear(image, src_layout, src_queue_mask) &&
- !radv_layout_can_fast_clear(image, dst_layout, dst_queue_mask)) {
+ } else if (radv_cmd_layout_can_fast_clear(cmd_buffer, image, src_layout, src_queue_mask) &&
+ !radv_cmd_layout_can_fast_clear(cmd_buffer, image, dst_layout, dst_queue_mask)) {
radv_fast_clear_flush_image_inplace(cmd_buffer, image);
}
}
@@ -2736,18 +2746,27 @@ static void radv_handle_dcc_image_transition(struct radv_cmd_buffer *cmd_buffer,
{
if (src_layout == VK_IMAGE_LAYOUT_UNDEFINED) {
radv_initialize_dcc(cmd_buffer, image, 0x20202020u);
- } else if (radv_layout_can_fast_clear(image, src_layout, src_queue_mask) &&
- !radv_layout_can_fast_clear(image, dst_layout, dst_queue_mask)) {
+ } else if (radv_cmd_layout_can_fast_clear(cmd_buffer, image, src_layout, src_queue_mask) &&
+ !radv_cmd_layout_can_fast_clear(cmd_buffer, image, dst_layout, dst_queue_mask)) {
radv_fast_clear_flush_image_inplace(cmd_buffer, image);
}
}
+static uint32_t radv_get_queue_family_mask(struct radv_cmd_buffer *cmd_buffer,
+ struct radv_image *image,
+ uint32_t family)
+{
+ if (family == VK_QUEUE_FAMILY_IGNORED)
+ return 1u << cmd_buffer->queue_family_index;
+ return radv_image_queue_family_mask(image, family);
+}
+
static void radv_handle_image_transition(struct radv_cmd_buffer *cmd_buffer,
struct radv_image *image,
VkImageLayout src_layout,
VkImageLayout dst_layout,
- int src_family,
- int dst_family,
+ uint32_t src_family,
+ uint32_t dst_family,
VkImageSubresourceRange range,
VkImageAspectFlags pending_clears)
{
@@ -2768,8 +2787,8 @@ static void radv_handle_image_transition(struct radv_cmd_buffer *cmd_buffer,
return;
}
- unsigned src_queue_mask = radv_image_queue_family_mask(image, src_family);
- unsigned dst_queue_mask = radv_image_queue_family_mask(image, dst_family);
+ unsigned src_queue_mask = radv_get_queue_family_mask(cmd_buffer, image, src_family);
+ unsigned dst_queue_mask = radv_get_queue_family_mask(cmd_buffer, image, dst_family);
if (image->htile.size)
radv_handle_depth_image_transition(cmd_buffer, image, src_layout,
diff --git a/src/amd/vulkan/radv_image.c b/src/amd/vulkan/radv_image.c
index f75f008..608ab72 100644
--- a/src/amd/vulkan/radv_image.c
+++ b/src/amd/vulkan/radv_image.c
@@ -905,7 +905,7 @@ bool radv_layout_can_fast_clear(const struct radv_image *image,
}
-unsigned radv_image_queue_family_mask(const struct radv_image *image, int family) {
+unsigned radv_image_queue_family_mask(const struct radv_image *image, uint32_t family) {
if (image->exclusive)
return 1u <<family;
return image->queue_family_mask;
diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h
index 340e40d..b3ccd28 100644
--- a/src/amd/vulkan/radv_private.h
+++ b/src/amd/vulkan/radv_private.h
@@ -1089,7 +1089,7 @@ bool radv_layout_can_fast_clear(const struct radv_image *image,
unsigned queue_mask);
-unsigned radv_image_queue_family_mask(const struct radv_image *image, int family);
+unsigned radv_image_queue_family_mask(const struct radv_image *image, uint32_t family);
static inline uint32_t
radv_get_layerCount(const struct radv_image *image,
--
2.9.3
More information about the mesa-dev
mailing list