[Mesa-dev] [PATCH] vulkan/wsi: use function ptr definitions from the spec.

Eric Engestrom eric.engestrom at imgtec.com
Thu Nov 16 13:34:48 UTC 2017


On Thursday, 2017-11-16 08:46:41 +1000, Dave Airlie wrote:
> From: Dave Airlie <airlied at redhat.com>
> 
> This just seems cleaner, and we may expand this in future.
> 
> Signed-off-by: Dave Airlie <airlied at redhat.com>

Reviewed-by: Eric Engestrom <eric.engestrom at imgtec.com>

> ---
>  src/amd/vulkan/radv_wsi.c           | 3 ++-
>  src/intel/vulkan/anv_wsi.c          | 3 ++-
>  src/vulkan/wsi/wsi_common.h         | 4 +---
>  src/vulkan/wsi/wsi_common_wayland.c | 2 +-
>  4 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/src/amd/vulkan/radv_wsi.c b/src/amd/vulkan/radv_wsi.c
> index 7a9064b..0145da6 100644
> --- a/src/amd/vulkan/radv_wsi.c
> +++ b/src/amd/vulkan/radv_wsi.c
> @@ -29,8 +29,9 @@
>  #include "vk_util.h"
>  #include "util/macros.h"
>  
> +#define WSI_CB(x) .x = radv_##x
>  MAYBE_UNUSED static const struct wsi_callbacks wsi_cbs = {
> -   .get_phys_device_format_properties = radv_GetPhysicalDeviceFormatProperties,
> +	WSI_CB(GetPhysicalDeviceFormatProperties),
>  };
>  
>  VkResult
> diff --git a/src/intel/vulkan/anv_wsi.c b/src/intel/vulkan/anv_wsi.c
> index 363f70f..a8b01dc 100644
> --- a/src/intel/vulkan/anv_wsi.c
> +++ b/src/intel/vulkan/anv_wsi.c
> @@ -27,8 +27,9 @@
>  #include "vk_util.h"
>  
>  #ifdef VK_USE_PLATFORM_WAYLAND_KHR

and this ^ reminds me I forgot to send the anv patch to turn this into
an always-compiled MAYBE_UNUSED; sending it in a bit :)

> +#define WSI_CB(x) .x = anv_##x
>  static const struct wsi_callbacks wsi_cbs = {
> -   .get_phys_device_format_properties = anv_GetPhysicalDeviceFormatProperties,
> +   WSI_CB(GetPhysicalDeviceFormatProperties),
>  };
>  #endif
>  
> diff --git a/src/vulkan/wsi/wsi_common.h b/src/vulkan/wsi/wsi_common.h
> index 3fa2631..7171de3 100644
> --- a/src/vulkan/wsi/wsi_common.h
> +++ b/src/vulkan/wsi/wsi_common.h
> @@ -122,9 +122,7 @@ struct wsi_device {
>  };
>  
>  struct wsi_callbacks {
> -   void (*get_phys_device_format_properties)(VkPhysicalDevice physicalDevice,
> -                                             VkFormat format,
> -                                             VkFormatProperties *pFormatProperties);
> +   PFN_vkGetPhysicalDeviceFormatProperties GetPhysicalDeviceFormatProperties;
>  };
>  
>  #define WSI_DEFINE_NONDISP_HANDLE_CASTS(__wsi_type, __VkType)              \
> diff --git a/src/vulkan/wsi/wsi_common_wayland.c b/src/vulkan/wsi/wsi_common_wayland.c
> index 60e72fb..4df5bb8 100644
> --- a/src/vulkan/wsi/wsi_common_wayland.c
> +++ b/src/vulkan/wsi/wsi_common_wayland.c
> @@ -84,7 +84,7 @@ wsi_wl_display_add_vk_format(struct wsi_wl_display *display, VkFormat format)
>     /* Don't add formats that aren't renderable. */
>     VkFormatProperties props;
>  
> -   display->wsi_wl->cbs->get_phys_device_format_properties(display->wsi_wl->physical_device,
> +   display->wsi_wl->cbs->GetPhysicalDeviceFormatProperties(display->wsi_wl->physical_device,
>                                                             format, &props);
>     if (!(props.optimalTilingFeatures & VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT))
>        return;
> -- 
> 2.9.5
> 
> _______________________________________________
> 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