vulkan/wsi/wayland: Add query cache to avoid roundtrips on format/present mode queries.
What does this MR do and why?
Add a cache (by last used wsi_device) for all the format and present mode queries, to avoid needing to setup and destroy a wsi_wl_display for each time.
wsi_devices have the same lifetime as VkPhysicalDevices, which outlive the VkSurfaceKHR.
Roundtrips are incredibly slow, and some apps can call these querie multiple times per frame.
Not only that, but setting up and destroying a wsi_wl_display gets and destroys a wl_registry. This is problematic as the server-side resources for a wl_registry are never ever cleared until a client dies. See 1 for more information.
This is a significant problem, and can result in 100+MB of leaking in under an hour on the compositor (not client) side.
This cache avoids both of these problems.
Signed-off-by: Joshua Ashton joshua@froggi.es