Commit Graph

2041 Commits

Author SHA1 Message Date
Sid Pranjale 30de94b91d vulkan/wsi: add cached bit to wsi host memory selection
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34247>
2025-06-10 12:55:09 +00:00
Dave Airlie 3fe375eca5 vulkan/video: add vp9 decode
Reviewed-by: David Rosca <david.rosca@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35398>
2025-06-09 20:46:03 +00:00
Lionel Landwerlin 9c0ff88e8d vulkan: dump headers/registry to 1.4.317
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35382>
2025-06-06 14:38:17 +00:00
Erik Faye-Lund a271b9a9a3 vulkan/format: map ASTC HDR formats
Because the ASTC HDR formats are extension formats, we need to convert
it manually in vk_format_to_pipe_format() instead of using the table.
Otherwise, the compiler tries to create a gigantic array and ends up
dying.

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34828>
2025-06-06 06:40:59 +00:00
Faith Ekstrand 347e957b44 vulkan/pipeline: Hash null descriptor robustness info
Fixes: 6ae401aa86 ("vulkan: Add null descriptor bits to vk_pipeline_robustness_state")
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34967>
2025-06-03 07:02:36 +00:00
Jonathan Gray ca33127652 vulkan: add missing include for FALLTHROUGH
When CLOCK_MONOTONIC_RAW and CLOCK_MONOTONIC_FAST are not
defined FALLTHROUGH is used.  Add the include for the define.
Fixes the build on OpenBSD.

Fixes: 3bc7564bb0 ("vulkan: add vk_device_get_timestamp")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35145>
2025-06-02 17:51:56 +00:00
Yiwei Zhang 749265da0d vulkan/wsi: split cmd record for img2buf blit and img2img blit
There's no behavior change, but to prepare for the next img2buf blit
improvement, except adding asserts to make clear of the existing blit
code paths.

v2: use switch with unreachable default per @gfxstrand has suggested

Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35220>
2025-05-29 01:20:27 +00:00
Yiwei Zhang 2af2314fb2 vulkan/wsi: include missing barrier for transferring to blit dst image
Fixes: 2975a7f453 ("vulkan/wsi: Add support for image -> image blits")
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35220>
2025-05-29 01:20:27 +00:00
Alyssa Rosenzweig f47de306b8 vulkan: pass enabled features to drivers
for pipelines, we know enabled features. for classic shader objects, we do not.
therefore, we want to plumb this through explicitly for drivers using common
pipelines, rather than making drivers guess whether they can use the device
features.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35169>
2025-05-27 13:23:12 +00:00
Derek Foreman b3e3f0fc2e loader/wayland: Move acquisition time tracking into perfetto flows
We only use the acquisition time for calculating latency for perfetto
tracks later, and the acquisition time should ideally be the start of the
perfetto flow.

This has been more or less true with very small error margin for vk wsi,
but the wayland EGL buffer handling is a lot more complicated. Moving the
time check into the flow start will make re-using this code for EGL much
simpler.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32757>
2025-05-26 16:13:25 -05:00
Derek Foreman 336cbc499f wsi/wayland: Move presentation tracing code into loader
Push the presentation feedback code into the common code in the loader,
so we're one step closer to using the perfetto instrumentation here in
the EGL code.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32757>
2025-05-26 16:13:25 -05:00
Derek Foreman 3521abe0d1 wsi/wayland: Early return from tracing function
We can bail on all of this if tracing isn't enabled.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32757>
2025-05-26 16:13:25 -05:00
Derek Foreman 94b45c6c8a wsi/wayland: Refactor some surface management code into loader
Share some wayland surface setup code in the loader so we can use it in
both VK and (in an upcoming commit) EGL.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32757>
2025-05-26 16:13:25 -05:00
Derek Foreman aefd3d835e wsi/wayland: Move buffer name string into common code
Push this into the loader bits so it will be available to egl when we
add profiling later.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32757>
2025-05-26 16:13:25 -05:00
Derek Foreman 6946758682 wsi/wayland: Move perfetto flow_ids into loader_wayland_buffer
Pull some more common stuff into the new abstraction.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32757>
2025-05-26 16:13:25 -05:00
Derek Foreman c06624d797 wsi/wayland: Refactor some buffer management code into loader
For now just pull the tiny bit that looks up the wayland buffer id for
profiling. The end goal is to promote more code sharing between vk and egl
and improving wayland egl's perfetto profiling.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32757>
2025-05-26 16:13:25 -05:00
Derek Foreman 81487d8663 wsi/wayland: Count outstanding feedbacks
Count the outstanding feedback requests instead of relying on list
length calculations.

When moving presentation feedback bits into common code shortly, the list
will no longer be exposed.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32757>
2025-05-26 16:13:25 -05:00
Derek Foreman 08ed1390e2 wsi/wayland: Add a bool to track the presentation id fallback path
Instead of testing the protocol object pointer, track this with a bool.

