Commit graph

2242 commits

Author SHA1 Message Date
Faith Ekstrand
6eac1cefd9 vulkan/wsi/x11: Use mesa_logX() instead of fprintf()
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
We have a logging framework.  We should use it.  This way we can shut
these warnings off in CI if we want to.

Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Eric Engestrom <eric@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37203>
2025-09-08 21:28:10 +00:00
Lars-Ivar Hesselberg Simonsen
e6dae6ef5f vulkan: Optimize implicit end_subpass barrier
Rather than adding an implicit barrier on the last subpass
unconditionally, track in what subpasses attachments are used for the
last time and only add dependencies if none exist and there might be an
image transition.

Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36985>
2025-09-08 16:54:06 +00:00
Lars-Ivar Hesselberg Simonsen
eccc198284 vulkan: Optimize implicit begin_subpass barrier
Rather than adding an implicit barrier on the first subpass
unconditionally, track in what subpasses attachments are used for the
first time and only add dependencies if none exist and there might be an
image transition.

Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36985>
2025-09-08 16:54:06 +00:00
Lars-Ivar Hesselberg Simonsen
c0def2cf27 vulkan: Add transition_view_mask calculation
Refactor out a function to calculate the view mask for required layout
transitions. This will be used in the following commits.

Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36985>
2025-09-08 16:54:06 +00:00
Lars-Ivar Hesselberg Simonsen
067305e4c6 vulkan: Find first_subpass when creating renderpass
Like last_subpass, add a per-view mask of what subpass first uses an
attachment. This is required for optimizing out some barriers later.

Note that this requires us to do another loop over the subpasses.

Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36985>
2025-09-08 16:54:06 +00:00
Lars-Ivar Hesselberg Simonsen
3bad2ae069 vulkan: Stop combining subpass dependencies
Rather than OR-ing all subpass dependencies together in the Vulkan layer,
pass an array of barriers down to the drivers and allow them to do the
OR-ing if needed.

Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36985>
2025-09-08 16:54:05 +00:00
David Rosca
a758273231 vulkan/format: Map VK_EXT_ycbcr_2plane_444_formats to pipe format
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37174>
2025-09-08 11:59:36 +00:00
Faith Ekstrand
446d5ef103 vulkan: Drop the driver_internal from vk_image_view_init/create()
It alwways comes in through the create flags now.

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36957>
2025-09-05 23:34:14 +00:00
Faith Ekstrand
42abf00f2b vulkan: Handle VK_IMAGE_VIEW_CREATE_DRIVER_INTERNAL_BIT_MESA automatically
This moves the bit into vk_image.h and handles it automatically in
vk_image_view_init() so drivers don't have to.

This also means that Meta is now hitting the driver_internal path for
all its images so we need to do the same format fixups there that we
sould normally do on the !driver_internal path.  We don't want to do
them unconditionally because v3dv and other drivers override
depth/stencil color formats and we don't want to break that.

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36957>
2025-09-05 23:34:11 +00:00
Faith Ekstrand
e7b0cbdf40 vulkan/meta: Always set VK_IMAGE_VIEW_CREATE_DRIVER_INTERNAL_BIT_MESA
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36957>
2025-09-05 23:34:11 +00:00
Karol Herbst
083a3dc545 util: move typed_memcpy into macros.h
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37135>
2025-09-05 20:01:00 +00:00
Hans-Kristian Arntzen
fa486a0346 anti-lag: Fix stype for submit2 semaphores.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
Fixes: 722ffe9a73 ("vulkan: implement VK_AMD_anti_lag as implicit vulkan layer")
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37159>
2025-09-05 08:14:28 +00:00
Olivia Lee
5faa62f91e vulkan/util: add vk_topology_to_mesa helper function
Something like this already exists in a few drivers, move it to common
code. This specific version was pulled from honeykrisp, which is the
only one that handles META_RECT_LIST_MESA.

Signed-off-by: Olivia Lee <olivia.lee@collabora.com>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37038>
2025-09-03 22:04:14 -07:00
Yiwei Zhang
ee7666e3df vulkan/util: drop unused vk_select_android_external_format
Acked-by: Connor Abbott <cwabbott0@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37099>
2025-09-04 02:29:32 +00:00
Yiwei Zhang
6e1c2e4d83 vulkan: handle wsi private data properly
On Android, Vulkan loader implements KHR_swapchain and owns both surface
and swapchain handles. On non-Android, common wsi implements the same and
owns the same. So for both cases, the drivers are unable to handle
vkGet/SetPrivateData call on either a surface or a swapchain.

