1// Copyright 2014-2023 The Khronos Group Inc. 2// 3// SPDX-License-Identifier: CC-BY-4.0 4 5[[display]] 6== Presenting Directly to Display Devices 7 8In some environments applications can: also present Vulkan rendering 9directly to display devices without using an intermediate windowing system. 10This can: be useful for embedded applications, or implementing the 11rendering/presentation backend of a windowing system using Vulkan. 12The `apiext:VK_KHR_display` extension provides the functionality necessary 13to enumerate display devices and create sname:VkSurfaceKHR objects that 14target displays. 15 16 17=== Display Enumeration 18 19[open,refpage='VkDisplayKHR',desc='Opaque handle to a display object',type='handles'] 20-- 21Displays are represented by sname:VkDisplayKHR handles: 22 23include::{generated}/api/handles/VkDisplayKHR.adoc[] 24-- 25 26[open,refpage='vkGetPhysicalDeviceDisplayPropertiesKHR',desc='Query information about the available displays',type='protos'] 27-- 28:refpage: vkGetPhysicalDeviceDisplayPropertiesKHR 29 30Various functions are provided for enumerating the available display devices 31present on a Vulkan physical device. 32To query information about the available displays, call: 33 34include::{generated}/api/protos/vkGetPhysicalDeviceDisplayPropertiesKHR.adoc[] 35 36 * pname:physicalDevice is a physical device. 37 * pname:pPropertyCount is a pointer to an integer related to the number of 38 display devices available or queried, as described below. 39 * pname:pProperties is either `NULL` or a pointer to an array of 40 sname:VkDisplayPropertiesKHR structures. 41 42If pname:pProperties is `NULL`, then the number of display devices available 43for pname:physicalDevice is returned in pname:pPropertyCount. 44Otherwise, pname:pPropertyCount must: point to a variable set by the user to 45the number of elements in the pname:pProperties array, and on return the 46variable is overwritten with the number of structures actually written to 47pname:pProperties. 48If the value of pname:pPropertyCount is less than the number of display 49devices for pname:physicalDevice, at most pname:pPropertyCount structures 50will be written, and ename:VK_INCOMPLETE will be returned instead of 51ename:VK_SUCCESS, to indicate that not all the available properties were 52returned. 53 54include::{chapters}/commonvalidity/no_dynamic_allocations_common.adoc[] 55 56include::{generated}/validity/protos/vkGetPhysicalDeviceDisplayPropertiesKHR.adoc[] 57-- 58 59[open,refpage='VkDisplayPropertiesKHR',desc='Structure describing an available display device',type='structs'] 60-- 61The sname:VkDisplayPropertiesKHR structure is defined as: 62 63include::{generated}/api/structs/VkDisplayPropertiesKHR.adoc[] 64 65 * pname:display is a handle that is used to refer to the display described 66 here. 67 This handle will be valid for the lifetime of the Vulkan instance. 68 * pname:displayName is `NULL` or a pointer to a null-terminated UTF-8 69 string containing the name of the display. 70 Generally, this will be the name provided by the display's EDID. 71 If `NULL`, no suitable name is available. 72 If not `NULL`, the string pointed to must: remain accessible and 73 unmodified as long as pname:display is valid. 74 * pname:physicalDimensions describes the physical width and height of the 75 visible portion of the display, in millimeters. 76 * pname:physicalResolution describes the physical, native, or preferred 77 resolution of the display. 78 79[NOTE] 80.Note 81==== 82For devices which have no natural value to return here, implementations 83should: return the maximum resolution supported. 84==== 85 86 * pname:supportedTransforms is a bitmask of 87 elink:VkSurfaceTransformFlagBitsKHR describing which transforms are 88 supported by this display. 89 * pname:planeReorderPossible tells whether the planes on this display can: 90 have their z order changed. 91 If this is ename:VK_TRUE, the application can: re-arrange the planes on 92 this display in any order relative to each other. 93 * pname:persistentContent tells whether the display supports 94 self-refresh/internal buffering. 95 If this is true, the application can: submit persistent present 96 operations on swapchains created against this display. 97 98[NOTE] 99.Note 100==== 101Persistent presents may: have higher latency, and may: use less power when 102the screen content is updated infrequently, or when only a portion of the 103screen needs to be updated in most frames. 104==== 105 106include::{generated}/validity/structs/VkDisplayPropertiesKHR.adoc[] 107-- 108 109ifdef::VK_KHR_get_display_properties2[] 110[open,refpage='vkGetPhysicalDeviceDisplayProperties2KHR',desc='Query information about the available displays',type='protos'] 111-- 112:refpage: vkGetPhysicalDeviceDisplayProperties2KHR 113 114To query information about the available displays, call: 115 116include::{generated}/api/protos/vkGetPhysicalDeviceDisplayProperties2KHR.adoc[] 117 118 * pname:physicalDevice is a physical device. 119 * pname:pPropertyCount is a pointer to an integer related to the number of 120 display devices available or queried, as described below. 121 * pname:pProperties is either `NULL` or a pointer to an array of 122 sname:VkDisplayProperties2KHR structures. 123 124fname:vkGetPhysicalDeviceDisplayProperties2KHR behaves similarly to 125flink:vkGetPhysicalDeviceDisplayPropertiesKHR, with the ability to return 126extended information via chained output structures. 127 128include::{chapters}/commonvalidity/no_dynamic_allocations_common.adoc[] 129 130include::{generated}/validity/protos/vkGetPhysicalDeviceDisplayProperties2KHR.adoc[] 131-- 132 133[open,refpage='VkDisplayProperties2KHR',desc='Structure describing an available display device',type='structs'] 134-- 135The sname:VkDisplayProperties2KHR structure is defined as: 136 137include::{generated}/api/structs/VkDisplayProperties2KHR.adoc[] 138 139 * pname:sType is a elink:VkStructureType value identifying this structure. 140 * pname:pNext is `NULL` or a pointer to a structure extending this 141 structure. 142 * pname:displayProperties is a slink:VkDisplayPropertiesKHR structure. 143 144include::{generated}/validity/structs/VkDisplayProperties2KHR.adoc[] 145-- 146endif::VK_KHR_get_display_properties2[] 147 148ifdef::VK_EXT_direct_mode_display[] 149include::{chapters}/VK_EXT_direct_mode_display/acquire_release_displays.adoc[] 150endif::VK_EXT_direct_mode_display[] 151 152 153==== Display Planes 154 155[open,refpage='vkGetPhysicalDeviceDisplayPlanePropertiesKHR',desc='Query the plane properties',type='protos'] 156-- 157:refpage: vkGetPhysicalDeviceDisplayPlanePropertiesKHR 158 159Images are presented to individual planes on a display. 160Devices must: support at least one plane on each display. 161Planes can: be stacked and blended to composite multiple images on one 162display. 163Devices may: support only a fixed stacking order and fixed mapping between 164planes and displays, or they may: allow arbitrary application specified 165stacking orders and mappings between planes and displays. 166To query the properties of device display planes, call: 167 168include::{generated}/api/protos/vkGetPhysicalDeviceDisplayPlanePropertiesKHR.adoc[] 169 170 * pname:physicalDevice is a physical device. 171 * pname:pPropertyCount is a pointer to an integer related to the number of 172 display planes available or queried, as described below. 173 * pname:pProperties is either `NULL` or a pointer to an array of 174 sname:VkDisplayPlanePropertiesKHR structures. 175 176If pname:pProperties is `NULL`, then the number of display planes available 177for pname:physicalDevice is returned in pname:pPropertyCount. 178Otherwise, pname:pPropertyCount must: point to a variable set by the user to 179the number of elements in the pname:pProperties array, and on return the 180variable is overwritten with the number of structures actually written to 181pname:pProperties. 182If the value of pname:pPropertyCount is less than the number of display 183planes for pname:physicalDevice, at most pname:pPropertyCount structures 184will be written. 185 186include::{chapters}/commonvalidity/no_dynamic_allocations_common.adoc[] 187 188include::{generated}/validity/protos/vkGetPhysicalDeviceDisplayPlanePropertiesKHR.adoc[] 189-- 190 191[open,refpage='VkDisplayPlanePropertiesKHR',desc='Structure describing display plane properties',type='structs'] 192-- 193The sname:VkDisplayPlanePropertiesKHR structure is defined as: 194 195include::{generated}/api/structs/VkDisplayPlanePropertiesKHR.adoc[] 196 197 * pname:currentDisplay is the handle of the display the plane is currently 198 associated with. 199 If the plane is not currently attached to any displays, this will be 200 dlink:VK_NULL_HANDLE. 201 * pname:currentStackIndex is the current z-order of the plane. 202 This will be between 0 and the value returned by 203 fname:vkGetPhysicalDeviceDisplayPlanePropertiesKHR in 204 pname:pPropertyCount. 205 206include::{generated}/validity/structs/VkDisplayPlanePropertiesKHR.adoc[] 207-- 208 209ifdef::VK_KHR_get_display_properties2[] 210[open,refpage='vkGetPhysicalDeviceDisplayPlaneProperties2KHR',desc='Query information about the available display planes.',type='protos'] 211-- 212:refpage: vkGetPhysicalDeviceDisplayPlaneProperties2KHR 213 214To query the properties of a device's display planes, call: 215 216include::{generated}/api/protos/vkGetPhysicalDeviceDisplayPlaneProperties2KHR.adoc[] 217 218 * pname:physicalDevice is a physical device. 219 * pname:pPropertyCount is a pointer to an integer related to the number of 220 display planes available or queried, as described below. 221 * pname:pProperties is either `NULL` or a pointer to an array of 222 sname:VkDisplayPlaneProperties2KHR structures. 223 224fname:vkGetPhysicalDeviceDisplayPlaneProperties2KHR behaves similarly to 225flink:vkGetPhysicalDeviceDisplayPlanePropertiesKHR, with the ability to 226return extended information via chained output structures. 227 228include::{chapters}/commonvalidity/no_dynamic_allocations_common.adoc[] 229 230include::{generated}/validity/protos/vkGetPhysicalDeviceDisplayPlaneProperties2KHR.adoc[] 231-- 232 233[open,refpage='VkDisplayPlaneProperties2KHR',desc='Structure describing an available display plane',type='structs'] 234-- 235The sname:VkDisplayPlaneProperties2KHR structure is defined as: 236 237include::{generated}/api/structs/VkDisplayPlaneProperties2KHR.adoc[] 238 239 * pname:sType is a elink:VkStructureType value identifying this structure. 240 * pname:pNext is `NULL` or a pointer to a structure extending this 241 structure. 242 * pname:displayPlaneProperties is a slink:VkDisplayPlanePropertiesKHR 243 structure. 244 245include::{generated}/validity/structs/VkDisplayPlaneProperties2KHR.adoc[] 246-- 247endif::VK_KHR_get_display_properties2[] 248 249[open,refpage='vkGetDisplayPlaneSupportedDisplaysKHR',desc='Query the list of displays a plane supports',type='protos'] 250-- 251:refpage: vkGetDisplayPlaneSupportedDisplaysKHR 252 253To determine which displays a plane is usable with, call 254 255include::{generated}/api/protos/vkGetDisplayPlaneSupportedDisplaysKHR.adoc[] 256 257 * pname:physicalDevice is a physical device. 258 * pname:planeIndex is the plane which the application wishes to use, and 259 must: be in the range [eq]#[0, physical device plane count - 1]#. 260 * pname:pDisplayCount is a pointer to an integer related to the number of 261 displays available or queried, as described below. 262 * pname:pDisplays is either `NULL` or a pointer to an array of 263 sname:VkDisplayKHR handles. 264 265If pname:pDisplays is `NULL`, then the number of displays usable with the 266specified pname:planeIndex for pname:physicalDevice is returned in 267pname:pDisplayCount. 268Otherwise, pname:pDisplayCount must: point to a variable set by the user to 269the number of elements in the pname:pDisplays array, and on return the 270variable is overwritten with the number of handles actually written to 271pname:pDisplays. 272If the value of pname:pDisplayCount is less than the number of usable 273display-plane pairs for pname:physicalDevice, at most pname:pDisplayCount 274handles will be written, and ename:VK_INCOMPLETE will be returned instead of 275ename:VK_SUCCESS, to indicate that not all the available pairs were 276returned. 277 278include::{chapters}/commonvalidity/no_dynamic_allocations_common.adoc[] 279 280.Valid Usage 281**** 282 * [[VUID-vkGetDisplayPlaneSupportedDisplaysKHR-planeIndex-01249]] 283 pname:planeIndex must: be less than the number of display planes 284 supported by the device as determined by calling 285 fname:vkGetPhysicalDeviceDisplayPlanePropertiesKHR 286**** 287 288include::{generated}/validity/protos/vkGetDisplayPlaneSupportedDisplaysKHR.adoc[] 289-- 290 291Additional properties of displays are queried using specialized query 292functions. 293 294 295==== Display Modes 296 297[open,refpage='VkDisplayModeKHR',desc='Opaque handle to a display mode object',type='handles'] 298-- 299Display modes are represented by sname:VkDisplayModeKHR handles: 300 301include::{generated}/api/handles/VkDisplayModeKHR.adoc[] 302-- 303 304[open,refpage='vkGetDisplayModePropertiesKHR',desc='Query the set of mode properties supported by the display',type='protos'] 305-- 306:refpage: vkGetDisplayModePropertiesKHR 307 308Each display has one or more supported modes associated with it by default. 309These built-in modes are queried by calling: 310 311include::{generated}/api/protos/vkGetDisplayModePropertiesKHR.adoc[] 312 313 * pname:physicalDevice is the physical device associated with 314 pname:display. 315 * pname:display is the display to query. 316 * pname:pPropertyCount is a pointer to an integer related to the number of 317 display modes available or queried, as described below. 318 * pname:pProperties is either `NULL` or a pointer to an array of 319 sname:VkDisplayModePropertiesKHR structures. 320 321If pname:pProperties is `NULL`, then the number of display modes available 322on the specified pname:display for pname:physicalDevice is returned in 323pname:pPropertyCount. 324Otherwise, pname:pPropertyCount must: point to a variable set by the user to 325the number of elements in the pname:pProperties array, and on return the 326variable is overwritten with the number of structures actually written to 327pname:pProperties. 328If the value of pname:pPropertyCount is less than the number of display 329modes for pname:physicalDevice, at most pname:pPropertyCount structures will 330be written, and ename:VK_INCOMPLETE will be returned instead of 331ename:VK_SUCCESS, to indicate that not all the available display modes were 332returned. 333 334include::{chapters}/commonvalidity/no_dynamic_allocations_common.adoc[] 335 336include::{generated}/validity/protos/vkGetDisplayModePropertiesKHR.adoc[] 337-- 338 339[open,refpage='VkDisplayModePropertiesKHR',desc='Structure describing display mode properties',type='structs'] 340-- 341The sname:VkDisplayModePropertiesKHR structure is defined as: 342 343include::{generated}/api/structs/VkDisplayModePropertiesKHR.adoc[] 344 345 * pname:displayMode is a handle to the display mode described in this 346 structure. 347 This handle will be valid for the lifetime of the Vulkan instance. 348 * pname:parameters is a slink:VkDisplayModeParametersKHR structure 349 describing the display parameters associated with pname:displayMode. 350 351include::{generated}/validity/structs/VkDisplayModePropertiesKHR.adoc[] 352-- 353 354[open,refpage='VkDisplayModeCreateFlagsKHR',desc='Reserved for future use',type='flags'] 355-- 356include::{generated}/api/flags/VkDisplayModeCreateFlagsKHR.adoc[] 357 358tname:VkDisplayModeCreateFlagsKHR is a bitmask type for setting a mask, but 359is currently reserved for future use. 360-- 361 362ifdef::VK_KHR_get_display_properties2[] 363[open,refpage='vkGetDisplayModeProperties2KHR',desc='Query information about the available display modes.',type='protos'] 364-- 365:refpage: vkGetDisplayModeProperties2KHR 366 367To query the properties of a device's built-in display modes, call: 368 369include::{generated}/api/protos/vkGetDisplayModeProperties2KHR.adoc[] 370 371 * pname:physicalDevice is the physical device associated with 372 pname:display. 373 * pname:display is the display to query. 374 * pname:pPropertyCount is a pointer to an integer related to the number of 375 display modes available or queried, as described below. 376 * pname:pProperties is either `NULL` or a pointer to an array of 377 sname:VkDisplayModeProperties2KHR structures. 378 379fname:vkGetDisplayModeProperties2KHR behaves similarly to 380flink:vkGetDisplayModePropertiesKHR, with the ability to return extended 381information via chained output structures. 382 383include::{chapters}/commonvalidity/no_dynamic_allocations_common.adoc[] 384 385include::{generated}/validity/protos/vkGetDisplayModeProperties2KHR.adoc[] 386-- 387 388[open,refpage='VkDisplayModeProperties2KHR',desc='Structure describing an available display mode',type='structs'] 389-- 390The sname:VkDisplayModeProperties2KHR structure is defined as: 391 392include::{generated}/api/structs/VkDisplayModeProperties2KHR.adoc[] 393 394 * pname:sType is a elink:VkStructureType value identifying this structure. 395 * pname:pNext is `NULL` or a pointer to a structure extending this 396 structure. 397 * pname:displayModeProperties is a slink:VkDisplayModePropertiesKHR 398 structure. 399 400include::{generated}/validity/structs/VkDisplayModeProperties2KHR.adoc[] 401-- 402endif::VK_KHR_get_display_properties2[] 403 404[open,refpage='VkDisplayModeParametersKHR',desc='Structure describing display parameters associated with a display mode',type='structs'] 405-- 406The sname:VkDisplayModeParametersKHR structure is defined as: 407 408include::{generated}/api/structs/VkDisplayModeParametersKHR.adoc[] 409 410 * pname:visibleRegion is the 2D extents of the visible region. 411 * pname:refreshRate is a code:uint32_t that is the number of times the 412 display is refreshed each second multiplied by 1000. 413 414[NOTE] 415.Note 416==== 417For example, a 60Hz display mode would report a pname:refreshRate of 60,000. 418==== 419 420.Valid Usage 421**** 422 * [[VUID-VkDisplayModeParametersKHR-width-01990]] 423 The pname:width member of pname:visibleRegion must: be greater than `0` 424 * [[VUID-VkDisplayModeParametersKHR-height-01991]] 425 The pname:height member of pname:visibleRegion must: be greater than `0` 426 * [[VUID-VkDisplayModeParametersKHR-refreshRate-01992]] 427 pname:refreshRate must: be greater than `0` 428**** 429 430include::{generated}/validity/structs/VkDisplayModeParametersKHR.adoc[] 431-- 432 433[open,refpage='vkCreateDisplayModeKHR',desc='Create a display mode',type='protos'] 434-- 435:refpage: vkCreateDisplayModeKHR 436 437Additional modes may: also be created by calling: 438 439include::{generated}/api/protos/vkCreateDisplayModeKHR.adoc[] 440 441 * pname:physicalDevice is the physical device associated with 442 pname:display. 443 * pname:display is the display to create an additional mode for. 444 * pname:pCreateInfo is a pointer to a slink:VkDisplayModeCreateInfoKHR 445 structure describing the new mode to create. 446 * pname:pAllocator is the allocator used for host memory allocated for the 447 display mode object when there is no more specific allocator available 448 (see <<memory-allocation,Memory Allocation>>). 449 * pname:pMode is a pointer to a slink:VkDisplayModeKHR handle in which the 450 mode created is returned. 451 452include::{chapters}/commonvalidity/no_dynamic_allocations_common.adoc[] 453 454include::{generated}/validity/protos/vkCreateDisplayModeKHR.adoc[] 455-- 456 457[open,refpage='VkDisplayModeCreateInfoKHR',desc='Structure specifying parameters of a newly created display mode object',type='structs'] 458-- 459The sname:VkDisplayModeCreateInfoKHR structure is defined as: 460 461include::{generated}/api/structs/VkDisplayModeCreateInfoKHR.adoc[] 462 463 * pname:sType is a elink:VkStructureType value identifying this structure. 464 * pname:pNext is `NULL` or a pointer to a structure extending this 465 structure. 466 * pname:flags is reserved for future use, and must: be zero. 467 * pname:parameters is a slink:VkDisplayModeParametersKHR structure 468 describing the display parameters to use in creating the new mode. 469 If the parameters are not compatible with the specified display, the 470 implementation must: return ename:VK_ERROR_INITIALIZATION_FAILED. 471 472include::{generated}/validity/structs/VkDisplayModeCreateInfoKHR.adoc[] 473-- 474 475[open,refpage='vkGetDisplayPlaneCapabilitiesKHR',desc='Query capabilities of a mode and plane combination',type='protos'] 476-- 477:refpage: vkGetDisplayPlaneCapabilitiesKHR 478 479Applications that wish to present directly to a display must: select which 480layer, or "`plane`" of the display they wish to target, and a mode to use 481with the display. 482Each display supports at least one plane. 483The capabilities of a given mode and plane combination are determined by 484calling: 485 486include::{generated}/api/protos/vkGetDisplayPlaneCapabilitiesKHR.adoc[] 487 488 * pname:physicalDevice is the physical device associated with the display 489 specified by pname:mode 490 * pname:mode is the display mode the application intends to program when 491 using the specified plane. 492 Note this parameter also implicitly specifies a display. 493 * pname:planeIndex is the plane which the application intends to use with 494 the display, and is less than the number of display planes supported by 495 the device. 496 * pname:pCapabilities is a pointer to a 497 slink:VkDisplayPlaneCapabilitiesKHR structure in which the capabilities 498 are returned. 499 500include::{chapters}/commonvalidity/no_dynamic_allocations_common.adoc[] 501 502include::{generated}/validity/protos/vkGetDisplayPlaneCapabilitiesKHR.adoc[] 503-- 504 505[open,refpage='VkDisplayPlaneCapabilitiesKHR',desc='Structure describing capabilities of a mode and plane combination',type='structs'] 506-- 507The sname:VkDisplayPlaneCapabilitiesKHR structure is defined as: 508 509include::{generated}/api/structs/VkDisplayPlaneCapabilitiesKHR.adoc[] 510 511 * pname:supportedAlpha is a bitmask of 512 elink:VkDisplayPlaneAlphaFlagBitsKHR describing the supported alpha 513 blending modes. 514 * pname:minSrcPosition is the minimum source rectangle offset supported by 515 this plane using the specified mode. 516 * pname:maxSrcPosition is the maximum source rectangle offset supported by 517 this plane using the specified mode. 518 The pname:x and pname:y components of pname:maxSrcPosition must: each be 519 greater than or equal to the pname:x and pname:y components of 520 pname:minSrcPosition, respectively. 521 * pname:minSrcExtent is the minimum source rectangle size supported by 522 this plane using the specified mode. 523 * pname:maxSrcExtent is the maximum source rectangle size supported by 524 this plane using the specified mode. 525 * pname:minDstPosition, pname:maxDstPosition, pname:minDstExtent, 526 pname:maxDstExtent all have similar semantics to their corresponding 527 ptext:*Src* equivalents, but apply to the output region within the mode 528 rather than the input region within the source image. 529 Unlike the ptext:*Src* offsets, pname:minDstPosition and 530 pname:maxDstPosition may: contain negative values. 531 532The minimum and maximum position and extent fields describe the 533implementation limits, if any, as they apply to the specified display mode 534and plane. 535Vendors may: support displaying a subset of a swapchain's presentable images 536on the specified display plane. 537This is expressed by returning pname:minSrcPosition, pname:maxSrcPosition, 538pname:minSrcExtent, and pname:maxSrcExtent values that indicate a range of 539possible positions and sizes which may: be used to specify the region within 540the presentable images that source pixels will be read from when creating a 541swapchain on the specified display mode and plane. 542 543Vendors may: also support mapping the presentable images`' content to a 544subset or superset of the visible region in the specified display mode. 545This is expressed by returning pname:minDstPosition, pname:maxDstPosition, 546pname:minDstExtent and pname:maxDstExtent values that indicate a range of 547possible positions and sizes which may: be used to describe the region 548within the display mode that the source pixels will be mapped to. 549 550Other vendors may: support only a 1-1 mapping between pixels in the 551presentable images and the display mode. 552This may: be indicated by returning [eq]#(0,0)# for pname:minSrcPosition, 553pname:maxSrcPosition, pname:minDstPosition, and pname:maxDstPosition, and 554(display mode width, display mode height) for pname:minSrcExtent, 555pname:maxSrcExtent, pname:minDstExtent, and pname:maxDstExtent. 556 557The value pname:supportedAlpha must: contain at least one valid 558elink:VkDisplayPlaneAlphaFlagBitsKHR bit. 559 560These values indicate the limits of the implementation's individual fields. 561Not all combinations of values within the offset and extent ranges returned 562in sname:VkDisplayPlaneCapabilitiesKHR are guaranteed to be supported. 563Presentation requests specifying unsupported combinations may: fail. 564 565include::{generated}/validity/structs/VkDisplayPlaneCapabilitiesKHR.adoc[] 566-- 567 568ifdef::VK_KHR_get_display_properties2[] 569[open,refpage='vkGetDisplayPlaneCapabilities2KHR',desc='Query capabilities of a mode and plane combination',type='protos'] 570-- 571:refpage: vkGetDisplayPlaneCapabilities2KHR 572 573To query the capabilities of a given mode and plane combination, call: 574 575include::{generated}/api/protos/vkGetDisplayPlaneCapabilities2KHR.adoc[] 576 577 * pname:physicalDevice is the physical device associated with 578 pname:pDisplayPlaneInfo. 579 * pname:pDisplayPlaneInfo is a pointer to a slink:VkDisplayPlaneInfo2KHR 580 structure describing the plane and mode. 581 * pname:pCapabilities is a pointer to a 582 slink:VkDisplayPlaneCapabilities2KHR structure in which the capabilities 583 are returned. 584 585fname:vkGetDisplayPlaneCapabilities2KHR behaves similarly to 586flink:vkGetDisplayPlaneCapabilitiesKHR, with the ability to specify extended 587inputs via chained input structures, and to return extended information via 588chained output structures. 589 590include::{chapters}/commonvalidity/no_dynamic_allocations_common.adoc[] 591 592include::{generated}/validity/protos/vkGetDisplayPlaneCapabilities2KHR.adoc[] 593-- 594 595[open,refpage='VkDisplayPlaneInfo2KHR',desc='Structure defining the intended configuration of a display plane',type='structs'] 596-- 597The sname:VkDisplayPlaneInfo2KHR structure is defined as: 598 599include::{generated}/api/structs/VkDisplayPlaneInfo2KHR.adoc[] 600 601 * pname:sType is a elink:VkStructureType value identifying this structure. 602 * pname:pNext is `NULL` or a pointer to a structure extending this 603 structure. 604 * pname:mode is the display mode the application intends to program when 605 using the specified plane. 606 607[NOTE] 608.Note 609==== 610This parameter also implicitly specifies a display. 611==== 612 613 * pname:planeIndex is the plane which the application intends to use with 614 the display. 615 616The members of sname:VkDisplayPlaneInfo2KHR correspond to the arguments to 617flink:vkGetDisplayPlaneCapabilitiesKHR, with pname:sType and pname:pNext 618added for extensibility. 619 620include::{generated}/validity/structs/VkDisplayPlaneInfo2KHR.adoc[] 621-- 622 623[open,refpage='VkDisplayPlaneCapabilities2KHR',desc='Structure describing the capabilities of a mode and plane combination',type='structs'] 624-- 625The sname:VkDisplayPlaneCapabilities2KHR structure is defined as: 626 627include::{generated}/api/structs/VkDisplayPlaneCapabilities2KHR.adoc[] 628 629 * pname:sType is a elink:VkStructureType value identifying this structure. 630 * pname:pNext is `NULL` or a pointer to a structure extending this 631 structure. 632 * pname:capabilities is a slink:VkDisplayPlaneCapabilitiesKHR structure. 633 634include::{generated}/validity/structs/VkDisplayPlaneCapabilities2KHR.adoc[] 635-- 636endif::VK_KHR_get_display_properties2[] 637 638ifdef::VK_EXT_display_control[] 639include::{chapters}/VK_EXT_display_control/display_control.adoc[] 640endif::VK_EXT_display_control[] 641 642 643[[wsi-display-surfaces]] 644=== Display Surfaces 645 646[open,refpage='vkCreateDisplayPlaneSurfaceKHR',desc='Create a slink:VkSurfaceKHR structure representing a display plane and mode',type='protos'] 647-- 648:refpage: vkCreateDisplayPlaneSurfaceKHR 649 650A complete display configuration includes a mode, one or more display planes 651and any parameters describing their behavior, and parameters describing some 652aspects of the images associated with those planes. 653Display surfaces describe the configuration of a single plane within a 654complete display configuration. 655To create a sname:VkSurfaceKHR object for a display plane, call: 656 657include::{generated}/api/protos/vkCreateDisplayPlaneSurfaceKHR.adoc[] 658 659 * pname:instance is the instance corresponding to the physical device the 660 targeted display is on. 661 * pname:pCreateInfo is a pointer to a slink:VkDisplaySurfaceCreateInfoKHR 662 structure specifying which mode, plane, and other parameters to use, as 663 described below. 664 * pname:pAllocator is the allocator used for host memory allocated for the 665 surface object when there is no more specific allocator available (see 666 <<memory-allocation,Memory Allocation>>). 667 * pname:pSurface is a pointer to a slink:VkSurfaceKHR handle in which the 668 created surface is returned. 669 670include::{generated}/validity/protos/vkCreateDisplayPlaneSurfaceKHR.adoc[] 671-- 672 673[open,refpage='VkDisplaySurfaceCreateInfoKHR',desc='Structure specifying parameters of a newly created display plane surface object',type='structs'] 674-- 675The sname:VkDisplaySurfaceCreateInfoKHR structure is defined as: 676 677include::{generated}/api/structs/VkDisplaySurfaceCreateInfoKHR.adoc[] 678 679 * pname:sType is a elink:VkStructureType value identifying this structure. 680 * pname:pNext is `NULL` or a pointer to a structure extending this 681 structure. 682 * pname:flags is reserved for future use, and must: be zero. 683 * pname:displayMode is a slink:VkDisplayModeKHR handle specifying the mode 684 to use when displaying this surface. 685 * pname:planeIndex is the plane on which this surface appears. 686 * pname:planeStackIndex is the z-order of the plane. 687 * pname:transform is a elink:VkSurfaceTransformFlagBitsKHR value 688 specifying the transformation to apply to images as part of the scanout 689 operation. 690 * pname:globalAlpha is the global alpha value. 691 This value is ignored if pname:alphaMode is not 692 ename:VK_DISPLAY_PLANE_ALPHA_GLOBAL_BIT_KHR. 693 * pname:alphaMode is a elink:VkDisplayPlaneAlphaFlagBitsKHR value 694 specifying the type of alpha blending to use. 695 * pname:imageExtent is the size of the presentable images to use with the 696 surface. 697 698[NOTE] 699.Note 700==== 701Creating a display surface must: not modify the state of the displays, 702planes, or other resources it names. 703For example, it must: not apply the specified mode to be set on the 704associated display. 705Application of display configuration occurs as a side effect of presenting 706to a display surface. 707==== 708 709.Valid Usage 710**** 711 * [[VUID-VkDisplaySurfaceCreateInfoKHR-planeIndex-01252]] 712 pname:planeIndex must: be less than the number of display planes 713 supported by the device as determined by calling 714 fname:vkGetPhysicalDeviceDisplayPlanePropertiesKHR 715 * [[VUID-VkDisplaySurfaceCreateInfoKHR-planeReorderPossible-01253]] 716 If the pname:planeReorderPossible member of the 717 sname:VkDisplayPropertiesKHR structure returned by 718 fname:vkGetPhysicalDeviceDisplayPropertiesKHR for the display 719 corresponding to pname:displayMode is ename:VK_TRUE then 720 pname:planeStackIndex must: be less than the number of display planes 721 supported by the device as determined by calling 722 fname:vkGetPhysicalDeviceDisplayPlanePropertiesKHR; otherwise 723 pname:planeStackIndex must: equal the pname:currentStackIndex member of 724 sname:VkDisplayPlanePropertiesKHR returned by 725 fname:vkGetPhysicalDeviceDisplayPlanePropertiesKHR for the display plane 726 corresponding to pname:displayMode 727 * [[VUID-VkDisplaySurfaceCreateInfoKHR-alphaMode-01254]] 728 If pname:alphaMode is ename:VK_DISPLAY_PLANE_ALPHA_GLOBAL_BIT_KHR then 729 pname:globalAlpha must: be between `0` and `1`, inclusive 730 * [[VUID-VkDisplaySurfaceCreateInfoKHR-alphaMode-01255]] 731 pname:alphaMode must: be one of the bits present in the 732 pname:supportedAlpha member of sname:VkDisplayPlaneCapabilitiesKHR for 733 the display plane corresponding to pname:displayMode 734 * [[VUID-VkDisplaySurfaceCreateInfoKHR-transform-06740]] 735 pname:transform must: be one of the bits present in the 736 pname:supportedTransforms member of sname:VkDisplayPropertiesKHR for the 737 display corresponding to pname:displayMode 738 * [[VUID-VkDisplaySurfaceCreateInfoKHR-width-01256]] 739 The pname:width and pname:height members of pname:imageExtent must: be 740 less than or equal to 741 slink:VkPhysicalDeviceLimits::pname:maxImageDimension2D 742**** 743 744include::{generated}/validity/structs/VkDisplaySurfaceCreateInfoKHR.adoc[] 745-- 746 747[open,refpage='VkDisplaySurfaceCreateFlagsKHR',desc='Reserved for future use',type='flags'] 748-- 749include::{generated}/api/flags/VkDisplaySurfaceCreateFlagsKHR.adoc[] 750 751tname:VkDisplaySurfaceCreateFlagsKHR is a bitmask type for setting a mask, 752but is currently reserved for future use. 753-- 754 755[open,refpage='VkDisplayPlaneAlphaFlagBitsKHR',desc='Alpha blending type',type='enums'] 756-- 757Bits which can: be set in 758slink:VkDisplaySurfaceCreateInfoKHR::pname:alphaMode, specifying the type of 759alpha blending to use on a display, are: 760 761include::{generated}/api/enums/VkDisplayPlaneAlphaFlagBitsKHR.adoc[] 762 763 * ename:VK_DISPLAY_PLANE_ALPHA_OPAQUE_BIT_KHR specifies that the source 764 image will be treated as opaque. 765 * ename:VK_DISPLAY_PLANE_ALPHA_GLOBAL_BIT_KHR specifies that a global 766 alpha value must: be specified that will be applied to all pixels in the 767 source image. 768 * ename:VK_DISPLAY_PLANE_ALPHA_PER_PIXEL_BIT_KHR specifies that the alpha 769 value will be determined by the alpha component of the source image's 770 pixels. 771 If the source format contains no alpha values, no blending will be 772 applied. 773 The source alpha values are not premultiplied into the source image's 774 other color components. 775 * ename:VK_DISPLAY_PLANE_ALPHA_PER_PIXEL_PREMULTIPLIED_BIT_KHR is 776 equivalent to ename:VK_DISPLAY_PLANE_ALPHA_PER_PIXEL_BIT_KHR, except the 777 source alpha values are assumed to be premultiplied into the source 778 image's other color components. 779-- 780 781[open,refpage='VkDisplayPlaneAlphaFlagsKHR',desc='Bitmask of VkDisplayPlaneAlphaFlagBitsKHR',type='flags'] 782-- 783include::{generated}/api/flags/VkDisplayPlaneAlphaFlagsKHR.adoc[] 784 785tname:VkDisplayPlaneAlphaFlagsKHR is a bitmask type for setting a mask of 786zero or more elink:VkDisplayPlaneAlphaFlagBitsKHR. 787-- 788