Commit graph

2802 commits

Author SHA1 Message Date
Juan A. Suarez Romero
fa25e2de48 util: add DECLARE_LINEAR_ZALLOC with no sanitize
This specific macro allow to create a new() operator version with a
sanitizer flag disabled.

Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Reviewed-by: Yonggang Luo <luoyonggang@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36884>
2025-08-21 12:09:04 +00:00
Juan A. Suarez Romero
1c2aa6f5c3 meson: check for no_sanitize function attributes
Meson doesn't support for checking no_sanitize attributes, so we do it
manually through testing.

Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Reviewed-by: Yonggang Luo <luoyonggang@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36884>
2025-08-21 12:09:04 +00:00
Yiwei Zhang
5568085568 driconf: drop obsolete DRI_CONF_VK_KHR_PRESENT_WAIT
Acked-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36835>
2025-08-21 07:53:15 +00:00
Marek Olšák
61c58fa0af util/hash_table: add _mesa_hash_table_copy, a cloning helper without allocation
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36728>
2025-08-21 06:13:48 +00:00
Marek Olšák
271a1d8dd9 util/hash_table: don't allocate hash_table_u64::table, declare it statically
We can use _mesa_hash_table_init instead of _mesa_hash_table_create.
It doesn't have to be allocated.

Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36728>
2025-08-21 06:13:48 +00:00
Marek Olšák
9724f7eeae util/hash_table: set _mesa_hash_table_init return type to void
it always returns true because it no longer allocates anything

Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36728>
2025-08-21 06:13:48 +00:00
Marek Olšák
bcffade9af util/hash_table: don't allocate the smallest table, declare it in the struct
When compiling Heaven shaders with radeonsi+ACO, this reduces the total
number of ralloc calls by 10.8% (same number as the sets, which also reduced
it by 10.8%). Apparently we like to create a lot of hash tables.

Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36728>
2025-08-21 06:13:48 +00:00
Marek Olšák
2028caad28 util/hash_table: improve support for usage without "hash_table" allocation
_mesa_hash_table_init & _mesa_hash_table_fini (and equivalents) is
the preferred way to set up hash tables.

This adds missing "init" and "fini" functions.

_mesa_string_hash_table_create is also changed to non-inline.

Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36728>
2025-08-21 06:13:48 +00:00
Marek Olšák
be5a15f11d util/hash_table: start with 16 entries to reduce reallocations
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36728>
2025-08-21 06:13:48 +00:00
Marek Olšák
06cef7bcc2 util/set: add _mesa_set_copy, a cloning helper without allocation
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36728>
2025-08-21 06:13:48 +00:00
Marek Olšák
ed246aafd8 util/set: set _mesa_set_init return type to void
it always returns true because it no longer allocates anything

Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36728>
2025-08-21 06:13:48 +00:00
Marek Olšák
34cfc2600f util/set: don't allocate the smallest table, declare it in the struct
When compiling Heaven shaders with radeonsi+ACO, this reduces the total
number of ralloc calls by 10.8%. _mesa_set_init was the biggest user
of ralloc (rzalloc_array) during shader compilation.

Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36728>
2025-08-21 06:13:48 +00:00
Marek Olšák
3ead244914 util/set: start with 16 entries to reduce reallocations when growing the set
The set originally started with just 2 entries.

Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36728>
2025-08-21 06:13:47 +00:00
Marek Olšák
9efee5f75f util/set: improve support for usage without "set" structure allocation
The set can be used without allocating the "set" structure, so let's
add missing init and fini functions.

Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36728>
2025-08-21 06:13:47 +00:00
Yonggang Luo
3f3bc4ece5 util/format: u_format_gen.h are using UTIL_ARCH_LITTLE_ENDIAN, include util/u_endian.h for it
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Eric Engestrom <eric@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36891>
2025-08-21 03:18:59 +08:00
Yonggang Luo
b2761d1481 util: Remove usage of USE_**_ASM macros
Use DETECT_ARCH_X86 DETECT_ARCH_X86_64 DETECT_ARCH_AARCH64 DETECT_CC_GCC instead

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36635>
2025-08-20 16:21:28 +00:00
Yonggang Luo
a3e3c889d1 util: Add DETECT_ARCH_SPARC64 for sparc
By reference to
https://sourceforge.net/p/predef/wiki/Architectures/

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36635>
2025-08-20 16:21:27 +00:00
Boris Brezillon
5e01ec4bd0 util/format: Auto-generate a bunch of YUV helpers
Now that the YUV subsampling pattern is encoded in the name, we can
auto-generate a bunch of helpers that were previously hand-written,
and are pretty often lagging behind when new formats are added.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35177>
2025-08-20 14:01:07 +00:00
Boris Brezillon
f20ee2806e util/format: Add subsampling info to our YUV-as-RGB format names
This will allow for more autogen and is good to have regardless, because
it makes it clear what the subsampling is when looking at the name.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35177>
2025-08-20 14:01:07 +00:00
Boris Brezillon
75ba8f403d util/format: Use more descriptive names for YUV formats
This is the first step for more auto-generated YUV helpers. We keep
the short/fourcc names as aliases, and generate defines so we don't have
to patch the existing code, but ultimately, it'd be good to consistently
use the fully descriptive names so it's easier to reason about the
formats when reading the code.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35177>
2025-08-20 14:01:07 +00:00
Boris Brezillon
fabd0d82db util/format: Auto-generate the enum pipe_format definition
I've recently discovered a case where the enum entry was defined, but the
description in the yaml was missing, leading to a NULL deref when we
were querying the util_format_description object for this format.

