Commit graph

1663 commits

Author SHA1 Message Date
Lionel Landwerlin
db6ee2e1bb vulkan: track compression control flags on vk_image
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28632>
2024-04-16 05:56:12 +00:00
Erik Kurzinger
899263ecfc wsi/x11: support explicit sync
This adds support to the X11 WSI for explicit synchronization using DRM
syncobjs. It relies on versions 1.4 of the DRI3 and Present extensions.

Signed-off-by: Erik Kurzinger <ekurzinger@nvidia.com
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27226>
2024-04-16 02:40:01 +00:00
Paulo Zanoni
edf07649f4 vulkan: reduce struct vk_object_base by 8 bytes
I know that, in the grand scheme of things, this isn't significant.
The problem is: now that I know the hole is there, my OCD won't allow
me to sleep until it's fixed.

We went from:

struct vk_object_base {
	VK_LOADER_DATA             _loader_data;         /*     0     8 */
	VkObjectType               type;                 /*     8     4 */

	/* XXX 4 bytes hole, try to pack */

	struct vk_device *         device;               /*    16     8 */
	struct vk_instance *       instance;             /*    24     8 */
	_Bool                      client_visible;       /*    32     1 */

	/* XXX 7 bytes hole, try to pack */

	struct util_sparse_array   private_data;         /*    40    24 */
	/* --- cacheline 1 boundary (64 bytes) --- */
	char *                     object_name;          /*    64     8 */

	/* size: 72, cachelines: 2, members: 7 */
	/* sum members: 61, holes: 2, sum holes: 11 */
	/* last cacheline: 8 bytes */
};

to:

struct vk_object_base {
	VK_LOADER_DATA             _loader_data;         /*     0     8 */
	VkObjectType               type;                 /*     8     4 */
	_Bool                      client_visible;       /*    12     1 */

	/* XXX 3 bytes hole, try to pack */

	struct vk_device *         device;               /*    16     8 */
	struct vk_instance *       instance;             /*    24     8 */
	struct util_sparse_array   private_data;         /*    32    24 */
	char *                     object_name;          /*    56     8 */

	/* size: 64, cachelines: 1, members: 7 */
	/* sum members: 61, holes: 1, sum holes: 3 */
};

which is cool because now the struct nicely fits in a cacheline.

Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28699>
2024-04-15 22:12:52 +00:00
Dave Airlie
1e16851ab1 vulkan/video: copy the profile over for h264 encode.
This allows is to use it for encoding h264 headers.

Acked-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25900>
2024-04-11 12:48:22 +10:00
Erik Kurzinger
c1401fda8a wsi/wayland: don't use explicit sync with sw
When using software rendering with the Wayland WSI we should not try to
use explicit sync even if it is supported by the compositor. Not only is
it not necessary in that case, but the protocol explicitly disallows
using it with shared memory buffers.

As a fix, first we modify wsi_configure_cpu_image to not set
info->explicit_sync to true for CPU images. However, we still want the
implicit_sync parameter in wsi_create_buffer_blit_context to be set to
false since CPU images don't need implicit sync either. To ensure that
remains so, we add a new field to wsi_image_info tracking the image
type, and then only enable implicit sync for DRM images when explicit
sync is not supported.

Additionally, we modify wsi_wl_use_explicit_sync to return false when
device->sw is true.

Signed-off-by: Erik Kurzinger <ekurzinger@nvidia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28678>
2024-04-10 23:08:36 +00:00
Hans-Kristian Arntzen
2e502542ac vulkan/runtime: Check correct callback list for binding report.
instance_callbacks is only used for vkCreateInstance time callbacks.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
Fixes: 34e8e5d76f ("vulkan/debug_utils: add a helper for reporting address binding")
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28649>
2024-04-10 13:50:56 +00:00
Paulo Zanoni
b0653370d0 vulkan: don't zero-initialize STACK_ARRAY()'s stack array
STACK_ARRAY() is used in a lot of places. When games are running we
see STACK_ARRAY() arrays being used all the time: each queue
submission uses 6, WaitSemaphores and syncobj waiting also uses them:
they're constantly present in Vulkan runtime.

