Commit graph

1616 commits

Author SHA1 Message Date
Hans-Kristian Arntzen
73c1fbfc79 wsi/wayland: Replace surface pilfer with retired bool.
PresentWait can still be called on a retired swapchain, and pilfering
the WSI surface can cause issues. To avoid retired swapchains
interfering with non-retired swapchain event queue, flag a swapchain as
retired instead and immediately return OUT_OF_DATE from acquire and
present.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27851>
2024-02-29 21:08:59 +00:00
Derek Foreman
c7dc82e3e8 vulkan/wsi/wayland: Use wl_display_dispatch_queue_timeout
Instead of coding our own polling function, use the (new) wayland
wl_display_dispatch_queue_timeout() function instead.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27851>
2024-02-29 21:08:59 +00:00
Derek Foreman
7eaceb0392 vulkan/wsi/wayland: Adjust presentation id locking
If we want to use the new wl_display_dispatch_queue_timeout function
in libwayland we lose the ability to drop the lock while we poll
and pick it up again to dispatch.

That would cause other waiters to potentially block past their
timeouts while waiting for the dispatching thread's timeout.

Prepare for this change now by dropping the lock for the entire
dispatch, and reacquiring the lock in the functions being dispatched.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27851>
2024-02-29 21:08:59 +00:00
Derek Foreman
fb22b69df3 vulkan/wsi/wayland: Remove confusing comment
We do own the lock if there's a timeout, and the code is written with that
in mind - but the comment seems to imply otherwise.

Drop it.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27851>
2024-02-29 21:08:59 +00:00
Eric Engestrom
64f037e079 vk/util: print a nice error in vk_icd_gen.py when VK_HEADER_VERSION is not defined
Shouldn't be reachable in normal case, but when messing with vk.xml it's
nicer than the current:

    TypeError: can only concatenate str (not NoneType) to str

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27779>
2024-02-29 14:25:49 +00:00
Eric Engestrom
3f2790adcd vk/util: trivial cleanups in vk_icd_gen.py
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27779>
2024-02-29 14:25:49 +00:00
Mike Blumenkrantz
5d91db9666 vulkan/dispatch_table: add an uncompacted version of the table
this is a bandaid fix that allows users (zink) to actually call the
functions intended to be called. the real fix would be to figure out
which extensions are enabled on the device and then only GPA the
functions associated with those extensions

that's too hard though so I'm slapping some flex tape on it

cc: mesa-stable

Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27834>
2024-02-29 11:18:18 +00:00
Faith Ekstrand
bb8b11d806 vulkan/pipeline: Handle fully compiled library shaders properly
In the fast-link case, we should just use the library shader and assume
that it's correct.  We have to do this because we may not have a
precompiled shader in this case so we can't even generate the shader
hash.

In the link optimization case, we could still have a library shader
coming in from some library pipeline.  That shader may happen to be
correct, in which case we can just use it and not even bother digging
around in the cache.  In the more likely case, the keys won't match and
we should throw it away before we look up a different shader in the
cache and leak our reference.

Fixes: 9308e8d90d ("vulkan: Add generic graphics and compute VkPipeline implementation")
Acked-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27860>
2024-02-29 02:49:42 +00:00
Faith Ekstrand
d9908af9d2 vulkan/pipeline: Whitespace fix
Acked-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27860>
2024-02-29 02:49:42 +00:00
Chia-I Wu
f623c27eab meson: fix a build ereror
Fixes

  src/vulkan/wsi/meson.build:71:13:
  ERROR: Unknown variable "libloader_wayland_helper".

for headless vulkan-only builds.

Fixes: a00f9c401b ("loader/wayland: Add fallback wl_display_dispatch_queue_timeout")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27837>
2024-02-28 15:03:05 +00:00
Robert Beckett
9c096e23c0 vulkan/wsi: fix force_bgra8_unorm_first
fixes: 7c16a1ae vulkan/wsi: Add a driconf option to force WSI to advertise BGRA8_UNORM first