This autogen of the enum will also allow for more autogen, and proper
classication of formats.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35177>
2025-08-20 14:01:06 +00:00
Olivia Lee
78d3b9cd0a perfetto: allow specifying clock domain for cpu timestamps
Everything is currently using CLOCK_BOOTTIME, which is perfetto's
default, and matches the previous behavior. On some hardware, different
clocks may be better synchronized with the gpu clock.

Signed-off-by: Olivia Lee <olivia.lee@collabora.com>
Reviewed-by: Eric R. Smith <eric.smith@collabora.com>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34390>
2025-08-19 09:50:36 +00:00
Yonggang Luo
fcab92d557 util: Now DETECT_ARCH_X86_64 can be safely used in rounding.h
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36744>
2025-08-15 09:27:19 +00:00
Yonggang Luo
219905aec7 util: Add DETECT_ARCH_ARM64EC for defined(_M_ARM64EC) equivalent
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36744>
2025-08-15 09:27:19 +00:00
Yonggang Luo
9beb0e90b4 util: Update DETECT_ARCH_X86_64 to exclude _M_ARM64EC
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36744>
2025-08-15 09:27:19 +00:00
Yonggang Luo
e14a9e7fe4 util: Remove dbghelp.h that already comes with winsdk and mingw for fix warning with mingw
The warning is:
../../src/util/dbghelp.h:900:10: warning: the current #pragma pack alignment value is modified in the included file [-Wpragma-pack]
  900 | #include <pshpack4.h>

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36708>
2025-08-13 13:18:52 +00:00
Aleksi Sapon
3bd0badd3a util: SWAP macro implementation for older MSVC versions
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Acked-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36682>
2025-08-11 13:50:02 +00:00
Erik Faye-Lund
fe42a3d0eb meson/util: properly detect sysconf
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
There's two functions that use sysconf(), and they don't seem to agree
on what combination of platforms supports the function. Let's perform
proper function detection instead.

Acked-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Eric Engestrom <eric@igalia.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36621>
2025-08-11 12:30:23 +00:00
Erik Faye-Lund
e636991c78 prefer _SC_PAGESIZE over _SC_PAGE_SIZE
The POSIX spec says that_SC_PAGE_SIZE is a synonym for _SC_PAGESIZE, and
both will have the same value. Let's be consistent in which one we use,
and let's use the one that points directly to the authoritative
documentation.

Acked-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Eric Engestrom <eric@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36621>
2025-08-11 12:30:23 +00:00
Lars-Ivar Hesselberg Simonsen
78ca5ef87f u_trace: Indirect capture fixes
Fixes a missing sizeof parenthesis.
Fixes multiple indirects writing to the same address.

