Commit graph

117 commits

Author SHA1 Message Date
Ginu Jacob
7d88e2a619 present_id2 dependency handling in present_timing extension
The present_timing extension depends on present_id2. The dependency
handling is incorrect and is fixed in this change.

Signed-off-by: Ginu Jacob <ginu.jacob@arm.com>
Change-Id: Id645450eeb5b22551f328a860ffec75ebdbfbc79
2025-09-29 16:11:01 +01:00
Nir.Ekhauz
1ca76265fe Support VK_KHR_surface_maintenance1
Upadte:
1. Json file.
2. README file.

Signed-off-by: Nir.Ekhauz <nir.ekhauz@arm.com>
Change-Id: I6ea5fcb08bcf84aa2df2e6468b440f3bab9b7158
2025-09-21 11:15:21 +03:00
Nir Ekhauz
8c65fb2af7 Update the layer's readme and release notes with VK_KHR_present_wait2 support
1. Update the README file.
2. Remove the guards from the code.

Signed-off-by: Nir.Ekhauz <nir.ekhauz@arm.com>
Change-Id: Idf65baee25d09a3b4bc3b563455468bac4d5bddf
2025-09-18 10:20:43 +01:00
Nir Ekhauz
ee6d45430f Fix Wayland swapchain to support present_id2
Adding support for present_id2

Signed-off-by: Nir.Ekhauz <nir.ekhauz@arm.com>
Change-Id: Ie30caf423902fea9f2bc3341c3b61390b09c0f7c
2025-09-17 10:20:46 +01:00
Maged Elnaggar
fb23a9b14e Support VK_KHR_swapchain_mutable_format extension
- Add support for VK_KHR_swapchain_mutable_format extension to the Layer.
- Expose support for the VK_KHR_swapchain_mutable_format extension.
- Improve find_extension helper API to be spec-correct, const-correct,
  and clearer by using the right base type (VkBaseInStructure for input,
  VkBaseOutStructure for output),
  and concise docs explaining it returns the first matching struct or nullptr.
- Correctly use image_create_info instead of m_image_create_info in
  create_swapchain_image function for Wayland.

Signed-off-by: Maged Elnaggar <maged.elnaggar@arm.com>
Change-Id: Id40b28977e63ba76012d3a8f693327f757d75dcd
2025-09-11 09:28:03 +01:00
Maged Elnaggar
78b21da4ef Adding exception-safe custom mutex to the WSI layer
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
2025-09-05 16:06:38 +01:00
Rosen Zhelev
ef9b134054 Merge 'Update present timing types' into 'main'
See merge request mesa/vulkan-wsi-layer!195
2025-09-04 17:48:10 +01:00
Iason Paraskevopoulos
b02e682d30 Update present timing types
Updates the present timing implementation and types to be aligned with
the latest commit.

Fixes an issue, where the queue used for the presentation feedback
events was destroyed before getting the last events.

Signed-off-by: Iason Paraskevopoulos <iason.paraskevopoulos@arm.com>
Change-Id: I1dba2fd0e4ad9ec8c02d71c58c93edceaa75d07e
2025-09-04 17:48:10 +01:00
Iason Paraskevopoulos
deb70d9473 Merge 'Add JSON schema to layer manifest' into 'main'
See merge request mesa/vulkan-wsi-layer!193
2025-09-03 14:51:37 +00:00
Nir Ekhauz
5060dbbc3a Implement vkWaitForPresent2KHR
Add the entry point for VK_KHR_present_wait2.

Signed-off-by: Nir.Ekhauz <nir.ekhauz@arm.com>
Change-Id: I8b0ad681a6c02ea646d072e69b25113a8c8ad3ce
2025-08-28 15:46:50 +01:00
Alex Bates
88be0b1649 Add JSON schema to layer manifest
Change-Id: I00fb3306a88f9c24932ee1e9f0d623076118e6d0
Signed-off-by: Alex Bates <alex.bates@arm.com>
2025-08-26 14:16:08 +01:00
Nir Ekhauz
64c1c46609 Initial support for VK_KHR_present_wait2
Add support for present wait2 ext. for physical, surface and sc.

Signed-off-by: Nir.Ekhauz <nir.ekhauz@arm.com>
Change-Id: I0f7cdadb2d3ea0ecbc32b8b2efe9fc3bb4ba0369
2025-08-26 13:42:14 +01:00
Nir Ekhauz
7fac7b1339 Update the layer's readme and release notes with VK_KHR_present_id2 support
Removed experimental flags around this extension.