Signed-off-by: Robert Beckett <bob.beckett@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23991>
2024-02-28 13:20:56 +00:00
Derek Foreman
61cfabda5d vulkan/wsi/wayland: Give names to our Wayland event queues
Named queues just add a little bit more debugging information.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27824>
2024-02-28 11:01:31 +00:00
Faith Ekstrand
9308e8d90d vulkan: Add generic graphics and compute VkPipeline implementations
These implementations are built on top of vk_shader.  For the most part,
the driver shouldn't notice a difference between draws consuming
pipelines vs. draws consuming shaders.  The only real difference is
that, when vk_driver_shader_ops::compile() is called for pipelines, a
struct vk_graphics_pipeline_state is provided.  For shader objects, the
state object will be NULL indicating that all state is unknown.  Besides
that, all the rest of the differences between Vulkan 1.0 pipelines,
VK_EXT_graphics_pipeline_library, and VK_EXT_shader_object are handled
by the Vulkan runtime code.

Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27024>
2024-02-27 22:17:09 +00:00
Faith Ekstrand
c488dc9f50 vulkan: Add a BLAKE3 hash to vk_descriptor_set_layout
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27024>
2024-02-27 22:17:09 +00:00
Faith Ekstrand
682b99a63f vulkan: Add push constant ranges to vk_pipeline_layout
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27024>
2024-02-27 22:17:09 +00:00
Faith Ekstrand
e2cb395a1f vulkan: Add a vk_pipeline base struct
We need to be able to thunk through a destroy callback if we want to
have different kinds of pipelines implemented in different parts of the
stack.

Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27024>
2024-02-27 22:17:09 +00:00
Faith Ekstrand
5e71e6f3f6 vulkan: Add a new dynamic state for render pass attachments
This is useful for implementing VK_EXT_dynamic_rendering_unused_attachments

Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27024>
2024-02-27 22:17:09 +00:00
Faith Ekstrand
6ec177b116 vulkan: Rework vk_render_pass_state::attachments
The new bitfield has a separat flag for each of the color attachments.

Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27024>
2024-02-27 22:17:09 +00:00
Faith Ekstrand
c09c086c12 vulkan: Add a vk_render_pass_state_has_attachment_info() helper
We already have a helper like this internally.  Give it a better name
and expose it.

Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27024>
2024-02-27 22:17:09 +00:00
Faith Ekstrand
9f62008bff vulkan: Add runtime code for VK_EXT_shader_object
This adds a new base vk_shader object along with vtables for creating,
binding, and working with shader objects.

Unlike other parts of the runtime, the new shader object code is a bit
more sanitized and opinionated than just handing you the Vulkan
entrypoints.  For one thing, the create_shaders() calback takes a NIR
shader, not SPIR-V.  Conversion of SPIR-V into NIR, handling of magic
meta NIR shaders, etc. is all done in common code.  [De]serialization is
done via `struct blob` and the common code does a checksum of the binary
and handles rejecting invalid binaries based on shaderBinaryUUID and
shaderBinaryVersion.  This should make life a bit easier for driver
authors as well as provides a bit nicer interface for building the
common pipeline implementation on top of shader objects.

Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27024>
2024-02-27 22:17:09 +00:00
Connor Abbott
0d225c9e43 vk/graphics_state: Add stubs required by VK_EXT_shader_objects
Because these functions were introduced by VK_EXT_shader_objects, we
technically have to expose them even though they have to do with NV
extensions that no one else supports.

Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27024>
2024-02-27 22:17:09 +00:00
Connor Abbott
657b8e5264 vk/graphics_state: Remove bogus assert in CmdSetSampleMaskEXT
We're supposed to just ignore samples above what we support, and there's
no VU matching this assert. Fixes a crash in
dEQP-VK.pipeline.shader_object_unlinked_spirv.extended_dynamic_state.misc.sample_shading_dynamic_sample_count.

Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27024>
2024-02-27 22:17:08 +00:00
Faith Ekstrand
6ad294202e vulkan: Move the descriptor set limit to vk_limits.h
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27024>
2024-02-27 22:17:08 +00:00
Faith Ekstrand
498d58a5f8 vulkan: Add a vk_get_subgroup_size() helper
No reason to duplicate this logic between pipelines and shader objects.

Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27024>
2024-02-27 22:17:08 +00:00
Sebastian Wick
0fe7e06f5f vulkan/wsi/wayland: Use dispatch_queue_timeout in acquire_next_image
Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27511>
2024-02-27 13:10:13 +00:00
Sebastian Wick
a00f9c401b loader/wayland: Add fallback wl_display_dispatch_queue_timeout
This is almost a 1:1 copy of the same function in libwayland. If the version
with the symbol propagates far enough the fallback can be removed again.

Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27511>
2024-02-27 13:10:13 +00:00
Pierre-Eric Pelloux-Prayer
a8a4bcec36 wsi/wl: check wsi_wl_surface's validity before use
Fixes: 9a00a360ad ("wsi/wl: flush connection on swapchain failure")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27767>
2024-02-26 16:56:27 +00:00
Faith Ekstrand
a72bcc0a26 vulkan/meta: Handle VK_REMAINING_ARRAY_LAYERS in blit and resolve
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27795>
2024-02-26 16:25:08 +00:00
Alyssa Rosenzweig
a97966b840 vulkan: add vk_index_type_to_restart helper
from nvk

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27764>
2024-02-26 14:13:07 +00:00
Pierre-Eric Pelloux-Prayer
9a00a360ad wsi/wl: flush connection on swapchain failure
wayland-client stores up to MAX_FDS_OUT (28) outgoing fds and
then release them in batch later through close_fds.