Fixes: 0a17035b5c ("u_trace: add support for indirect data")
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Christoph Pillmayer <christoph.pillmayer@arm.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36519>
2025-08-11 10:12:29 +00:00
Yonggang Luo
8f88991024 util: Remove usage of WIN32 macro for DETECT_OS_WINDOWS
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
As we use _WIN32 in many place, and WIN32 usage are depends on windows.h that defined in minwindef.h.
So do not use it at all, after this change, DETECT_OS_WINDOWS and _WIN32 will have the same effect.
This is for avoid confusion when DETECT_OS_WINDOWS and _WIN32 are mixed used.

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Eric Engestrom <eric@igalia.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36654>
2025-08-08 19:38:54 +00:00
Yonggang Luo
070bf8986c util: Upgrade xxhash.h to v0.8.3
Download with:
curl https://raw.githubusercontent.com/Cyan4973/xxHash/refs/tags/v0.8.3/xxhash.h -o src/util/xxhash.h

This is for avoid invalid use `defined(WIN32)`

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Eric Engestrom <eric@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36654>
2025-08-08 19:38:54 +00:00
Yonggang Luo
2a6ac3a79c util: Add namespace over float16_t in half_float.h
As float16_t may comes from arm_neon.h:
arm_neon.h:74:16: error: conflicting declaration 'typedef __fp16 float16_t'
   74 | typedef __fp16 float16_t;

Also it is std::float16_t from <stdfloat> as part of C++23

So place it under namespace mesa to avoid conflict when upgrading xxhash.h to v0.8.3

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Eric Engestrom <eric@igalia.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36654>
2025-08-08 19:38:54 +00:00
Yiwei Zhang
e74516dbc7 util/perf: amend missing atrace_init
When perfetto isn't enabled, atrace can still be used freely on Android.
All trace micros have accounted for that, but the init is missed.

Cc: mesa-stable
Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36655>
2025-08-08 16:02:30 +00:00
Yonggang Luo
723eeac89b util: Refactoring util_dl_get_path_from_proc out of clc/clc_helpers.cpp
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
For getting clc_helpers.cpp can be compiled with gcc/mingw

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Eric Engestrom <eric@igalia.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36597>
2025-08-07 21:15:13 +00:00
Matt Turner
a8ab696033 meson: Allow configuring with Android-internal perfetto
This enables ninja-to-soong to generate an Android.bp that builds Mesa
against Android's `libperfetto_client_experimental` library.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36561>
2025-08-07 16:22:37 +00:00
Yurii Kolesnykov
bdb9b50dc4 Guard double include of libdrm.h by defining LIBDRM_H
Signed-off-by: Yurii Kolesnykov <root@yurikoles.com>
Reviewed-by: Eric Engestrom <eric@igalia.com>
Fixes: 4be68b119e ("loader: Don't load nouveau GL on nvidia kmd")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36495>
2025-08-06 08:46:52 +00:00
Marek Olšák
6b2cb71560 glsl: add support for linear_ctx into ir_instruction
The type of the "new operator" parameter determines whether ir_instruction
is allocated with linear_ctx or ralloc. The ralloc operators will be
removed in the next commit.

GCC expects classes with virtual functions to have a virtual destructor,
but linear_ctx has static assertions that expects that no destructor is
present. Remove the assertions, as that's our only option. The destructor
is empty including in all derived classes, so it doesn't have to execute.

Acked-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Acked-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36539>
2025-08-04 02:07:00 +00:00
Marek Olšák
ae5b168051 ralloc/linalloc: allow adding custom code to LINEAR_ALLOC new operator
for GLSL IR

Acked-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Acked-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36539>
2025-08-04 02:07:00 +00:00
Alyssa Rosenzweig
7f2a6cdd26 hk: only enable image view min LOD for dx12
I don't really want random Vulkan apps using this. fixes Steam shading
precaching via fossilize.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36399>
2025-08-03 14:40:53 -04:00
Rob Clark
898fa317dd util: Optimize MESA_TRACE_FUNC()
Avoiding the vsnprintf speeds up drawoverhead -test 3 by 60+% !!

