1// Copyright 2014-2023 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*PROPOSED RESOLUTION*: Many modern displays support at most a handful of 35resolutions and 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*PROPOSED RESOLUTION*: 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*PROPOSED RESOLUTION*: 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*PROPOSED RESOLUTION*: When using this extension, swapchains are created 73relative to a mode 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*PROPOSED RESOLUTION*: 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*PROPOSED RESOLUTION*: 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*PROPOSED RESOLUTION*: No known hardware has such limitations, but 101determining such limitations 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*PROPOSED RESOLUTION*: 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*PROPOSED RESOLUTION*: 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*PROPOSED RESOLUTION*: Developers prefer to query modes directly from the 120physical GPU so they can use display information as an input to their device 121selection algorithms 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*PROPOSED RESOLUTION*: 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*PROPOSED RESOLUTION*: Defer. 144This could be a separate extension on top of the base WSI specs. 145 146ifdef::editing-notes[] 147[NOTE] 148.editing-note 149==== 150There appears to be a missing sentence for the first part of issue 13 here. 151==== 152endif::editing-notes[] 153 154if they are one physical display device to an end user, but may internally 155be implemented as two side-by-side displays using the same display engine 156(and sometimes cabling) resources as two physically separate display 157devices. 158 159*RESOLVED*: Tiled displays will appear as a single display object in this 160API. 161 16214) Should the raw EDID data be included in the display information? 163 164*RESOLVED*: No. 165A future extension could be added which reports the EDID if necessary. 166This may be complicated by the outcome of issue 13. 167 16815) Should min and max scaling factor capabilities of overlays be exposed? 169 170*RESOLVED*: Yes. 171This is exposed indirectly by allowing applications to query the min/max 172position and extent of the source and destination regions from which image 173contents are fetched by the display engine when using a particular mode and 174overlay pair. 175 17616) Should devices be able to expose planes that can be moved between 177displays? If so, how? 178 179*RESOLVED*: Yes. 180Applications can determine which displays a given plane supports using 181flink:vkGetDisplayPlaneSupportedDisplaysKHR. 182 18317) Should there be a way to destroy display modes? If so, does it support 184destroying "`built in`" modes? 185 186*RESOLVED*: Not in this extension. 187A future extension could add this functionality. 188 18918) What should the lifetime of display and built-in display mode objects 190be? 191 192*RESOLVED*: The lifetime of the instance. 193These objects cannot be destroyed. 194A future extension may be added to expose a way to destroy these objects 195and/or support display hotplug. 196 19719) Should persistent mode for smart panels be enabled/disabled at swapchain 198creation time, or on a per-present basis. 199 200*RESOLVED*: On a per-present basis. 201 202ifndef::VKSC_VERSION_1_0[] 203=== Examples 204 205[NOTE] 206.Note 207==== 208The example code for the `VK_KHR_display` and 209`apiext:VK_KHR_display_swapchain` extensions was removed from the appendix 210after revision 1.0.43. 211The display enumeration example code was ported to the cube demo that is 212shipped with the official Khronos SDK, and is being kept up-to-date in that 213location (see: 214https://github.com/KhronosGroup/Vulkan-Tools/blob/master/cube/cube.c). 215==== 216endif::VKSC_VERSION_1_0[] 217 218=== Version History 219 220 * Revision 1, 2015-02-24 (James Jones) 221 ** Initial draft 222 223 * Revision 2, 2015-03-12 (Norbert Nopper) 224 ** Added overlay enumeration for a display. 225 226 * Revision 3, 2015-03-17 (Norbert Nopper) 227 ** Fixed typos and namings as discussed in Bugzilla. 228 ** Reordered and grouped functions. 229 ** Added functions to query count of display, mode and overlay. 230 ** Added native display handle, which may be needed on some platforms to 231 create a native Window. 232 233 * Revision 4, 2015-03-18 (Norbert Nopper) 234 ** Removed primary and virtualPostion members (see comment of James Jones 235 in Bugzilla). 236 ** Added native overlay handle to information structure. 237 ** Replaced , with ; in struct. 238 239 * Revision 6, 2015-03-18 (Daniel Rakos) 240 ** Added WSI extension suffix to all items. 241 ** Made the whole API more "`Vulkanish`". 242 ** Replaced all functions with a single vkGetDisplayInfoKHR function to 243 better match the rest of the API. 244 ** Made the display, display mode, and overlay objects be first class 245 objects, not subclasses of VkBaseObject as they do not support the 246 common functions anyways. 247 ** Renamed *Info structures to *Properties. 248 ** Removed overlayIndex field from VkOverlayProperties as there is an 249 implicit index already as a result of moving to a "`Vulkanish`" API. 250 ** Displays are not get through device, but through physical GPU to match 251 the rest of the Vulkan API. 252 Also this is something ISVs explicitly requested. 253 ** Added issue (6) and (7). 254 255 * Revision 7, 2015-03-25 (James Jones) 256 ** Added an issues section 257 ** Added rotation and mirroring flags 258 259 * Revision 8, 2015-03-25 (James Jones) 260 ** Combined the duplicate issues sections introduced in last change. 261 ** Added proposed resolutions to several issues. 262 263 * Revision 9, 2015-04-01 (Daniel Rakos) 264 ** Rebased extension against Vulkan 0.82.0 265 266 * Revision 10, 2015-04-01 (James Jones) 267 ** Added issues (10) and (11). 268 ** Added more straw-man issue resolutions, and cleaned up the proposed 269 resolution for issue (4). 270 ** Updated the rotation and mirroring enums to have proper bitmask 271 semantics. 272 273 * Revision 11, 2015-04-15 (James Jones) 274 ** Added proposed resolution for issues (1) and (2). 275 ** Added issues (12), (13), (14), and (15) 276 ** Removed pNativeHandle field from overlay structure. 277 ** Fixed small compilation errors in example code. 278 279 * Revision 12, 2015-07-29 (James Jones) 280 ** Rewrote the guts of the extension against the latest WSI swapchain 281 specifications and the latest Vulkan API. 282 ** Address overlay planes by their index rather than an object handle and 283 refer to them as "`planes`" rather than "`overlays`" to make it 284 slightly clearer that even a display with no "`overlays`" still has at 285 least one base "`plane`" that images can be displayed on. 286 ** Updated most of the issues. 287 ** Added an "`extension type`" section to the specification header. 288 ** Reused the VK_EXT_KHR_surface surface transform enumerations rather 289 than redefining them here. 290 ** Updated the example code to use the new semantics. 291 292 * Revision 13, 2015-08-21 (Ian Elliott) 293 ** Renamed this extension and all of its enumerations, types, functions, 294 etc. 295 This makes it compliant with the proposed standard for Vulkan 296 extensions. 297 ** Switched from "`revision`" to "`version`", including use of the 298 VK_MAKE_VERSION macro in the header file. 299 300 * Revision 14, 2015-09-01 (James Jones) 301 ** Restore single-field revision number. 302 303 * Revision 15, 2015-09-08 (James Jones) 304 ** Added alpha flags enum. 305 ** Added premultiplied alpha support. 306 307 * Revision 16, 2015-09-08 (James Jones) 308 ** Added description section to the spec. 309 ** Added issues 16 - 18. 310 311 * Revision 17, 2015-10-02 (James Jones) 312 ** Planes are now a property of the entire device rather than individual 313 displays. 314 This allows planes to be moved between multiple displays on devices 315 that support it. 316 ** Added a function to create a VkSurfaceKHR object describing a display 317 plane and mode to align with the new per-platform surface creation 318 conventions. 319 ** Removed detailed mode timing data. 320 It was agreed that the mode extents and refresh rate are sufficient for 321 current use cases. 322 Other information could be added back in as an extension if it is 323 needed in the future. 324 ** Added support for smart/persistent/buffered display devices. 325 326 * Revision 18, 2015-10-26 (Ian Elliott) 327 ** Renamed from VK_EXT_KHR_display to VK_KHR_display. 328 329 * Revision 19, 2015-11-02 (James Jones) 330 ** Updated example code to match revision 17 changes. 331 332 * Revision 20, 2015-11-03 (Daniel Rakos) 333 ** Added allocation callbacks to creation functions. 334 335 * Revision 21, 2015-11-10 (Jesse Hall) 336 ** Added VK_DISPLAY_PLANE_ALPHA_OPAQUE_BIT_KHR, and use 337 VkDisplayPlaneAlphaFlagBitsKHR for 338 VkDisplayPlanePropertiesKHR::alphaMode instead of 339 VkDisplayPlaneAlphaFlagsKHR, since it only represents one mode. 340 ** Added reserved flags bitmask to VkDisplayPlanePropertiesKHR. 341 ** Use VkSurfaceTransformFlagBitsKHR instead of obsolete 342 VkSurfaceTransformKHR. 343 ** Renamed vkGetDisplayPlaneSupportedDisplaysKHR parameters for clarity. 344 345 * Revision 22, 2015-12-18 (James Jones) 346 ** Added missing "`planeIndex`" parameter to 347 vkGetDisplayPlaneSupportedDisplaysKHR() 348 349 * Revision 23, 2017-03-13 (James Jones) 350 ** Closed all remaining issues. 351 The specification and implementations have been shipping with the 352 proposed resolutions for some time now. 353 ** Removed the sample code and noted it has been integrated into the 354 official Vulkan SDK cube demo. 355