We're going to wrap the protocol object in some common code later, so
testing it directly will become inconvenient.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32757>
2025-05-26 16:13:25 -05:00
Samuel Pitoiset fef1174b00 vulkan/runtime: fix a wrong assert that validates timeline semaphores
It's still legal to include VkTimelineSemaphoreSubmitInfo in pNext
without any timeline semaphores. While we are at it, also fix the VUs.

This was observed with Doom The Dark Ages.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35022>
2025-05-19 07:22:23 +00:00
llyyr 033ce1bae1 vulkan/wsi/wayland: make needs_color_surface_old check if surface exists
Otherwise we end up removing refcount even when we don't have a color
surface already for applications going from SRGB_NONLINEAR to
PASS_THROUGH dring runtime.

To reproduce the bug, start mpv with "--target-colorspace-hint=yes" then
set it to "no" during runtime with a keybind

Fixes: 789507c99c ("vulkan/wsi: implement the Wayland color management protocol")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34708>
2025-05-17 08:01:57 +00:00
Yiwei Zhang cc4fd7cc9d vulkan: fix random tabs to spaces
Only the vk_time_max_deviation tab usage requires a manual fix to make
sense. Others are boring replacements.

Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35011>
2025-05-16 03:57:31 +00:00
Konstantin Seurer 4a8e232e39 vulkan: Add more information to BVH update callbacks
Reviewed-by: Natalie Vock <natalie.vock@gmx.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34601>
2025-05-12 17:45:16 +02:00
Konstantin Seurer 5da0810e5d vulkan/bvh: Add type information for vk_bvh_geometry_data
Reviewed-by: Natalie Vock <natalie.vock@gmx.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34601>
2025-05-12 17:45:11 +02:00
Konstantin Seurer e1110d20f8 vulkan: Add acceleration structure update keys
The driver can use an optimized shader when src == dst.

Reviewed-by: Natalie Vock <natalie.vock@gmx.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34601>
2025-05-12 17:44:56 +02:00
Samuel Pitoiset 2f2a5d31bd vulkan: add support for VK_IMAGE_LAYOUT_ZERO_INITIALIZED_EXT
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34896>
2025-05-12 06:53:55 +00:00
Samuel Pitoiset 62ec7e1056 vulkan: Update XML and headers to 1.4.315
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34896>
2025-05-12 06:53:55 +00:00
Konstantin Seurer 2eaf997574 vulkan: Add helpers for creating bvh build pipelines/layouts
This should make it easier for drivers to use the meta framework for
managing encode/update pipelines.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34594>
2025-05-09 09:55:32 +00:00
Konstantin Seurer 33ac143779 vulkan: Introduce VK_BUILD_FLAG for specializing BVH build shaders
The advantage of using spec constants is that we do not have to include
multiple spirv binaries for multiple variants of a build stage.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34594>
2025-05-09 09:55:32 +00:00
Lionel Landwerlin fa2627aefb vulkan/runtime: add a multialloc variant for pipeline create
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34874>
2025-05-08 11:22:55 +00:00
Lionel Landwerlin 565ac1ee6a vulkan/runtime: fixup assert with link_geom_stages
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Fixes: 9308e8d90d ("vulkan: Add generic graphics and compute VkPipeline implementations")
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34874>
2025-05-08 11:22:55 +00:00
Lionel Landwerlin a29d0cfaf0 vulkan/runtime: track dynamics descriptor in a set layout
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34874>
2025-05-08 11:22:55 +00:00
Lionel Landwerlin fead813644 vulkan/runtime: store index of the push descriptor in pipeline layout
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34874>
2025-05-08 11:22:55 +00:00
Emma Anholt 188bd800c2 wsi: Label the WSI blit command buffer with a name.
Given that the command buffer will be long-lived, no reason not to just do
this so that debugging tools can see what the cmdbuf is doing.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22350>
2025-05-08 01:21:25 +00:00
Hyunjun Ko 7998106355 vulkan/video: Fix wrong parsing for H265 decoding
Not found real issues yet related to this though,
this is apparently wrong.

