Due to Vulkan WSI only support query surface caps by KHR,
so query result will mismatch when driver support EXT and
have different strategy with Vulkan WSI.
Mesa init min/maxImageCount = {4,0} both in EXT and KHR
Vulkan WSI init min/maxImageCount = {2,6} only in KHR
So cts obtain {4,0} by vkGetPhysicalDeviceSurface
Capabilities2EXT and obtain {2,6} by vkGetPhysicalDevi
ceSurfaceCapabilitiesKHR.
fix case:
dEQP-VK.wsi.wayland.surface.query_surface_counters
Signed-off-by: Ryan Zhang <ryan.zhang@nxp.com>
Makes use of the VK_QUERY_POOL_CREATE_RESET_BIT_KHR when creating the
query pool. It disables present timing when VK_KHR_maintenance9 is not
supported by the device.
Signed-off-by: Iason Paraskevopoulos <iason.paraskevopoulos@arm.com>
Change-Id: I9d364050f0cd4a2be74e1b1d44cf3f6a0795e6f4
Adds a per-device check for a 'best' queue family to
use for present timing, rather than always using index 0.
wsi_ext_present_timing holds resources (such as the command
buffer) per queue family, rather than supporting only one. However,
currently, only one queue family is supported at a time.
In future, we can hook vkGetDeviceQueue calls to map
VkQueues to their family index. Doing this will transparently
give present timing support for multiple queue families.
Signed-off-by: Alex Bates <alex.bates@arm.com>
Change-Id: I5becb29dfc4a082e301031e0c693acd23eb95a51
1. Update the README file.
2. Remove the guards from the code.
Signed-off-by: Nir.Ekhauz <nir.ekhauz@arm.com>
Change-Id: Idf65baee25d09a3b4bc3b563455468bac4d5bddf
Introduce util::mutex, util::recursive_mutex
and util::unique_lock; switch WSI layer call sites to it.
All locks are acquired via try_lock(), no system_error leaks.
Signed-off-by: Maged Elnaggar <maged.elnaggar@arm.com>
Change-Id: Ide9ef4318be7cc47e9577059695cc298f8b8e579
Add support for present wait2 ext. for physical, surface and sc.
Signed-off-by: Nir.Ekhauz <nir.ekhauz@arm.com>
Change-Id: I0f7cdadb2d3ea0ecbc32b8b2efe9fc3bb4ba0369
fully spec-compliant and avoid leaking unsupported symbols.
Extension enablement
* Only enable extensions promoted to core in Vulkan 1.1 when
the application’s API version is < 1.1.
* Filter the list passed to vkGet{Instance,Device}ProcAddr so
that only _application_-enabled extensions affect symbol lookup. Internally-added
extensions are ignored during GetProcAddr resolution.
Entrypoint exposure fixes
* getProcAddr now only returns pointers for entrypoints when _all_ of
their required extensions (or core version) are enabled:
* vkGetPhysicalDevicePresentRectanglesKHR
* vkAcquireNextImage2KHR
* vkGetDeviceGroupSurfacePresentModesKHR
* vkBindImageMemory2 / vkBindImageMemory2KHR
* vkGetPhysicalDeviceFeatures2KHR
* Removed all OR-conditions that previously exposed these functions prematurely,
replacing them with clear AND-checks per the spec.
Always-exposed device-level entrypoints
* Introduce INSTANCE_ENTRYPOINTS_LIST_EXPANSION for entrypoints that:
* Come from device-level extensions,
* Are looked up via instance APIs,
* Are _not_ in core Vulkan.
* Assign them an empty extension string so they’re always exposed, regardless
of which instance extensions the application requests.
Hiding non-intercepted functions
* Any entrypoint the layer lists internally but does _not_ intercept
is now hidden from applications, preventing calls into stubs.
These combined changes ensure the layer:
* advertises only the extensions it needs,
* obeys all cross-extension dependencies, and
* never leaks unsupported symbols via GetInstanceProcAddr/GetDeviceProcAddr.
Signed-off-by: Maged Elnaggar maged.elnaggar@arm.com
Change-Id: I7a5e5cb210e017f1aed76b187db1f40537010914
Fixes the following issues:
* For Wayland backend, populates the presentation feedback listener with all callbacks as it is considered a fault by the protocol to not implement those
* For Wayland backend presentation feedback listener, forwards the feedback_discarded event to present ID as there could be situations where previously submitted buffers are discarded, such as when swapchains are using the MAILBOX presentation mode.
* For all swapchains, communicate critical errors back to present wait extension as otherwise, all callers waiting that are waiting on present to be delivered in vkWaitForPresentKHR call will never exit.
* Expanded the implementation in vkWaitForPresentKHR to be able to return critical swapchain errors if they have occured during the wait time.
* Fix issues in present ID where infinite waits could result in the vkWaitForPresentKHR call returning immediately due to UINT64_MAX timeout resulting in overflowing the system clock used in std::condition_variable
Change-Id: I1e475c3073c05394db259657eae1da21764a5a5c
Signed-off-by: Normunds Rieksts <normunds.rieksts@arm.com>
Signed-off-by: Alex Bates <alex.bates@arm.com>
Tags the fences created by the layer with the WsiLayerFence name
when instrumentation has been enabled.
Change-Id: I90ad71e5073d80cd650c6ba3be406abd67185376
Signed-off-by: Iason Paraskevopoulos <iason.paraskevopoulos@arm.com>
Enabling VK_PRESENT_MODE_FIFO_LATEST_READY_EXT for headless & wayland
This extension is handled the same as the MAILBOX ext.
Signed-off-by: Nir Ekhauz <nir.ekhauz@arm.com>
Change-Id: I010c3c9474a6d9c28964806ba5aa63549b622454
In this change, instead of checking the available version for
vkGetCalibratedTimestamps between KHR and EXT, unconditionally use the
KHR version in VK_EXT_present_timing as the extension has a dependency
on VK_KHR_calibrated_timestamps extension.
Signed-off-by: Ginu Jacob <ginu.jacob@arm.com>
Change-Id: I279182ae6d5311613c430546a8054dee0276c499
In this change, the support for present stage local time doimain
is enabled. The Vulkan entry-points vkGetCalibratedTimestampsEXT and
vkGetCalibratedTimestampsKHR are introduced. These entry-points are
intercepted for the structure VkSwapchainCalibratedTimestampInfoEXT
to calibrate any stage local time domains.
Internally, the stage local time domains are mapped to VK time
domains with an offset. On intercepting the APIs when the structure
VkSwapchainCalibratedTimestampInfoEXT is available, timestamps
are internally queried based on VK time domain from the driver and are
then converted to the corresponding stage local timestamps using the
internally maintained offset for the time domain.
Signed-off-by: Ginu Jacob <ginu.jacob@arm.com>
Change-Id: I635e1bc27dd40540cc5e016ab5f784f9d8ebd333
The comment explaining the format for the entrypoint entries are
updated to include the new alias parameter.
Signed-off-by: Dennis Tsiang <dennis.tsiang@arm.com>
Change-Id: I34b0d1247a010b0e60b19bb284bb6bdaf32eab23
Some entrypoints when promoted lose the KHR suffix. Some ICDs only
provide the non-KHR versions and the KHR versions are unavailable
unless the associated extension is explicitly enabled. This change
makes the layer's dispatch table internally convert any promoted KHR
entrypoint calls to the non-KHR version when the the Vulkan API is of
sufficient level.
Signed-off-by: Dennis Tsiang <dennis.tsiang@arm.com>
Change-Id: I556c9071b738e15ef5fd2f970a8443b1c5215b16
Advertises support for present wait in vkGetPhysicalDeviceFeatures2KHR when all surface extensions are supported. If there are unsupported extensions, present wait feature advertisement is left to lower layers.
Fixes two bugs:
- The handling when swapchains are destroyed when VK_NULL_HANDLE is
passed for the vkDestroySwapchain function to terminate early rather
than forward it to any dispatch functions below us which could
potentially not be exported by the layers/ICDs below us.
- The dispatcher did not implement get_fn() correctly as if the
function that we attempted to acquire was NULL, this function still
returned a valid std::optional with the function pointer itself
being set to NULL if no layers/ICDs under ours did not implement
these entrypoints. This fixes other issues that could arise in the
layer when this function is used.
Change-Id: If4fb67c246ef48a97f88914acfb8db3df734b133
Signed-off-by: Normunds Rieksts <normunds.rieksts@arm.com>
Adds initial support to the headless and Wayland backends to query
swapchain timing properties. This patch also moves all present timing
backend specific code into its own file and refactors the private_data
code that is specific to present timing entrypoints into a more common
format.
Change-Id: I377197a6e14b3cbd968e35735d43060d19dfe5bc
Signed-off-by: Normunds Rieksts <normunds.rieksts@arm.com>
In this change, an abstraction layer is added to the swapchain
extensions. The extensions present_timing, present_id,
image_compression_control, frame_boundary, and swapchain_maintenance1
are moved to the new extensions abstraction framework.
Additionally, the compression control extension has been formalized in
the layer as it is part of Vulkan spec so compression control guards
have been removed.
Change-Id: Ib28739ca35dfbf5df987241a9010619279f3e1bb
Signed-off-by: Ginu Jacob <ginu.jacob@arm.com>
Signed-off-by: Normunds Rieksts <normunds.rieksts@arm.com>
Layer updated to advertise support for the VK_KHR_present_id
extension. vkGetPhysicalDeviceFeatures2KHR and vkCreateDevice updated
to handle the new struct.
Also add the extensions enabled by the layer to the
instance_data and device_data objects so that the layer can correctly
check which extensions have been enabled.
Signed-off-by: Dennis Tsiang <dennis.tsiang@arm.com>
Change-Id: I71ae2b28c94d3f16b485a06094712d6c3f6c7e77
Adds the vkReleaseSwapchainImagesEXT entrypoint in the WSI layer which
allows applications to release the acquired images back to the swapchain
without presenting them.
Change-Id: I52900547f95661e6ec40cb586b035da0ca2d266f
Signed-off-by: Normunds Rieksts <normunds.rieksts@arm.com>
Signed-off-by: Dennis Tsiang <dennis.tsiang@arm.com>
Signed-off-by: Fufu Fang <fufu.fang@arm.com>
Check for VkPhyscialDeviceSwapchainMaintenance1FeaturesEXT struct in
the pNext chains of VkCreateDeviceInfo and VkPhysicalDeviceFeatures2
Change-Id: I540b800d882855c6782043ca6c88bafc850c4bcd
Signed-off-by: Dennis Tsiang <dennis.tsiang@arm.com>
Signed-off-by: Fufu Fang <fufu.fang@arm.com>
Implementation of VK_KHR_display swapchain class. VK_KHR_display is
another WSI backend that provides surfaces to render directly to a
display. The swapchain class is responsible for creating and managing a
swapchain based on the specific type of surface provided by
VK_KHR_display.
Change-Id: I9b103c20c3444b1ca75f3df7edf6b66fc87a0992
Signed-off-by: Dennis Wildmark <dennis.wildmark@arm.com>
Signed-off-by: Fufu Fang <fufu.fang@arm.com>
Support for VK_KHR_shared_presentable image added in swapchain_base.
Headless backend will report support for it through
vkGetPhysicalDeviceSurfacePresentModesKHR.
Signed-off-by: Dennis Wildmark <dennis.wildmark@arm.com>
Change-Id: Ibbbab0b8c8137fdd41df9889d7e183a8259c83ba
Fixes issues reported by the
create_instance_device_intentional_alloc_fail.basic CTS test. One of the
issues can happen if allocation fails at the time when dispatch table is
allocated at device/instance creation time which can result in dispatch
table being a null pointer which later is used to resolve Vulkan entrypoints.
This patch also makes sure that dispatch table is passed around the
{instance/device}_private_data::associate functions as a value-type
rather than a pointer which forces the user of the table to use the move
operator as otherwise the ownership transfer from the user to
the{instance/device}_private_data classes was not obvious and the user
could continue to invoke dispatch table functions erroneously.
Fixes the issue of the layer making use of the dispatch table when its
initialization has failed in the cases when calls to
dispatch_table::populate returned an error.
Any calls to vkDestroyInstance within vkCreateInstance
have been removed as the Vulkan loader handles the unloading of the
instance which would otherwise result in a double-free exception being
thrown.
Change-Id: I36bb7219db9d852bc31f09c8154b2f93776c162f
Signed-off-by: Normunds Rieksts <normunds.rieksts@arm.com>
Add functionality to the dispatch tables enabling the layer to hide
entrypoints from user. Add filtering to
vkGetDeviceProcAddr/vkGetInstanceProcAddr to only return pointers to
entrypoints which belongs to user enabled extensions.
Signed-off-by: Dennis Wildmark <dennis.wildmark@arm.com>
Change-Id: Ieec305cc9479363de0b8e1618c671c08f7af3997
Fixes an issue, where the swapchain addresses weren't removed from the
device_private_data::swapchains member after swapchain destruction. This
could cause clashes with swapchains handled by different components
(e.g. ICD).
Signed-off-by: Iason Paraskevopoulos <iason.paraskevopoulos@arm.com>
Change-Id: I0e05734368ef6100b67ded973283f99ef248e540
The layer needs functionality that is not part of Vulkan 1.0 and is
provided by either Vulkan 1.1 or separate Vulkan extensions.
The layer used to solve this issue by bumping the API version passed
by the application in VkCreateInfo to 1.1 if this was set to 1.0.
This workaround does not seem to be working anymore with recent
versions of the loader. Fortunately, the loader now allows layers
to change the extension lists passed by the application.
This patch changes the layer to use this approach and removes the
API bump logic.
Documentation is updated accordingly.
Change-Id: I61c426311612c7f288a0f7d969782d6c5365acf5
Signed-off-by: Matteo Franchin <matteo.franchin@arm.com>
Implement support for VK_EXT_image_compression_control_swapchain
for both the Wayland and the headless windowing systems.
The extension can be conditionally enabled through the new build option
BUILD_WSI_IMAGE_COMPRESSION_CONTROL_SWAPCHAIN. Compiling with this
option enabled requires recent Vulkan headers (1.3.213)
Note also that support in the layer is enabled conditionally to
the ICD supporting VK_EXT_image_compression_control.
Update the WSIALLOC interface to version 2 and add support to
prefer selection of a format with the highest fixed rate compression
from the formats provided. This is used to pick a fixed rate
compression when VK_IMAGE_COMPRESSION_FIXED_RATE_EXPLICIT_EXT is
specified during swapchain creation.
Signed-off-by: Dennis Tsiang <dennis.tsiang@arm.com>
Signed-off-by: Rosen Zhelev <rosen.zhelev@arm.com>
Signed-off-by: Normunds Rieksts <normunds.rieksts@arm.com>
Signed-off-by: Matteo Franchin <matteo.franchin@arm.com>
Change-Id: Ie37e6901042a65f2a408e428a705b5a24227b262
Adds support for the VK_KHR_get_surface_capabilities2 extension.
Change-Id: Iae882a41819baf413a0ba949ec44d6e722ebca5a
Signed-off-by: Iason Paraskevopoulos <iason.paraskevopoulos@arm.com>
The VK_KHR_external_[fence|semaphore]_fd extensions allow sync
primitives to be signalled without the use of QueueSubmit. Using these
extensions in AcquireNextImage instead of using QueueSubmit offers two
advantages: (1) there is no waiting for work to complete in the queue
before the primitives are signalled and (2) there is no data race if
the application happens to call QueueSubmit on the same queue at the
same time.
The QueueSubmit method of signalling sync primitives continues to be
used for ICDs that do not support the external FD extensions.
Signed-off-by: David Harvey-Macaulay <david.harvey-macaulay@arm.com>
Change-Id: Ib4a922d44430110e2353a4e0221e27017e72abab
Stores the enabled instance and device extensions during
vkCreateInstance and vkCreateDevice respectively. This fixes an issue
where function pointers for functions of disabled extensions were
returned during vkGetInstanceProcAddr/vkGetDeviceProcAddr.
Adds functionality for adding extensions that belong to a subset of
other extensions in util::extension_list.
Adds function for checking if the proper surface extension has been
enabled in each WSI backend.
Signed-off-by: Iason Paraskevopoulos <iason.paraskevopoulos@arm.com>
Change-Id: If5e23e0d07c9f09006be18c410c4e1d4c3a1e676
Adds an additional semaphore for every swapchain image to be waited for
before the present engine access an image. During a present request with
multiple swapchains, these semaphores are grouped together and are
signaled after the incoming pWaitSemaphores signal.
Signed-off-by: Iason Paraskevopoulos <iason.paraskevopoulos@arm.com>
Change-Id: I94cabbf5f7d9a45dceef60eec7773b48ccc32078
This change adds the use of zwp_linux_explicit_synchronization_v1 to
attach a Sync FD fence on presented image submitted to the compositor.
The change introduces the wsi/synchronization.hpp header and
implementation of the synchronization primitives used by WSI
implementations. Currently only Vulkan fences and fences exportable to
Sync FD are supported.
Change-Id: Ic7d6b712cc8ae8d171f799af51a70be62585b8a1
Signed-off-by: Rosen Zhelev <rosen.zhelev@arm.com>
Defines an abstract wsi::surface object to be implemented by each WSI
backend. This object is then associated with the corresponding VkSurface
object in the instance specific data.
To keep track of these objects the layer now intercepts
vkDestroySurfaceKHR, while specific surface creation entrypoints are
intercepted by individual WSI backends.
In addition this change should allow for fixing incompatibility issues
with layers that wrap VkSurface which breaks casting to the Loader's ICD
VkSurface type.
Make greater use of util::unique_ptr and allow for such pointers to be
constructable when casting derived types.
Change-Id: I163e9c47088ad9989583ebce1319b1fc05559d73
Signed-off-by: Rosen Zhelev <rosen.zhelev@arm.com>