Commit graph

344 commits

Author SHA1 Message Date
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
Fufu Fang
a98287a681 Fix refresh duration comment for headless backend
Signed-off-by: Fufu Fang <fufu.fang@arm.com>
Change-Id: I9e37ea162197dd8fbb75679663fa9b4b5e9e9694
2025-06-05 17:55:50 +01: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
Iason Paraskevopoulos
16293a438b Merge 'Change device extension entrypoint visibility check' into 'main'
See merge request mesa/vulkan-wsi-layer!162
2025-05-28 11:05:07 +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
Dennis Tsiang
20f64a2e48 Merge 'Set refreshDuration to 1 on headless backend' into 'main'
See merge request mesa/vulkan-wsi-layer!166
2025-05-22 10:12:33 +00:00
Fufu Fang
32c15e130e Set refreshDuration to 1 on headless backend 2025-05-22 10:12:33 +00:00
Rosen Zhelev
6fce2f8e16 Merge 'Make all jobs run on Merge Requests' into 'main'
See merge request mesa/vulkan-wsi-layer!164
2025-05-20 09:37:03 +01:00
Dennis Tsiang
84d2c16afe Make all jobs run on Merge Requests
Use the standard GitLab workflows to ensure the build job is run on
both Merge Requests and the main branch.

Signed-off-by: Dennis Tsiang <dennis.tsiang@arm.com>
Change-Id: I0469fd48200cb258ec6fea77bf9e817506d3570f
2025-05-19 10:28:33 +01:00
Dennis Tsiang
e876b6b4d9 Merge 'Fix compile error due to missing include' into 'main'
See merge request mesa/vulkan-wsi-layer!163
2025-05-16 18:06:42 +00:00
Normunds Rieksts
3c82178968 Fix compile error due to missing include 2025-05-16 18:06:42 +00:00
Rosen Zhelev
b2484fe518 Merge 'Introduce swapchain_image_creator' into 'main'
See merge request mesa/vulkan-wsi-layer!154
2025-05-16 16:22:43 +01:00
Dennis Tsiang
fb48778631 Merge 'Support WSI present timing if time domain supported' into 'main'
See merge request mesa/vulkan-wsi-layer!159
2025-05-16 08:26:19 +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
Rosen Zhelev
089418f0a8 Merge 'Use the KHR version for vkGetCalibratedTimestamps' into 'main'
See merge request mesa/vulkan-wsi-layer!156
2025-05-14 16:32:07 +01: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