Import from CS git

This commit is contained in:
eabdullin 2025-11-11 10:02:00 +00:00
parent 8b021a8fa7
commit 112ceb6ce2
9 changed files with 484 additions and 2749 deletions

8
.gitignore vendored
View File

@ -1,5 +1,5 @@
SOURCES/libclc-19.1.1.src.tar.xz
SOURCES/mesa-24.2.8.tar.xz
SOURCES/libclc-20.1.3.src.tar.xz
SOURCES/mesa-25.0.7.tar.xz
SOURCES/meson-1.3.0.tar.gz
SOURCES/spirv-llvm-translator-90a9764.tar.gz
SOURCES/wayland-protocols-1.34.tar.xz
SOURCES/spirv-llvm-translator-834db1a.tar.gz
SOURCES/wayland-protocols-1.38.tar.xz

View File

@ -1,5 +1,5 @@
81a02b6bb65f0d0e3704a6dbeea919340a7b108c SOURCES/libclc-19.1.1.src.tar.xz
c7994d1bf40879518b6ae331dd92e04b6e9d436e SOURCES/mesa-24.2.8.tar.xz
0d3fda8d6ac128ead0883253008c24f16b7d3848 SOURCES/libclc-20.1.3.src.tar.xz
7f98eca4670fe20cebb327a0d78f01d76332f861 SOURCES/mesa-25.0.7.tar.xz
6e2c98cccd1b85d5fe8716e7b0f6f080acd77f37 SOURCES/meson-1.3.0.tar.gz
821a2175ada624e0aa397b26ea25eb2dfe25a1dc SOURCES/spirv-llvm-translator-90a9764.tar.gz
9e2df4b15428c0b0ce7d9256d4f469b70daab524 SOURCES/wayland-protocols-1.34.tar.xz
23de2f0b60789090c06f33ea7293d862b0362af4 SOURCES/spirv-llvm-translator-834db1a.tar.gz
3fbb7095a8a33e8465351c25ff1fc01bedeafacd SOURCES/wayland-protocols-1.38.tar.xz

View File

