Commit graph

316 commits

Author SHA1 Message Date
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
Rosen Zhelev
6baf6ff52a Merge 'Implement vkWaitForPresent2KHR' into 'main'
See merge request mesa/vulkan-wsi-layer!194
2025-08-28 15:46:50 +01: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
Rosen Zhelev
76771e7f67 Merge 'Initial support for VK_KHR_present_wait2' into 'main'
See merge request mesa/vulkan-wsi-layer!192
2025-08-26 13:42:14 +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
Rosen Zhelev
ad2767ee77 Merge 'Update the layer's readme and release notes with VK_KHR_present_id2 support' into 'main'
See merge request mesa/vulkan-wsi-layer!191
2025-08-20 12:45:47 +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
Rosen Zhelev
60f53bddd0 Merge 'Add initial support for VK_KHR_present_id2 in the layer' into 'main'
See merge request mesa/vulkan-wsi-layer!190
2025-08-18 10:23:02 +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
Rosen Zhelev
a0700e3e86 Merge 'Add initial support for VK_KHR_present_id2 in the layer' into 'main'
See merge request mesa/vulkan-wsi-layer!181
2025-08-13 09:41:22 +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
Rosen Zhelev
467d6af310 Merge 'Append WSI layer warning flags' into 'main'
See merge request mesa/vulkan-wsi-layer!187
2025-08-05 13:34:59 +01:00
Maged Elnaggar
d1ade3d218 Append WSI layer warning flags
- switch CMAKE_CXX_FLAGS and C_FLAGS to string(APPEND)
- concatenate flags without semicolons or list issues
- preserve existing: -Wall -Werror -Wextra -pthread -fPIC
- add new diagnostics:
  Wdouble-promotion, Wnon-virtual-dtor,
  Wdelete-non-virtual-dtor, Woverloaded-virtual,
  Wcast-qual, Wmissing-field-initializers,
  Werror=return-type, Wmissing-format-attribute
- add C-only check: -Wstrict-prototypes

Change-Id: Icae6cf649b9ab88c1d0bc736b91b4bc50e24c9dd
Signed-off-by: Maged Elnaggar <maged.elnaggar@arm.com>
2025-08-05 13:34:59 +01:00
Iason Paraskevopoulos
050b43c769 Merge 'Implement scheduling for headless present stages' into 'main'
See merge request mesa/vulkan-wsi-layer!184
2025-07-30 12:27:09 +00:00
Normunds Rieksts
dfe88e3c1c The patch changes the following:
* Implement scheduling support for headless present stages.
* Fix a bug where present query stages were added to the internal queue when application did not request any.
* Change the implementation of present timing extension to store device_private_data rather than VkDevice as all queries require it.
* Document the shortcomings of implenting scheduling support for Wayland backends.

Change-Id: I050cc700a88bce476b350caf8cc23dfb551f4a0c 
Signed-off-by: Normunds Rieksts normunds.rieksts@arm.com
2025-07-30 12:27:09 +00:00
Rosen Zhelev
e0cd3c645f Merge 'Retry mechanism for Wayland image presented event' into 'main'
See merge request mesa/vulkan-wsi-layer!185
2025-07-29 15:52:21 +01:00
Ginu Jacob
27430b2138 Retry mechanism for Wayland image presented event
In this change, when performing dispatch_queue for the present timing
VK_PRESENT_STAGE_IMAGE_FIRST_PIXEL_OUT_BIT_EXT stage a retry mechanism
is implemented to dispatch Wayland events until there are no more
events in the queue or till we get the Wayland presented event.

Signed-off-by: Ginu Jacob <ginu.jacob@arm.com>
Change-Id: Ieb9c2f3360d6f7c06167fb8096a398adaf71cdd2
2025-07-28 11:53:10 +01:00
Iason Paraskevopoulos
1016e4d2e9 Merge 'Timestamp for VK_PRESENT_STAGE_IMAGE_FIRST_PIXEL_OUT_BIT_EXT in Wayland' into 'main'
See merge request mesa/vulkan-wsi-layer!177
2025-07-24 08:39:10 +00:00
Ginu Jacob
d807a089c3 Timestamp for VK_PRESENT_STAGE_IMAGE_FIRST_PIXEL_OUT_BIT_EXT in Wayland
In this change, support for the presentation stage
VK_PRESENT_STAGE_IMAGE_FIRST_PIXEL_OUT_BIT_EXT is added for the Wayland
backend.

