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

Samuel Pitoiset samuel.pitoiset at gmail.com
Thu Nov 16 08:47:00 UTC 2017


Reviewed-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>

On 11/15/2017 11:46 PM, 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>
> ---
>   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
> +#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;
> 


More information about the mesa-dev mailing list