radv/image: Implement the wsi "extension"
authorJason Ekstrand <jason.ekstrand@intel.com>
Thu, 16 Nov 2017 16:27:01 +0000 (08:27 -0800)
committerJason Ekstrand <jason.ekstrand@intel.com>
Mon, 4 Dec 2017 18:04:19 +0000 (10:04 -0800)
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
src/amd/vulkan/radv_device.c
src/amd/vulkan/radv_image.c

index 81d04e9..07c6397 100644 (file)
@@ -2151,11 +2151,17 @@ VkResult radv_alloc_memory(VkDevice                        _device,
        const VkMemoryDedicatedAllocateInfoKHR *dedicate_info =
                vk_find_struct_const(pAllocateInfo->pNext, MEMORY_DEDICATED_ALLOCATE_INFO_KHR);
 
+       const struct wsi_memory_allocate_info *wsi_info =
+               vk_find_struct_const(pAllocateInfo->pNext, WSI_MEMORY_ALLOCATE_INFO_MESA);
+
        mem = vk_alloc2(&device->alloc, pAllocator, sizeof(*mem), 8,
                          VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
        if (mem == NULL)
                return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
 
+       if (wsi_info && wsi_info->implicit_sync)
+               flags |= RADEON_FLAG_IMPLICIT_SYNC;
+
        if (dedicate_info) {
                mem->image = radv_image_from_handle(dedicate_info->image);
                mem->buffer = radv_buffer_from_handle(dedicate_info->buffer);
index ee03a1d..5c53e81 100644 (file)
@@ -1121,11 +1121,15 @@ radv_CreateImage(VkDevice device,
                 const VkAllocationCallbacks *pAllocator,
                 VkImage *pImage)
 {
+       const struct wsi_image_create_info *wsi_info =
+               vk_find_struct_const(pCreateInfo->pNext, WSI_IMAGE_CREATE_INFO_MESA);
+       bool scanout = wsi_info && wsi_info->scanout;
+
        return radv_image_create(device,
                                 &(struct radv_image_create_info) {
                                         .vk_info = pCreateInfo,
-                                                .scanout = false,
-                                                },
+                                        .scanout = scanout,
+                                },
                                 pAllocator,
                                 pImage);
 }