試着用 opencv-samples 裏面的 stitching 拼圖片:
mkdir tmp && cd ./tmp
cp /usr/share/opencv4/samples/cpp/stitching.cpp ./
g++ -o stitching stitching.cpp $(pkgconf --cflags opencv4) $(pkgconf --libs opencv4)
./stitching --mode scans 1.png 2.png 3.png
XRT build version: 2.21.75
Build hash: 4eb1f4392a012b4e6eca759762389c612537f7c7
Build date: 2026-04-24 10:52:40
Git branch: makepkg
PID: 173216
UID: 1000
[Thu May 28 07:19:25 2026 GMT]
HOST: reimu
EXE: /home/farseerfc/tmp/test-opencv/stitching
[XRT] ERROR: No devices found
[XRT] ERROR: No devices found
[XRT] ERROR: No devices found
[1] 173216 segmentation fault (core dumped) ./stitching --mode scans 1.png 2.png 3.png
關掉 rusticl 後端就正常了:
RUSTICL_ENABLE=0 ./stitching --mode scans 1.png 2.png 3.png
XRT build version: 2.21.75
Build hash: 4eb1f4392a012b4e6eca759762389c612537f7c7
Build date: 2026-04-24 10:52:40
Git branch: makepkg
PID: 173503
UID: 1000
[Thu May 28 07:19:59 2026 GMT]
HOST: reimu
EXE: /home/farseerfc/tmp/test-opencv/stitching
[XRT] ERROR: No devices found
[XRT] ERROR: No devices found
[XRT] ERROR: No devices found
stitching completed successfully
result.jpg saved
復現可以用兩張有點重疊的截圖作爲 1.png 和 2.png ,比如
看 coredump 確實是死在了 rusticl 的 nir shader 裏
Core was generated by `./stitching --mode scans 1.png 2.png'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 src_init () at ../mesa-26.1.1/src/compiler/nir/nir.c:763
763 src->ssa = NULL;
[Current thread is 1 (Thread 0x7f6b29ffb6c0 (LWP 175238))]
(gdb) bt
#0 src_init () at ../mesa-26.1.1/src/compiler/nir/nir.c:763
#1 nir_call_instr_create () at ../mesa-26.1.1/src/compiler/nir/nir.c:926
#2 0x00007f6b72aa7c9d in clone_call () at ../mesa-26.1.1/src/compiler/nir/nir_clone.c:483
#3 clone_instr () at ../mesa-26.1.1/src/compiler/nir/nir_clone.c:528
#4 0x00007f6b72aa81eb in clone_block () at ../mesa-26.1.1/src/compiler/nir/nir_clone.c:583
#5 clone_cf_list () at ../mesa-26.1.1/src/compiler/nir/nir_clone.c:637
#6 0x00007f6b72aa84c4 in clone_if () at ../mesa-26.1.1/src/compiler/nir/nir_clone.c:605
#7 clone_cf_list () at ../mesa-26.1.1/src/compiler/nir/nir_clone.c:640
#8 0x00007f6b72aa84c4 in clone_if () at ../mesa-26.1.1/src/compiler/nir/nir_clone.c:605
#9 clone_cf_list () at ../mesa-26.1.1/src/compiler/nir/nir_clone.c:640
#10 0x00007f6b72aa84c4 in clone_if () at ../mesa-26.1.1/src/compiler/nir/nir_clone.c:605
#11 clone_cf_list () at ../mesa-26.1.1/src/compiler/nir/nir_clone.c:640
#12 0x00007f6b72aa83ca in clone_loop () at ../mesa-26.1.1/src/compiler/nir/nir_clone.c:620
#13 clone_cf_list () at ../mesa-26.1.1/src/compiler/nir/nir_clone.c:643
#14 0x00007f6b72aa84c4 in clone_if () at ../mesa-26.1.1/src/compiler/nir/nir_clone.c:605
#15 clone_cf_list () at ../mesa-26.1.1/src/compiler/nir/nir_clone.c:640
#16 0x00007f6b72aa88d8 in clone_function_impl () at ../mesa-26.1.1/src/compiler/nir/nir_clone.c:714
#17 0x00007f6b72aa8e92 in nir_shader_clone () at ../mesa-26.1.1/src/compiler/nir/nir_clone.c:846
#18 0x00007f6b72a52a4d in mesa_rust::compiler::nir::NirShader::dup_for_driver (self=0x7f6b29ff2948) at ../mesa-26.1.1/src/gallium/frontends/rusticl/mesa/compiler/nir.rs:197
#19 0x00007f6b72a4fe72 in mesa_rust::compiler::nir::{impl#9}::clone (self=0x7f6b29ff2948) at ../mesa-26.1.1/src/gallium/frontends/rusticl/mesa/compiler/nir.rs:512
#20 0x00007f6b729d176c in rusticl::core::kernel::{impl#58}::clone (self=0x7f6b29ff2930) at ../mesa-26.1.1/src/gallium/frontends/rusticl/core/kernel.rs:583
#21 0x00007f6b729de108 in rusticl::core::kernel::compile_nir_remaining::{closure#1} () at ../mesa-26.1.1/src/gallium/frontends/rusticl/core/kernel.rs:1127
#22 0x00007f6b72a21ab7 in core::bool::{impl#0}::then<rusticl::core::kernel::CompilationResult, rusticl::core::kernel::compile_nir_remaining::{closure_env#1}> (self=true, f=...)
at /usr/src/debug/rust/rustc-1.95.0-src/library/core/src/bool.rs:66
#23 0x00007f6b729ddf4b in rusticl::core::kernel::compile_nir_remaining (dev=0x56030ab4d710, nir=..., args=..., name=...) at ../mesa-26.1.1/src/gallium/frontends/rusticl/core/kernel.rs:1127
#24 0x00007f6b729dd4c8 in rusticl::core::kernel::convert_spirv_to_nir::{closure#2} () at ../mesa-26.1.1/src/gallium/frontends/rusticl/core/kernel.rs:1248
#25 0x00007f6b729eaf52 in core::option::Option<rusticl::core::kernel::SPIRVToNirResult>::unwrap_or_else<rusticl::core::kernel::SPIRVToNirResult, rusticl::core::kernel::convert_spirv_to_nir::{closure_env#2}> (self=..., f=...) at /usr/src/debug/rust/rustc-1.95.0-src/library/core/src/option.rs:1067
#26 0x00007f6b729dd1db in rusticl::core::kernel::convert_spirv_to_nir (build=0x56030b278f60, name=..., args=..., spec_constants=0x56030b25d8e0, dev=0x56030ab4d710)
at ../mesa-26.1.1/src/gallium/frontends/rusticl/core/kernel.rs:1239
#27 0x00007f6b729780bd in rusticl::core::program::ProgramBuild::rebuild_kernels (self=0x56030b25d868, devs=..., is_src=true)
at ../mesa-26.1.1/src/gallium/frontends/rusticl/core/program.rs:141
#28 0x00007f6b72979ffc in rusticl::core::program::create_build_closure::{closure#0} () at ../mesa-26.1.1/src/gallium/frontends/rusticl/core/program.rs:978
#29 0x00007f6b72a117d0 in mesa_rust::util::queue::exec_rust_job<rusticl::core::program::create_build_closure::{closure_env#0}> (data=0x56030b26b8c0)
at ../mesa-26.1.1/src/gallium/frontends/rusticl/mesa/util/queue.rs:123
#30 0x00007f6b72c31911 in util_queue_thread_func () at ../mesa-26.1.1/src/util/u_queue.c:294
#31 0x00007f6b72c7a90d in impl_thrd_routine () at ../mesa-26.1.1/src/c11/impl/threads_posix.c:43
#32 0x00007f6b994981b9 in start_thread (arg=<optimized out>) at pthread_create.c:454
#33 0x00007f6b9951d21c in __GI___clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
執行環境是 AMD 的 CPU 和 GPU 。
CPU: AMD Ryzen Threadripper 3960X 24-Core (48) @ 4.57 GHz
GPU 1: AMD Radeon RX 5700 XT [Discrete]
GPU 2: AMD Radeon RX 9060 XT [Discrete]
有人能復現麼?
這是該給 mesa 開 bug 麼?

