Commit graph

2129 commits

Author SHA1 Message Date
Antonio Ospite
ddf2aa3a4d build: avoid redefining unreachable() which is standard in C23
In the C23 standard unreachable() is now a predefined function-like
macro in <stddef.h>

See https://android.googlesource.com/platform/bionic/+/HEAD/docs/c23.md#is-now-a-predefined-function_like-macro-in

And this causes build errors when building for C23:

-----------------------------------------------------------------------
In file included from ../src/util/log.h:30,
                 from ../src/util/log.c:30:
../src/util/macros.h:123:9: warning: "unreachable" redefined
  123 | #define unreachable(str)    \
      |         ^~~~~~~~~~~
In file included from ../src/util/macros.h:31:
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:456:9: note: this is the location of the previous definition
  456 | #define unreachable() (__builtin_unreachable ())
      |         ^~~~~~~~~~~
-----------------------------------------------------------------------

So don't redefine it with the same name, but use the name UNREACHABLE()
to also signify it's a macro.

Using a different name also makes sense because the behavior of the
macro was extending the one of __builtin_unreachable() anyway, and it
also had a different signature, accepting one argument, compared to the
standard unreachable() with no arguments.

This change improves the chances of building mesa with the C23 standard,
which for instance is the default in recent AOSP versions.

All the instances of the macro, including the definition, were updated
with the following command line:

  git grep -l '[^_]unreachable(' -- "src/**" | sort | uniq | \
  while read file; \
  do \
    sed -e 's/\([^_]\)unreachable(/\1UNREACHABLE(/g' -i "$file"; \
  done && \
  sed -e 's/#undef unreachable/#undef UNREACHABLE/g' -i src/intel/isl/isl_aux_info.c

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36437>
2025-07-31 17:49:42 +00:00
Antonio Ospite
b4c7d3a08e build: stop calling unreachable() without arguments
The unreachable(str) macro defined in src/util/macros.h is defined to
accept a literal string as an argument.

However the way it checks that the argument is a string literal, by
prepending an empty string where the argument is used, i.e.:

  #define unreachabel(str) assert(!"" str)

still allows users to call the macro with no arguments.

This is confusing, so pass an empty string to all invocations of
unreachable() for consistency.

This is done with the following command:

  git grep -l '[^_]unreachable();' -- "src/**" | sort | uniq | \
  while read file; \
  do \
    sed -e 's/\([^_]\)unreachable();/\1unreachable("");/g' -i "$file";
  done

This should not change the behaviour of the callers of unreachable() in
a meaningful way, but there will be some cosmetic consequence.

The changed invocations will now print:

  Assertion `!"" ""' failed.

instead of

  Assertion `!""' failed.