Signed-off-by: Ginu Jacob <ginu.jacob@arm.com>
Change-Id: I866f8c55cfb6b69ba03761706d838ea17acf9651
2025-07-24 08:39:09 +00:00
Rosen Zhelev
d0a267380c Merge 'Missing return wsi_alloc_utils.hpp in WSI layer' into 'main'
See merge request mesa/vulkan-wsi-layer!183
2025-07-22 14:47:13 +01:00
Maged Elnaggar
5dbb34a16d Missing return wsi_alloc_utils.hpp in WSI layer
Ensure the move-assignment operator in
swapchain_wsialloc_allocator returns *this on all
code paths. This avoids undefined behavior and satisfies
the function’s return type requirements.

Signed-off-by: Maged Elnaggar <maged.elnaggar@arm.com>
Change-Id: I99762484d7a02c24a4632a7a84b415a3842d02a3
2025-07-21 14:30:08 +01:00
Iason Paraskevopoulos
ba93b67fb6 Merge 'Fix check for present_id feature in present timing' into 'main'
See merge request mesa/vulkan-wsi-layer!182
2025-07-18 14:59:53 +00:00
Iason Paraskevopoulos
d344eeae70 Fix check for present_id feature in present timing
Signed-off-by: Iason Paraskevopoulos <iason.paraskevopoulos@arm.com>
Change-Id: I04f02372758d64ec8230d6f0ba9a6b5f882668cd
2025-07-18 15:26:54 +01:00
Iason Paraskevopoulos
8b7103e0e3 Merge 'Improve wait_for_pending_buffers' into 'main'
See merge request mesa/vulkan-wsi-layer!175
2025-07-18 11:44:25 +00:00
Iason Paraskevopoulos
e34e3775d6 Merge 'Implement monotonic stage timestamps on headless' into 'main'
See merge request mesa/vulkan-wsi-layer!176
2025-07-18 11:39:41 +00:00
Alex Bates
c43dd058ed Implement monotonic stage timestamps on headless
Sets timestamps for `vkGetPastPresentationTimingEXT` for the remaining
present stages on headless:

- VK_PRESENT_STAGE_IMAGE_LATCHED_BIT_EXT
- VK_PRESENT_STAGE_IMAGE_FIRST_PIXEL_OUT_BIT_EXT
- VK_PRESENT_STAGE_IMAGE_FIRST_PIXEL_VISIBLE_BIT_EXT

These are all set to the same value: when swapchain::present_image is
called. It uses the best monotonic clock supported by the driver.

No need for slot member variables to be atomic any more because they
are only accessed while a lock on m_queue_mutex is held.

Signed-off-by: Alex Bates <alex.bates@arm.com>
Change-Id: I90ffc876890ee74620b7ba8da753794cae51dd36
2025-07-18 11:39:41 +00:00
Iason Paraskevopoulos
24a77e8300 Merge 'Update time domain handling to comply with Vulkan spec' into 'main'
See merge request mesa/vulkan-wsi-layer!180
2025-07-11 10:13:34 +00: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
9296f8032e Merge 'Add VkPastPresentationTimingFlagBitsEXT' into 'main'
See merge request mesa/vulkan-wsi-layer!179
2025-07-09 07:54:14 +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
Iason Paraskevopoulos
f879ceeeee Merge 'Tighten extension gating, filtering, and exposure logic' into 'main'
See merge request mesa/vulkan-wsi-layer!174
2025-06-27 15:21:58 +00: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
Iason Paraskevopoulos
11bda63226 Merge 'Reintroduce is pending' into 'main'
See merge request mesa/vulkan-wsi-layer!178
2025-06-27 09:52:50 +00:00
Iason Paraskevopoulos
b4896d3ab8 Reintroduce is pending
Change-Id: Ie5f2e9363df827d6b0e4e3ff83859bcd20106d62
Signed-off-by: Iason Paraskevopoulos <iason.paraskevopoulos@arm.com>
2025-06-26 18:21:09 +01:00
Iason Paraskevopoulos
fb4b1b18bb Merge 'Improve implementation of vkGetPastPresentationTimingsEXT' into 'main'
See merge request mesa/vulkan-wsi-layer!170
2025-06-26 08:14:17 +00:00
Iason Paraskevopoulos
1eee8ffea1 Improve implementation of vkGetPastPresentationTimingsEXT
Fixes a few issues with the vkGetPastPresentationTimingsEXT
implementation. In particular:
    - Entries with presentId = 0 are used to match entries in the
      internal queue that didn't have a presentId supplied in the
      presentation request.
    - pPresentationTimings is returned to the application without any
      holes.
    - The appropriate return code is returned.

