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

Jason Ekstrand jason at jlekstrand.net
Fri Nov 17 05:51:05 UTC 2017


On November 16, 2017 21:40:42 Michael Schellenberger Costa 
<mschellenbergercosta at googlemail.com> wrote:

> Hi Jason,
>
> -----Ursprüngliche Nachricht-----
> Von: mesa-dev [mailto:mesa-dev-bounces at lists.freedesktop.org] Im Auftrag 
> von Jason Ekstrand
> Gesendet: Donnerstag, 16. November 2017 22:29
> An: mesa-dev at lists.freedesktop.org
> Cc: Dave Airlie <airlied at redhat.com>
> Betreff: [Mesa-dev] [PATCH 01/28] vulkan/wsi: use function ptr definitions 
> from the spec.
>
> 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         | 6 +++---
>  src/vulkan/wsi/wsi_common_wayland.c | 2 +-
>  4 files changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/src/amd/vulkan/radv_wsi.c b/src/amd/vulkan/radv_wsi.c
> index 64f5b0d..98346ca 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),
>
> The indentation is wrong here.

Actually, the rest of this files uses tabs.  The old indentation was wrong.

> --Michael
>
>  };
>
>  VkResult
> diff --git a/src/intel/vulkan/anv_wsi.c b/src/intel/vulkan/anv_wsi.c
> index 08d83cd..945b011 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 8166b7d..7be0182 100644
> --- a/src/vulkan/wsi/wsi_common.h
> +++ b/src/vulkan/wsi/wsi_common.h
> @@ -118,11 +118,11 @@ struct wsi_device {
>      struct wsi_interface *                  wsi[VK_ICD_WSI_PLATFORM_MAX];
>  };
>
> +#define WSI_CB(cb) PFN_vk##cb cb
>  struct wsi_callbacks {
> -   void (*get_phys_device_format_properties)(VkPhysicalDevice physicalDevice,
> -                                             VkFormat format,
> -                                             VkFormatProperties 
> *pFormatProperties);
> +   WSI_CB(GetPhysicalDeviceFormatProperties);
>  };
> +#undef WSI_CB
>
>  #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 4c94cd6..b93c3d7 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.5.0.400.gff86faf
>
> _______________________________________________
> 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