@ -0,0 +1,88 @@
From 870b8717b25eceadac8dd653debe8346826227cb Mon Sep 17 00:00:00 2001
From: Dave Airlie <airlied@redhat.com>
Date: Mon, 9 Jun 2025 09:19:28 +1000
Subject: [PATCH] Revert "hasvk/elk: stop turning load_push_constants into
load_uniform"
This reverts commit b036d2ded2de32e81730ec8ce37c803bad112efa.
This seems to break gtk4 and other stuff.
Cc: mesa-stable
(taking ack from Lionel saying we should revert)
Acked-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35407>
---
src/intel/compiler/elk/elk_fs_nir.cpp | 4 ++--
src/intel/vulkan_hasvk/anv_nir_apply_pipeline_layout.c | 6 +++---
src/intel/vulkan_hasvk/anv_nir_compute_push_layout.c | 3 +--
3 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/src/intel/compiler/elk/elk_fs_nir.cpp b/src/intel/compiler/elk/elk_fs_nir.cpp
index 459e2d966b7..6b78d6cf9f8 100644
--- a/src/intel/compiler/elk/elk_fs_nir.cpp
+++ b/src/intel/compiler/elk/elk_fs_nir.cpp
@@ -4969,8 +4969,7 @@ fs_nir_emit_intrinsic(nir_to_elk_state &ntb,
break;
}
- case nir_intrinsic_load_uniform:
- case nir_intrinsic_load_push_constant: {
+ case nir_intrinsic_load_uniform: {
/* Offsets are in bytes but they should always aligned to
* the type size
*/
@@ -7058,3 +7057,4 @@ nir_to_elk(elk_fs_visitor *s)
ralloc_free(ntb.mem_ctx);
}
+
diff --git a/src/intel/vulkan_hasvk/anv_nir_apply_pipeline_layout.c b/src/intel/vulkan_hasvk/anv_nir_apply_pipeline_layout.c
index 2bedf9017ed..1c613a9ebe7 100644
--- a/src/intel/vulkan_hasvk/anv_nir_apply_pipeline_layout.c
+++ b/src/intel/vulkan_hasvk/anv_nir_apply_pipeline_layout.c
@@ -463,9 +463,9 @@ build_buffer_addr_for_res_index(nir_builder *b,
nir_iadd(b, res.dyn_offset_base, res.array_index);
nir_def *dyn_load =
- nir_load_uniform(b, 1, 32, nir_imul_imm(b, dyn_offset_idx, 4),
- .base = offsetof(struct anv_push_constants, dynamic_offsets),
- .range = MAX_DYNAMIC_BUFFERS * 4);
+ nir_load_push_constant(b, 1, 32, nir_imul_imm(b, dyn_offset_idx, 4),
+ .base = offsetof(struct anv_push_constants, dynamic_offsets),
+ .range = MAX_DYNAMIC_BUFFERS * 4);
nir_def *dynamic_offset =
nir_bcsel(b, nir_ieq_imm(b, res.dyn_offset_base, 0xff),
diff --git a/src/intel/vulkan_hasvk/anv_nir_compute_push_layout.c b/src/intel/vulkan_hasvk/anv_nir_compute_push_layout.c
index ed314af8b98..8a3f83f2c26 100644
--- a/src/intel/vulkan_hasvk/anv_nir_compute_push_layout.c
+++ b/src/intel/vulkan_hasvk/anv_nir_compute_push_layout.c
@@ -55,7 +55,6 @@ anv_nir_compute_push_layout(nir_shader *nir,
has_const_ubo = true;
break;
- case nir_intrinsic_load_uniform:
case nir_intrinsic_load_push_constant: {
unsigned base = nir_intrinsic_base(intrin);
unsigned range = nir_intrinsic_range(intrin);
@@ -132,7 +131,6 @@ anv_nir_compute_push_layout(nir_shader *nir,
nir_intrinsic_instr *intrin = nir_instr_as_intrinsic(instr);
switch (intrin->intrinsic) {
- case nir_intrinsic_load_uniform:
case nir_intrinsic_load_push_constant: {
/* With bindless shaders we load uniforms with SEND
* messages. All the push constants are located after the
@@ -141,6 +139,7 @@ anv_nir_compute_push_layout(nir_shader *nir,
* elk_nir_lower_rt_intrinsics.c).
*/
unsigned base_offset = push_start;
+ intrin->intrinsic = nir_intrinsic_load_uniform;
nir_intrinsic_set_base(intrin,
nir_intrinsic_base(intrin) -
base_offset);
--
2.49.0

View File

@ -0,0 +1,46 @@
From 24f85c06c28736b73c14208a0ffa6657d2aee9cd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jos=C3=A9=20Exp=C3=B3sito?= <jexposit@redhat.com>
Date: Mon, 21 Apr 2025 13:52:14 +0200
Subject: [PATCH] Revert "kopper: Explicitly choose zink"
On QEMU (virtio driver), without 3D acceleration enabled and without
mesa-vulkan-drivers installed, this commit prevents Mutter to start.
This reverts commit c0bc957c5d8c7edd57626284b712dd6ea1e375fc.
Related: https://bugzilla.redhat.com/show_bug.cgi?id=2360851
Related: https://gitlab.freedesktop.org/mesa/mesa/-/issues/13009
---
.pick_status.json | 2 +-
src/gallium/frontends/dri/kopper.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/.pick_status.json b/.pick_status.json
index 99df2fb30c2..cdf3965678c 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -16204,7 +16204,7 @@
"description": "kopper: Explicitly choose zink",
"nominated": false,
"nomination_type": 0,
- "resolution": 1,
+ "resolution": 4,
"main_sha": null,
"because_sha": null,
"notes": null
diff --git a/src/gallium/frontends/dri/kopper.c b/src/gallium/frontends/dri/kopper.c
index a1d7dcb79b4..3bdb56022a9 100644
--- a/src/gallium/frontends/dri/kopper.c
+++ b/src/gallium/frontends/dri/kopper.c
@@ -73,7 +73,7 @@ kopper_init_screen(struct dri_screen *screen, bool driver_name_is_inferred)
bool success;
#ifdef HAVE_LIBDRM
if (screen->fd != -1)
- success = pipe_loader_drm_probe_fd(&screen->dev, screen->fd, true);
+ success = pipe_loader_drm_probe_fd(&screen->dev, screen->fd, false);
else
success = pipe_loader_vk_probe_dri(&screen->dev);
#else
--
2.49.0

View File

@ -0,0 +1,154 @@
From ebf600843432f73a05a9848d60cecd219ca2e01f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= <marek.olsak@amd.com>
Date: Fri, 21 Feb 2025 01:14:39 -0500
Subject: [PATCH] glx: don't call GL functions directly, use the current
dispatch instead
With glvnd, GL functions will not be publicly exported from libGLX_mesa
and we don't even need them privately defined.
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33634>
---
src/glx/drisw_glx.c | 6 ++++--
src/glx/meson.build | 2 +-
src/glx/xfont.c | 46 +++++++++++++++++++++++----------------------
3 files changed, 29 insertions(+), 25 deletions(-)
diff --git a/src/glx/drisw_glx.c b/src/glx/drisw_glx.c
index 45837a81f37..58cc0e7d09a 100644
--- a/src/glx/drisw_glx.c
+++ b/src/glx/drisw_glx.c
@@ -43,6 +43,8 @@
#include "kopper_interface.h"
#include "loader_dri_helper.h"
#include "dri_util.h"
+#include "mapi/glapi/glapi.h"
+#include "mesa/main/dispatch.h"
static int xshm_error = 0;
static int xshm_opcode = -1;
@@ -540,7 +542,7 @@ driswSwapBuffers(__GLXDRIdrawable * pdraw,
(void) remainder;
if (flush) {
- glFlush();
+ CALL_Flush(GET_DISPATCH(), ());
}
if (psc->kopper)
@@ -556,7 +558,7 @@ drisw_copy_sub_buffer(__GLXDRIdrawable * pdraw,
int x, int y, int width, int height, Bool flush)
{
if (flush) {
- glFlush();
+ CALL_Flush(GET_DISPATCH(), ());
}
driswCopySubBuffer(pdraw->dri_drawable, x, y, width, height);
diff --git a/src/glx/meson.build b/src/glx/meson.build
index b52b91c5269..3315a7843fa 100644
--- a/src/glx/meson.build
+++ b/src/glx/meson.build
@@ -113,7 +113,7 @@ if with_platform_windows
endif
libglx = static_library(
'glx',
- [files_libglx, glx_generated],
+ [files_libglx, glx_generated, main_dispatch_h],
include_directories : [inc_include, inc_src, inc_glapi, inc_loader, inc_loader_x11,
inc_gallium, inc_mesa, inc_st_dri, inc_gallium_aux],
c_args : [
diff --git a/src/glx/xfont.c b/src/glx/xfont.c
index d58b02f189a..f1ca7bba032 100644
--- a/src/glx/xfont.c
+++ b/src/glx/xfont.c
@@ -36,6 +36,8 @@
#ifdef GLX_DIRECT_RENDERING
#include "glxclient.h"
+#include "mapi/glapi/glapi.h"
+#include "mesa/main/dispatch.h"
/* Implementation. */
@@ -197,22 +199,22 @@ DRI_glXUseXFont(struct glx_context *CC, Font font, int first, int count, int lis
#endif
/* Save the current packing mode for bitmaps. */
- glGetIntegerv(GL_UNPACK_SWAP_BYTES, &swapbytes);
- glGetIntegerv(GL_UNPACK_LSB_FIRST, &lsbfirst);
- glGetIntegerv(GL_UNPACK_ROW_LENGTH, &rowlength);
- glGetIntegerv(GL_UNPACK_SKIP_ROWS, &skiprows);
- glGetIntegerv(GL_UNPACK_SKIP_PIXELS, &skippixels);
- glGetIntegerv(GL_UNPACK_ALIGNMENT, &alignment);
+ CALL_GetIntegerv(GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, &swapbytes));
+ CALL_GetIntegerv(GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, &lsbfirst));
+ CALL_GetIntegerv(GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, &rowlength));
+ CALL_GetIntegerv(GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, &skiprows));
+ CALL_GetIntegerv(GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, &skippixels));
+ CALL_GetIntegerv(GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, &alignment));
/* Enforce a standard packing mode which is compatible with
fill_bitmap() from above. This is actually the default mode,
except for the (non)alignment. */
- glPixelStorei(GL_UNPACK_SWAP_BYTES, GL_FALSE);
- glPixelStorei(GL_UNPACK_LSB_FIRST, GL_FALSE);
- glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
- glPixelStorei(GL_UNPACK_SKIP_ROWS, 0);
- glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0);
- glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+ CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, GL_FALSE));
+ CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, GL_FALSE));
+ CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, 0));
+ CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, 0));
+ CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, 0));
+ CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, 1));
pixmap = XCreatePixmap(dpy, RootWindow(dpy, screen), 10, 10, 1);
values.foreground = BlackPixel(dpy, DefaultScreen(dpy));
@@ -260,18 +262,18 @@ DRI_glXUseXFont(struct glx_context *CC, Font font, int first, int count, int lis
bm_width = (width + 7) / 8;
bm_height = height;
- glNewList(list, GL_COMPILE);
+ CALL_NewList(GET_DISPATCH(), (list, GL_COMPILE));
if (valid && (bm_width > 0) && (bm_height > 0)) {
memset(bm, '\0', bm_width * bm_height);
fill_bitmap(dpy, screen, gc, bm_width, bm_height, x, y, c, bm);
- glBitmap(width, height, x0, y0, dx, dy, bm);
+ CALL_Bitmap(GET_DISPATCH(), (width, height, x0, y0, dx, dy, bm));
}
else {
- glBitmap(0, 0, 0.0, 0.0, dx, dy, NULL);
+ CALL_Bitmap(GET_DISPATCH(), (0, 0, 0.0, 0.0, dx, dy, NULL));
}
- glEndList();
+ CALL_EndList(GET_DISPATCH(), ());
}
free(bm);
@@ -279,12 +281,12 @@ DRI_glXUseXFont(struct glx_context *CC, Font font, int first, int count, int lis
XFreeGC(dpy, gc);
/* Restore saved packing modes. */
- glPixelStorei(GL_UNPACK_SWAP_BYTES, swapbytes);
- glPixelStorei(GL_UNPACK_LSB_FIRST, lsbfirst);
- glPixelStorei(GL_UNPACK_ROW_LENGTH, rowlength);
- glPixelStorei(GL_UNPACK_SKIP_ROWS, skiprows);
- glPixelStorei(GL_UNPACK_SKIP_PIXELS, skippixels);
- glPixelStorei(GL_UNPACK_ALIGNMENT, alignment);
+ CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, swapbytes));
+ CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, lsbfirst));
+ CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, rowlength));
+ CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, skiprows));
+ CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, skippixels));
+ CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, alignment));
}
#endif
--
2.51.0

