2 * Copyright © 2015 Intel Corporation
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
26 #include "anv_private.h"
30 struct anv_wsi_surface
{
31 struct anv_instance
*instance
;
33 void (*destroy
)(struct anv_wsi_surface
*surface
,
34 const VkAllocationCallbacks
*pAllocator
);
35 VkResult (*get_support
)(struct anv_wsi_surface
*surface
,
36 struct anv_physical_device
*device
,
37 uint32_t queueFamilyIndex
,
38 VkBool32
* pSupported
);
39 VkResult (*get_capabilities
)(struct anv_wsi_surface
*surface
,
40 struct anv_physical_device
*device
,
41 VkSurfaceCapabilitiesKHR
* pSurfaceCapabilities
);
42 VkResult (*get_formats
)(struct anv_wsi_surface
*surface
,
43 struct anv_physical_device
*device
,
44 uint32_t* pSurfaceFormatCount
,
45 VkSurfaceFormatKHR
* pSurfaceFormats
);
46 VkResult (*get_present_modes
)(struct anv_wsi_surface
*surface
,
47 struct anv_physical_device
*device
,
48 uint32_t* pPresentModeCount
,
49 VkPresentModeKHR
* pPresentModes
);
50 VkResult (*create_swapchain
)(struct anv_wsi_surface
*surface
,
51 struct anv_device
*device
,
52 const VkSwapchainCreateInfoKHR
* pCreateInfo
,
53 const VkAllocationCallbacks
* pAllocator
,
54 struct anv_swapchain
**swapchain
);
57 struct anv_swapchain
{
58 struct anv_device
*device
;
60 VkResult (*destroy
)(struct anv_swapchain
*swapchain
,
61 const VkAllocationCallbacks
*pAllocator
);
62 VkResult (*get_images
)(struct anv_swapchain
*swapchain
,
63 uint32_t *pCount
, VkImage
*pSwapchainImages
);
64 VkResult (*acquire_next_image
)(struct anv_swapchain
*swap_chain
,
65 uint64_t timeout
, VkSemaphore semaphore
,
66 uint32_t *image_index
);
67 VkResult (*queue_present
)(struct anv_swapchain
*swap_chain
,
68 struct anv_queue
*queue
,
69 uint32_t image_index
);
72 ANV_DEFINE_NONDISP_HANDLE_CASTS(anv_wsi_surface
, VkSurfaceKHR
)
73 ANV_DEFINE_NONDISP_HANDLE_CASTS(anv_swapchain
, VkSwapchainKHR
)
75 VkResult
anv_x11_init_wsi(struct anv_instance
*instance
);
76 void anv_x11_finish_wsi(struct anv_instance
*instance
);
77 VkResult
anv_wl_init_wsi(struct anv_instance
*instance
);
78 void anv_wl_finish_wsi(struct anv_instance
*instance
);