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