xref: /third_party/mesa3d/src/virtio/vulkan/vn_wsi.h (revision bf215546)
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
40VkResult
41vn_wsi_create_image_from_swapchain(
42   struct vn_device *dev,
43   const VkImageCreateInfo *create_info,
44   const VkImageSwapchainCreateInfoKHR *swapchain_info,
45   const VkAllocationCallbacks *alloc,
46   struct vn_image **out_img);
47
48#else
49
50static inline VkResult
51vn_wsi_init(UNUSED struct vn_physical_device *physical_dev)
52{
53   return VK_SUCCESS;
54}
55
56static inline void
57vn_wsi_fini(UNUSED struct vn_physical_device *physical_dev)
58{
59}
60
61static inline const struct wsi_image_create_info *
62vn_wsi_find_wsi_image_create_info(const VkImageCreateInfo *create_info)
63{
64   return NULL;
65}
66
67static inline VkResult
68vn_wsi_create_image(struct vn_device *dev,
69                    const VkImageCreateInfo *create_info,
70                    const struct wsi_image_create_info *wsi_info,
71                    const VkAllocationCallbacks *alloc,
72                    struct vn_image **out_img)
73{
74   return VK_ERROR_OUT_OF_HOST_MEMORY;
75}
76
77static inline VkResult
78vn_wsi_create_image_from_swapchain(
79   struct vn_device *dev,
80   const VkImageCreateInfo *create_info,
81   const VkImageSwapchainCreateInfoKHR *swapchain_info,
82   const VkAllocationCallbacks *alloc,
83   struct vn_image **out_img)
84{
85   return VK_ERROR_OUT_OF_HOST_MEMORY;
86}
87
88#endif /* VN_USE_WSI_PLATFORM */
89
90#endif /* VN_WSI_H */
91