There's no need for STACK_ARRAY()'s stack array to be initialized,
callers cannot not depend on it. If the number of elements is greater
than STACK_ARRAY_SIZE, then STACK_ARRAY() will just malloc() the array
and return it not initialized: anybody depending of
zero-initialization is going to break when the array is big.

The reason why we're zero-intializing STACK_ARRAY()'s stack array is
to silence -Wmaybe-uninitialized warnings: see commit d7957df318
("vulkan: fix uninitialized variables"). I don't think that commit is
the ideal way to deal with the problem, so this patch proposes a
better solution.

The problem here is that zero-initializing it adds code we don't need
for every single caller. STACK_ARRAY() already has 63 callers and only
3 of them are affected by the -Wmaybe-uninitialized warining. So here
we undo what commit d7957df318 did and instead we fix the 3 cases
that actually generate the -Wmaybe-uninitialized warnings.

Gcc is only emitting those warinings because it knows that the number
of elements in the array may be zero, so the loops we have that set
elements to the array may end up do nothing, and then we pass the
array uninitialized to other functions.

For the cases related to vk_sync this is just returning VK_SUCCESS
earlier, instead of relying on the check that eventually happens at
__vk_sync_wait_many(). For the vkCmdWaitEvents() function, the Vulkan
spec says that "eventCount must be greater than 0", so the early
return doesn't hurt anybody either. In both cases we make the zero
case faster by not defining an 8-sized array, zero-initializing it,
then returning success without using it.

Reference: d7957df318 ("vulkan: fix uninitialized variables")
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28288>
2024-04-08 17:23:25 +00:00
Faith Ekstrand
aac2a31b3d vulkan: Add a bunch of -Wpadded errors
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28615>
2024-04-06 23:54:36 -05:00
Samuel Pitoiset
34e8e5d76f vulkan/debug_utils: add a helper for reporting address binding
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28373>
2024-04-03 08:48:36 +00:00
Eric Engestrom
96e8648b32 docs: replace references to the deprecated VK_INSTANCE_LAYERS with the new VK_LOADER_LAYERS_ENABLE
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28516>
2024-04-02 18:08:52 +00:00
Joshua Ashton
5f7a5a27ef wsi: Implement linux-drm-syncobj-v1
This implements explicit sync with linux-drm-syncobj-v1 for the
Wayland WSI.

Signed-off-by: Joshua Ashton <joshua@froggi.es>

Reviewed-by: Hans-Kristian Arntzen <post@arntzen-software.no>
Reviewed-by: Erik Kurzinger <ekurzinger@nvidia.com>
Reviewed-by: Sebastian Wick <sebastian.wick@redhat.com>
Reviewed-by: Eric Engestrom <eric@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25709>
2024-04-02 13:09:38 +00:00
Joshua Ashton
59813ae468 wsi: Add common infrastructure for explicit sync
Signed-off-by: Joshua Ashton <joshua@froggi.es>

Reviewed-by: Hans-Kristian Arntzen <post@arntzen-software.no>
Reviewed-by: Erik Kurzinger <ekurzinger@nvidia.com>
Reviewed-by: Sebastian Wick <sebastian.wick@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25709>
2024-04-02 13:09:37 +00:00
Joshua Ashton
4bf8f96b3e wsi: Get timeline semaphore exportable handle types
We need to know this for explicit sync

Signed-off-by: Joshua Ashton <joshua@froggi.es>

Reviewed-by: Hans-Kristian Arntzen <post@arntzen-software.no>
Reviewed-by: Erik Kurzinger <ekurzinger@nvidia.com>
Reviewed-by: Sebastian Wick <sebastian.wick@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25709>
2024-04-02 13:09:37 +00:00
Joshua Ashton
6a72ea01d3 wsi: Track CPU side present ordering via a serial
We will use this in our hueristics to pick the most optimal buffer in AcquireNextImageKHR

