1/*
2 * Copyright 2019 Google LLC
3 * SPDX-License-Identifier: MIT
4 *
5 * based in part on anv and radv which are:
6 * Copyright © 2015 Intel Corporation
7 * Copyright © 2016 Red Hat.
8 * Copyright © 2016 Bas Nieuwenhuizen
9 */
10
11#ifndef VN_WSI_H
12#define VN_WSI_H
13
14#include "vn_common.h"
15
16#include "wsi_common.h"
17
18#ifdef VN_USE_WSI_PLATFORM
19
20VkResult
21vn_wsi_init(struct vn_physical_device *physical_dev);
22
23void
24vn_wsi_fini(struct vn_physical_device *physical_dev);
25
26static inline const struct wsi_image_create_info *
27vn_wsi_find_wsi_image_create_info(const VkImageCreateInfo *create_info)
28{
29   return vk_find_struct_const(create_info->pNext,
30                               WSI_IMAGE_CREATE_INFO_MESA);
31}
32
33VkResult
34vn_wsi_create_image(struct vn_device *dev,
35                    const VkImageCreateInfo *create_info,
36                    const struct wsi_image_create_info *wsi_info,
37                    const VkAllocationCallbacks *alloc,
38                    struct vn_image **out_img);
39
40#else
41
42static inline VkResult
43vn_wsi_init(UNUSED struct vn_physical_device *physical_dev)
44{
45   return VK_SUCCESS;
46}
47
48static inline void
49vn_wsi_fini(UNUSED struct vn_physical_device *physical_dev)
50{
51}
52
53static inline const struct wsi_image_create_info *
54vn_wsi_find_wsi_image_create_info(const VkImageCreateInfo *create_info)
55{
56   return NULL;
57}
58
59static inline VkResult
60vn_wsi_create_image(struct vn_device *dev,
61                    const VkImageCreateInfo *create_info,
62                    const struct wsi_image_create_info *wsi_info,
63                    const VkAllocationCallbacks *alloc,
64                    struct vn_image **out_img)
65{
66   return VK_ERROR_OUT_OF_HOST_MEMORY;
67}
68
69#endif /* VN_USE_WSI_PLATFORM */
70
71#endif /* VN_WSI_H */
72