Signed-off-by: Nir.Ekhauz <nir.ekhauz@arm.com>
Change-Id: If314e8c05d0f0fd7405379fe1c714f0e56519b4b
2025-08-20 12:45:46 +01:00
Nir Ekhauz
8256b027d7 Add initial support for VK_KHR_present_id2 in the layer
Add support for present id2 ext. for physical, surface and sc.

Signed-off-by: Nir Ekhauz <nir.ekhauz@arm.com>
Change-Id: I934d5d8ef7e0fde2de8682bb54696a4044edb047
2025-08-18 10:23:02 +01:00
Nir Ekhauz
472597ed42 Add initial support for VK_KHR_present_id2 in the layer
Add support for present id2 ext.

Signed-off-by: Nir.Ekhauz <nir.ekhauz@arm.com>
Change-Id: Ic4cf137158188e9b6db1fa999f2c61248456c139
2025-08-13 09:41:21 +01:00
Maged Elnaggar
3ffd85a26d Update time domain handling to comply with Vulkan spec
- Refactor vkGetSwapchainTimeDomainPropertiesEXT to follow spec
- Ensure all time values are returned in nanoseconds
  according to the active time domain

Signed-off-by: Maged Elnaggar <maged.elnaggar@arm.com>
Change-Id: Id4c6b86577bd509ec7bb5a946785dbe6642cfb1c
2025-07-11 10:13:34 +00:00
Iason Paraskevopoulos
7c58549ec2 Add VkPastPresentationTimingFlagBitsEXT
Handles VkPastPresentationTimingFlagBitsEXT in
VkPastPresentationTimingInfoEXT.

Changes present_timing_queue_set_size to return VK_NOT_READY when
queue_size is bigger thank m_queue.size().

Change-Id: I4f8038c2b0060cfdac30754234536aa9ce42acbb
Signed-off-by: Iason Paraskevopoulos <iason.paraskevopoulos@arm.com>
2025-07-02 16:51:17 +01:00
Maged Elnaggar
4a6f61a72b This commit merges several related changes to make the layer
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
2025-06-27 15:21:58 +00:00
Alex Bates
441d95f1bb Adds support for present timing on Wayland even if the compositor does not support wp_presentation. Previously, support for wp_presentation was assumed.
If the time domain used by the compositor matches one of the time domains supported by the ICD:

* Advertise `VK_PRESENT_STAGE_IMAGE_FIRST_PIXEL_VISIBLE_BIT_EXT` in `VkPresentTimingSurfaceCapabilitiesEXT`
* List `VK_PRESENT_STAGE_IMAGE_FIRST_PIXEL_VISIBLE_BIT_EXT` in `swapchain_time_domains`

Also handles the case where neither `VK_TIME_DOMAIN_CLOCK_MONOTONIC_KHR` or `VK_TIME_DOMAIN_CLOCK_MONOTONIC_RAW_KHR` is supported for all backends.

Additionally fixes the issue where Wayland protocol was not dispatched correctly which resulted in Clock_ID event not being communicated back to the layer.

Signed-off-by: Alex Bates <alex.bates@arm.com>
Signed-off-by: Dennis Tsiang <dennis.tsiang@arm.com>
Signed-off-by: Normunds Rieksts <normunds.rieksts@arm.com>
2025-06-18 12:15:41 +00:00
Nir Ekhauz
0545f795de Document the VK_PRESENT_MODE_FIFO_LATEST_READY_EXT support for Headless and Wayland
1. Remove the guards.
2. Update the README.md file

Signed-off-by: Nir Ekhauz <nir.ekhauz@arm.com>
Change-Id: Iccf31b407c5cef4ebf2577f48cc378c6438ccf68
2025-06-08 15:32:22 +03:00
Normunds Rieksts
cedf53a2be Enables the present wait extension by default - experimental flag is no longer needed.
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>
2025-06-06 16:41:12 +00:00
Iason Paraskevopoulos
5e91113efd Merge 'Tag fences created by the layer' into 'main'
See merge request mesa/vulkan-wsi-layer!161
2025-06-04 11:18:37 +00:00
Iason Paraskevopoulos
eda337c308 Tag fences created by the layer
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>
2025-06-04 11:18:37 +00:00
Rosen Zhelev
3aee47be65 Merge 'Support VK_PRESENT_MODE_FIFO_LATEST_READY_EXT for headless & wayland' into 'main'
See merge request mesa/vulkan-wsi-layer!160
2025-06-04 09:39:04 +01:00
Avi Shif
670f1e9476 Support VK_PRESENT_MODE_FIFO_LATEST_READY_EXT for headless & wayland
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
2025-06-04 09:39:03 +01:00
Iason Paraskevopoulos
ff0ddbe47d Merge 'Acquiring timings for VK_PRESENT_STAGE_QUEUE_OPERATIONS_END_BIT_EXT' into 'main'
See merge request mesa/vulkan-wsi-layer!167
2025-05-28 15:59:16 +00:00
Ginu Jacob
5d4b84408a Acquiring timings for VK_PRESENT_STAGE_QUEUE_OPERATIONS_END_BIT_EXT 2025-05-28 15:59:16 +00:00
Fufu Fang
8ee8790497 Change device extension entrypoint visibility check
The check that determines device extension entrypoint visibility
was changed in order to fix CTS failures.

