[Mesa-dev] [PATCH] radv: handle VK_QUEUE_FAMILY_IGNORED in image transitions

Bas Nieuwenhuizen bas at basnieuwenhuizen.nl
Tue Jan 31 07:21:56 UTC 2017


On Tue, Jan 31, 2017, at 06:24, Dave Airlie wrote:
> 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.
> 
> Signed-off-by: Dave Airlie <airlied at redhat.com>
> ---
>  src/amd/vulkan/radv_cmd_buffer.c |  8 ++++----
>  src/amd/vulkan/radv_image.c      | 13 ++++++++++---
>  src/amd/vulkan/radv_private.h    |  2 +-
>  3 files changed, 15 insertions(+), 8 deletions(-)
> 
> diff --git a/src/amd/vulkan/radv_cmd_buffer.c
> b/src/amd/vulkan/radv_cmd_buffer.c
> index 7dd4aeb..3785020 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,VK_QUEUE_FAMILY_IGNORED
>  					 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);
>  
> @@ -2746,8 +2746,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)
>  {
> diff --git a/src/amd/vulkan/radv_image.c b/src/amd/vulkan/radv_image.c
> index f75f008..0d02772 100644
> --- a/src/amd/vulkan/radv_image.c
> +++ b/src/amd/vulkan/radv_image.c
> @@ -900,12 +900,19 @@ bool radv_layout_can_fast_clear(const struct
> radv_image *image,
>  			        VkImageLayout layout,
>  			        unsigned queue_mask)
>  {
> -       return layout == VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL &&
> -               queue_mask == (1u << RADV_QUEUE_GENERAL);
> +       if (layout != VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL)
> +               return false;
> +       if (queue_mask != VK_QUEUE_FAMILY_IGNORED) {
> +               if (queue_mask != (1u << RADV_QUEUE_GENERAL))
> +                       return false;
> +       }
> +       return true;
>  }
>  
>  
> -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 (family == VK_QUEUE_FAMILY_IGNORED)
> +               return VK_QUEUE_FAMILY_IGNORED;

Shouldn't we use the current queue as single queue family instead of
always claiming we support fast clear on this queue 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 1f25af2..38f60f2 100644
> --- a/src/amd/vulkan/radv_private.h
> +++ b/src/amd/vulkan/radv_private.h
> @@ -1088,7 +1088,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
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list