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.
Enables the layer to intercept vkBindImageMemory2KHR, and by requiring
the extension we ensure we can always call the entrypoint down the
chain as well.
Signed-off-by: Dennis Tsiang <dennis.tsiang@arm.com>
Change-Id: I1ec5f8c6ba648151e08101549cb795e990c84aeb
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>
The development of the swapchain maintenance features
has been finalized. As a result, the temporary guards
used during development have been removed, as they are
no longer necessary.
Change-Id: I768358d4b650ba13c84af1a65ff407f2c44b2283
Signed-off-by: Angeliki Agathi Tsintzira <angelikiagathi.tsintzira@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>
With the addition of the -Wextra flag, additional compiler warnings
are enabled, which help identify potential issues in the code.
However, enabling -Wextra caused compilation failures due to the
-Werror flag, which treats warnings as errors. This commit enables
-Wextra and addresses all the warnings produced, ensuring the
code compiles successfully while maintaining higher code quality standards.
Change-Id: I0bbaead9b2b15530d2565a3dddf1ed676901269b
Signed-off-by: Angeliki Agathi Tsintzira <angelikiagathi.tsintzira@arm.com>
Re-adds assertion that checked that valid synchronisation primitives
were passed to vkAcquireNextImageKHR due to failing CTS tests that were
breaking the Vulkan spec. After fixing the tests, the assertion is no
longer necessary
Change-Id: Ic600714be4012575b6d7e4f568ea54cbf2e0ca4f
Signed-off-by: Normunds Rieksts <normunds.rieksts@arm.com>
Implements the entrypoint vkSetSwapchainPresentTimingQueueSizeEXT and
handles VkPresentTimingsInfoEXT. The presentation timing queue is
also implemented the present id from parsing VkPresentTimingsInfoEXT is
stored in the queue.
Signed-off-by: ginujacob <ginu.jacob@arm.com>
Change-Id: I81b6113b54db5e59f7018ef9a22e80af6dcdd568
In submit_wait_request we were passing the memory location of the
pointer to submission_pnext instead of the actual pointer. This commit
fixes it to pass the actual pointer. Additionally when creating the
frame boundary, set the pNext explicitly to nullptr.
Change-Id: I61ab9c898c3af4b3f401a3de6fdf7201fd2553ac
Signed-off-by: Dennis Tsiang <dennis.tsiang@arm.com>
Enabling the VK_EXT_present_timing features
VkPhysicalDevicePresentTimingFeaturesEXT and
VkPresentTimingSurfaceCapabilitiesEXT.
The feature values are updated based on the backend.
Signed-off-by: Ginu Jacob <ginu.jacob@arm.com>
Change-Id: Ie322f58118108c656530128b18ec905bd6815c63
The feature is still experimental so we should guard it with the flag
until it's ready to be used.
Change-Id: I3f10f730ca916374241fdcdceaf332672788040d
Signed-off-by: Dennis Tsiang <dennis.tsiang@arm.com>
Adds support for handling the present IDs privided by the VkPresentIdKHR
structure that is exposed by the VK_KHR_present_id extension.
Change-Id: If2dfe2cf942f376729b5c0dec79bcfa0c0b49738
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
Adding the entry-points and definitions required for the
VK_EXT_present_timing feature.
Signed-off-by: Ginu Jacob <ginu.jacob@arm.com>
Change-Id: I5f388b50d12fe32556676c4de0d37c95e1ff611b
Add support for handling VkSwapchainPresentModeInfoEXT and
VkSwapchainPresentModesCreateInfoEXT when supplied as part of the
pNext chain of VkPresentInfoKHR and VkSwapchainCreateInfoKHR
respectively.
Since the headless backend has no effect when switching between FIFO
and FIFO_RELAXED, and the wayland backend does not support switching
presentation modes between MAILBOX and FIFO, the only real thing we
can do is check that the presentation mode requested is one that is
supported by the swapchain and is compatible with the current
presentation mode.
Change-Id: I8d5506e9b1a8fba079e2f9d6ee133038feb27dca
Signed-off-by: Dennis Tsiang <dennis.tsiang@arm.com>
Signed-off-by: Fufu Fang <fufu.fang@arm.com>
Adds support for VK_SWAPCHAIN_CREATE_DEFERRED_MEMORY_ALLOCATION_BIT_EXT,
by deferring calling create_and_bind_swapchain_image in
acquire_next_image. Also, adds a function for checking if a swapchain
image can be bound to memory when deferred has been selected.
Change-Id: I22e40260d6b06091cc704bca3bf2baa80370c589
Signed-off-by: Iason Paraskevopoulos <iason.paraskevopoulos@arm.com>
Signed-off-by: Fufu Fang <fufu.fang@arm.com>
Extends queue_submit to handle the fences passed by the application
through VkSwapchainPresentFenceInfoEXT.
Change-Id: If3f44e2634cc771ee7d01589a59a95d0f86f99df
Signed-off-by: Iason Paraskevopoulos <iason.paraskevopoulos@arm.com>
Signed-off-by: Fufu Fang <fufu.fang@arm.com>
Adds a helper function in synchronization.hpp, which makes an empty
vkQueueSubmit in order to chain wait with signal semaphores and fences.
This function is used in submit_wait_request and
fence_sync::set_payload.
Introduces queue_submit_semaphores for grouping the signal and wait
semaphores.
Change-Id: I6107a29f3410fad8250f998b0e4c2052ed1923b8
Signed-off-by: Iason Paraskevopoulos <iason.paraskevopoulos@arm.com>
Signed-off-by: Fufu Fang <fufu.fang@arm.com>
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>
This commit adds support for querying a surface's compatible
presentation modes via VkSurfacePresentModeEXT and
VkSurfacePresentModeCompatibilityEXT, as part of the
VK_EXT_surface_maintenance1 extension.
A new struct present_mode_compatibility has been created to capture
this new functionality.
Our headless implementation supports compability between FIFO and
FIFO_RELAXED. On Wayland, we do not allow compatibility between FIFO
and MAILBOX presentation.
Change-Id: I53659cb2f2aa0ac41e37975cc34aee3ce8317a73
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>
Implementation of the surface_properties interface for VK_KHR_display.
Change-Id: Idd3b53bec0d0a829478d51b4263db767c872d0e5
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>
For maintenance6, VkBindImageMemory2KHR should not return on
the first failure, but rather store the result and return it
after everything is bound.
Signed-off-by: Embla Flatlandsmo <embla.flatlandsmo@arm.com>
Change-Id: I2578d0ad0e6330ed9c091794e05cf5f24c876fb1
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
Modify the layer so that instance extensions needed for Wayland are only enabled when Wayland is selected.
In the past, the layer was changed to explicitly enable the instance extensions it needs in the intercepted calls to vkCreateInstance. Therefore, the layers always enabled the extension VK_KHR_external_memory_capabilities, despite this is only required by Wayland.
In this patch, this extension is only enabled when Wayland is enabled, i.e. when VK_KHR_wayland_surface is part of the extensions passed to vkCreateInstance.
Signed-off-by: Angeliki Agathi Tsintzira <angelikiagathi.tsintzira@arm.com>
Change-Id: I57e98b36e42012ba46769e9dd760a628a09b9ba5
Extends the TRY macros exposed by the helper header to be able to print
out error messages.
Change-Id: I61c607376304ba744a95dd6782bb29653235096a
Signed-off-by: Normunds Rieksts <normunds.rieksts@arm.com>
To comply with ICDs that expose the
VK_KHR_shared_presentable_image extension, the Layer needs to
handle VkSharedPresentSurfaceCapabilitiesKHR struct (holds
sType=VK_STRUCTURE_TYPE_SHARED_PRESENT_SURFACE_CAPABILITIES_KHR)
for queries on the VkSurfaces managed by the Layer.
A simple implementation that sets the minimum required flags is
provided in this commit.
Since no WSI layer swapchain will support the shared presentable modes,
no other functionality is required. VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT
must be included in the sharedPresentSupportedUsageFlags field but
implementations may support additional usages.
Signed-off-by: Lior Dekel <lior.dekel@arm.com>
Change-Id: I73b29e54a84376c663b3cada989c910d1ba27293