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
27 #include "radv_private.h"
29 #include "util/disk_cache.h"
30 #include "util/strtod.h"
33 #include <xf86drmMode.h>
35 #include <amdgpu_drm.h>
36 #include "winsys/amdgpu/radv_amdgpu_winsys_public.h"
37 #include "ac_llvm_util.h"
38 #include "vk_format.h"
40 #include "util/debug.h"
41 #include "wsi_common_display.h"
43 #define MM_PER_PIXEL (1.0/96.0 * 25.4)
46 radv_GetPhysicalDeviceDisplayPropertiesKHR(VkPhysicalDevice physical_device
,
47 uint32_t *property_count
,
48 VkDisplayPropertiesKHR
*properties
)
50 RADV_FROM_HANDLE(radv_physical_device
, pdevice
, physical_device
);
52 return wsi_display_get_physical_device_display_properties(
60 radv_GetPhysicalDeviceDisplayPlanePropertiesKHR(
61 VkPhysicalDevice physical_device
,
62 uint32_t *property_count
,
63 VkDisplayPlanePropertiesKHR
*properties
)
65 RADV_FROM_HANDLE(radv_physical_device
, pdevice
, physical_device
);
67 return wsi_display_get_physical_device_display_plane_properties(
75 radv_GetDisplayPlaneSupportedDisplaysKHR(VkPhysicalDevice physical_device
,
77 uint32_t *display_count
,
78 VkDisplayKHR
*displays
)
80 RADV_FROM_HANDLE(radv_physical_device
, pdevice
, physical_device
);
82 return wsi_display_get_display_plane_supported_displays(
92 radv_GetDisplayModePropertiesKHR(VkPhysicalDevice physical_device
,
94 uint32_t *property_count
,
95 VkDisplayModePropertiesKHR
*properties
)
97 RADV_FROM_HANDLE(radv_physical_device
, pdevice
, physical_device
);
99 return wsi_display_get_display_mode_properties(physical_device
,
100 &pdevice
->wsi_device
,
107 radv_CreateDisplayModeKHR(VkPhysicalDevice physical_device
,
108 VkDisplayKHR display
,
109 const VkDisplayModeCreateInfoKHR
*create_info
,
110 const VkAllocationCallbacks
*allocator
,
111 VkDisplayModeKHR
*mode
)
113 RADV_FROM_HANDLE(radv_physical_device
, pdevice
, physical_device
);
115 return wsi_display_create_display_mode(physical_device
,
116 &pdevice
->wsi_device
,
124 radv_GetDisplayPlaneCapabilitiesKHR(VkPhysicalDevice physical_device
,
125 VkDisplayModeKHR mode_khr
,
126 uint32_t plane_index
,
127 VkDisplayPlaneCapabilitiesKHR
*capabilities
)
129 RADV_FROM_HANDLE(radv_physical_device
, pdevice
, physical_device
);
131 return wsi_get_display_plane_capabilities(physical_device
,
132 &pdevice
->wsi_device
,
139 radv_CreateDisplayPlaneSurfaceKHR(
140 VkInstance _instance
,
141 const VkDisplaySurfaceCreateInfoKHR
*create_info
,
142 const VkAllocationCallbacks
*allocator
,
143 VkSurfaceKHR
*surface
)
145 RADV_FROM_HANDLE(radv_instance
, instance
, _instance
);
146 const VkAllocationCallbacks
*alloc
;
151 alloc
= &instance
->alloc
;
153 return wsi_create_display_surface(_instance
, alloc
,
154 create_info
, surface
);
158 radv_ReleaseDisplayEXT(VkPhysicalDevice physical_device
,
159 VkDisplayKHR display
)
161 RADV_FROM_HANDLE(radv_physical_device
, pdevice
, physical_device
);
163 return wsi_release_display(physical_device
,
164 &pdevice
->wsi_device
,
168 #ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT
170 radv_AcquireXlibDisplayEXT(VkPhysicalDevice physical_device
,
172 VkDisplayKHR display
)
174 RADV_FROM_HANDLE(radv_physical_device
, pdevice
, physical_device
);
176 return wsi_acquire_xlib_display(physical_device
,
177 &pdevice
->wsi_device
,
183 radv_GetRandROutputDisplayEXT(VkPhysicalDevice physical_device
,
186 VkDisplayKHR
*display
)
188 RADV_FROM_HANDLE(radv_physical_device
, pdevice
, physical_device
);
190 return wsi_get_randr_output_display(physical_device
,
191 &pdevice
->wsi_device
,
196 #endif /* VK_USE_PLATFORM_XLIB_XRANDR_EXT */