[Mesa-dev] [PATCH v2 31/32] vulkan/wsi: Initialize individual WSI interfaces in wsi_device_init

Chad Versace chadversary at chromium.org
Sat Dec 2 16:03:39 UTC 2017


On Tue 28 Nov 2017, Jason Ekstrand wrote:
> Now that we have anv_device_init/finish functions, there's no reason to
> have the individual driver do any more work than that.

You mean "wsi_device_init/finish" functions.

> ---
>  src/amd/vulkan/radv_wsi.c           | 36 ++++++------------------------------
>  src/intel/vulkan/anv_wsi.c          | 36 ++++++------------------------------
>  src/vulkan/wsi/wsi_common.c         | 37 +++++++++++++++++++++++++++++++++++--
>  src/vulkan/wsi/wsi_common.h         | 19 +++++++------------
>  src/vulkan/wsi/wsi_common_private.h | 10 ++++++++++
>  5 files changed, 64 insertions(+), 74 deletions(-)


> -void
> +VkResult
>  wsi_device_init(struct wsi_device *wsi,
>                  VkPhysicalDevice pdevice,
> -                WSI_FN_GetPhysicalDeviceProcAddr proc_addr)
> +                WSI_FN_GetPhysicalDeviceProcAddr proc_addr,
> +                const VkAllocationCallbacks *alloc)
>  {
> +   VkResult result;
> +
>     memset(wsi, 0, sizeof(*wsi));
>  
>  #define WSI_GET_CB(func) \
> @@ -69,6 +72,36 @@ wsi_device_init(struct wsi_device *wsi,
>     WSI_GET_CB(QueueSubmit);
>     WSI_GET_CB(WaitForFences);
>  #undef WSI_GET_CB
> +
> +#ifdef VK_USE_PLATFORM_XCB_KHR
> +   result = wsi_x11_init_wsi(wsi, alloc);
> +   if (result != VK_SUCCESS)
> +      return result;
> +#endif
> +
> +#ifdef VK_USE_PLATFORM_WAYLAND_KHR
> +   result = wsi_wl_init_wsi(wsi, alloc, pdevice);
> +   if (result != VK_SUCCESS) {
> +#ifdef VK_USE_PLATFORM_XCB_KHR
> +      wsi_x11_finish_wsi(wsi, alloc);
> +#endif
> +      return result;
> +   }
> +#endif

This looks like a bug. wsi_device_init() fails if either of x11 or
wayland initialization fails, even if the user requested only one of
VK_KHR_{xcb,xlib,wayland}_surface.

I filed https://bugs.freedesktop.org/show_bug.cgi?id=104039 .

But this patch is just a refactor patch, and it preserves the existing
(and possibly buggy) behavior. With the commit message fixed,
Reviewed-by: Chad Versace <chadversary at chromium.org>




More information about the mesa-dev mailing list