Commit Graph

4 Commits

Author SHA1 Message Date
Jason Ekstrand 591da98779 vulkan: Add a common VkPipelineCache implementation
This is partly copied+pasted from ANV but is mostly new code with lots
of reference counting bugs fixed (I hope!).  The new cache caches
"object" which derive from a base vk_pipeline_class_object struct.  It
uses a kernel-style "ops" interface for virtual methods on these objects
to allow for easy destruction (when the reference count hits zero) as
well as serialization an deserialization interfaces.  This should allow
drivers to cache basically whatever they want without having to think
too hard about the details.

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13184>
2022-04-22 19:38:52 +00:00
Jason Ekstrand 6073610d7a vulkan,docs: Document vk_physical_device
Acked-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15472>
2022-04-07 16:32:21 +00:00
Jason Ekstrand 60e7359db0 vulkan: Add a common implementation of VkFence
This is built on the new vk_sync primitives.  In the vk_physical_device,
the driver provides a null-terminated array of vk_sync_type pointers in
priority order.  The fence implementation then selects the first type
that meets the necessary criterion.  In particular, fences can't be
timelines and need to support reset and CPU wait.  It also auto-selects
the fence type based on the external handle types provided and can
down-grade as needed to support a particular external handle.

The implementation itself is mostly copy+pasted from ANV.  The primary
difference is the fact that anv_fence_impl has been replaced with
vk_sync.  The permanent vk_sync is still embedded (like ANV) but the
temporary one is a pointer.  This makes stealing the temporary state as
part of VkQueueSubmit a bit easier.

All of the interesting stuff around waits, resets, etc. is implemented
by the vk_sync interface.  All this code does is wrap it all in the
annoyingly detailed VkFence rules so we can provide the correct Vulkan
entrypoint behavior.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13427>
2021-11-16 10:02:08 -06:00
Jason Ekstrand 4108fda426 vulkan: Move all the common object code to runtime/
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13156>
2021-10-29 23:12:32 +00:00
Renamed from src/vulkan/util/vk_physical_device.h (Browse further)