Commit graph

1841 commits

Author SHA1 Message Date
Valentine Burley
c8a8543af7 vulkan: Fix incorrect bpcs value for padded formats
Skip padding channels and only consider valid color channels.
Add and use a common helper for this.

Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Signed-off-by: Valentine Burley <valentine.burley@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30821>
2024-10-16 14:30:15 +00:00
Faith Ekstrand
f33e18ab39 vulkan/queue: Check for _mem_signal_temp before we submit
vk_queue_push_submit() takes ownership of the vk_queue_submit object and
potentially passes it to another thread.  This fixes a race where, if
the other thread processes and deletes the vk_queue_submit before we get
to checking _mem_signal_temp, we may have a use-after-free.

Fixes: c95b646e23 ("vulkan/queue: Use _mem_signal_temp instead of signal_mem_sync")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/11988
Reviewed-by: Juan A. Suarez <jasuarez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31597>
2024-10-14 13:13:15 +00:00
Faith Ekstrand
746ea7b0cd vulkan: Add a vk_fragment_shading_rate_is_disabled() helper
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31585>
2024-10-10 23:16:57 +00:00
Samuel Pitoiset
5bd825a4b8 vulkan: fix merging bind sparse submits together
Looks like this was completely broken because what we want is to merge
first/second binds to the merged object.

This fixes new CTS dEQP-VK.sparse_resources.image_sparse_binding.*.

Fixes: bba6bf33a8 ("vulkan/queue: Merge submits when possible")
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31545>
2024-10-07 15:59:42 +00:00
Alyssa Rosenzweig
5fe3f57d3f vulkan: export vk_robustness_disabled
HK will use this for a HK_PERFTEST=norobust flag.

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/31466>
2024-10-04 17:52:10 +00:00
Alyssa Rosenzweig
1a2827e401 vulkan: merge driver internal bits
no reason for hk and vk_meta to diverge here.

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/31466>
2024-10-04 17:52:10 +00:00
Faith Ekstrand
bba6bf33a8 vulkan/queue: Merge submits when possible
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25576>
2024-10-03 22:11:40 +00:00
Faith Ekstrand
c3bf1a67a1 vulkan/queue: Split vk_queue_submit into create and submit
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25576>
2024-10-03 22:11:40 +00:00
Faith Ekstrand
f0392779d9 vulkan/queue: Use a builder pattern for vk_queue_submit
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25576>
2024-10-03 22:11:39 +00:00
Faith Ekstrand
899c774b9a vulkan: Add a vk_queue_submit_has_bind() helper
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25576>
2024-10-03 22:11:39 +00:00
Faith Ekstrand
c95b646e23 vulkan/queue: Use _mem_signal_temp instead of signal_mem_sync
The two checks should be equivalent.  This just lets us use data in
struct vk_queue_submit rather than a local boolean.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25576>
2024-10-03 22:11:39 +00:00
Faith Ekstrand
267b7f1deb vulkan/queue: Move has_binary_permanent_semaphore_wait into the sumbit struct
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25576>
2024-10-03 22:11:39 +00:00
Faith Ekstrand
9b21dc06c4 vulkan/queue: Don't use vk_semaphore in threaded payload stealing
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25576>
2024-10-03 22:11:39 +00:00
Boris Brezillon
3d7bf07089 vk/meta: Make some helpers public
vk_image_view_type_to_sampler_dim() and vk_image_view_type_is_array()
can be useful to driver-specific meta shaders.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31441>
2024-10-03 09:53:34 +00:00
Boris Brezillon
cd38fd37f7 vk/meta: Allow tracking of driver-specific objects in the meta list
Add VK_META_OBJECT_KEY_DRIVER_OFFSET to define an offset for
driver-specific key types.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31441>
2024-10-03 09:53:34 +00:00
Boris Brezillon
7fe4f64c3b vk/meta: Support VkShaderExt objects to allow tracking internal shaders
PanVK has a few internal shaders that don't fit in the vk_meta
compute/graphics pipeline model. Teaching vk_meta about VkShaderEXT
allows us to keep track of those internal shaders without using yet
another hash table.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31441>
2024-10-03 09:53:34 +00:00
Boris Brezillon
790759dfaf vk/image: Fix the extent adjustment of non-compressed views
When creating a non-compressed view of a compressed image, we need to
divide the extent by the image block size not the view block size.

Fixes: 8ddc527ba4 ("vk/image: Fix the view extent of uncompressed views of compressed images")
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31439>
2024-10-02 21:54:53 +00:00
Boris Brezillon
767a7d785b vk/meta: Fix buffer -> image copy using a graphics pipeline
Unlike 3D image views, 2D array image views created by meta_copy only
contain the layers needed for rendering, so we shouldn't consider the
base layer an image offset.

