vulkan: Add EXT_acquire_xlib_display [v5]
[mesa.git] / src / vulkan / wsi / wsi_common_display.h
1 /*
2 * Copyright © 2017 Keith Packard
3 *
4 * Permission to use, copy, modify, distribute, and sell this software and its
5 * documentation for any purpose is hereby granted without fee, provided that
6 * the above copyright notice appear in all copies and that both that copyright
7 * notice and this permission notice appear in supporting documentation, and
8 * that the name of the copyright holders not be used in advertising or
9 * publicity pertaining to distribution of the software without specific,
10 * written prior permission. The copyright holders make no representations
11 * about the suitability of this software for any purpose. It is provided "as
12 * is" without express or implied warranty.
13 *
14 * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
15 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
16 * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
17 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
18 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
19 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
20 * OF THIS SOFTWARE.
21 */
22
23 #ifndef WSI_COMMON_DISPLAY_H
24 #define WSI_COMMON_DISPLAY_H
25
26 #include "wsi_common.h"
27 #include <xf86drm.h>
28 #include <xf86drmMode.h>
29
30 #define typed_memcpy(dest, src, count) ({ \
31 STATIC_ASSERT(sizeof(*src) == sizeof(*dest)); \
32 memcpy((dest), (src), (count) * sizeof(*(src))); \
33 })
34
35 VkResult
36 wsi_display_get_physical_device_display_properties(
37 VkPhysicalDevice physical_device,
38 struct wsi_device *wsi_device,
39 uint32_t *property_count,
40 VkDisplayPropertiesKHR *properties);
41
42 VkResult
43 wsi_display_get_physical_device_display_plane_properties(
44 VkPhysicalDevice physical_device,
45 struct wsi_device *wsi_device,
46 uint32_t *property_count,
47 VkDisplayPlanePropertiesKHR *properties);
48
49 VkResult
50 wsi_display_get_display_plane_supported_displays(
51 VkPhysicalDevice physical_device,
52 struct wsi_device *wsi_device,
53 uint32_t plane_index,
54 uint32_t *display_count,
55 VkDisplayKHR *displays);
56
57 VkResult
58 wsi_display_get_display_mode_properties(VkPhysicalDevice physical_device,
59 struct wsi_device *wsi_device,
60 VkDisplayKHR display,
61 uint32_t *property_count,
62 VkDisplayModePropertiesKHR *properties);
63
64 VkResult
65 wsi_display_create_display_mode(VkPhysicalDevice physical_device,
66 struct wsi_device *wsi_device,
67 VkDisplayKHR display,
68 const VkDisplayModeCreateInfoKHR *create_info,
69 const VkAllocationCallbacks *allocator,
70 VkDisplayModeKHR *mode);
71
72 VkResult
73 wsi_get_display_plane_capabilities(VkPhysicalDevice physical_device,
74 struct wsi_device *wsi_device,
75 VkDisplayModeKHR mode_khr,
76 uint32_t plane_index,
77 VkDisplayPlaneCapabilitiesKHR *capabilities);
78
79 VkResult
80 wsi_create_display_surface(VkInstance instance,
81 const VkAllocationCallbacks *pAllocator,
82 const VkDisplaySurfaceCreateInfoKHR *pCreateInfo,
83 VkSurfaceKHR *pSurface);
84
85 VkResult
86 wsi_release_display(VkPhysicalDevice physical_device,
87 struct wsi_device *wsi_device,
88 VkDisplayKHR display);
89
90
91 #if VK_USE_PLATFORM_XLIB_XRANDR_EXT
92 VkResult
93 wsi_acquire_xlib_display(VkPhysicalDevice physical_device,
94 struct wsi_device *wsi_device,
95 Display *dpy,
96 VkDisplayKHR display);
97
98 VkResult
99 wsi_get_randr_output_display(VkPhysicalDevice physical_device,
100 struct wsi_device *wsi_device,
101 Display *dpy,
102 RROutput output,
103 VkDisplayKHR *display);
104
105 #endif /* VK_USE_PLATFORM_XLIB_XRANDR_EXT */
106
107 #endif