vulkan/wsi/x11: wait for acquirable images in FIFO mode In FIFO presentation mode we block either on our present-queue or on Present events after an image was transmitted. In case we receive completion events without idle events at some point we exhaust our acquire-queue and can not block anymore on present-queue. Ensure that the consumer has at least one image to acquire before blocking again on present-queue. Otherwise wait for one from the X server. CC: mesa-stable Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3344 Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl> Reviewed-by: Simon Ser <contact@emersion.fr> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6513>
vulkan/wsi/x11: add sent image counter Add a counter to count how many images from our swapchain are currently "sent" to the X server via Present extension. An image is sent when it has been presented but we have not yet received an idle event for it. CC: mesa-stable Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl> Reviewed-by: Simon Ser <contact@emersion.fr> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6513>
vulkan/wsi: add sw support. (v2) This adds an option to the WSI support for a software path to be used with the vulkan sw drivers. There is probably some changes that could be made to improve this and use present, for now just use put image. v2: roll out flag across all drivers (Eric) Reviewed-by: Roland Scheidegger <sroland@vmware.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6082>
vulkan/wsi: Convert usage of -1 to UINT32_MAX. The integers are unsigned so they do the same but this makes it locally more clear what happened. Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6071>
vulkan/wsi/x11: report device-group present rectangles with prime. dEQP-VK.wsi.xlib.surface.query_devgroup_present_modes with prime fail when 0 rectangles are reported. While I believe that test tests this unintentionally (trying to test the VK_INCOMPLETE return), I believe it makes sense to always return a rectangle. In particular we require the data from the given rectangle for presentation even if we use prime and given that prime is completely transparent for the app it still counts as local from the perspective as the application. Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6071>
meson: fix android vulkan build Android doesn't have `pthread_cancel()` and is unlikely to ever implement it [1], but `wsi_common_display.c` needs it (or an alternative). Let's just disable the platform on Android (as it used to be before 448eb19158f483d807ef). [1] https://android-review.googlesource.com/c/platform/bionic/+/1215779/1/docs/status.md Fixes: 448eb19158f483d807ef ("vulkan: automatically compile the `display` platform when available") Signed-off-by: Eric Engestrom <eric@engestrom.ch> Acked-by: Nataraj Deshpande <nataraj.deshpande@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5860>
vulkan: automatically compile the `display` platform when available Signed-off-by: Eric Engestrom <eric.engestrom@intel.com> Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl> Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3161>
vulkan/wsi: Don't consider VK_SUBOPTIMAL_KHR to be an error condition This was causing vkAcquireNextImageKHR to not signal the fences and semaphores. In the case where the semaphore was brand new, this could cause an unsignalled syncobj to be passed into execbuffer2 which it will reject with -EINVAL leading to VK_ERROR_DEVICE_LOST. Thanks to Henrik Rydgård who works on the PPSSPP project for helping me figure this out. Fixes: ca3cfbf6f1e00 "vk: Add an initial implementation of the actual..." Fixes: 778b51f491cfe "vulkan/wsi: Add a hooks for signaling semaphores..." Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5672>
radv,vulkan: add a new x11 wsi drirc workaround for DOOM Eternal DOOM Eternal happily creates a swapchain with 2 images for IMMEDIATE. This fixes a 10% performance issue with RADV. Cc: 20.1 <mesa-stable@lists.freedesktop.org> Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5704>
Revert "vulkan/wsi/x11: Ensure we create at least minImageCount images." This breaks some games like Wolfenstein Youngblood or Wolfenstein 2 that crash at launch if the number of images is more than what they expected. We could add vk_x11_strict_image_count to fix these game bugs but it seems more conservative to revert that change and add a new wsi drirc workaround for Doom Eternal. This reverts commit 5f97dfc4c848cb6388ec138c19a22a8a880901d1. Cc: 20.1 <mesa-stable@lists.freedesktop.org> Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5704>
vulkan/wsi/x11: Ensure we create at least minImageCount images. Doom Eternal happily creates a swapchain with 2 images for IMMEDIATE... This fixes a 10% performance issues with Doom Eternal for me. Since the game only sets a minImageCount increasing till our own minimum is totally okay. CC: <stable@lists.freedesktop.org> Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/2684 Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3156 Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4368>
vulkan/wsi: Really terminate DRM lease in wsi_release_display(). wsi_release_display() implements vkReleaseDisplayEXT() which is supposed to return control to the lessor of an output upon call. We need to terminate the wsi->wait_thread when close()'ing the wsi->fd, otherwise the wait_thread holds another reference to the wsi->fd, keeping the lease active, and thereby the leased output blocked, until vkDestroyInstance() is called. This gives users their GUI back, instead of extended darkness. Fixes: 352d320a0745 ("vulkan: Add EXT_direct_mode_display [v2]") Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com> Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Cc: <mesa-stable@lists.freedesktop.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5396>
vulkan/wsi: replace all dup() with os_dupfd_cloexec() Signed-off-by: Eric Engestrom <eric@engestrom.ch> Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com> Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5369>
meson: use gnu_symbol_visibility argument This uses a meson builtin to handle -fvisibility=hidden. This is nice because we don't need to track which languages are used, if C++ is suddenly added meson just does the right thing. Acked-by: Matt Turner <mattst88@gmail.com> Reviewed-by: Eric Engestrom <eric@engestrom.ch> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4740>
vulkan/wsi: Make wsi_swapchain inherit from vk_object_base Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Acked-by: Kristian H. Kristensen <hoegsberg@google.com> Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl> Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4690>
vulkan/wsi: Add callback to set ownership of buffer. For radv BO list pruning. Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> Acked-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4306>
meson: inline `inc_common` Let's make it clear what includes are being added everywhere, so that they can be cleaned up. Signed-off-by: Eric Engestrom <eric@engestrom.ch> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4360>
vulkan/wsi: fix cleanup when dup() fails Fixes: f5433e4d6ce247b86dae ("vulkan/wsi: Add modifiers support to wsi_create_native_image") Signed-off-by: Eric Engestrom <eric@engestrom.ch> Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4137> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4137>