Commit graph

15 commits

Author SHA1 Message Date
Alex Bates
ace729f7f8 Support nonzero present timing queue family
Adds a per-device check for a 'best' queue family to
use for present timing, rather than always using index 0.

wsi_ext_present_timing holds resources (such as the command
buffer) per queue family, rather than supporting only one. However,
currently, only one queue family is supported at a time.
In future, we can hook vkGetDeviceQueue calls to map
VkQueues to their family index. Doing this will transparently
give present timing support for multiple queue families.

Signed-off-by: Alex Bates <alex.bates@arm.com>
Change-Id: I5becb29dfc4a082e301031e0c693acd23eb95a51
2025-10-06 11:27:34 +01:00
Iason Paraskevopoulos
7ebafbfb79 Add stdexcept in custom_allocator.hpp 2024-10-25 09:57:24 +00:00
ginujacob
9abd1af3ce Handle VkPresentTimingsInfoEXT
Implements the entrypoint vkSetSwapchainPresentTimingQueueSizeEXT and
handles VkPresentTimingsInfoEXT. The presentation timing queue is
also implemented the present id from parsing VkPresentTimingsInfoEXT is
stored in the queue.

Signed-off-by: ginujacob <ginu.jacob@arm.com>
Change-Id: I81b6113b54db5e59f7018ef9a22e80af6dcdd568
2024-10-11 18:56:31 +01:00
Dennis Tsiang
4423a52816 Update clang-format rules
Signed-off-by: Dennis Tsiang <dennis.tsiang@arm.com>
Change-Id: I76f87648a8ddaeddb6774123d263957b845d10a1
2024-07-04 10:30:42 +01:00
Dennis Tsiang
92a3da6ad2 Fix issues reported by static analysis tools
Fix CERT C/CPP issues flagged by static analysis tools.

Signed-off-by: Dennis Tsiang <dennis.tsiang@arm.com>
Change-Id: I6758bb83bd0647e4e6b7ccbf84e94f05ba90e160
2022-11-11 14:27:03 +00:00
Normunds Rieksts
86fa15a8a2 Fix OOM issue
Fixes an issue where there was a chance that an exception would be
thrown when out of memory rather than returning an
appropriate VkResult code.

Additionally introduces a noncopyable utility class that can be used to
mark classes that should not have copy semantics

Change-Id: I1f84dc9bb1ea96db2a88a90d56adbee78b17c5e3
Signed-off-by: Normunds Rieksts <normunds.rieksts@arm.com>
2021-11-11 18:27:31 +00:00
Ben Davis
6ef056b517 Update code to use modern c++ style
Fix warnings given by clang-tidy 8 with checks 'bugprone-*,modernize-*'

Change-Id: I2e5660c5872728f957869c66b1143cfcc76bc20e
Signed-off-by: Ben Davis <ben.davis@arm.com>
2021-11-11 10:15:22 +00:00
Ben Davis
e00a2d8e40 Fix issues found by static analysis
Change-Id: I222ec3b352aa220b6c08df3a71de48178b67f06d
Signed-off-by: Ben Davis <ben.davis@arm.com>
2021-10-11 17:31:57 +00:00
Rosen Zhelev
c7be05e3ff Implement objects associated with VkSurface
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>
2021-08-17 16:42:21 +01:00
Dennis Tsiang
f22b7e33b9 Add documentation for unique_ptr and deleter class
Add brief documentation to explain what the custom util::unique_ptr and
deleter class is used for.

Change-Id: I7f4d456a34d55c09ad470b7c34e32b069203ca6b
Signed-off-by: Dennis Tsiang <dennis.tsiang@arm.com>
2021-07-26 16:40:27 +01:00
Normunds Rieksts
d63261cce5 Remove usages of generic allocator in the layer
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>
2021-07-22 19:05:26 +01:00
Normunds Rieksts
af2af23333 Ensure allocations happen through custom allocators
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>
2021-06-28 11:51:33 +01:00
Joe Jenner-Bailey
f0dcf4fb36 util: add class for storing extensions strings
This utility will be used in future commits.

Also add -Wno-undefined to the linker flags to prevent leaving
undefined symbols in the layer .so file. Fix issues highlighted while
using this flag.

Change-Id: I682e266f7b3f313742cb2da83e5ad2569fc72da3
Signed-off-by: Joe Jenner-Bailey <joe.jenner-bailey@arm.com>
Signed-off-by: Matteo Franchin <matteo.franchin@arm.com>
Signed-off-by: Rosen Zhelev <rosen.zhelev@arm.com>
2021-01-18 10:33:17 +00:00
Matteo Franchin
f0b541a4e3 Use util::allocator in swapchain object
Change util::allocator's create and destroy methods so that they can
allocate multiple objects, in line with the allocate and deallocate
methods of std::allocator.

Also add documentation for util::allocator and its methods.

Finally, use util::allocator in swapchain.cpp, rather than allocating
memory directly via VkAllocationCallbacks.

Change-Id: I0bc25abe3cbc3af9608218411da8d70e04dd9749
Signed-off-by: Matteo Franchin <matteo.franchin@arm.com>
2020-12-10 17:46:36 +00:00
Joe Jenner-Bailey
9585b28b12 Implement a vector utility that uses a custom allocator
Add util::vector to provide functionality similar to std::vector,
i.e. growable arrays. util::vector does its allocations via a custom
allocator provided via VkAllocationCallbacks and provides methods to
check whether the allocation fails, e.g. try_push_back() returns false
when the allocation fails and replaces std::vector's push_back() method
that would rather raise an exception to report an allocation failure.

Note that this commit switches on exceptions in the layer by removing
the flag -fno-exceptions.

util::vector is also used to store swapchain images.

Change-Id: I2bf2b24bd06e198c198c4f4aedd8f7fced96a346
Signed-off-by: Joe Jenner-Bailey <joe.jenner-bailey@arm.com>
Signed-off-by: Matteo Franchin <matteo.franchin@arm.com>
2020-11-30 10:31:53 +00:00