While this is not a problem in normal situation, because the
app would also have a reference to the same buffers, this is
an issue when these buffers are released (eg: because the
swapchain creation failed).
In this situation wayland-client owns the last ref to these
buffers and prevent their deletion.

This is an issue with dEQP-VK.wsi.wayland.swapchain.simulate_oom.image_extent
because it creates swapchains in a fast loop with a failing allocator
to fail the swapchain creation.
Without this change, on a 16GB dGPU the test peaks at 95% VRAM / 60% GTT and
completes in 1.5 sec.
With this change, the max usage is 65% VRAM / 10% GTT and  completes it
in 0.3 sec.

Reviewed-by: Sebastian Wick <sebastian.wick@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27592>
2024-02-22 14:32:26 +00:00
Mike Blumenkrantz
1e849b12f5 vk/wsi/x11/sw: use swapchain depth for putimage
this is otherwise broken for 32bit depth windows

cc: mesa-stable

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27605>
2024-02-20 15:47:45 +00:00
Oskar Viljasaar
68f80f9b0f vulkan/properties: Start looping from the next member in GPDP2
We don't need to start iterating from `pProperties`, as the first member
is already handled in vk_common_GetPhysicalDeviceProperties2. Eliminate
this iteration by starting from pProperties->pNext.

Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27671>
2024-02-20 09:16:23 +00:00
Faith Ekstrand
08d13a55e4 vulkan: Update XML and headers to 1.3.278
Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27599>
2024-02-16 17:31:04 +00:00
Hans-Kristian Arntzen
bd23753991 wsi/x11: Rewrite logic for how we consider minImageCount.
MAILBOX reduced from 5 to 4 to be more inline with WL.

With xwayland_wait_ready = false now being the default,
add some extra consideration for non-FIFO present modes.
Add a lengthy rationale for why minImageCount = 3 is exposed on Xwl.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27074>
2024-02-10 11:47:22 +00:00
Hans-Kristian Arntzen
8b4259e69b wsi/x11: Disable vk_xwayland_wait_ready by default on most drivers.
Venus is special and still requires extra waits.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27074>
2024-02-10 11:47:22 +00:00
Felix DeGrood
11465e4b3a mesa-overlay: defer listening to socket until first frame
mesa-overlay with control arg fails to setup socket properly when multiple
adapters launched. First adapter listens to socket, blocking all remaining
adapters. This is a common occurrence with games using lauchers where the
launcher is also a vulkan app. Fixed by deferring socket listening to first
frame rendered, which should be the game.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27538>
2024-02-09 16:16:24 +00:00
Gurchetan Singh
0525dac7f8 vk_image.c: #ifndef _WIN32 --> DETECT_OS_LINUX + DETECT_OS_BSD
DRM modifiers are a BSD/Linux phenomenon.