Fixes: 07c6459cd8 ("vk/meta: Add copy/fill/update helpers")
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31439>
2024-10-02 21:54:53 +00:00
Faith Ekstrand
bf013cf8de vulkan: Add a comment explainint SEVERITY_WARNING_BIT for vk_error*()
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31449>
2024-10-01 00:48:36 +00:00
Jules Blok
b9af5564bb vulkan: Add support for VK_EXT_depth_clamp_control
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31411>
2024-09-30 22:18:27 +00:00
Faith Ekstrand
05ece3e219 vulkan: Use SEVERITY_WARNING_BIT for vk_error*()
Our usage of vk_error to expound on error messages returned by drivers
probably falls more into the warning category.

Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Eric Engestrom <eric@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31292>
2024-09-27 21:28:17 +00:00
Mike Blumenkrantz
8097a8e81e vk/runtime: add EXT DGC layout handling
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/31386>
2024-09-27 18:41:41 +00:00
Faith Ekstrand
5ebcb71e94 vulkan/pipeline: Patch through INDIRECT_BINDABLE_BIT
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31394>
2024-09-26 17:18:25 +00:00
Faith Ekstrand
4ae2882bc1 vulkan: Add a vk_pipeline_ops::get_shader method
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31394>
2024-09-26 17:18:25 +00:00
Faith Ekstrand
4a9a4721fe vulkan: Add a stages field to vk_pipeline
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31394>
2024-09-26 17:18:25 +00:00
Samuel Pitoiset
777f9900b3 vulkan: Update XML and headers to 1.3.296
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31381>
2024-09-26 11:12:03 +00:00
Colin Marc
2cf5ef37ba vulkan/video: set HEVC nuh_temporal_id_plus1 and nal_unit_type correctly
This is only relevant for hierarchical coding using sub-layers.

Fixes: 72f52329cd ("vulkan/video: add a nal_unit lookup for hevc")

Reviewed-by: Hyunjun Ko <zzoon@igalia.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Colin Marc <hi@colinmarc.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31303>
2024-09-26 04:18:11 +00:00
Iván Briano
101a803858 vulkan: use standard sample locations if there's no VkPipelineSampleLocationsStateCreateInfoEXT
If the pipeline is created with no
VkPipelineSampleLocationsStateCreateInfoEXT, but
VK_DYNAMIC_STATE_SAMPLE_LOCATIONS_ENABLE_EXT is set, we end up
dereferencing a NULL pointer.

Fixes future dEQP-VK.pipeline.*.extended_dynamic_state.*.sample_locations_enable_no_create_info

Fixes: 1deb83fb86 ("vulkan: Add more dynamic multisample states")

Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31377>
2024-09-26 03:43:57 +00:00
Mike Blumenkrantz
c4d6d9254a vk/image: fix view creation for planar video aspects
drivers do implement this