Signed-off-by: Rob Clark <rob.clark@oss.qualcomm.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36492>
2025-08-01 19:58:24 +00:00
Antonio Ospite
9ced3148ca util: avoid calling UNREACHABLE(str) macro without arguments
After commit 2dcd6bed6a ("util: enforce unreachable()'s argument being
a literal string", 2023-04-17) the compiler effectively emit errors when
an argument that is not a string literal is passed to UNREACHABLE(str),
however the compiler still allows the macro to be called without
arguments, which can be confusing.

Implement the type check outside of the assert() call so that we have
two types of errors:

1. The compiler will error out when the argument passed to the macro is
   not a string literal because the concatenation with an empty string
   will not be allowed.

2. The compiler will error out when no arguments are passed to the macro
   because the invocation of assert() will be invalid.

This also has the nice side-effect of removing the extra empty string
printed in the assert() messages; after the changes the messages will
look like:

  Assertion `!"Invalid type"' failed.

instead of:

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

Fixes: 2dcd6bed6a ("util: enforce unreachable()'s argument being a literal string", 2023-04-17)

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:43 +00:00
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
Gurchetan Singh
7390276d9b util: rust: make stubs simpler
Apparently, this works with a newer rustc.

Suggested-by: <nkgold@google.com>
Reviewed-by: Marcin Radomski <dextero@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36456>
2025-07-31 15:11:07 +00:00
Job Noorman
f95a62897c tu: add constlen shader stat
Signed-off-by: Job Noorman <jnoorman@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36460>
2025-07-30 16:05:15 +00:00
Mel Henning
4be68b119e loader: Don't load nouveau GL on nvidia kmd
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
The vulkan driver already has a check for this. This prevents the GL
driver from loading too.

Reviewed-by: Karol Herbst <kherbst@redhat.com>
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/13484
Fixes: e99446fc ("egl: Add EGL_EXT_device_query_name and EGL_EXT_device_persistent_id")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36449>
2025-07-29 23:52:32 +00:00
Timothy Arceri
6a217a06d9 util: remove recursion from bitset helpers
Recursion can cause a stack overflow when the range is very large.

Fixes: cb558b2b88 ("glsl: add mark_array_elements_referenced() fast path")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/13617

Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Caio Oliveira <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36430>
2025-07-29 23:07:12 +00:00
Paolo Bonzini
8ea232a9ae meson: rename Rust subprojects to NAME-SEMVER-rs
Use the convention for Rust subprojects that was adopted by Meson 1.5.0
and newer.

Distros would prefer to avoid vendored crate sources, and instead use
local sources from e.g. /usr/share/cargo/registry.  While Meson does not
support a local registry, it can be emulated with MESON_PACKAGE_CACHE_DIR.

However, because the distro might not be using the exact version of the
package, but only one that has the same semver, packagers need to add
some hacks to rewrite the wrap files.  For example, in Fedora:

    export MESON_PACKAGE_CACHE_DIR="%{cargo_registry}/"
    # So... Meson can't actually find them without tweaks
    %define inst_crate_nameversion() %(basename %{cargo_registry}/%{1}-*)
    %define rewrite_wrap_file() sed -e "/source.*/d" -e "s/%{1}-.*/%{inst_crate_nameversion %{1}}/" -i subprojects/%{1}.wrap
    %rewrite_wrap_file proc-macro2
    %rewrite_wrap_file quote
    %rewrite_wrap_file syn
    %rewrite_wrap_file unicode-ident
    %rewrite_wrap_file paste

Having a common convention for the name of Rust wraps makes it possible
to perform this transformation with a script without listing
the wraps one by one, and to share the script across multiple packages
(which will be useful when QEMU starts using Rust in a similar way to Mesa).

For an example of such a script, see
https://lore.kernel.org/r/20250722083507.678542-1-pbonzini@redhat.com/.

Acked-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36284>
2025-07-24 17:52:34 +00:00
Daniel Schürmann
699ae0aad9 util/time: add os_time_nanosleep_until() function
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