Signed-off-by: Joshua Ashton <joshua@froggi.es>

Reviewed-by: Hans-Kristian Arntzen <post@arntzen-software.no>
Reviewed-by: Erik Kurzinger <ekurzinger@nvidia.com>
Reviewed-by: Sebastian Wick <sebastian.wick@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25709>
2024-04-02 13:09:37 +00:00
Joshua Ashton
7467f29af1 wsi: Add acquired member to wsi_image
Tracks whether this wsi_image has been acquired by the app

Signed-off-by: Joshua Ashton <joshua@froggi.es>

Reviewed-by: Hans-Kristian Arntzen <post@arntzen-software.no>
Reviewed-by: Erik Kurzinger <ekurzinger@nvidia.com>
Reviewed-by: Sebastian Wick <sebastian.wick@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25709>
2024-04-02 13:09:37 +00:00
Joshua Ashton
a50ce3df71 wsi: Track if timeline semaphores are supported
This will be needed before we expose and use explicit sync.

Even if the host Wayland compositor supports timeline semaphores, in the
case of Venus, etc the underlying driver may not.

Signed-off-by: Joshua Ashton <joshua@froggi.es>

Reviewed-by: Hans-Kristian Arntzen <post@arntzen-software.no>
Reviewed-by: Erik Kurzinger <ekurzinger@nvidia.com>
Reviewed-by: Sebastian Wick <sebastian.wick@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25709>
2024-04-02 13:09:37 +00:00
Joshua Ashton
efa6fac0d7 build: Add linux-drm-syncobj-v1 wayland protocol
Signed-off-by: Joshua Ashton <joshua@froggi.es>

Reviewed-by: Hans-Kristian Arntzen <post@arntzen-software.no>
Reviewed-by: Erik Kurzinger <ekurzinger@nvidia.com>
Reviewed-by: Sebastian Wick <sebastian.wick@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25709>
2024-04-02 13:09:37 +00:00
Joshua Ashton
72240780f2 wsi: Add explicit_sync to wsi_drm_image_params
Allow the WSI frontend to request explicit sync buffers.

Signed-off-by: Joshua Ashton <joshua@froggi.es>

Reviewed-by: Hans-Kristian Arntzen <post@arntzen-software.no>
Reviewed-by: Erik Kurzinger <ekurzinger@nvidia.com>
Reviewed-by: Sebastian Wick <sebastian.wick@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25709>
2024-04-02 13:09:37 +00:00
Joshua Ashton
c30c969c24 wsi: Add explicit_sync to wsi_image_info
Will be used in future for specifying explicit sync for Vulkan WSI when supported.

Additionally cleans up wsi_create_buffer_blit_context, etc..

Signed-off-by: Joshua Ashton <joshua@froggi.es>

Reviewed-by: Hans-Kristian Arntzen <post@arntzen-software.no>
Reviewed-by: Erik Kurzinger <ekurzinger@nvidia.com>
Reviewed-by: Sebastian Wick <sebastian.wick@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25709>
2024-04-02 13:09:37 +00:00
Joshua Ashton
eae948332a wsi: Pass wsi_drm_image_params to wsi_configure_prime_image
Signed-off-by: Joshua Ashton <joshua@froggi.es>

Reviewed-by: Hans-Kristian Arntzen <post@arntzen-software.no>
Reviewed-by: Erik Kurzinger <ekurzinger@nvidia.com>
Reviewed-by: Sebastian Wick <sebastian.wick@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25709>
2024-04-02 13:09:37 +00:00
Joshua Ashton
d6345250ca wsi: Pass wsi_drm_image_params to wsi_configure_native_image
No need to split this out into function parameters, it's just less clean.

Signed-off-by: Joshua Ashton <joshua@froggi.es>