cc: mesa-stable

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31318>
2024-09-25 06:21:58 +00:00
Boris Brezillon
e171579f51 vk/meta: Make sure texel is 32-bit in build_buffer_to_image_cs()
Just like fragment stores, image stores expect 32-bit values (at least
that's the case of the Bifrost backend), so make sure the value passed
to write_img() is always 32-bit, even when convert_texel() doesn't touch
the texel because the image view format matches the buffer format.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Tested-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31227>
2024-09-20 18:21:50 +00:00
Aleksi Sapon
6967f59906 wsi: Fix Metal WSI CAMetalDrawable leak
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31238>
2024-09-18 22:55:28 +00:00
Aleksi Sapon
a42c2293ab wsi: Metal support
Lavapipe can render to a Metal surface now.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31208>
2024-09-18 17:54:02 +00:00
llyyr
5450306a36 vulkan/wsi/wayland: fix suboptimal flag being ignored with explicit sync
Signed-off-by: llyyr <llyyr.public@gmail.com>
Fixes: 5f7a5a27ef ("wsi: Implement linux-drm-syncobj-v1")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31122>
2024-09-13 20:48:05 +00:00
Faith Ekstrand
3a9fe645d7 vulkan: Handle variable-length property arrays more generically
Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31119>
2024-09-13 18:33:11 +00:00
Caio Oliveira
807aa97a12 vulkan: Update XML and headers to 1.3.295
Acked-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Acked-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30956>
2024-09-10 18:22:42 +00:00
Samuel Pitoiset
279b5ca10c vulkan: skip the disk cache when disableInternalCache is true
The Vulkan spec says:
    "disableInternalCache can be used to disable the driver’s internal
     cache, allowing an application to take full control of both memory
     and disk usage."

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30812>
2024-09-10 08:19:52 +00:00
Samuel Pitoiset
60474c9d69 vulkan: Update XML and headers to 1.3.294
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30812>
2024-09-10 08:19:52 +00:00
Mike Blumenkrantz
b6f201b173 meson: require dri3 modifiers
the year is 2024 and we have the technology

Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31044>
2024-09-06 17:34:17 +00:00
Caio Oliveira
ce9e2dbc62 vk/runtime: Allow "require full subgroups" for Mesh/Task
Per description of VkPipelineShaderStageCreateFlags

```
  VK_PIPELINE_SHADER_STAGE_CREATE_REQUIRE_FULL_SUBGROUPS_BIT specifies
  that the subgroup sizes must be launched with all invocations active in
  the task, mesh, or compute stage.
```

Future CTS tests will use that.

Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31023>
2024-09-06 05:49:07 +00:00
Gurchetan Singh
1e84588887 vulkan/android: change vk_enum_defines.h path
To match everything else in vulkan/runtime.

Reviewed-by: Roman Stratiienko <r.stratiienko@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31030>
2024-09-05 22:59:58 +00:00
Faith Ekstrand
9ba70bb1ed vulkan: Expose a vk_cmd_set_rendering_attachment_locations() helper
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31033>
2024-09-05 17:55:21 +00:00
Faith Ekstrand
ea783a96b8 vulkan: Allow pColorAttachmentLocations == NULL in CmdSetRenderingAttachmentLocationsKHR()
Fixes: fe19405c46 ("vulkan/runtime: handle new dynamic states for attachment remapping")
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31033>
2024-09-05 17:55:21 +00:00
Faith Ekstrand
c626be82f4 vulkan: Add a helper for getting VkRenderingAttachmentLocaiontInfoKHR
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31033>
2024-09-05 17:55:21 +00:00
David Rosca
af8c680087 vulkan/wsi: Fix stack-use-after-scope in x11_surface_create_swapchain
drm_image_params and num_modifiers are used outside the if-scope as
wsi_swapchain_init argument.

Fixes: 8f6fca89aa ("meson: delete dri3 build option")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31036>
2024-09-05 13:18:57 +00:00
Mike Blumenkrantz
8f6fca89aa meson: delete dri3 build option
this existed for historical reasons, but realistically now it should
be possible to build mesa with dri3 always enabled. additionally,
this check was often used as a substitute for having drm functionality,
which is sort of similar but also not really a direct match

this simplifies a bunch of conditionals and prevents users from footgunnning
themselves into orbit

Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Eric Engestrom <eric@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30952>
2024-09-04 14:48:17 +00:00
Mike Blumenkrantz
cd7ad7bd7e vk: rename DGC feature to DGC-NV
this is an NV extension, so it should have NV suffix

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31015>
2024-09-04 12:27:21 +00:00
Dave Airlie
af425a63f7 vulkan/video: fix vui encoding
This is a single bit field.

Fixes: d46162981a ("vulkan/video: add h264 headers encode")
Reviewed-by: Hyunjun Ko <zzoon@igalia.com>
Tested-by: Bernhard C. Schrenk <clemy@clemy.org>
Reviewed-by: Bernhard C. Schrenk <clemy@clemy.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30968>
2024-09-02 21:15:13 +00:00
Casey Bowman
eda55c7c2f vulkan/screenshot-layer: Add Vulkan screenshot layer
This change adds a Vulkan screenshot layer that allows users to take
screenshots from a Vulkan application, but has an emphasis on
performance, decreasing the performance impact on the application
involved. This allows for automated setups to use this layer to take
screenshots for navigating various in-application menus.

This layer works by hooking into various common Vulkan setup functions, until
it enters the vkQueuePresentKHR function, and from there it copies the current
frame's image from the swapchain as an RGB image to host-cached memory, where
we will receive the information as a framebuffer pointer. From there, we copy
the framebuffer contents to a thread that will detach from the main process
so it can write the image to a PNG file without holding back the main thread.

This layer was created from using the existing overlay layer as a template,
then adding portions of LunarG's VulkanTools screenshot layer:
https://github.com/LunarG/VulkanTools/blob/main/layersvt/screenshot.cpp

More specifically, there were usages of functions, along with modifications of
various functions from screenshot.cpp in the VulkanTools project, used in
screenshot.cpp.

There are some sections of the screenshotting functionality that remain
unmodified from the original screenshot.cpp file in VulkanTools, including the
global locking structures and the writeFile() function, which takes care of
obtaining the images from the swapchain. There were various areas in which
modifications were made, including how images are written to a file (using PNG
instead of PPM, introducing threading, added fences/semaphores, etc), along
with many smaller changes.

v2: Fix segfault upon application exit

v3: Fix filename issue with concatenation, along with some leftover
memory handling that wasn't cleaned up.

v4: Fix some error handling and nits

v5: Fix output directory handling

Reviewed-by: Ivan Briano <ivan.briano@intel.com

Signed-off-by: Casey Bowman <casey.g.bowman@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30527>
2024-08-30 02:56:02 +00:00
Valentine Burley
b37e06fd58 vulkan, radv: Add new common vk_format_get_plane_width/height helpers
Add new vk_format_get_plane_width/height helpers using ycbcr_info and use it to
replace RADV's ones which relied on util_format_get_plane_width/height.

We already have this data in the YCbCr table, so this avoids having the maintain the list
of pipe formats in util_format_get_plane_width/height.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Signed-off-by: Valentine Burley <valentine.burley@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30899>
2024-08-29 15:57:51 +00:00
Faith Ekstrand
42114aa723 vulkan: Handle VIEW_INDEX_FROM_DEVICE_INDEX_BIT in the runtime
Reviewed-by: Ivan Briano <ivan.briano@intel.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30876>
2024-08-29 03:30:31 +00:00