• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
20 VkResult
21 vn_wsi_init(struct vn_physical_device *physical_dev);
22 
23 void
24 vn_wsi_fini(struct vn_physical_device *physical_dev);
25 
26 static inline const struct wsi_image_create_info *
vn_wsi_find_wsi_image_create_info(const VkImageCreateInfo * create_info)27 vn_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 
33 VkResult
34 vn_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 
42 static inline VkResult
vn_wsi_init(UNUSED struct vn_physical_device * physical_dev)43 vn_wsi_init(UNUSED struct vn_physical_device *physical_dev)
44 {
45    return VK_SUCCESS;
46 }
47 
48 static inline void
vn_wsi_fini(UNUSED struct vn_physical_device * physical_dev)49 vn_wsi_fini(UNUSED struct vn_physical_device *physical_dev)
50 {
51 }
52 
53 static inline const struct wsi_image_create_info *
vn_wsi_find_wsi_image_create_info(const VkImageCreateInfo * create_info)54 vn_wsi_find_wsi_image_create_info(const VkImageCreateInfo *create_info)
55 {
56    return NULL;
57 }
58 
59 static inline VkResult
vn_wsi_create_image(struct vn_device * dev,const VkImageCreateInfo * create_info,const struct wsi_image_create_info * wsi_info,const VkAllocationCallbacks * alloc,struct vn_image ** out_img)60 vn_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