Reviewed-by: Hans-Kristian Arntzen <post@arntzen-software.no>
Reviewed-by: Erik Kurzinger <ekurzinger@nvidia.com>
Reviewed-by: Sebastian Wick <sebastian.wick@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25709>
2024-04-02 13:09:37 +00:00
Hans-Kristian Arntzen
5eb0dec525 wsi/x11: Return OUT_OF_DATE on sw resize.
This is more in line with DRI3 path, and fixes a regression
since SUBOPTIMAL was not considered correctly.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
Fixes: 19dba854be ("wsi/x11: Rewrite implementation to always use threads.")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/10878
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28413>
2024-03-28 14:22:19 +00:00
Yonggang Luo
49f6270e7d vulkan: Move vk_format_is_alpha and vk_format_is_alpha_on_msb into vk_format.h from pvr
The vk_format_description moved to front because it's referenced by vk_format_is_alpha_on_msb

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Matt Coster <matt.coster@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28266>
2024-03-28 04:11:52 +00:00
David Stern
82ed8aadea vulkan/wsi/x11: Explicitly discard errors from xcb_present_pixmap.
Errors produced by the call to `xcb_present_pixmap` should be explicitly
discarded to ensure they don't leak into the application event loop.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>

Fixes: 2b885b23 ("vk/wsi/x11: stop roundtripping on presentation")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28402>
2024-03-28 00:23:38 +00:00
Charlie Turner
9e3932e990 {vulkan,radv,anv}/video: fix issue in H264 scaling lists derivation
Originally was trying to copy a pps's scaling list when an sps's was
signaled.

Fixes: 8daa32963 ("vulkan/video: add helper to derive H264 scaling lists")

Signed-off-by: Charlie Turner <cturner@igalia.com>
Reviewed-by: Hyunjun Ko <zzoon@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28352>
2024-03-27 00:19:32 +00:00
Yonggang Luo
1ac1c0843f treewide: Replace usage of macro DEBUG with MESA_DEBUG when possible
This is achieved by the following steps:

#ifndef DEBUG => #if !MESA_DEBUG
defined(DEBUG) => MESA_DEBUG
#ifdef DEBUG => #if MESA_DEBUG

This is done by replace in vscode

excludes
docs,*.rs,addrlib,src/imgui,*.sh,src/intel/vulkan/grl/gpu

These are safe because those files should keep DEBUG macro is already excluded;
and not directly replace DEBUG, as we have some symbols around it.

Use debug or NDEBUG instead of DEBUG in comments when proper

This for reduce the usage of DEBUG,
so it's easier migrating to MESA_DEBUG

These are found when migrating DEBUG to MESA_DEBUG,
these are all comment update, so it's safe

Replace comment /* DEBUG */ and /* !DEBUG */ with proper /* MESA_DEBUG */ or /* !MESA_DEBUG */ manually

DEBUG || !NDEBUG -> MESA_DEBUG || !NDEBUG
!DEBUG && NDEBUG -> !(MESA_DEBUG || !NDEBUG)

Replace the DEBUG present in comment with proper new MESA_DEBUG manually

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: David Heidelberg <david.heidelberg@collabora.com>
Reviewed-by: Eric Engestrom <eric@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28092>
2024-03-22 18:22:34 +00:00
Hans-Kristian Arntzen
1900617baf wsi/wayland: Init outstanding list earlier.
Fixes a crash if swapchain free is called before the list is
initialized. This only happens when swapchain init fails, so
it is highly unlikely to happen in practical scenarios.

Fixes dEQP-VK.wsi.wayland.swapchain.simulate_oom.min_image_count.

Fixes: 0d51cd4808 ("wsi/wl: Improve fallback for present_wait.")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/10866

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
Reviewed-by: Joshua Ashton <joshua@froggi.es>
Tested-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28325>
2024-03-22 14:02:26 +00:00
Yonggang Luo
680e707534 treewide: Replace the invalid usage #if DEBUG with #ifdef DEBUG
This is done by find&replace and exclude the following folders in vscode
docs,*.rs,addrlib,src/imgui,*.sh,src/intel/vulkan/grl/gpu

This is a prepare step for re-working https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21946

These issues are found when to try switch DEBUG to MESA_DEBUG=0|1 in MR