Signed-off-by: Hyunjun Ko <zzoon@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34782>
2025-05-06 04:24:22 +00:00
Samuel Pitoiset 4e09a5c992 vulkan: Update XML and headers to 1.4.314
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34810>
2025-05-05 15:02:19 +00:00
Mike Blumenkrantz 9082715ab0 vk/cmd_queue: generate copies for string struct members
this includes e.g., debug labels, which previously was garbage data

Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34534>
2025-04-30 15:01:35 +00:00
Mike Blumenkrantz 26cdd7ebd6 vk/cmd_queue: generate copies for struct-ptr members
this includes e.g., VkCommandBufferBeginInfo::pInheritanceInfo,
which previously was garbage data

Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34534>
2025-04-30 15:01:35 +00:00
Mike Blumenkrantz a7edaaacce vk/cmd_queue: stop generating weird casts for free functions
these are unnecessary and error-prone

Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34534>
2025-04-30 15:01:35 +00:00
Mike Blumenkrantz c3b6122cdf vk/cmd_queue: try to fix some indentation
still not perfect, but at least somewhat readable now

Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34534>
2025-04-30 15:01:35 +00:00
Mel Henning 60452e016e wsi/headless: Override finish_create
Since headless overrides create_mem, it needs to override finish_create
too. Fixes a segfault in nvk that was caused by us mixing
wsi_create_null_image_mem with wsi_finish_create_blit_context, which
would then call CmdCopyImageToBuffer with image->blit.buffer == NULL

Fixes a cts failure on nvk in:
dEQP-VK.image.swapchain_mutable.headless.2d.r8g8b8a8_unorm_b8g8r8a8_unorm_clear_copy_format_list
and several others

Fixes: 579578f10a ("vulkan/wsi/drm: Break create_prime_image in pieces")
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34646>
2025-04-23 19:11:59 +00:00
Konstantin Seurer c33e598f39 vulkan: Add vk_ir_header::dst_leaf_node_offset
Reviewed-by: Natalie Vock <natalie.vock@gmx.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34273>
2025-04-17 20:20:40 +00:00
Konstantin Seurer 2dee1117b7 vulkan: Add a vk_device parameter to get_encode_key
Useful for selecting different encoding options based on hardware
generation.

Reviewed-by: Natalie Vock <natalie.vock@gmx.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34273>
2025-04-17 20:20:40 +00:00
Lars-Ivar Hesselberg Simonsen 20c0d169e4 vk/sync: Fix execution only barriers
With vkCmdPipelineBarrier, it's possible to specify a barrier with
pipeline stages but without any memory barriers. These might not be
practical, but are legal Vulkan code.

Barriers like this are currently ignored in mesa, as we only convert
barriers with passed memory barriers into vkCmdPipelineBarrier2.

This commit adds handling of execution only barriers by converting them
into a memory barrier without access masks.

Fixes: 97f0a4494b ("vulkan: implement legacy entrypoints on top of VK_KHR_synchronization2")
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34187>
2025-04-10 15:28:22 +00:00
Boris Brezillon 3669cc66c6 vulkan/state: Fix default input attachment map values
When no input attachment location info is provided, the depth/stencil
attachment are supposed to be NO_INDEX, not UNUSED, and we should also
set the color_attachment_count to UNKNOWN.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32540>
2025-04-10 13:17:53 +00:00
Boris Brezillon be2532fc00 vk/pass: Add input attachment location info
For drivers using the render pass emulation provided by the
runtime, it's important to express the mapping between
depth/stencil/color attachments and input attachments using
VkRenderingInputAttachmentIndexInfoKHR, otherwise those drivers
have to special-case emulated render passes in their
CmdBeginRendering() implementation.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32540>
2025-04-10 13:17:53 +00:00
Boris Brezillon 38e546c202 vulkan/state: Fix input attachment map state initialization/copy
vk_dynamic_graphics_state_copy() is not copying the input attachment
map, and color_attachment_count is not initialized in
vk_dynamic_graphics_state_init_ial().

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Acked-by: Mary Guillemard <mary.guillemard@collabora.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32540>
2025-04-10 13:17:53 +00:00
Alyssa Rosenzweig 045880c8a6 vk/meta: generalize 3D blit code
This handles the 3D->2D Array case that we hit with maintenance8. Fixes tests
like
dEQP-VK.api.copy_and_blit.dedicated_allocation.blit_image.simple_tests.3d_to_2d_array.max_slices_linear

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34426>
2025-04-08 19:04:47 +00:00
Felix DeGrood b895c0ec05 vk/overlay-layer: fix regression in non-control pathway
Fixes regression introduced by prior commit. Prior commit fixed
the control pathway to starting overlay-layer but broke non-
control pathway. Now both pathways should be working.

Fixes: 06423b1792 ("defer log creation to swapchain creation")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/12884
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34413>
2025-04-08 17:52:57 +00:00
Rob Clark d2ea532528 vulkan: Use syncobj shim
This will allow syncobj use in cases where the process does not have
direct rendernode access (ex, vtest).

An alternative would be an alternate vk_sync_type implementation, but
the WSI code was also directly using drm syncobjs.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Tested-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33433>
2025-04-08 15:38:39 +00:00
Xaver Hugl 0c1f2b90c9 vulkan/wsi: warn once when HDR metadata is skipped because of protocol errors
Signed-off-by: Xaver Hugl <xaver.hugl@kde.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34000>
2025-04-08 10:30:42 +00:00