Commit graph

72 commits

Author SHA1 Message Date
Alex Bates
575cf49d95 Remove ion wsialloc implementation
Signed-off-by: Alex Bates <alex.bates@arm.com>
Change-Id: Iecfb86ecefc0cfba2796b9dca6b105392a3b3f73
2025-11-10 16:28:20 +00:00
Lior Dekel
65078fb361 Adding debug interface
Added new debug file with function that exposes the
DRM modifier of a swapchain image buffer.
Building the layer with DEBUG=1 flag will result
building this file and tests can now get the modifier
value for assertions.

Signed-off-by: Lior Dekel <lior.dekel@arm.com>
Change-Id: I97a44dbda87b7cdb8984576aab613612f2f12a55
2025-11-04 12:20:24 +00: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
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
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
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
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
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
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
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
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
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
Normunds Rieksts
ab138f30ef Implement vkWaitForPresentKHR entrypoint 2025-05-09 16:04:39 +00:00
Fufu Fang
b07d5d61e2 Fix the extension name stripping in CMakeLists.txt
This patch fixes the sed command in CMakeLists.txt. Previously
the extended regular expression flag was not correctly set.

Change-Id: I7beb1c2ba68134ecd1cf37bbc0f7888f903fd6bb
Signed-off-by: Fufu Fang <fufu.fang@arm.com>
2025-04-29 16:46:49 +01:00
Iason Paraskevopoulos
281049aa78 Merge remote-tracking branch 'main' into add_swapchain_image_creator
Change-Id: I22a4c697c8b1181127242848f37ea081243f0d03
Signed-off-by: Iason Paraskevopoulos <iason.paraskevopoulos@arm.com>
2025-04-25 15:30:01 +01:00
Iason Paraskevopoulos
ca3820a0ba Add external memory extension
Adds a swapchain create info extension for creating an image using
external memory. This removes the need for modifying the
image_create_info in the display and wayland backends. There is still
code duplication left in these backends though, because swapchain
allocation needs to know the selected format. This will be removed when
the swapchain images will be created from the swapchain image creator.

Moves the definition of drm_format_pair to drm_utils.

Removes two step initialization from swapchain_wsi_allocator.

Change-Id: I0c937a59cc62e7e3134f0af4728fdda3739237bd
Signed-off-by: Iason Paraskevopoulos <iason.paraskevopoulos@arm.com>
2025-04-25 15:28:39 +01:00
Iason Paraskevopoulos
b326e4b21f Add wsialloc wrapper class
Adds a class for owning and managing a wsialloc allocator, which removes
duplicated functionality from the wayland and display backends.

Change-Id: Ieb0c75481c2b1c0019e620a88fc0e153eba1e29a
Signed-off-by: Iason Paraskevopoulos <iason.paraskevopoulos@arm.com>
2025-04-25 15:03:42 +01:00
Iason Paraskevopoulos
9ba06600b5 Add compression control image creator extension
Copies the image_compression_control implementation from wsi/extensions
to wsi/swapchain_image_create_extensions. Replaces the usage of the
wsi_extension with the swapchain_image_create_extension in the headless
backend.

Change-Id: I29c5d0b7eba4f79be63fda3f103ff786968fc367
Signed-off-by: Iason Paraskevopoulos <iason.paraskevopoulos@arm.com>
2025-04-25 15:03:42 +01:00
Iason Paraskevopoulos
1e9cb8b1b3 Introduce swapchain_image_creator
Adds a new class named swapchain_image_creator, which will be
responsible for owning and extending image create info.

Change-Id: Icdda2304698e110d4c0d52caa6b7c1fe59c383a9
Signed-off-by: Iason Paraskevopoulos <iason.paraskevopoulos@arm.com>
2025-04-25 15:03:42 +01: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
Iason Paraskevopoulos
87b58a39b4 Merge 'Handle VkPhysicalDevicePresentWaitFeaturesKHR' into 'main'
See merge request mesa/vulkan-wsi-layer!142
2025-04-01 09:29:51 +00: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
2d1b682129 Use wp_presentation_feedback to update the presented ID value 2025-04-01 09:27:18 +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
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
3051ca8b67 Add vkGetSwapchainTimeDomainPropertiesEXT support 2024-11-15 12:49:31 +00:00
Iason Paraskevopoulos
be2fee5043 Rename KERNEL_DIR to KERNEL_HEADER_DIR
Renames KERNEL_DIR to KERNEL_HEADER_DIR to allow getting the kernel
headers from a directory that is not coupled with the kernel source
tree.