Signed-off-by: Fufu Fang <fufu.fang@arm.com>
2025-05-28 11:05:07 +00:00
Maged Elnaggar
16e77d770a Support WSI present timing if time domain supported 2025-05-16 08:26:19 +00:00
Dennis Tsiang
c3b192ac2f Merge 'Set present timing feature false if timestamp querying is not supported' into 'main'
See merge request mesa/vulkan-wsi-layer!155
2025-05-15 12:36:48 +00:00
Ginu Jacob
7f68fef91d Set present timing feature false if timestamp querying is not supported 2025-05-15 12:36:48 +00:00
Ginu Jacob
29ee099f25 Use the KHR version for vkGetCalibratedTimestamps
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
2025-05-14 16:32:07 +01:00
Normunds Rieksts
ab138f30ef Implement vkWaitForPresentKHR entrypoint 2025-05-09 16:04:39 +00:00
Ginu Jacob
4bd55986b3 Merge branch 'upstream/main' into gitlab/ginu.jacob/present_stage_time_domain_cal
Signed-off-by: Ginu Jacob <ginu.jacob@arm.com>
Change-Id: I7185d7009412a684f023791427f4cac7c0ba3806
2025-04-08 17:10:26 +01:00
Iason Paraskevopoulos
a7c2a9181c Merge 'Make layer require VK_KHR_bind_memory2 extension and intercept KHR' into 'main'
See merge request mesa/vulkan-wsi-layer!146
2025-04-08 12:45:02 +00:00
Ginu Jacob
27aecc165e Support timestamp calibration for present stage local time domains
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
2025-04-03 16:11:31 +01:00
Dennis Tsiang
bd54fc460b Update entrypoint list documentation with the alias parameter
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
2025-04-03 11:55:02 +01:00
Dennis Tsiang
928514385b Make layer use non-KHR commands for promoted entrypoints
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
2025-04-02 18:44:47 +01:00
Alex Bates
4eb145cf8b Handle VkPhysicalDevicePresentWaitFeaturesKHR
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.
2025-04-01 09:29:51 +00:00
Dennis Tsiang
201914d7cc Make layer require VK_KHR_bind_memory2 extension and intercept KHR
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
2025-03-31 13:42:18 +01:00
Rosen Zhelev
0562f6c433 Merge 'Fix the bugs with function dispatcher and swapchain handling' into 'main'
See merge request mesa/vulkan-wsi-layer!145
2025-03-14 16:15:36 +00:00
Normunds Rieksts
637b847465 Fix the bugs with function dispatcher and swapchain handling
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>
2025-03-13 17:47:43 +00:00
Dennis Tsiang
ce542a16a3 Change the condition to add extensions to the layer 2025-03-12 10:25:28 +00:00
Normunds Rieksts
279896dda6 Merge branch 'main' of upstream into 'ext_refactor'
Merges upstream 'main' into 'ext_refactor' branch and fix merge
conflict.

Change-Id: I718ec54cb11b7f456d713728b976c61ea7811eb0
Signed-off-by: Normunds Rieksts <normunds.rieksts@arm.com>
2025-02-17 15:49:21 +00:00
Normunds Rieksts
a92fa2a8d9 Add support for querying swapchain timing properties
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>
2025-02-11 16:47:42 +00:00
Angeliki Agathi Tsintzira
03804c74fe Remove guards on swapchain maintenance features
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>
2025-02-06 21:51:35 +00:00
Ginu Jacob
02ae04d08f Introduce an extensions abstraction in the layer
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>
2025-01-31 17:31:32 +00:00
Rosen Zhelev
196af34b9f Merge 'Add -Wextra flag and fix warnings' into 'main'
See merge request mesa/vulkan-wsi-layer!130
2025-01-21 13:47:22 +00:00
Angeliki Agathi Tsintzira
5c3d3a9d7c Add -Wextra flag and fix warnings
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>
2025-01-20 10:19:25 +00:00
Angeliki Agathi Tsintzira
1f37310208 Check for unsupported surfaces in the layer
Change-Id: I64eca7bf0f5f095c4dbc916c84377ae17350b3ec
Signed-off-by: Angeliki Agathi Tsintzira <angelikiagathi.tsintzira@arm.com>
2025-01-13 10:53:31 +00:00