https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28092

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: David Heidelberg <david.heidelberg@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28083>
2024-03-15 16:08:18 +00:00
Eric Engestrom
6d287943d1 vk/update-aliases: drop VK_ERROR_ prefix substitution
There is no code currently concatenating that string so it is not useful
to have it here, and it is triggering a loop because a substitution is
becoming itself if we remove this prefix.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28102>
2024-03-11 14:48:14 +00:00
Boris Brezillon
6fab8abebb vk/meta: Fix base_type selection in build_{clear,blit}_shader()
vk_format_is_int() returns true for both signed and unsigned integers,
which means unsigned types will always be assigned a GLSL_TYPE_INT type,
which causes some backend compilers (like bifrost) to pick a wrong
register type.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28073>
2024-03-11 11:52:13 +00:00
Boris Brezillon
c722265c16 vk/meta: Add the PUSH_DESCRIPTOR_BIT flag when creating blit pipeline layouts
Descriptors are updated with CmdPushDescriptorSet(), we need to reflect
that with a VK_DESCRIPTOR_SET_LAYOUT_CREATE_PUSH_DESCRIPTOR_BIT_KHR when
the DescriptorSetLayout is created.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28073>
2024-03-11 11:52:13 +00:00
Yiwei Zhang
c9d3cc2615 vulkan: refactor the runtime header gen order dependency
Summary:
- ensure headers used outside runtime are included in dependency source
- drop redundant idep_vulkan_common_entrypoints_h
- drop redundant icd side tricks for the order of header gen

Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Yonggang Luo <luoyonggang@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28066>
2024-03-08 21:42:07 +00:00
Yiwei Zhang
d857f10574 vulkan: remove header files from lib source files
The generated "astc_spv.h" is for runtime internal use, so leave it
inside the runtime files to ensure the header is generated before being
used to compile.

Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Yonggang Luo <luoyonggang@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28066>
2024-03-08 21:42:07 +00:00
Yiwei Zhang
90824e07a2 vulkan: properly ensure wsi_entrypoints header gen order
Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Yonggang Luo <luoyonggang@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28066>
2024-03-08 21:42:07 +00:00
Yiwei Zhang
872c9fabeb vulkan: remove unused wsi_common_entrypoints include and dep
Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28066>
2024-03-08 21:42:07 +00:00
Zan Dobersek
e29677b16d vulkan/rmv: enable logging miscellaneous internal resources
Add the vk_rmv_misc_internal_description struct and list the misc_internal
member of that type in the vk_rmv_resource_create_token union, allowing
logging of different internal resources in RMV dumps.

The vk_rmv_common.h header also has the C-linkage block added in order to
enable its inclusion in C++ files.

Signed-off-by: Zan Dobersek <zdobersek@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27631>
2024-03-08 11:34:17 +00:00
Yiwei Zhang
bffdd05a79 vulkan: fix runtime libraries' dep against generated headers
This change adds a new generated header dep to the runtime internal
library dependencies. This ensures the headers are generated before the
below libraries are compiled:
- libvulkan_lite_runtime (already satisfied due to file sources)
- libvulkan_lite_instance
- libvulkan_runtime
- libvulkan_instance

Fixes: fe2ec50844 ("vulkan: allow building venus without libcompiler")
Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28062>
2024-03-07 22:17:12 -08:00
Yonggang Luo
fe2ec50844 vulkan: allow building venus without libcompiler
This is done by introduce idep_vulkan_lite_runtime, and only venus
depends on  idep_vulkan_lite_runtime.

Modify the meson and source files to allow building venus without
the compiler.

See details Venus build metrics at the MR description.

gfxstream-vulkan forwards the shader to the host, and doesn't
need to convert into NIR in the guest.  This results in faster
builds and less parts of Mesa to build.  Also venus does the
same thing too, that's what the build is keyed on right now
as an in-tree user.

