2 * Copyright © 2017 Keith Packard
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.
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
23 #ifndef WSI_COMMON_DISPLAY_H
24 #define WSI_COMMON_DISPLAY_H
26 #include "wsi_common.h"
28 #include <xf86drmMode.h>
30 #define typed_memcpy(dest, src, count) ({ \
31 STATIC_ASSERT(sizeof(*src) == sizeof(*dest)); \
32 memcpy((dest), (src), (count) * sizeof(*(src))); \
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
);
43 wsi_display_get_physical_device_display_properties2(
44 VkPhysicalDevice physical_device
,
45 struct wsi_device
*wsi_device
,
46 uint32_t *pPropertyCount
,
47 VkDisplayProperties2KHR
*pProperties
);
50 wsi_display_get_physical_device_display_plane_properties(
51 VkPhysicalDevice physical_device
,
52 struct wsi_device
*wsi_device
,
53 uint32_t *property_count
,
54 VkDisplayPlanePropertiesKHR
*properties
);
57 wsi_display_get_physical_device_display_plane_properties2(
58 VkPhysicalDevice physical_device
,
59 struct wsi_device
*wsi_device
,
60 uint32_t *property_count
,
61 VkDisplayPlaneProperties2KHR
*properties
);
64 wsi_display_get_display_plane_supported_displays(
65 VkPhysicalDevice physical_device
,
66 struct wsi_device
*wsi_device
,
68 uint32_t *display_count
,
69 VkDisplayKHR
*displays
);
72 wsi_display_get_display_mode_properties(VkPhysicalDevice physical_device
,
73 struct wsi_device
*wsi_device
,
75 uint32_t *property_count
,
76 VkDisplayModePropertiesKHR
*properties
);
79 wsi_display_get_display_mode_properties2(VkPhysicalDevice physical_device
,
80 struct wsi_device
*wsi_device
,
82 uint32_t *property_count
,
83 VkDisplayModeProperties2KHR
*properties
);
86 wsi_display_create_display_mode(VkPhysicalDevice physical_device
,
87 struct wsi_device
*wsi_device
,
89 const VkDisplayModeCreateInfoKHR
*create_info
,
90 const VkAllocationCallbacks
*allocator
,
91 VkDisplayModeKHR
*mode
);
94 wsi_get_display_plane_capabilities(VkPhysicalDevice physical_device
,
95 struct wsi_device
*wsi_device
,
96 VkDisplayModeKHR mode_khr
,
98 VkDisplayPlaneCapabilitiesKHR
*capabilities
);
101 wsi_get_display_plane_capabilities2(VkPhysicalDevice physical_device
,
102 struct wsi_device
*wsi_device
,
103 const VkDisplayPlaneInfo2KHR
*pDisplayPlaneInfo
,
104 VkDisplayPlaneCapabilities2KHR
*capabilities
);
107 wsi_create_display_surface(VkInstance instance
,
108 const VkAllocationCallbacks
*pAllocator
,
109 const VkDisplaySurfaceCreateInfoKHR
*pCreateInfo
,
110 VkSurfaceKHR
*pSurface
);
113 wsi_release_display(VkPhysicalDevice physical_device
,
114 struct wsi_device
*wsi_device
,
115 VkDisplayKHR display
);
118 #ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT
120 wsi_acquire_xlib_display(VkPhysicalDevice physical_device
,
121 struct wsi_device
*wsi_device
,
123 VkDisplayKHR display
);
126 wsi_get_randr_output_display(VkPhysicalDevice physical_device
,
127 struct wsi_device
*wsi_device
,
130 VkDisplayKHR
*display
);
132 #endif /* VK_USE_PLATFORM_XLIB_XRANDR_EXT */
134 /* VK_EXT_display_control */
136 wsi_display_power_control(VkDevice device
,
137 struct wsi_device
*wsi_device
,
138 VkDisplayKHR display
,
139 const VkDisplayPowerInfoEXT
*display_power_info
);
142 wsi_register_device_event(VkDevice device
,
143 struct wsi_device
*wsi_device
,
144 const VkDeviceEventInfoEXT
*device_event_info
,
145 const VkAllocationCallbacks
*allocator
,
146 struct wsi_fence
**fence
);
149 wsi_register_display_event(VkDevice device
,
150 struct wsi_device
*wsi_device
,
151 VkDisplayKHR display
,
152 const VkDisplayEventInfoEXT
*display_event_info
,
153 const VkAllocationCallbacks
*allocator
,
154 struct wsi_fence
**fence
);
157 wsi_get_swapchain_counter(VkDevice device
,
158 struct wsi_device
*wsi_device
,
159 VkSwapchainKHR swapchain
,
160 VkSurfaceCounterFlagBitsEXT flag_bits
,