Adds an m_set member in swapchain_presentation_timing in order to allow
marking entries as completed that didn't have a timestamp, e.g.
a presentation request was rejected by the presentation engine.

Adds a mutex for guarding accesses to the internal queue by functions
that can be called by the application.

Minor documentation updates.

Change-Id: Id56bfd039b341e7f540a5ed028e954c490d00dd5
Signed-off-by: Iason Paraskevopoulos <iason.paraskevopoulos@arm.com>
2025-06-26 08:14:17 +00:00
Iason Paraskevopoulos
83c646aa6a Improve wait_for_pending_buffers
Changes wait_for_pending_buffers to not call wait_for_free_buffer
if there are already free buffers. The reason is that
wait_for_free_buffer consumes the m_free_image_semaphore, which is ok
when it is done by acquire_next_image but wrong when it is done
by wait_for_pending_buffers which doesn't acquire any images. A side
effect of this could be that subsequent calls might
block if it they called after wait_for_pending_buffers and
there was only one free image remaining.

Renames wait_for_free_buffer to wait_and_get_free_buffer to better
communication that the semaphore is decremented after in the function.

Change-Id: Ie88fa435ba5805066d7bf13fce9fb2ce4c966cef
Signed-off-by: Iason Paraskevopoulos <iason.paraskevopoulos@arm.com>
2025-06-20 12:43:02 +01:00
Iason Paraskevopoulos
004da7974c Merge 'Support present timing on Wayland regardless of compositor support for wp_presentation' into 'main'
See merge request mesa/vulkan-wsi-layer!151
2025-06-18 12:15:42 +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
Rosen Zhelev
35250885d6 Merge 'Update minimum version of CMake' into 'main'
See merge request mesa/vulkan-wsi-layer!173
2025-06-17 11:33:44 +01:00
Maged Elnaggar
1eafebc56a Update minimum version of CMake
Set CMake minimum required version range to 3.4.3...4.0
to silence compatibility errors in CMake 4.0
by explicitly opting into all policies up to 4.0

Signed-off-by: Maged Elnaggar <maged.elnaggar@arm.com>
Change-Id: I2e0527dde4e764e9c17f519fc0ddd3c0e382fa31
2025-06-17 11:33:44 +01:00
Dennis Tsiang
7c71bbc214 Merge 'Add fix to Document the VK_PRESENT_MODE_FIFO_LATEST_READY_EXT support for Headless and Wayland' into 'main'
See merge request mesa/vulkan-wsi-layer!172
2025-06-11 08:03:02 +00:00
Nir Ekhauz
3abe2a18c9 Add fix to Document the VK_PRESENT_MODE_FIFO_LATEST_READY_EXT support for Headless and Wayland
Remove fifo_latest_ready from CMakeLists.txt

Signed-off-by: Nir Ekhauz <nir.ekhauz@arm.com>
Change-Id: I581b385c48bcaf25dac8a291ecf23946127263a3
2025-06-10 12:18:11 +03:00
Dennis Tsiang
12b15ec3fe Merge 'Document the VK_PRESENT_MODE_FIFO_LATEST_READY_EXT support for Headless and Wayland' into 'main'
See merge request mesa/vulkan-wsi-layer!171
2025-06-10 07:33:31 +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
Iason Paraskevopoulos
1ef16210ea Merge 'Enable and fix VK_KHR_present_wait device extension' into 'main'
See merge request mesa/vulkan-wsi-layer!165
2025-06-06 16:41:12 +00: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
604b1e6a17 Merge 'Improvement for present timing stages' into 'main'
See merge request mesa/vulkan-wsi-layer!168
2025-06-06 09:56:17 +00:00
Ginu Jacob
ef9b6eed8c Improvement for present timing stages
In this change, handling for the present timings stages are improved.

Signed-off-by: Ginu Jacob <ginu.jacob@arm.com>
Change-Id: I68e9ae67fa94d39e23504890d922a85bdce938cd
2025-06-06 09:56:17 +00:00
Rosen Zhelev
106de49b9e Merge 'Fix refresh duration comment for headless backend' into 'main'
See merge request mesa/vulkan-wsi-layer!169
2025-06-06 10:54:35 +01:00