But this is also what happens for the invocations that do pass an
argument, for instance `unreachable("Invalid type")` currently prints:

  Assertion `!"" "Invalid type"' failed.

So all invocations now also have the same output style.

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36437>
2025-07-31 17:49:40 +00:00
Sergii Ushakov
6c7f7e4953 android: moving HMI symbol to separate file
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
To support "surfaceless" builds on Android it is required to still have
HMI symbol exported by the library while no other android-specific code is
needed.

Reviewed-by: Gurchetan Singh <gurchetansingh@google.com>
Reviewed-by: Marcin Radomski <dextero@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36459>
2025-07-31 17:11:51 +00:00
David Rosca
2c3bb204a5 vulkan/video: Fix h265 level values
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
From spec:
"general_level_idc shall be set equal to a value of 30 times the level number."

Fixes: 8243145f02 ("vulkan/video: add a h265 level translator.")
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36285>
2025-07-31 10:08:05 +00:00
Konstantin Seurer
656acb96b0 vulkan/cmd_queue: Reorder memcpy in get_struct_copy
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
Using the temporary variable for the memcpy makes sure they are always
used so the "(void)tmp_src123" can be removed.

Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36331>
2025-07-31 08:13:59 +00:00
Konstantin Seurer
d29f446aa3 vulkan/cmd_queue: Clean up generating copies
Using the builder makes it much easier to see what is happening and
fixes indentation in the process.

Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36331>
2025-07-31 08:13:58 +00:00
Konstantin Seurer
d824525a01 vulkan/cmd_queue: Recursively free struct members
Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36331>
2025-07-31 08:13:58 +00:00
Konstantin Seurer
ea7a2f9834 vulkan/cmd_queue: Improve struct free code indentation
It also cleans up the way the string is generated because using large templates was a mess.

Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36331>
2025-07-31 08:13:58 +00:00
Konstantin Seurer
c29db0965c vulkan/cmd_queue: Do not free if driver_free_cb is provided
Avoids crashes when the custom implementation allocates differently.

Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36331>
2025-07-31 08:13:58 +00:00
Eric Engestrom
fdcad6e547 meson: include VkLayer_MESA_anti_lag in the devenv
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
See https://github.com/KhronosGroup/Vulkan-Loader/blob/main/docs/LoaderLayerInterface.md#linux-layer-discovery

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36346>
2025-07-30 23:53:51 +00:00
Eric Engestrom
55d5c3dd8f meson: include VkLayer_MESA_vram_report_limit in the devenv
See https://github.com/KhronosGroup/Vulkan-Loader/blob/main/docs/LoaderLayerInterface.md#linux-layer-discovery

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36346>
2025-07-30 23:53:51 +00:00
Eric Engestrom
56c910aafc meson: include VkLayer_MESA_screenshot in the devenv
See https://github.com/KhronosGroup/Vulkan-Loader/blob/main/docs/LoaderLayerInterface.md#linux-layer-discovery

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36346>
2025-07-30 23:53:51 +00:00
Eric Engestrom
45789ac396 meson: fix VkLayer_MESA_device_select in the devenv
It's an implicit layer, not an explicit one like the others in that MR,
which I missed in the previous commit.

Fixes: 294d8ce80a ("meson: include VkLayer_MESA_device_select in the devenv")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36346>
2025-07-30 23:53:51 +00:00
Eric Engestrom
a8e9af2ce9 wsi/display: pass the plane's modifiers to the image
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
This should cause us to choose a better-than-linear format modifier
automatically based on the intersection of the driver's support and the
display plane's support.

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36341>
2025-07-29 16:44:04 +00:00
Emma Anholt
0c0d9c05e0 wsi/display: Do connector setup before swapchain init.
The connector setup decides on a CRTC/plane, and can be done early.  We're
going to need that to get the modifiers list before we have swapchain init
create the images.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36341>
2025-07-29 16:44:04 +00:00
Emma Anholt
fe7652eae9 wsi/display: Pull DRM format translation up a level.
Saves doing it multiple times, but more importantly we want to know it
before wsi_swapchain_init() soon.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36341>
2025-07-29 16:44:03 +00:00
Eric Engestrom
b16a6a56d8 wsi/display: pass the image's DRM modifiers to the kernel
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36341>
2025-07-29 16:44:02 +00:00
Thomas H.P. Andersen
f8741cc344 anti-lag: pass a proper dataSize
dataSize was passed as sizeof(uint64_t)

From spec:
dataSize is the size in bytes of the buffer pointed to by pData.
dataSize must be large enough to contain the result of each query

The NVK driver checks that the dataSize is large enough and hit an assert.

This patch changes dataSize to sizeof(struct query) * num_timestamps.

Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36402>
2025-07-29 15:24:14 +00:00
Faith Ekstrand
064b9e5645 vulkan/wsi/x11: Handle VK_NOT_READY in AcquireNextImage()
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
This check assumed that we would always get `VK_TIMEOUT` from
wsi_queue_pull() but the new explicit sync wait is smart enough to do
that for us.  Unfortunately, the X11 code weasn't smart enough to know
that VK_NOT_READY (which is a positive return code) was also an early
exit condition.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/12971
Fixes: 899263ecfc ("wsi/x11: support explicit sync")
Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Tested-by: Adam Ivora
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36419>
2025-07-29 15:05:40 +00:00
Christoph Pillmayer
a501d26dee vk/sync: Pass dependencyFlags in vk_common_CmdPipelineBarrier
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>

Fixes: 97f0a449 ("vulkan: implement legacy entrypoints on top of VK_KHR_synchronization2")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36321>
2025-07-29 11:11:29 +00:00
Yiwei Zhang
aac51c3a0b vulkan/android: improve memoryTypeBits reporting in AHB props query
Instead of reporting all memory types being compatible, at least we can
limit the types to those compatible for dma-buf import. Optionally, we
can do even better here to actually create the image or buffer with the
AHB to get more accurate memory type bits for memory import. However, it
is optional since we can touch up in the common layer upon actual AHB
import time.

Reviewed-by: Antonio Ospite <antonio.ospite@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36388>
2025-07-29 07:50:09 +00:00
Mike Blumenkrantz
05cc38bb68 vulkan: silence typed_memcpy -Waddress warnings
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36413>
2025-07-28 17:31:54 +00:00
Maíra Canal
ab3aaad957 vulkan: don't destroy vk_sync_timeline if a point is still pending
Currently, vk_sync_timeline_wait() may report idle while we still have
time points outstanding in vk_queue. This race between vk_sync_timeline
and vk_queue is problematic as vk_queue_submit_cleanup() can end-up
trying to unref a timeline point that was already destroyed in
vk_sync_timeline_finish(), leading to an use-after-free.

Address this race-condition by introducing a reference counter to the
timeline. Each timeline point takes a reference to the timeline when
it's checked out and drops the reference when it's freed. Now, the
timeline is only destroyed when all the references had been dropped.

To guarantee that all references will be dropped and the timeline will
be destroyed, vk_sync_timeline_finish() waits for all pending points
to be checked out.

This commit fixes several Mesa CI flakes in v3dv related to timeline
semaphores.

Cc: mesa-stable
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/12648
Signed-off-by: Maíra Canal <mcanal@igalia.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35921>
2025-07-24 18:49:02 -03:00
Faith Ekstrand
088a979e79 vulkan: Hold a reference to pending vk_sync_timeline_points
Previously, we had a sort of double reference count with refcount being
used to track how many waits were holding a reference and pending being
used to track whether or not it was in the pending list. This meant
that the unref operation actually had to look at both refcount and
pending in order to determine if it could free the time point. This is
way too confusing. Instead, we should just always take a reference
while we're pending.

This also simplifies the over-all interface because there's no longer a
difference between free and release. `struct vk_sync_timeline_point` is
now just a reference-counted API.

Reviewed-by: Maíra Canal <mcanal@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35921>
2025-07-24 18:49:02 -03:00
Faith Ekstrand
54eb41588c vulkan: Rename a bunch of vk_sync_timeline helpers
Whenever we assume the timeline state is locked, we use _locked, pass in
the timeline state explicitly, and rename it so it's clearly an action
which the timeline does on the point.  This makes it far more clear who
owns a reference to what and where.

Reviewed-by: Maíra Canal <mcanal@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35921>
2025-07-24 18:49:02 -03:00
Maíra Canal
d73b9a7229 vulkan: create a wrapper struct for vk_sync_timeline
The lifetime of `struct vk_sync_timeline` is tied to the lifetime of
`vk_fence` or `vk_semaphore` objects. To better manage this lifecycle,
create a wrapper struct `vk_sync_timeline_state` that contains the
timeline state and is dynamically allocated when the timeline is
initialized. This separation allows the timeline state to persist
independently of the sync object lifecycle.

Signed-off-by: Maíra Canal <mcanal@igalia.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35921>
2025-07-24 18:48:19 -03:00
Hans-Kristian Arntzen
30c2e7871f anti-lag: Submit timestamps early in a frame.
Allows detecting if the queue ends up going idle due to
a cross-queue dependency. Since we're only considering delays from
specific queues, we would not be able to detect low-latency situations
arising from the start of a frame happening on async queues.

Until we observe real work happening for a queue in a frame context,
submit timestamps ahead of any other waits.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34242>
2025-07-24 09:50:08 +00:00
Hans-Kristian Arntzen
81bb109a3b anti-lag: Only consider timestamps from queues which have presented.
Avoids stray submissions to compute queues to nullify the delay.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34242>
2025-07-24 09:50:07 +00:00
Daniel Schürmann
722ffe9a73 vulkan: implement VK_AMD_anti_lag as implicit vulkan layer
VkLayer_MESA_anti_lag is a lightweight implicit layer which provides
an open-source implementation of the VK_AMD_anti_lag vulkan extension.

The algorithm used by this layer is very simplistic and only aims to
minimize the delay between calls to vkQueueSubmit or vkQueueSubmit2
and the begin of the execution of the submission.

In order to build VkLayer_MESA_anti_lag, pass -Dlayers=anti-lag to meson.
It is possible to either install the layer or to use

 VK_ADD_IMPLICIT_LAYER_PATH=<buildpath>/share/vulkan/implicit_layer.d/

for testing purposes.
(Keep in mind that you have to adjust the library_path in the json file in that case.)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34242>
2025-07-24 09:50:07 +00:00
Alyssa Rosenzweig
8a1a410389 treewide: use SWAP macro
Via Coccinelle patch + manual clean up:

    @@
    identifier temporary, a, b;
    type T;
    @@

    -T temporary = a;
    -a = b;
    -b = temporary;
    +SWAP(a, b);

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/36297>
2025-07-23 19:49:47 +00:00
Faith Ekstrand
22c624d75b vulkan/meta: Supply image view usage in vk_meta_clear_*_image()
This was the only meta function (including those built into honeykrisp)
which wasn't setting view usage so we can also assert that it's always
provided.

Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36301>
2025-07-23 17:00:02 +00:00
Alyssa Rosenzweig
bc64ea2815 vulkan: fix shader linking with common pipelines
Despite appearances, the current vk_pipeline implementation fails to link any
shaders, unless GPL is used or the link_geom_stages option is set (which no
drivers do). Notably monolithic pipelines don't get linked.

This patch attempts to fix our linking issues. Monolithic pipelines now get
linked, GPL optimized pipelines do too. GPL fast link is still not linked.

Geometry stages are now always linked because - despite the option - I think all
hardware wants this. Apps love writing random dead varyings for literally no
reason, which isn't free even on NVIDIA. This removes the option, effectively
setting it for all drivers, which in retrospect is the right decision.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Acked-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36265>
2025-07-23 14:15:57 +00:00
Emma Anholt
055d5759a7 wsi/display: Add error messages to some shouldn't-be-hit paths.
Maybe we could see objects without our required set of properties, but we
definitely should never fail at drmModeObjectGetProperties().

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6173>
2025-07-21 22:53:54 +00:00
Emma Anholt
3c302d29a4 wsi/display: Add some comments about what's going on in the code.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6173>
2025-07-21 22:53:54 +00:00
Jonathan Marek
513ffea1d3 wsi/display: use atomic mode setting
Switch from legacy api to the atomic api.  Atomic support should be
standard at this point, and failing to get a KHR_display connector in its
absence seems reasonable (rather than retaining code that we don't expect
to use or test, as in
https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4176)

This is a prerequisite for modifiers support, where we need to be able to
pick a specific plane in order to see its supported modifiers list.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6173>
2025-07-21 22:53:54 +00:00
Eric Engestrom
baa9b4225b wsi/display: also select a plane when selecting a crtc
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6173>
2025-07-21 22:53:54 +00:00
Eric Engestrom
09058ccbdb wsi/display: setup the connector earlier
Instead of setting it up when the swapchain is presented, set it up when
creating the swapchain. This means that multiple swapchains might use
the same crtc, but only one can be active at a time, and the connectors
are now refcounted.

This is necessary for the next commit.

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6173>
2025-07-21 22:53:53 +00:00
Alyssa Rosenzweig
86a9843c82 vulkan/nir_convert_ycbcr: use more effective nir
* use the tex builder (what I came for)
* use fmul_imm and fix weird wrapping

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36050>
2025-07-21 12:11:42 +00:00
Alyssa Rosenzweig
6b34e2174e nir: introduce ergonomic tex builder
for intrinsics, we have these really nice builders using designated initializers
+ macros to specify optional indices. texture instrs have even more craziness
involved, but we can do the same trick. this commit takes the existing "fixed
form" deref-centric tex builders and generalizes them to work with non-deref
textures, making it useful also for GL and late VK passes, while providing an
API that strives to be ergonomic and consistent.

this series only implements a subset of possible texture operations for now, but
more generalizing could be added as people have need.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36050>
2025-07-21 12:11:41 +00:00
Yiwei Zhang
f5c1b74c66 vulkan/android: improve AHB image format check logging
Decimal is better for VkFormat. Also prefer the hex logging with 0x to
be intuitive.

Reviewed-by: Lucas Fryzek <lfryzek@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36204>
2025-07-18 16:20:12 +00:00
Yiwei Zhang
7934c9ab78 vulkan/android: make vk_ahb_probe_format private to android runtime
...and drop duplicate docs.

Acked-by: Rob Clark <robclark@freedesktop.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36151>
2025-07-17 20:12:23 +00:00
Yiwei Zhang
9fb91dfd93 vulkan/android: add vk_android_get_ahb_buffer_properties
This is to assist GetPhysicalDeviceExternalBufferProperties query.

Acked-by: Rob Clark <robclark@freedesktop.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36151>
2025-07-17 20:12:23 +00:00
Yiwei Zhang
850ede0970 vulkan/android: add vk_android_get_ahb_image_properties
This is to assist GetPhysicalDeviceImageFormatProperties2 query.

Acked-by: Rob Clark <robclark@freedesktop.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36151>
2025-07-17 20:12:23 +00:00
Faith Ekstrand
950dac6e6c x11: Add an x11_xlib_display_is_thread_safe() helper
Even though Xlib 1.8 enables thread-safety by default it's still
theoretically possible that the user's system has an Xlib that has been
built with this turned off.  Warn in that case.  Since this requires
poking at Xlib internals, it's better to have this as a util helper.

Now that libloader_x11 contains more than just dri3 helpers, we build it
unconditionally if with_platform_x11 and just add loader_x11.c if it

Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Eric Engestrom <eric@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36123>
2025-07-16 01:32:56 +00:00
Faith Ekstrand
cf654be16b vulkan/wsi/x11: Refuse to connect to thread-unsafe Displays
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
We heavily rely on threading in Vulkan WSI.  There's no way this is safe
if XInitThreads() hasn't been called.  Fortunately, this should never be
the case since 2022 or so.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/13530
Cc: mesa-stable
Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36120>
2025-07-15 17:13:46 +00:00
Yiwei Zhang
c16e786c75 vulkan/wsi: drop unused common wsi helpers
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
Below are dropped:
- wsi_common_get_image
- wsi_common_bind_swapchain_image

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36095>
2025-07-13 07:49:10 +00:00
Connor Abbott
c65017f746 vk/runtime: Handle VK_PIPELINE_CREATE_2_PER_LAYER_FRAGMENT_DENSITY_BIT_VALVE
This flag must match in pre-rasterization and fragment shader state.
Pass it through in both.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35594>
2025-07-11 22:05:18 +00:00
Daniel Stone
355b96413d egl/wayland: Move bind_wayland_display to legacy build option
Similar to how support for X11's DRI2 protocol was deprecated in 24.2,
begin deprecating EGL_WL_bind_wayland_display (including
eglBindWaylandDisplayWL et al) by moving it behind a legacy-wayland
build option.

This extension was originally created in a pre-dmabuf world, where we
didn't have a universally-accepted way of exchanging buffers between
client and compositor, or even really the ability to describe formats
and modifiers universally.

Since then, the world has settled on dmabuf with DRM FourCC and
modifiers. We've had the zwp_linux_dmabuf_v1 protocol for 10 years now:
both clients and compositors implement this protocol to handle buffer
sharing. Compositors either use EGL_EXT_image_dma_buf_import or the
Vulkan dmabuf extensions to import these into GPU world.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36026>
2025-07-10 14:51:20 +00:00
Yiwei Zhang
e625862794 vulkan/wsi: add wsi_common_get_memory
The current wsi_common_get_image api is mainly used for aliased wsi
image binding. However, it's not a convenient api because what's missing
is the swapchain image memory bound, with which we can trivially fix the
VkBindImageMemoryInfo so it works just like a normal binding request
from the driver pov. To be noted, besides the simplification of the
driver codes, this helper is also to prepare for common BindImageMemory2
implementation.

Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35875>
2025-07-09 23:45:03 +00:00
Mike Blumenkrantz
0f5c663513 vulkan/cmd_queue: don't null deref when freeing pNext
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36004>
2025-07-09 05:48:22 +00:00