From befb9af14b51f514f008f7766cc506e388b483c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tapani=20P=C3=A4lli?= Date: Mon, 23 Feb 2026 09:08:17 +0200 Subject: [PATCH] util: bring back fix to avoid strict aliasing bugs in xxhash MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is commit b9e163fa67e that got lost in xxhash upgrade 070bf8986ce. Fixes graphics artifacts seen in multiple workloads with Intel driver when using clang compiler. Fixes also CTS tests: dEQP-GLES31.functional.geometry_shading.layered.fragment_layer_cubemap dEQP-GLES31.functional.geometry_shading.layered.fragment_layer_3d dEQP-GLES31.functional.geometry_shading.layered.fragment_layer_2d_array dEQP-GLES31.functional.geometry_shading.layered.fragment_layer_2d_multisample_array v2: pass arguments from meson.build instead of hardcoding (Eric Engestrom) Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/14684 Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/14107 Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/13895 Fixes: 070bf8986ce ("util: Upgrade xxhash.h to v0.8.3") Signed-off-by: Tapani Pälli Reviewed-by: Lionel Landwerlin (cherry picked from commit d2351b3d04d23e04398de234df53515b5a1dda5f) Part-of: --- .pick_status.json | 2 +- src/util/meson.build | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.pick_status.json b/.pick_status.json index 9dcd8d5227f..8bd00811a86 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -794,7 +794,7 @@ "description": "util: bring back fix to avoid strict aliasing bugs in xxhash", "nominated": true, "nomination_type": 2, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "070bf8986ce08bc58d1263fefb9e2e33de9e6bf4", "notes": null diff --git a/src/util/meson.build b/src/util/meson.build index 06066ab8aa1..62fc844f07f 100644 --- a/src/util/meson.build +++ b/src/util/meson.build @@ -349,9 +349,15 @@ _libmesa_util = static_library( build_by_default : false ) +# Mesa leaves strict aliasing on in the compiler, and xxhash code likes to +# dereference the passed in data as u32*, which means that the compiler is +# free to move the u32 read before the write of the struct members being +# hashed, and in practice it did in Freedreno and Intel drivers. +# Forcing 2 flags below prevents it. idep_mesautil = declare_dependency( sources : [shader_stats_h], link_with : _libmesa_util, + compile_args : [ '-DXXH_FORCE_ALIGN_CHECK=0', '-DXXH_FORCE_MEMORY_ACCESS=0' ], include_directories : [inc_util], dependencies : deps_for_libmesa_util, )