v7: By Yonggang Luo <luoyonggang@gmail.com>
  Add idep_vulkan_common_entrypoints_h into vulkan_lite_runtime_deps because
  vk_instance.c depends on idep_vulkan_common_entrypoints_h but vk_common_entrypoints is
  not compiled in library `vulkan_lite_instance`.
  Rename idep_vulkan_runtime_headers to idep_vulkan_lite_runtime_headers because
  both lite/full runtime library depends on this, but lite should not depends on full
  vk_meta_private.h added into vulkan_runtime_files

v6: By Yonggang Luo <luoyonggang@gmail.com>
  get vulkan_lite_runtime_files and vulkan_runtime_files sorted

v5: By Yiwei Zhang <zzyiwei@chromium.org>
  both vk_sampler and vk_ycbcr_conversion can stay in the lite runtime

v4: By Yonggang Luo <luoyonggang@gmail.com>
  only build vk_instance.(c|h) twice for reduce compiling time

v3: By Yiwei Zhang <zzyiwei@chromium.org>
  less code changes by introduce libvulkan_lite_runtime

v2: By Yonggang Luo <luoyonggang@gmail.com>
  allow building Vulkan without libcompiler without compiling flags, the
  venus is always built without libcompiler

v1: By Gurchetan Singh <gurchetansingh@google.com>
  allow building Vulkan without libcompiler

Signed-off-by: Gurchetan Singh <gurchetansingh@google.com>
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Yonggang Luo <luoyonggang@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26574>
2024-03-07 20:33:28 +00:00
Yonggang Luo
a367cd4931 Revert "meson/vulkan/util: allow venus to drop compiler deps"
This reverts commit 3923d43908.

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@google.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26574>
2024-03-07 20:33:28 +00:00
Konstantin Seurer
f3fe1f2f18 vulkan: Implement DebugMarkerSetObjectNameEXT
DebugMarkerSetObjectNameEXT is just a less powerful version of
SetDebugUtilsObjectNameEXT. Fixes the objectType cast warning as well.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27975>
2024-03-07 19:28:53 +00:00
Konstantin Seurer
ff09e95080 vulkan/cmd_queue: Implement CmdBuildAccelerationStructuresKHR
This is needed for copying the arguments properly.

Acked-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25616>
2024-03-06 16:34:25 +00:00
qbojj
4b7f4724f8 vulkan: Fix calculation of flags in vk_graphics_pipeline_state_fill
Fixes: 2b62d90158 ("vk/graphics_state: Support VK_KHR_maintenance5")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/10705
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27929>
2024-03-06 07:54:28 +00:00
Faith Ekstrand
d1cf01dc52 vulkan/pipeline: Always init pipeline cache objects
vk_shader_init_cache_obj() is fast enough and the already-found case is
rare enough that there's no good reason to avoid the init.  This allows
us to use vk_shader_unref instead of vk_shader_destroy which is probably
a touch safer over-all.  It also fixes the assert that the two shaders
have matching keys.

Fixes: bb8b11d806 ("vulkan/pipeline: Handle fully compiled library shaders properly")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/10752
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27993>
2024-03-05 23:12:34 +00:00
Yonggang Luo
1e97fded47 vulkan/runtime: Mark vk_default_dynamic_graphics_state to be private
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27526>
2024-03-05 19:05:00 +00:00
Yonggang Luo
db103c56ab treewide: Remove vulkan/runtime vulkan/util prefix in include path
This is for unify the include style of shared vulkan headers

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27526>
2024-03-05 19:05:00 +00:00
Friedrich Vock
e7d78a7b87 vulkan/runtime: Allow more than 8 DRM devices
Some people seem to have systems with more than 8 GPUs installed at
once. 256 is the maximum number of devices returned by libdrm, so using
this seems like a good choice for now.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27901>
2024-03-01 21:18:44 +00:00
Derek Foreman
7f72eb9e6c vulkan/wsi/wayland: More descriptive name for swapchain queue
We can have multiple swapchains, and we can also have retired swap chains
that can continue to deliver events briefly after being replaced. It's
helpful to have both a surface id and a per surface swapchain id.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27852>
2024-02-29 21:45:57 +00:00
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