We can also remove a bunch of these checks too.  No Linux specific
symbol or header is **actually** used, and the DRM modifier is
just represented as uint64_t.  But kept the style of the file
as is.

Reviewed-by: Serdar Kocdemir <kocdemir@google.com>
Reviewed-by: Yonggang Luo <luoyonggang@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27425>
2024-02-02 23:11:21 +00:00
Dave Airlie
60d2ea83e8 vulkan/video: add AV1 decode support to common code
This adds the av1 decode parameters handling.

Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27423>
2024-02-02 03:18:52 +00:00
Dave Airlie
59fb425e1c vulkan: update registry/includes to 1.3.277
Acked-by: Ivan Briano <ivan.briano@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27421>
2024-02-02 01:46:24 +00:00
Yiwei Zhang
2dd95bc4b7 vulkan/runtime: refactor to use DETECT_OS_ANDROID instead of ANDROID
Also update vk_android_native_buffer.h to use __ANDROID__ directly.

Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Yonggang Luo <luoyonggang@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27374>
2024-02-01 19:29:49 +00:00
Yiwei Zhang
f7d35be362 vulkan/util: drop redundant code gen from vk_extensions_gen.py
driver is now always 'vk'.

Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Yonggang Luo <luoyonggang@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27374>
2024-02-01 19:29:48 +00:00
Lionel Landwerlin
03490ec019 vulkan/runtime: rework VK_KHR_dynamic_rendering_local_read state tracking
I missed a bunch of things like input tracking. Also take the
opportunity to rename things.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Fixes: fe19405c46 ("vulkan/runtime: handle new dynamic states for attachment remapping")
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27380>
2024-02-01 13:20:21 +00:00
Lionel Landwerlin
d7f5a815e3 vulkan/multialloc: bump max number to 16
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27380>
2024-02-01 13:20:21 +00:00
Eric Engestrom
c35247ab20 vk/util: fix 'beta' check for physical device properties
`--beta` is a string, not a bool (although really it should be, but that's a bigger change).

Fixes: 083793a39d ("vulkan: Allow beta extensions for physical device properties")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27394>
2024-01-31 20:47:30 +00:00
Eric Engestrom
794ec7f0a1 vk/util: fix 'beta' check for physical device features
`--beta` is a string, not a bool (although really it should be, but that's a bigger change).

Fixes: a7141a6f8a ("vulkan: Allow beta extensions for physical device features")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27394>
2024-01-31 20:47:30 +00:00
Sagar Ghuge
9a4d951ef9 vulkan/runtime: Track VkSharingMode in vk_image
Signed-off-by: Sagar Ghuge <sagar.ghuge@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27349>
2024-01-31 19:28:12 +00:00
Friedrich Vock
7ea96ff75b vulkan: Use secure_getenv for trigger files
Reviewed-by: Eric Engestrom <eric@igalia.com>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27381>
2024-01-31 17:28:11 +00:00
Lionel Landwerlin
fe19405c46 vulkan/runtime: handle new dynamic states for attachment remapping
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27307>
2024-01-29 08:24:14 +00:00
Hans-Kristian Arntzen
2f4d6df372 wsi/common: Allow KHR_present_wait on WL.
The fallback in place ensures a good enough solution.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
Reviewed-by: Joshua Ashton <joshua@froggi.es>
Reviewed-by: Sebastian Wick <sebastian.wick@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27275>
2024-01-28 23:14:36 +00:00
Hans-Kristian Arntzen
0d51cd4808 wsi/wl: Improve fallback for present_wait.
When presentation feedback protocol is not supported,
fallback to using frame callbacks.
In some sense, frame callbacks functions like
present complete + latch delay, so it's a reasonable approach, given the
alternative.

Xwl uses frame callback for COMPLETE events, so it's not a new approach.

To guard against lack of forward progress guarantee,
add a timeout for present complete to avoid deadlocking applications.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
Reviewed-by: Joshua Ashton <joshua@froggi.es>
Reviewed-by: Sebastian Wick <sebastian.wick@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27275>
2024-01-28 23:14:36 +00:00