Inspired by https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37043

Cc: mesa-stable
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Ryan Zhang <ryan.zhang@nxp.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37064>
2025-09-01 05:44:40 +00:00
Olivia Lee
564b6fd7f4 vulkan: move internal vulkan pseudo-extensions to a common file
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
This makes it easier to see what all of the assigned values are to check
for collisions, and allows using them in vulkan/util.

Signed-off-by: Olivia Lee <olivia.lee@collabora.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37045>
2025-09-01 03:50:12 +00:00
Benjamin Otte
4598028fde device_select: Allow shortcut names for device types
Add a bunch of shortcut names to select physical devices by their device
type.
In particular this aims to make switching between igpu and dgpu easy as
well as testing with lavapipe.

v2:
- rebase and reformat
- use strncasecmp and VkPhysicalDeviceType
- only print debug message when enabled

Signed-off-by: Benjamin Otte <otte@redhat.com>
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com> (v2)
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36717>
2025-08-29 15:51:06 +00:00
Rhys Perry
dea14578b8 device-select: refactor device_select_get_default
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36717>
2025-08-29 15:51:06 +00:00
Rhys Perry
7302e839ea device-select: use debug_get_bool_option for FORCE_DEFAULT_DEVICE
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36717>
2025-08-29 15:51:05 +00:00
Rhys Perry
1ff868adcf device-select: do all getenv during instance creation
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36717>
2025-08-29 15:51:05 +00:00
Rhys Perry
e15e7738ac device-select: simplify adding/removing instances
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36717>
2025-08-29 15:51:04 +00:00
Rhys Perry
c1bd371f15 device-select: move get_default_device to it's own file
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36717>
2025-08-29 15:51:04 +00:00
Rhys Perry
a392a57778 device-select: clang-format
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36717>
2025-08-29 15:51:03 +00:00
Faith Ekstrand
9c5c11535c vulkan/wsi: Don't dma-buf sync import/export on success
Logging on success just generates unnecessary spam.

Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37033>
2025-08-28 22:27:05 +00:00
Faith Ekstrand
e4d9650e21 vulkan/wsi: Move a couple of dma-buf sync checks
In 14b4160792 ("vulkan/wsi: Only test for dma-buf sync file support
once"), I moved the dma-buf sync file import/export check earlier.  This
is fine for hardware implementations where we have real dma-buf
import/export but it broke lavapipe because the check itself ignored
whether or not we actually have dma-buf import/export.  Add a couple
more checks to wsi_drm_check_dma_buf_sync_file_import_export() so it's
safe even for SW drivers.  Also, in wsi_create_sync_for_dma_buf_wait(),
check if we actually have a dma-buf.

Fixes: 14b4160792 ("vulkan/wsi: Only test for dma-buf sync file support once")
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37033>
2025-08-28 22:27:05 +00:00
Arkadiusz Hiler
8abfd26534 wsi/display: Avoid connector reprobes in wsi_GetRandROutputDisplayEXT
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
Wine uses vkGetRandROutputDisplayEXT to query some GPU details on start
of a prefix that have to be exposed on the PE side.

Currently this causes minimum of 2 connector reprobes via
DRM_IOCTL_MODE_GETCONNECTOR. This can stall vblanks when timed just
right. In cases where prefixes are started over and over again (e.g.
Steam doing background processing) this causes periodic noticable
stutter.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37026>
2025-08-28 07:26:52 +00:00
Yiwei Zhang
c4e5661f29 vulkan/android: improve stage masks for semaphore ops
Strictly speaking, for an empty batch, there is no inherit/defined
ordering between the wait and signal operations within the batch. We
are relying on MESA impl defined behavior to transfer payloads of the
wait sempahores to the signal sempahore here.

Ideally we need a MESA internal hint to ensure transitivity, but since
this is on the legacy fallback path, it's not worth the effort. So here
we follow common wsi to use TRANSFER_BIT which avoids most unnecessary
stalls on the queue (an improvement over the previous ALL_COMMANDS_BIT).

Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36855>
2025-08-26 17:24:09 +00:00
Yiwei Zhang
d72d0e8580 vulkan/android: skip queue submit with copy_sync_payloads
Follows common wsi side for the same reason as explained in
https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36827

Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36855>
2025-08-26 17:24:08 +00:00
Yiwei Zhang
9ce92584ed vulkan/runtime: silence a -Wsometimes-uninitialized warning
../src/vulkan/runtime/vk_device.c:746:28: warning: variable
'was_signaled' is used uninitialized whenever 'for' loop exits
because its condition is false [-Wsometimes-uninitialized]

Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36855>
2025-08-26 17:24:08 +00:00
Yiwei Zhang
5372fe7cc4 vulkan/android: switch to vkQueueSubmit2
This follows common wsi side as suggested, and simplifies the later
adoption of vk_device_copy_semaphore_payloads.

Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36855>
2025-08-26 17:24:07 +00:00
Yiwei Zhang
3a5514febf vulkan/android: add an early return when there's no wait semaphores
..and no need to give result a default.

Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36855>
2025-08-26 17:24:07 +00:00
Aleksi Sapon
a9066c801b wsi/metal: current extents might not be known until swapchain is created
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33518>
2025-08-26 15:32:41 +00:00
Connor Abbott
bef37336fb vulkan/queue: Fix VkTimelineSemaphoreSubmitInfo sanitization
We're supposed to completely ignore VkTimelineSemaphoreSubmitInfo if
there aren't any timeline semaphores, including the array lengths, which
is made clear by the various VUs already cited by the code. The
vkQueueSubmit() path correctly handled this when asserting but still
dereferenced pWaitSemaphoreValues unconditionally, which could lead to
dereferencing an invalid pointer if waitSemaphoreValueCount is less than
waitSemaphoreCount. The vkQueueSparseBind() path didn't even assert
correctly. Bring vkQueueSparseBind() in line with vkQueueSubmit()
and make both only dereference the wait/signal array once we've
determined it must be present. While we're here, also fix the assert in
vkQueueSubmit() to disallow a waitSemaphoreValueCount of 0 if there are
timeline semaphores present, which conversely is not allowed.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36989>
2025-08-25 17:57:47 +00:00
Yiwei Zhang
25b1591df5 vulkan/android: support AHB query for VK_ANDROID_external_format_resolve
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
Conditional based on whether the extension is enabled.

Reviewed-by: Lucas Fryzek <lfryzek@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36866>
2025-08-22 23:40:36 +00:00
Yiwei Zhang
2c63252517 vulkan/android: refactor to retrieve AHB format properties once
...and loop through pNext chain once.

Reviewed-by: Lucas Fryzek <lfryzek@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36866>
2025-08-22 23:40:36 +00:00
Yiwei Zhang
9e99e604db vulkan/android: support AHARDWAREBUFFER_FORMAT_YCbCr_P010 format mapping
Add it only on external format code path so that no api level guard is
needed. It automatically works with gralloc impls that support
allocating such format.

Reviewed-by: Lucas Fryzek <lfryzek@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36866>
2025-08-22 23:40:35 +00:00
Yiwei Zhang
25a8e124e0 vulkan/android: amend a missing case for IMPLEMENTATION_DEFINED AHB
An AHB with IMPLEMENTATION_DEFINED format is commonly backed by NV12 or
XBGR8888. The former is the usual pick for camera <-> GPU interop, while
the latter is mostly only seen in Android CTS. Ideally, we can rely on
the queried fourcc to resolve everything instead of being on the
fallback path, but keeping this a minimal fix is easy for porting.

Cc: mesa-stable
Reviewed-by: Lucas Fryzek <lfryzek@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36866>
2025-08-22 23:40:33 +00:00
Faith Ekstrand
d9217bd9cf vulkan/wsi: Always use VK_PIPELINE_STAGE_2_TRANSFER_BIT for semaphore ops
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36827>
2025-08-22 23:05:05 +00:00
Faith Ekstrand
75434fb5cb vulkan/wsi: Skip the vkQueueSubmit() entirely if we aren't blitting
If we don't need any prime blits then there's no reason to submit
anything to the queue.  We can just signal the signal semaphores and
fences with the wait semaphores and skip the queue.

This is only possible because we no longer need a vkQueueSubmit() for
implicit synchronization.  The old ANV implicit synchronization path is
gone and all other drivers that do implicit sync do it per-bo so we can
assume that they synchronized somewhere else when writing to the BO and
that the present submit does nothing.

Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36827>
2025-08-22 23:05:05 +00:00
Faith Ekstrand
6266751749 vulkan/wsi: Consolodate vkQueueSubmit2() calls across swapchains
Vulkan WSI allows you to present to multiple swapchains at the same
time.  If it weren't for some of the Vulkan sync rules, this wouldn't be
a big deal as we could just loop and do the present per-swapchain.
However, the whole present takes a single set of wait semaphores and we
can only wait on them once.  Right now this works because we do at least
one QueueSubmit2() per-swapchain on the present queue.  Since those all
happen on the same queue, we can just wait on the semaphores in the
first present and all the others will pick up that wait thanks to queue
ordering.  However, this requires doing a lot of vkQueueSubmit().

This commit changes the vkQueuePresent() flow so that we do a single
vkQueueSubmit2() on the present queue for all swapchains that consumes
the wait semaphores and signals any per-image semaphores and fences.  In
the case where separate blit queues are used, we just signal blit
semaphores in the first vkQueueSubmit2() on the present queue and then
do a submit per-swapchain for each of the blit queue blits and signal
per-image semaphores and fences with that submit.

This significantly reduces the number of vkQueueSubmit2() calls being
made by vkQueuePresent() and also breaks the dependency on implicit
ordering of submits, which will be important in the next commit.

Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36827>
2025-08-22 23:05:05 +00:00
Faith Ekstrand
47fcc88b93 vulkan/wsi: Handle throttling in a separate loop
Instead of doing the throttle as we go through the present loop,
allocate throttle fences and wait on them at the top.

Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36827>
2025-08-22 23:05:04 +00:00
Faith Ekstrand
cec7e865a7 vulkan/wsi: Gather per-swapchain results in an array in queue_present()
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36827>
2025-08-22 23:05:04 +00:00
Faith Ekstrand
cb1ee1d730 vulkan/wsi: Add a QueueSubmit2() wrapper
Unlike regular QueueSubmit2(), the wrapper takes multiple out fences.

Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36827>
2025-08-22 23:05:03 +00:00
Faith Ekstrand
9a023b3615 vulkan/wsi: Make get_blit_queue return a struct vk_queue *
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36827>
2025-08-22 23:05:03 +00:00
Faith Ekstrand
59f85e678f vulkan/wsi: Take a vk_queue in wsi_common_queue_present()
The common entrypoint wrapper already depends on vk_queue, as do all the
drivers that implement drv_QueuePresentKHR() so there's no point in
passing through Vulkan API types anymore.

The one functional change here is that ANV is no longer forcing the
queue index to be zero, which I suspect was a mistake in the first
place.

Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36827>
2025-08-22 23:05:02 +00:00
Faith Ekstrand
81325cf887 vulkan,anv,hasvk: Drop vk_queue_wait_before_present()
This helper existed to ensure that drivers waited for semaphores to
materialize before processing a QueuePresent().  However, most drivers
never called this and they were kind-of fine.  Now that we have explicit
and dma-buf sync built into WSI, this wait happens as part
GetSemaphoreFd when we fetch the sync file from the semaphore.

It's also less racy to just rely on GetSemaphoreFd() because, even
though we were stalling the submit thread prior to present, the present
itself does one or more submits and those may go to the thread and
potentially race with the window system.  The GetSemaphoreFd(), however,
happens at the right time to ensure we actually stall before handing
off to the window system.

Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36827>
2025-08-22 23:05:02 +00:00
Faith Ekstrand
c9d361ca80 vulkan/wsi: Switch to vkQueueSubmit2()
Venus was the last driver to be implementing old-school vkQueueSubmit()
but it now has a 2-on-1 wrapper as of 07cee75c39 ("venus: layer
vkQueueSubmit2 over vkQueueSubmit w/o sync2").  This makes everything a
little more readable now that we're not juggling separate arrays for
timelines.

Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36827>
2025-08-22 23:05:01 +00:00
Faith Ekstrand
4827ba625d vulkan/drm_syncobj: Add a vk_drm_syncobj_copy_payloads helper
This intentionally matches vk_device::copy_sync_payloads.

Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36827>
2025-08-22 23:05:00 +00:00
Faith Ekstrand
f4d00c1dbf vulkan: Add a vk_device_copy_semaphore_payloads() helper
This acts as a vkQueueSubmit() except that it doesn't take any command
buffers or sparse binds and it doesn't act on a queue.  Instead, it just
copies semaphore payloads around using a new copy_sync_payloads vfunc on
vk_device.

Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36827>
2025-08-22 23:05:00 +00:00
Faith Ekstrand
379cffc3bb vulkan: Add a vk_sync_signal_unwrap() helper
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36827>
2025-08-22 23:05:00 +00:00