1// Copyright 2014-2024 The Khronos Group Inc. 2// 3// SPDX-License-Identifier: CC-BY-4.0 4 5include::{generated}/meta/{refprefix}VK_KHR_display.adoc[] 6 7=== Other Extension Metadata 8 9*Last Modified Date*:: 10 2017-03-13 11*IP Status*:: 12 No known IP claims. 13*Contributors*:: 14 - James Jones, NVIDIA 15 - Norbert Nopper, Freescale 16 - Jeff Vigil, Qualcomm 17 - Daniel Rakos, AMD 18 19=== Description 20 21This extension provides the API to enumerate displays and available modes on 22a given device. 23 24include::{generated}/interfaces/VK_KHR_display.adoc[] 25 26=== Issues 27 281) Which properties of a mode should be fixed in the mode information vs. 29settable in some other function when setting the mode? E.g., do we need to 30double the size of the mode pool to include both stereo and non-stereo 31modes? YUV and RGB scanout even if they both take RGB input images? BGR vs. 32RGB input? etc. 33 34*RESOLVED*: Many modern displays support at most a handful of resolutions 35and timings natively. 36Other "`modes`" are expected to be supported using scaling hardware on the 37display engine or GPU. 38Other properties, such as rotation and mirroring should not require 39duplicating hardware modes just to express all combinations. 40Further, these properties may be implemented on a per-display or per-overlay 41granularity. 42 43To avoid the exponential growth of modes as mutable properties are added, as 44was the case with code:EGLConfig/WGL pixel formats/code:GLXFBConfig, this 45specification should separate out hardware properties and configurable state 46into separate objects. 47Modes and overlay planes will express capabilities of the hardware, while a 48separate structure will allow applications to configure scaling, rotation, 49mirroring, color keys, LUT values, alpha masks, etc. 50for a given swapchain independent of the mode in use. 51Constraints on these settings will be established by properties of the 52immutable objects. 53 54Note the resolution of this issue may affect issue 5 as well. 55 562) What properties of a display itself are useful? 57 58*RESOLVED*: This issue is too broad. 59It was meant to prompt general discussion, but resolving this issue amounts 60to completing this specification. 61All interesting properties should be included. 62The issue will remain as a placeholder since removing it would make it hard 63to parse existing discussion notes that refer to issues by number. 64 653) How are multiple overlay planes within a display or mode enumerated? 66 67*RESOLVED*: They are referred to by an index. 68Each display will report the number of overlay planes it contains. 69 704) Should swapchains be created relative to a mode or a display? 71 72*RESOLVED*: When using this extension, swapchains are created relative to a 73mode and a plane. 74The mode implies the display object the swapchain will present to. 75If the specified mode is not the display's current mode, the new mode will 76be applied when the first image is presented to the swapchain, and the 77default operating system mode, if any, will be restored when the swapchain 78is destroyed. 79 805) Should users query generic ranges from displays and construct their own 81modes explicitly using those constraints rather than querying a fixed set of 82modes (Most monitors only have one real "`mode`" these days, even though 83many support relatively arbitrary scaling, either on the monitor side or in 84the GPU display engine, making "`modes`" something of a relic/compatibility 85construct). 86 87*RESOLVED*: Expose both. 88Display information structures will expose a set of predefined modes, as 89well as any attributes necessary to construct a customized mode. 90 916) Is it fine if we return the display and display mode handles in the 92structure used to query their properties? 93 94*RESOLVED*: Yes. 95 967) Is there a possibility that not all displays of a device work with all of 97the present queues of a device? If yes, how do we determine which displays 98work with which present queues? 99 100*RESOLVED*: No known hardware has such limitations, but determining such 101limitations is supported automatically using the existing 102`apiext:VK_KHR_surface` and `apiext:VK_KHR_swapchain` query mechanisms. 103 1048) Should all presentation need to be done relative to an overlay plane, or 105can a display mode + display be used alone to target an output? 106 107*RESOLVED*: Require specifying a plane explicitly. 108 1099) Should displays have an associated window system display, such as an 110code:HDC or code:Display*? 111 112*RESOLVED*: No. 113Displays are independent of any windowing system in use on the system. 114Further, neither code:HDC nor code:Display* refer to a physical display 115object. 116 11710) Are displays queried from a physical GPU or from a device instance? 118 119*RESOLVED*: Developers prefer to query modes directly from the physical GPU 120so they can use display information as an input to their device selection 121algorithms prior to device creation. 122This avoids the need to create placeholder device instances to enumerate 123displays. 124 125This preference must be weighed against the extra initialization that must 126be done by driver vendors prior to device instance creation to support this 127usage. 128 12911) Should displays and/or modes be dispatchable objects? If functions are 130to take displays, overlays, or modes as their first parameter, they must be 131dispatchable objects as defined in Khronos bug 13529. 132If they are not added to the list of dispatchable objects, functions 133operating on them must take some higher-level object as their first 134parameter. 135There is no performance case against making them dispatchable objects, but 136they would be the first extension objects to be dispatchable. 137 138*RESOLVED*: Do not make displays or modes dispatchable. 139They will dispatch based on their associated physical device. 140 14112) Should hardware cursor capabilities be exposed? 142 143*RESOLVED*: Defer. 144This could be a separate extension on top of the base WSI specs. 145 14613) How many display objects should be enumerated for "tiled" display 147devices? There are ongoing design discussions among lower-level display API 148authors regarding how to expose displays if they are one physical display 149device to an end user, but may internally be implemented as two side-by-side 150displays using the same display engine (and sometimes cabling) resources as 151two physically separate display devices. 152 153*RESOLVED*: Tiled displays will appear as a single display object in this 154API. 155 15614) Should the raw EDID data be included in the display information? 157 158*RESOLVED*: No. 159A future extension could be added which reports the EDID if necessary. 160This may be complicated by the outcome of issue 13. 161 16215) Should min and max scaling factor capabilities of overlays be exposed? 163 164*RESOLVED*: Yes. 165This is exposed indirectly by allowing applications to query the min/max 166position and extent of the source and destination regions from which image 167contents are fetched by the display engine when using a particular mode and 168overlay pair. 169 17016) Should devices be able to expose planes that can be moved between 171displays? If so, how? 172 173*RESOLVED*: Yes. 174Applications can determine which displays a given plane supports using 175flink:vkGetDisplayPlaneSupportedDisplaysKHR. 176 17717) Should there be a way to destroy display modes? If so, does it support 178destroying "`built in`" modes? 179 180*RESOLVED*: Not in this extension. 181A future extension could add this functionality. 182 18318) What should the lifetime of display and built-in display mode objects 184be? 185 186*RESOLVED*: The lifetime of the instance. 187These objects cannot be destroyed. 188A future extension may be added to expose a way to destroy these objects 189and/or support display hotplug. 190 19119) Should persistent mode for smart panels be enabled/disabled at swapchain 192creation time, or on a per-present basis. 193 194*RESOLVED*: On a per-present basis. 195 196ifndef::VKSC_VERSION_1_0[] 197=== Examples 198 199[NOTE] 200.Note 201==== 202The example code for the `VK_KHR_display` and 203`apiext:VK_KHR_display_swapchain` extensions was removed from the appendix 204after revision 1.0.43. 205The display enumeration example code was ported to the cube demo that is 206shipped with the official Khronos SDK, and is being kept up-to-date in that 207location (see: 208https://github.com/KhronosGroup/Vulkan-Tools/blob/master/cube/cube.c). 209==== 210endif::VKSC_VERSION_1_0[] 211 212=== Version History 213 214 * Revision 1, 2015-02-24 (James Jones) 215 ** Initial draft 216 217 * Revision 2, 2015-03-12 (Norbert Nopper) 218 ** Added overlay enumeration for a display. 219 220 * Revision 3, 2015-03-17 (Norbert Nopper) 221 ** Fixed typos and namings as discussed in Bugzilla. 222 ** Reordered and grouped functions. 223 ** Added functions to query count of display, mode and overlay. 224 ** Added native display handle, which may be needed on some platforms to 225 create a native Window. 226 227 * Revision 4, 2015-03-18 (Norbert Nopper) 228 ** Removed primary and virtualPostion members (see comment of James Jones 229 in Bugzilla). 230 ** Added native overlay handle to information structure. 231 ** Replaced , with ; in struct. 232 233 * Revision 6, 2015-03-18 (Daniel Rakos) 234 ** Added WSI extension suffix to all items. 235 ** Made the whole API more "`Vulkanish`". 236 ** Replaced all functions with a single vkGetDisplayInfoKHR function to 237 better match the rest of the API. 238 ** Made the display, display mode, and overlay objects be first class 239 objects, not subclasses of VkBaseObject as they do not support the 240 common functions anyways. 241 ** Renamed *Info structures to *Properties. 242 ** Removed overlayIndex field from VkOverlayProperties as there is an 243 implicit index already as a result of moving to a "`Vulkanish`" API. 244 ** Displays are not get through device, but through physical GPU to match 245 the rest of the Vulkan API. 246 Also this is something ISVs explicitly requested. 247 ** Added issue (6) and (7). 248 249 * Revision 7, 2015-03-25 (James Jones) 250 ** Added an issues section 251 ** Added rotation and mirroring flags 252 253 * Revision 8, 2015-03-25 (James Jones) 254 ** Combined the duplicate issues sections introduced in last change. 255 ** Added proposed resolutions to several issues. 256 257 * Revision 9, 2015-04-01 (Daniel Rakos) 258 ** Rebased extension against Vulkan 0.82.0 259 260 * Revision 10, 2015-04-01 (James Jones) 261 ** Added issues (10) and (11). 262 ** Added more straw-man issue resolutions, and cleaned up the proposed 263 resolution for issue (4). 264 ** Updated the rotation and mirroring enums to have proper bitmask 265 semantics. 266 267 * Revision 11, 2015-04-15 (James Jones) 268 ** Added proposed resolution for issues (1) and (2). 269 ** Added issues (12), (13), (14), and (15) 270 ** Removed pNativeHandle field from overlay structure. 271 ** Fixed small compilation errors in example code. 272 273 * Revision 12, 2015-07-29 (James Jones) 274 ** Rewrote the guts of the extension against the latest WSI swapchain 275 specifications and the latest Vulkan API. 276 ** Address overlay planes by their index rather than an object handle and 277 refer to them as "`planes`" rather than "`overlays`" to make it 278 slightly clearer that even a display with no "`overlays`" still has at 279 least one base "`plane`" that images can be displayed on. 280 ** Updated most of the issues. 281 ** Added an "`extension type`" section to the specification header. 282 ** Reused the VK_EXT_KHR_surface surface transform enumerations rather 283 than redefining them here. 284 ** Updated the example code to use the new semantics. 285 286 * Revision 13, 2015-08-21 (Ian Elliott) 287 ** Renamed this extension and all of its enumerations, types, functions, 288 etc. 289 This makes it compliant with the proposed standard for Vulkan 290 extensions. 291 ** Switched from "`revision`" to "`version`", including use of the 292 VK_MAKE_VERSION macro in the header file. 293 294 * Revision 14, 2015-09-01 (James Jones) 295 ** Restore single-field revision number. 296 297 * Revision 15, 2015-09-08 (James Jones) 298 ** Added alpha flags enum. 299 ** Added premultiplied alpha support. 300 301 * Revision 16, 2015-09-08 (James Jones) 302 ** Added description section to the spec. 303 ** Added issues 16 - 18. 304 305 * Revision 17, 2015-10-02 (James Jones) 306 ** Planes are now a property of the entire device rather than individual 307 displays. 308 This allows planes to be moved between multiple displays on devices 309 that support it. 310 ** Added a function to create a VkSurfaceKHR object describing a display 311 plane and mode to align with the new per-platform surface creation 312 conventions. 313 ** Removed detailed mode timing data. 314 It was agreed that the mode extents and refresh rate are sufficient for 315 current use cases. 316 Other information could be added back in as an extension if it is 317 needed in the future. 318 ** Added support for smart/persistent/buffered display devices. 319 320 * Revision 18, 2015-10-26 (Ian Elliott) 321 ** Renamed from VK_EXT_KHR_display to VK_KHR_display. 322 323 * Revision 19, 2015-11-02 (James Jones) 324 ** Updated example code to match revision 17 changes. 325 326 * Revision 20, 2015-11-03 (Daniel Rakos) 327 ** Added allocation callbacks to creation functions. 328 329 * Revision 21, 2015-11-10 (Jesse Hall) 330 ** Added VK_DISPLAY_PLANE_ALPHA_OPAQUE_BIT_KHR, and use 331 VkDisplayPlaneAlphaFlagBitsKHR for 332 VkDisplayPlanePropertiesKHR::alphaMode instead of 333 VkDisplayPlaneAlphaFlagsKHR, since it only represents one mode. 334 ** Added reserved flags bitmask to VkDisplayPlanePropertiesKHR. 335 ** Use VkSurfaceTransformFlagBitsKHR instead of obsolete 336 VkSurfaceTransformKHR. 337 ** Renamed vkGetDisplayPlaneSupportedDisplaysKHR parameters for clarity. 338 339 * Revision 22, 2015-12-18 (James Jones) 340 ** Added missing "`planeIndex`" parameter to 341 vkGetDisplayPlaneSupportedDisplaysKHR() 342 343 * Revision 23, 2017-03-13 (James Jones) 344 ** Closed all remaining issues. 345 The specification and implementations have been shipping with the 346 proposed resolutions for some time now. 347 ** Removed the sample code and noted it has been integrated into the 348 official Vulkan SDK cube demo. 349