1. Update the README file.
2. Remove the guards from the code.
Signed-off-by: Nir.Ekhauz <nir.ekhauz@arm.com>
Change-Id: Idf65baee25d09a3b4bc3b563455468bac4d5bddf
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
Add support for present wait2 ext. for physical, surface and sc.
Signed-off-by: Nir.Ekhauz <nir.ekhauz@arm.com>
Change-Id: I0f7cdadb2d3ea0ecbc32b8b2efe9fc3bb4ba0369
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
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>
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
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>
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.
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>
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>
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
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>
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>
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
Fixes an issue, where the swapchain addresses weren't removed from the
device_private_data::swapchains member after swapchain destruction. This
could cause clashes with swapchains handled by different components
(e.g. ICD).
Signed-off-by: Iason Paraskevopoulos <iason.paraskevopoulos@arm.com>
Change-Id: I0e05734368ef6100b67ded973283f99ef248e540
Implement support for VK_EXT_image_compression_control_swapchain
for both the Wayland and the headless windowing systems.
The extension can be conditionally enabled through the new build option
BUILD_WSI_IMAGE_COMPRESSION_CONTROL_SWAPCHAIN. Compiling with this
option enabled requires recent Vulkan headers (1.3.213)
Note also that support in the layer is enabled conditionally to
the ICD supporting VK_EXT_image_compression_control.
Update the WSIALLOC interface to version 2 and add support to
prefer selection of a format with the highest fixed rate compression
from the formats provided. This is used to pick a fixed rate
compression when VK_IMAGE_COMPRESSION_FIXED_RATE_EXPLICIT_EXT is
specified during swapchain creation.
Signed-off-by: Dennis Tsiang <dennis.tsiang@arm.com>
Signed-off-by: Rosen Zhelev <rosen.zhelev@arm.com>
Signed-off-by: Normunds Rieksts <normunds.rieksts@arm.com>
Signed-off-by: Matteo Franchin <matteo.franchin@arm.com>
Change-Id: Ie37e6901042a65f2a408e428a705b5a24227b262
Adds support for the VK_KHR_get_surface_capabilities2 extension.
Change-Id: Iae882a41819baf413a0ba949ec44d6e722ebca5a
Signed-off-by: Iason Paraskevopoulos <iason.paraskevopoulos@arm.com>
Adds a template function for setting the supported surface formats for
a surface. This function is used in the get_surface_formats
implementation of both the WSI backends, which previously were
implementing the same logic independently.
Removes the unused surface argument from get_surface_formats and
get_surface_capabilities.
Change-Id: Ib220166675d1c24aeef230cf9f510abba9e42a61
Signed-off-by: Iason Paraskevopoulos <iason.paraskevopoulos@arm.com>
Stores the enabled instance and device extensions during
vkCreateInstance and vkCreateDevice respectively. This fixes an issue
where function pointers for functions of disabled extensions were
returned during vkGetInstanceProcAddr/vkGetDeviceProcAddr.
Adds functionality for adding extensions that belong to a subset of
other extensions in util::extension_list.
Adds function for checking if the proper surface extension has been
enabled in each WSI backend.
Signed-off-by: Iason Paraskevopoulos <iason.paraskevopoulos@arm.com>
Change-Id: If5e23e0d07c9f09006be18c410c4e1d4c3a1e676
Fix warnings given by clang-tidy 8 with checks 'bugprone-*,modernize-*'
Change-Id: I2e5660c5872728f957869c66b1143cfcc76bc20e
Signed-off-by: Ben Davis <ben.davis@arm.com>
Defines an abstract wsi::surface object to be implemented by each WSI
backend. This object is then associated with the corresponding VkSurface
object in the instance specific data.
To keep track of these objects the layer now intercepts
vkDestroySurfaceKHR, while specific surface creation entrypoints are
intercepted by individual WSI backends.
In addition this change should allow for fixing incompatibility issues
with layers that wrap VkSurface which breaks casting to the Loader's ICD
VkSurface type.
Make greater use of util::unique_ptr and allow for such pointers to be
constructable when casting derived types.
Change-Id: I163e9c47088ad9989583ebce1319b1fc05559d73
Signed-off-by: Rosen Zhelev <rosen.zhelev@arm.com>
Remove all the leftover instances in layer that still use the
generic allocator rather than the VkAllocationCallbacks
Add additional memory utility that allows to release memory
allocated by custom allocators using RAII
Change-Id: I43594ddd3c506048ca0f02e31b64597a7abc481b
Signed-off-by: Normunds Rieksts <normunds.rieksts@arm.com>
Document instance_private_data and device_private_data.
Add additional utility containers (util::unordered_set,
util::unordered_map) that ensure that the storage containers
we use allow the use of the Vulkan allocation callbacks.
Additionally, ensure that these allocations don't throw in
case host runs out of memory but rather return the appropriate
Vulkan error code.
Also keep a copy the allocators so they can be used in other layer
functionality to facilitate following the Vulkan specification around
memory allocation.
Add additional utility util::optional that currently makes it easier
to handle errors in the containers described above.
Fix some small issues with the vkCreateInstance/vkCreateDevice
handling and ensure that vkDestroyDevice is called in the layer
handler.
Change-Id: Ic9d8ece405c82e743a2c016cc3dabf984cf77fc1
Signed-off-by: Normunds Rieksts <normunds.rieksts@arm.com>
Very basic Wayland support is implemented by importing
memory with VK_EXT_image_drm_format_modifiers.
The current implementation requires an external system
memory allocator. An API for this allocator is defined
in util/wsialloc/wsialloc.h and an implementation using
the ION memory allocator is included.
Outstanding issues:
* This is an initial prototype for Wayland support and
has many outstanding TODOs which need addressing to
properly use the Wayland protocol.
* Using ICD Exported memory instead of a system allocator
is not implemented.
Wayland support is still experimental and outstanding issues
will be fixed in future commits.
Change-Id: I1b0d5991e15ff1cf25ebbab3392a631b021e8c17
Signed-off-by: Rosen Zhelev <rosen.zhelev@arm.com>
Signed-off-by: Iason Paraskevopoulos <iason.paraskevopoulos@arm.com>
In vkCreateInstance:
- ppEnabledExtensionNames is checked to determine which window-system
platforms the layer should enable support for.
- support in the layer is always enabled if possible, even if this may
be provided by the ICDs. Platforms not supported by the layer should
still be correctly supported by the ICDs (untested.)
- pApplicationInfo is changed to bump the Vulkan API version
in order to enable instance extensions that are necessary for some
of the platforms implemented in the layer.
In vkCreateDevice:
- ppEnabledExtensionNames is extended with device extensions required
by the layer.
- if the extensions are not supported by the physical device, the
layer fails to initialize the device.
Change-Id: Ibdd69fca38e7909d5b8f0ac7698805ea5f425ac6
Signed-off-by: Joe Jenner-Bailey <joe.jenner-bailey@arm.com>
Signed-off-by: Matteo Franchin <matteo.franchin@arm.com>
A couple of details in the installation instructions needed updating.
Also fixed a warning message due to a missing return statement (the
return value is currently not used in calls to the function).
Signed-off-by: Matteo Franchin <matteo.franchin@arm.com>
Change-Id: I715b954579253e664ebe01f757587e0602ad82e7
This commit adds the initial sources for the vulkan-wsi-layer project:
a Vulkan layer which implements some of the Vulkan window system
integration extensions such as VK_KHR_swapchain.
The layer is designed to be GPU vendor agnostic when used as part of the
Vulkan ICD/loader architecture.
The project currently implements support for VK_EXT_headless_surface and
its dependencies. We hope to extend support for further platforms such
as Wayland and direct-to-display rendering in the future.
This initial commit collects contributions from different individuals
employed by Arm.
More information on the project (building instructions, how to
contribute, etc.) can be found on the README.md file at the top of the
project tree.
Signed-off-by: Matteo Franchin <matteo.franchin@arm.com>