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_properties2( 44 VkPhysicalDevice physical_device, 45 struct wsi_device *wsi_device, 46 uint32_t *pPropertyCount, 47 VkDisplayProperties2KHR *pProperties); 48 49 VkResult 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); 55 56 VkResult 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); 62 63 VkResult 64 wsi_display_get_display_plane_supported_displays( 65 VkPhysicalDevice physical_device, 66 struct wsi_device *wsi_device, 67 uint32_t plane_index, 68 uint32_t *display_count, 69 VkDisplayKHR *displays); 70 71 VkResult 72 wsi_display_get_display_mode_properties(VkPhysicalDevice physical_device, 73 struct wsi_device *wsi_device, 74 VkDisplayKHR display, 75 uint32_t *property_count, 76 VkDisplayModePropertiesKHR *properties); 77 78 VkResult 79 wsi_display_get_display_mode_properties2(VkPhysicalDevice physical_device, 80 struct wsi_device *wsi_device, 81 VkDisplayKHR display, 82 uint32_t *property_count, 83 VkDisplayModeProperties2KHR *properties); 84 85 VkResult 86 wsi_display_create_display_mode(VkPhysicalDevice physical_device, 87 struct wsi_device *wsi_device, 88 VkDisplayKHR display, 89 const VkDisplayModeCreateInfoKHR *create_info, 90 const VkAllocationCallbacks *allocator, 91 VkDisplayModeKHR *mode); 92 93 VkResult 94 wsi_get_display_plane_capabilities(VkPhysicalDevice physical_device, 95 struct wsi_device *wsi_device, 96 VkDisplayModeKHR mode_khr, 97 uint32_t plane_index, 98 VkDisplayPlaneCapabilitiesKHR *capabilities); 99 100 VkResult 101 wsi_get_display_plane_capabilities2(VkPhysicalDevice physical_device, 102 struct wsi_device *wsi_device, 103 const VkDisplayPlaneInfo2KHR *pDisplayPlaneInfo, 104 VkDisplayPlaneCapabilities2KHR *capabilities); 105 106 VkResult 107 wsi_create_display_surface(VkInstance instance, 108 const VkAllocationCallbacks *pAllocator, 109 const VkDisplaySurfaceCreateInfoKHR *pCreateInfo, 110 VkSurfaceKHR *pSurface); 111 112 VkResult 113 wsi_release_display(VkPhysicalDevice physical_device, 114 struct wsi_device *wsi_device, 115 VkDisplayKHR display); 116 117 118 #ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT 119 VkResult 120 wsi_acquire_xlib_display(VkPhysicalDevice physical_device, 121 struct wsi_device *wsi_device, 122 Display *dpy, 123 VkDisplayKHR display); 124 125 VkResult 126 wsi_get_randr_output_display(VkPhysicalDevice physical_device, 127 struct wsi_device *wsi_device, 128 Display *dpy, 129 RROutput output, 130 VkDisplayKHR *display); 131 132 #endif /* VK_USE_PLATFORM_XLIB_XRANDR_EXT */ 133 134 /* VK_EXT_display_control */ 135 VkResult 136 wsi_display_power_control(VkDevice device, 137 struct wsi_device *wsi_device, 138 VkDisplayKHR display, 139 const VkDisplayPowerInfoEXT *display_power_info); 140 141 VkResult 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, 147 int sync_fd); 148 149 VkResult 150 wsi_register_display_event(VkDevice device, 151 struct wsi_device *wsi_device, 152 VkDisplayKHR display, 153 const VkDisplayEventInfoEXT *display_event_info, 154 const VkAllocationCallbacks *allocator, 155 struct wsi_fence **fence, 156 int sync_fd); 157 158 VkResult 159 wsi_get_swapchain_counter(VkDevice device, 160 struct wsi_device *wsi_device, 161 VkSwapchainKHR swapchain, 162 VkSurfaceCounterFlagBitsEXT flag_bits, 163 uint64_t *value); 164 165 #endif 166