Change-Id: Ic98b39dd2ec117ef4bc413cb3bf86eee89ebe4fd
Signed-off-by: Iason Paraskevopoulos <iason.paraskevopoulos@arm.com>
2024-10-31 10:40:09 +00:00
Iason Paraskevopoulos
cd19e3827b Add dma_buf_heaps wsialloc implementation
Change-Id: I738f8cbfb1aec52a122689ebaeb7f5b898ba200a
Signed-off-by: Iason Paraskevopoulos <iason.paraskevopoulos@arm.com>
2024-10-31 10:40:09 +00:00
Iason Paraskevopoulos
8619f42973 Add helper functions to wsialloc
Moves out the non ion specific code from the wsialloc ion implementation
to a new wsialloc_helpers file.

Change-Id: I7ca816b27eb7e68fd1f138ec7bda006b204c0cbe
Signed-off-by: Iason Paraskevopoulos <iason.paraskevopoulos@arm.com>
2024-10-31 10:40:09 +00:00
Rosen Zhelev
b612383789 Merge 'Disable the FIFO present thread implementation on Wayland by default' into 'main'
See merge request mesa/vulkan-wsi-layer!121
2024-10-23 10:00:47 +00:00
Maged Elnaggar
57fedd8cdb Enable -Werror on Vulkan WSI Layer 2024-10-22 09:14:54 +00:00
Dennis Tsiang
dbf8ad01c0 Disable the FIFO present thread implementation on Wayland by default
The FIFO implementation in the Wayland backend that uses the
presentation thread is not technically Vulkan conformant. This commit
enables a true FIFO implementation that is conformant to the Vulkan
spec by blocking in the vkQueuePresent path. On Wayland this is
achieved by having the main thread wait for the frame_done event to be
sent by the compositor. This was already used in FIFO before but
previously it would be the presentation thread that would block.
This implementation is now used by default.

The downside of this approach is that it has a significant performance
impact due to blocking the main thread.

Users wishing to continue using the presentation thread
implementation to achieve better performance can still do so through
a new build option `ENABLE_WAYLAND_FIFO_PRESENTATION_THREAD`.

The README has also been updated to document the FIFO shortcomings.

Signed-off-by: Dennis Tsiang <dennis.tsiang@arm.com>
Change-Id: I8674f9ea330a45f97d32024f97057ffc25c76c7a
2024-10-21 12:24:40 +01:00
Iason Paraskevopoulos
e6fa021f8d Merge 'Add support for wp_presentation in the WSI layer' into 'main'
See merge request mesa/vulkan-wsi-layer!113
2024-10-03 16:12:53 +00:00
Normunds Rieksts
94dd9840c9 Implement support for marking frame boundaries 2024-10-01 15:18:22 +00:00
ginujacob
7f63c67cf2 Add support for wp_presentation in the WSI layer
Enabling the support for wp_presentation in
Wayland surface. A handle to the interface is
stored in the Wayland surface. The handle is
initialized for each VKSurface.

Signed-off-by: ginujacob <ginu.jacob@arm.com>
Change-Id: I9a2239b3047720fdeb857e23bb529c0f0fce9575
2024-10-01 13:37:29 +01:00
ginujacob
0cee10aa6f Advertise VK_EXT_present_timing features.
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
2024-09-17 11:31:46 +01:00
Dennis Tsiang
7e27d1d762 Guard swapchain maintenance features with experimental flag
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>
2024-09-05 16:52:48 +01:00
Fufu Fang
743f00f9bb Merge branch 'main' into 'swapchain_maintenance_new' 2024-08-19 12:20:16 +00:00
ginujacob
0a293fcfa9 VK_EXT_present_timing changes for the layer's json file.
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
2024-08-15 12:01:36 +01:00
Normunds Rieksts
d2b8eb3135 Add vkReleaseSwapchainImagesEXT entrypoint
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>
2024-08-13 19:27:53 +01:00
Dennis Wildmark
c48d7382ef Refactor framebuffer format support
Add support for format modifiers in framebuffers using
drmModeAddFB2WithModifiers.
Add compilation flag to force VK_KHR_display to not support format
modifiers for framebuffers.

Change-Id: Ie8eb2e96e543a15ab3534a7e73425f277a4b7d58
Signed-off-by: Dennis Wildmark <dennis.wildmark@arm.com>
Signed-off-by: Fufu Fang <fufu.fang@arm.com>
2024-08-12 11:44:22 +00:00
Dennis Wildmark
e62cc2d42f VK_KHR_display swapchain implementation
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>
2024-08-12 11:44:22 +00:00
Dennis Wildmark
8da77f2b8b VK_KHR_display surface_properties implementation
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>
2024-08-12 11:44:22 +00:00
Dennis Wildmark
8a74233de2 Add support for VK_KHR_shared_presentable_image for headless backend
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
2024-04-30 08:28:21 +00:00