View File

@ -1,128 +0,0 @@
From 622f7407d7a002030b24ed384532cb6d585b3479 Mon Sep 17 00:00:00 2001
From: Benjamin ROBIN <dev@benjarobin.fr>
Date: Sun, 5 Jan 2025 16:36:12 +0100
Subject: [PATCH 1/2] util/disk_cache: Do not try to delete old cache if cache
is disabled
Prevent following warning if not running as a normal user:
Failed to create /home for shader cache (Permission denied)---disabling
disk_cache_delete_old_cache() is going to create first the cache directory
using disk_cache_generate_cache_dir(). From mkdir_if_needed(), the stat()
of "/home" is failing with "Permission denied" under some circumstances
when using Firefox.
Fixes: #12168
Fixes: c3bc6991d27c61b5c1b3 ("util/disk_cache: Delete the old multifile cache if using the default.")
Signed-off-by: Benjamin ROBIN <dev@benjarobin.fr>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32886>
---
src/util/disk_cache.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/util/disk_cache.c b/src/util/disk_cache.c
index a6940ee494084..391f8cfdc1da9 100644
--- a/src/util/disk_cache.c
+++ b/src/util/disk_cache.c
@@ -232,7 +232,7 @@ disk_cache_create(const char *gpu_name, const char *driver_id,
/* Since switching the default cache to <mesa_shader_cache_db>, remove the
* old cache folder if it hasn't been modified for more than 7 days.
*/
- if (!getenv("MESA_SHADER_CACHE_DIR") && !getenv("MESA_GLSL_CACHE_DIR"))
+ if (!getenv("MESA_SHADER_CACHE_DIR") && !getenv("MESA_GLSL_CACHE_DIR") && disk_cache_enabled())
disk_cache_delete_old_cache();
}
--
GitLab
From 023db569e8f7bf325fba86a1fa4ba984026a532c Mon Sep 17 00:00:00 2001
From: Benjamin ROBIN <dev@benjarobin.fr>
Date: Sun, 5 Jan 2025 17:03:52 +0100
Subject: [PATCH 2/2] docs: Update MESA_SHADER_CACHE_DIR env variable behavior
Update documentation to match implementation of
disk_cache_generate_cache_dir().
Signed-off-by: Benjamin ROBIN <dev@benjarobin.fr>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32886>
---
docs/envvars.rst | 21 ++++++++++++---------
src/util/disk_cache_os.c | 13 +++++++++----
2 files changed, 21 insertions(+), 13 deletions(-)
diff --git a/docs/envvars.rst b/docs/envvars.rst
index 7247158cc5073..e812b9280777a 100644
--- a/docs/envvars.rst
+++ b/docs/envvars.rst
@@ -200,10 +200,11 @@ Core Mesa environment variables
.. envvar:: MESA_SHADER_CACHE_DIR
if set, determines the directory to be used for the on-disk cache of
- compiled shader programs. If this variable is not set, then the cache
- will be stored in ``$XDG_CACHE_HOME/mesa_shader_cache_db`` (if that
- variable is set), or else within ``.cache/mesa_shader_cache_db`` within
- the user's home directory.
+ compiled shader programs. If set then the cache will be stored in
+ ``$MESA_SHADER_CACHE_DIR/mesa_shader_cache_db``. If this variable is not
+ set, then the cache will be stored in
+ ``$XDG_CACHE_HOME/mesa_shader_cache_db`` (if that variable is set), or else
+ within ``.cache/mesa_shader_cache_db`` within the user's home directory.
.. envvar:: MESA_SHADER_CACHE_SHOW_STATS
@@ -218,9 +219,10 @@ Core Mesa environment variables
cache DBs via :envvar:`MESA_DISK_CACHE_READ_ONLY_FOZ_DBS` or
:envvar:`MESA_DISK_CACHE_READ_ONLY_FOZ_DBS_DYNAMIC_LIST`. This
implementation does not support cache size limits via
- :envvar:`MESA_SHADER_CACHE_MAX_SIZE`. If
- :envvar:`MESA_SHADER_CACHE_DIR` is not set, the cache will be stored
- in ``$XDG_CACHE_HOME/mesa_shader_cache_sf`` (if that variable is set)
+ :envvar:`MESA_SHADER_CACHE_MAX_SIZE`. If :envvar:`MESA_SHADER_CACHE_DIR`
+ is set, the cache will be stored in
+ ``$MESA_SHADER_CACHE_DIR/mesa_shader_cache_sf``, or else within
+ ``$XDG_CACHE_HOME/mesa_shader_cache_sf`` (if that variable is set)
or else within ``.cache/mesa_shader_cache_sf`` within the user's home
directory.
@@ -229,8 +231,9 @@ Core Mesa environment variables
if set to 1, enables the multi file on-disk shader cache implementation
instead of the default Mesa-DB cache implementation.
This implementation increases the overall disk usage.
- If :envvar:`MESA_SHADER_CACHE_DIR` is not set, the cache will be stored
- in ``$XDG_CACHE_HOME/mesa_shader_cache`` (if that variable is set)
+ If :envvar:`MESA_SHADER_CACHE_DIR` is set, the cache will be stored in
+ ``$MESA_SHADER_CACHE_DIR/mesa_shader_cache``, or else within
+ ``$XDG_CACHE_HOME/mesa_shader_cache`` (if that variable is set)
or else within ``.cache/mesa_shader_cache`` within the user's home
directory.
diff --git a/src/util/disk_cache_os.c b/src/util/disk_cache_os.c
index 8d6ce428c1823..09051491d332f 100644
--- a/src/util/disk_cache_os.c
+++ b/src/util/disk_cache_os.c
@@ -873,10 +873,15 @@ disk_cache_write_item_to_disk(struct disk_cache_put_job *dc_job,
/* Determine path for cache based on the first defined name as follows:
*
- * $MESA_SHADER_CACHE_DIR
- * $XDG_CACHE_HOME/mesa_shader_cache
- * $HOME/.cache/mesa_shader_cache
- * <pwd.pw_dir>/.cache/mesa_shader_cache
+ * $MESA_SHADER_CACHE_DIR/mesa_shader_cache*
+ * $XDG_CACHE_HOME/mesa_shader_cache*
+ * $HOME/.cache/mesa_shader_cache*
+ * <pwd.pw_dir>/.cache/mesa_shader_cache*
+ *
+ * The directory 'mesa_shader_cache*' is named depending of cache type:
+ * - For DISK_CACHE_MULTI_FILE: mesa_shader_cache
+ * - For DISK_CACHE_SINGLE_FILE: mesa_shader_cache_sf
+ * - For DISK_CACHE_DATABASE: mesa_shader_cache_db
*/
char *
disk_cache_generate_cache_dir(void *mem_ctx, const char *gpu_name,
--
GitLab

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,144 @@
From e4eb5e80c316c0af3fff310ca89e1175d81556c1 Mon Sep 17 00:00:00 2001
From: Nikita Popov <npopov@redhat.com>
Date: Thu, 27 Feb 2025 15:44:27 +0100
Subject: [PATCH] clover: Don't include libclc headers
Per https://github.com/llvm/llvm-project/issues/119967 these
headers are internal implementation details of libclc and were
never supposed to be installed. They are not available anymore
since LLVM 20. Instead opencl-c.h should be used.
There already ise a code path for including opencl-c.h, so always
use it.
This didn't work for me out of the box, because the build system
currently hardcodes the clang resource directory, which is incorrect
for Fedora at least. Fix this by using GetResourcePath +
CLANG_RESOURCE_DIR provided by clang instead. This is basically
the same as what is done in clc_helper.c
I've still retained the old behavior as a fallback just in case
(e.g. if clang is linked statically?)
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33805>
---
.../frontends/clover/llvm/invocation.cpp | 53 +++++++++++++------
src/gallium/frontends/clover/meson.build | 5 +-
2 files changed, 39 insertions(+), 19 deletions(-)
diff --git a/src/gallium/frontends/clover/llvm/invocation.cpp b/src/gallium/frontends/clover/llvm/invocation.cpp
index 3cbb05baecf67..ca030b404d791 100644
--- a/src/gallium/frontends/clover/llvm/invocation.cpp
+++ b/src/gallium/frontends/clover/llvm/invocation.cpp
@@ -24,6 +24,8 @@
// OTHER DEALINGS IN THE SOFTWARE.
//
+#include <dlfcn.h>
+
#include <llvm/IR/DiagnosticPrinter.h>
#include <llvm/IR/DiagnosticInfo.h>
#include <llvm/IR/LLVMContext.h>
@@ -39,6 +41,8 @@
#include <clang/Frontend/TextDiagnosticBuffer.h>
#include <clang/Frontend/TextDiagnosticPrinter.h>
#include <clang/Basic/TargetInfo.h>
+#include <clang/Config/config.h>
+#include <clang/Driver/Driver.h>
#if LLVM_VERSION_MAJOR >= 20
#include <llvm/Support/VirtualFileSystem.h>
@@ -323,6 +327,30 @@ namespace {
return c;
}
+ std::string getResourceDirectory() {
+ Dl_info info;
+ if (dladdr((void *)clang::CompilerInvocation::CreateFromArgs, &info) == 0) {
+ return FALLBACK_CLANG_RESOURCE_DIR;
+ }
+
+ char *libclang_path = realpath(info.dli_fname, NULL);
+ if (libclang_path == nullptr) {
+ return FALLBACK_CLANG_RESOURCE_DIR;
+ }
+
+ // GetResourcePath is a way to retrieve the actual libclang resource dir based on a given
+ // binary or library.
+ std::string clang_resource_dir =
+#if LLVM_VERSION_MAJOR >= 20
+ clang::driver::Driver::GetResourcesPath(std::string(libclang_path));
+#else
+ clang::driver::Driver::GetResourcesPath(std::string(libclang_path), CLANG_RESOURCE_DIR);
+#endif
+ free(libclang_path);
+
+ return clang_resource_dir;
+ }
+
std::unique_ptr<Module>
compile(LLVMContext &ctx, clang::CompilerInstance &c,
const std::string &name, const std::string &source,
@@ -331,25 +359,18 @@ namespace {
c.getFrontendOpts().ProgramAction = clang::frontend::EmitLLVMOnly;
c.getHeaderSearchOpts().UseBuiltinIncludes = true;
c.getHeaderSearchOpts().UseStandardSystemIncludes = true;
- c.getHeaderSearchOpts().ResourceDir = CLANG_RESOURCE_DIR;
- if (use_libclc) {
- // Add libclc generic search path
- c.getHeaderSearchOpts().AddPath(LIBCLC_INCLUDEDIR,
- clang::frontend::Angled,
- false, false);
+ std::string clang_resource_dir = getResourceDirectory();
+ c.getHeaderSearchOpts().ResourceDir = clang_resource_dir;
- // Add libclc include
- c.getPreprocessorOpts().Includes.push_back("clc/clc.h");
- } else {
- // Add opencl-c generic search path
- c.getHeaderSearchOpts().AddPath(CLANG_RESOURCE_DIR,
- clang::frontend::Angled,
- false, false);
+ // Add opencl-c generic search path
+ std::string clang_include_path = clang_resource_dir + "/include";
+ c.getHeaderSearchOpts().AddPath(clang_include_path,
+ clang::frontend::Angled,
+ false, false);
- // Add opencl include
- c.getPreprocessorOpts().Includes.push_back("opencl-c.h");
- }
+ // Add opencl include
+ c.getPreprocessorOpts().Includes.push_back("opencl-c.h");
// Add definition for the OpenCL version
const auto dev_version = dev.device_version();
diff --git a/src/gallium/frontends/clover/meson.build b/src/gallium/frontends/clover/meson.build
index e569b86a1bea7..56a9894f0dbb1 100644
--- a/src/gallium/frontends/clover/meson.build
+++ b/src/gallium/frontends/clover/meson.build
@@ -10,7 +10,6 @@ clover_opencl_cpp_args = [
'-DCL_USE_DEPRECATED_OPENCL_2_0_APIS',
'-DCL_USE_DEPRECATED_OPENCL_2_1_APIS',
'-DCL_USE_DEPRECATED_OPENCL_2_2_APIS',
- '-DLIBCLC_INCLUDEDIR="@0@/"'.format(dep_clc.get_variable(pkgconfig : 'includedir')),
'-DLIBCLC_LIBEXECDIR="@0@/"'.format(dep_clc.get_variable(pkgconfig : 'libexecdir'))
]
clover_incs = [inc_include, inc_src, inc_gallium, inc_gallium_aux]
@@ -43,9 +42,9 @@ libclllvm = static_library(
cpp_args : [
clover_cpp_args,
clover_opencl_cpp_args,
- '-DCLANG_RESOURCE_DIR="@0@"'.format(join_paths(
+ '-DFALLBACK_CLANG_RESOURCE_DIR="@0@"'.format(join_paths(
dep_llvm.get_variable(cmake : 'LLVM_LIBRARY_DIR', configtool: 'libdir'), 'clang',
- dep_llvm.version(), 'include',
+ dep_llvm.version()
)),
],
gnu_symbol_visibility : 'hidden',
--
GitLab

View File

@ -66,7 +66,7 @@
Name: mesa
Summary: Mesa graphics libraries
%global ver 24.2.8
%global ver 25.0.7
Version: %{lua:ver = string.gsub(rpm.expand("%{ver}"), "-", "~"); print(ver)}
Release: 3%{?dist}
License: MIT AND BSD-3-Clause AND SGI-B-2.0
@ -84,7 +84,7 @@ Source2: https://github.com/mesonbuild/meson/releases/download/%{meson_ver}/meso
# libclc is not available in RHEL but it is required for Intel drivers since
# mesa >= 24.1.0
%global libclc_version 19.1.1
%global libclc_version 20.1.3
Source3: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{libclc_version}/libclc-%{libclc_version}.src.tar.xz
BuildRequires: libedit-devel
BuildRequires: clang-devel >= %{libclc_version}
@ -92,8 +92,8 @@ BuildRequires: clang-devel >= %{libclc_version}
# BuildRequires: spirv-llvm-translator-tools
# spirv-llvm-translator is a dependency of libclc
%global spirv_llvm_trans_ver 19.1.1
%global spirv_llvm_trans_commit 90a976491d3847657396456e0e94d7dc48d35996
%global spirv_llvm_trans_ver 20.1.0
%global spirv_llvm_trans_commit 834db1a1985ac36d5a3e1b4b34dc1ca3f919ad5b
%global spirv_llvm_trans_shortcommit %(c=%{spirv_llvm_trans_commit}; echo ${c:0:7})
Source4: https://github.com/KhronosGroup/SPIRV-LLVM-Translator/archive/%{spirv_llvm_trans_commit}/spirv-llvm-translator-%{spirv_llvm_trans_shortcommit}.tar.gz
BuildRequires: cmake
@ -103,22 +103,29 @@ BuildRequires: spirv-headers-devel
BuildRequires: spirv-tools-devel
BuildRequires: zlib-devel
# wayland-protocols >= 1.34 is required
%global wayland_protocols_ver 1.34
# wayland-protocols >= 1.38 is required
%global wayland_protocols_ver 1.38
Source5: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/releases/%{wayland_protocols_ver}/downloads/wayland-protocols-%{wayland_protocols_ver}.tar.xz
BuildRequires: wayland-devel
Patch10: gnome-shell-glthread-disable.patch
# AMD Navi4x support:
# Backport fixes for radeonsi and disable GFX12 on radv
# https://issues.redhat.com/browse/RHEL-53419
Patch11: RHEL-53423.patch
# Backport of https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33805
# to fix clover with libclc from LLVM 20.
Patch20: e4eb5e80c316c0af3fff310ca89e1175d81556c1.patch
# Fix for firefox crash seen on NV dGFX
# Backport fixes for firefox crash seen on NV dGFX
# https://issues.redhat.com/browse/RHEL-107885
Patch12: 32886.patch
# This patch makes Fedora CI fail and causes issues in QEMU. Revert it until
# we find a fix.
# https://bugzilla.redhat.com/show_bug.cgi?id=2360851
# https://gitlab.freedesktop.org/mesa/mesa/-/issues/13009
Patch40: 0001-Revert-kopper-Explicitly-choose-zink.patch
# Upstream revert for gtk corruption on haswell
Patch50: 0001-Revert-hasvk-elk-stop-turning-load_push_constants-in.patch
# Black screen on ppc64le:
# Fix direct gl calls
Patch12: 0001-glx-don-t-call-GL-functions-directly-use-the-current.patch
# Build our own version but keep the dependency for the RPM macros
BuildRequires: meson
@ -131,7 +138,7 @@ BuildRequires: kernel-headers
# We only check for the minimum version of pkgconfig(libdrm) needed so that the
# SRPMs for each arch still have the same build dependencies. See:
# https://bugzilla.redhat.com/show_bug.cgi?id=1859515
BuildRequires: pkgconfig(libdrm) >= 2.4.121
BuildRequires: pkgconfig(libdrm) >= 2.4.122
%if 0%{?with_libunwind}
BuildRequires: pkgconfig(libunwind)
%endif
@ -141,7 +148,7 @@ BuildRequires: pkgconfig(libzstd)
BuildRequires: pkgconfig(libselinux)
BuildRequires: pkgconfig(wayland-scanner)
# Build our own version
# BuildRequires: pkgconfig(wayland-protocols) >= 1.34
# BuildRequires: pkgconfig(wayland-protocols) >= 1.38
BuildRequires: pkgconfig(wayland-client) >= 1.11
BuildRequires: pkgconfig(wayland-server) >= 1.11
BuildRequires: pkgconfig(wayland-egl-backend) >= 3
@ -230,16 +237,15 @@ Obsoletes: mesa-omx-drivers < %{?epoch:%{epoch}:}%{version}-%{release}
%package libGL
Summary: Mesa libGL runtime libraries
Requires: %{name}-libglapi%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release}
Requires: libglvnd-glx%{?_isa} >= 1:1.3.2
Recommends: %{name}-dri-drivers%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release}
Requires: %{name}-dri-drivers%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release}
%description libGL
%{summary}.
%package libGL-devel
Summary: Mesa libGL development package
Requires: %{name}-libGL%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release}
Requires: (%{name}-libGL%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release} if %{name}-libGL%{?_isa})
Requires: libglvnd-devel%{?_isa} >= 1:1.3.2
Provides: libGL-devel
Provides: libGL-devel%{?_isa}
@ -252,15 +258,14 @@ Recommends: gl-manpages
Summary: Mesa libEGL runtime libraries
Requires: libglvnd-egl%{?_isa} >= 1:1.3.2
Requires: %{name}-libgbm%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release}
Requires: %{name}-libglapi%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release}
Recommends: %{name}-dri-drivers%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release}
Requires: %{name}-dri-drivers%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release}
%description libEGL
%{summary}.
%package libEGL-devel
Summary: Mesa libEGL development package
Requires: %{name}-libEGL%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release}
Requires: (%{name}-libEGL%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release} if %{name}-libEGL%{?_isa})
Requires: libglvnd-devel%{?_isa} >= 1:1.3.2
Requires: %{name}-khr-devel%{?_isa}
Provides: libEGL-devel
@ -272,10 +277,11 @@ Provides: libEGL-devel%{?_isa}
%package dri-drivers
Summary: Mesa-based DRI drivers
Requires: %{name}-filesystem%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release}
Requires: %{name}-libglapi%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release}
%if 0%{?with_va}
Recommends: %{name}-va-drivers%{?_isa}
%endif
Obsoletes: %{name}-libglapi < 25.0.0~rc2-1
Provides: %{name}-libglapi >= 25.0.0~rc2-1
# If mesa-libEGL is installed, it must match in version. This is here to prevent using
# mesa-libEGL < 23.0.3-1 (frozen in the 'fedora' repo) which didn't have strong enough
# inter-dependencies. See https://bugzilla.redhat.com/show_bug.cgi?id=2193135 .
@ -305,7 +311,6 @@ Requires: %{name}-filesystem%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{rel
%package libOSMesa
Summary: Mesa offscreen rendering libraries
Requires: %{name}-libglapi%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release}
Provides: libOSMesa
Provides: libOSMesa%{?_isa}
@ -360,22 +365,10 @@ Provides: libxatracker-devel%{?_isa}
%{summary}.
%endif
%package libglapi
Summary: Mesa shared glapi
Provides: libglapi
Provides: libglapi%{?_isa}
# If mesa-dri-drivers are installed, they must match in version. This is here to prevent using
# older mesa-dri-drivers together with a newer mesa-libglapi or its dependants.
# See https://bugzilla.redhat.com/show_bug.cgi?id=2193135 .
Requires: (%{name}-dri-drivers%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release} if %{name}-dri-drivers%{?_isa})
%description libglapi
%{summary}.
%if 0%{?with_opencl}
%package libOpenCL
Summary: Mesa OpenCL runtime library
Requires: ocl-icd%{?_isa}
Requires: (ocl-icd%{?_isa} or OpenCL-ICD-Loader%{?_isa})
Requires: libclc%{?_isa}
Requires: %{name}-libgbm%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release}
Requires: opencl-filesystem
@ -487,7 +480,7 @@ sed -e "s!libexecdir=!libexecdir=\/%{buildroot}!" -i %{buildroot}%{_libdir}/pkgc
# Build wayland-protocols
cd wayland-protocols-%{wayland_protocols_ver}
%meson --prefix=%{buildroot}
%meson --prefix=%{buildroot} -Dtests=false
%meson_build
%meson_install
cd -
@ -515,12 +508,11 @@ export MESON_PACKAGE_CACHE_DIR="%{cargo_registry}/"
%meson \
-Dplatforms=x11,wayland \
-Ddri3=enabled \
-Dosmesa=true \
%if 0%{?with_hardware}
-Dgallium-drivers=swrast,virgl,nouveau%{?with_r300:,r300}%{?with_crocus:,crocus}%{?with_iris:,iris}%{?with_vmware:,svga}%{?with_radeonsi:,radeonsi}%{?with_r600:,r600}%{?with_freedreno:,freedreno}%{?with_etnaviv:,etnaviv}%{?with_tegra:,tegra}%{?with_vc4:,vc4}%{?with_v3d:,v3d}%{?with_lima:,lima}%{?with_panfrost:,panfrost}%{?with_vulkan_hw:,zink} \
-Dgallium-drivers=llvmpipe,virgl,nouveau%{?with_r300:,r300}%{?with_crocus:,crocus}%{?with_i915:,i915}%{?with_iris:,iris}%{?with_vmware:,svga}%{?with_radeonsi:,radeonsi}%{?with_r600:,r600}%{?with_freedreno:,freedreno}%{?with_etnaviv:,etnaviv}%{?with_tegra:,tegra}%{?with_vc4:,vc4}%{?with_v3d:,v3d}%{?with_lima:,lima}%{?with_panfrost:,panfrost}%{?with_vulkan_hw:,zink} \
%else
-Dgallium-drivers=swrast,virgl \
-Dgallium-drivers=llvmpipe,virgl \
%endif
-Dgallium-vdpau=%{?with_vdpau:enabled}%{!?with_vdpau:disabled} \
-Dgallium-va=%{?with_va:enabled}%{!?with_va:disabled} \
@ -628,7 +620,6 @@ popd
%dir %{_includedir}/GL/internal
%{_includedir}/GL/internal/dri_interface.h
%{_libdir}/pkgconfig/dri.pc
%{_libdir}/libglapi.so
%files libEGL
%{_datadir}/glvnd/egl_vendor.d/50_mesa.json
@ -638,10 +629,6 @@ popd
%{_includedir}/EGL/eglext_angle.h
%{_includedir}/EGL/eglmesaext.h
%files libglapi
%{_libdir}/libglapi.so.0
%{_libdir}/libglapi.so.0.*
%files libOSMesa
%{_libdir}/libOSMesa.so.8*
%files libOSMesa-devel
@ -706,6 +693,7 @@ popd
%files dri-drivers
%{_datadir}/drirc.d/00-mesa-defaults.conf
%{_libdir}/libgallium-*.so
%{_libdir}/gbm/dri_gbm.so
%{_libdir}/dri/kms_swrast_dri.so
%{_libdir}/dri/libdril_dri.so
%{_libdir}/dri/swrast_dri.so
@ -859,10 +847,18 @@ popd
%endif
%changelog
* Tue Aug 5 2025 Anusha Srivatsa <asrivats@redhat.com> - 24.2.8-3
* Thu Sep 18 2025 Jocelyn Falempe <jfalempe@redhat.com> - 25.0.7-3
- Fix black screen on ppc64le
Resolves: https://issues.redhat.com/browse/RHEL-113831
* Wed Jul 16 2025 Anusha Srivatsa <asrivats@redhat.com> - 25.0.7-2
- NV dGFX fix for firefox crashing
Backport fixes for NV dGFX driver crashing firefox
Resolves: https://issues.redhat.com/browse/RHEL-107885
Resolves: https://issues.redhat.com/browse/RHEL-93219
* Wed Jun 18 2025 José Expósito <jexposit@redhat.com> - 25.0.7-1
* Update to 25.0.7
Resolves: https://issues.redhat.com/browse/RHEL-75954
* Thu Feb 13 2025 José Expósito <jexposit@redhat.com> - 24.2.8-2
- AMD Navi4x support