Bug 6654

Summary: mpv failed to play any video
Product: Fedora Reporter: trung.le
Component: mesa-freeworldAssignee: Luya Tshimbalanga <luya_tfz>
Status: RESOLVED FIXED    
Severity: normal CC: leigh123linux
Priority: P1    
Version: f38   
Hardware: ppc64le   
OS: GNU/Linux   
namespace:

Description trung.le 2023-04-24 15:18:06 CEST
## Info

OS: Fedora 38 (6.2.11-300.fc38.ppc64le)
Hardware: AMD Radeon RX 6600XT (amdgpu driver)
Software: mesa-va-drivers-freeworld 23.0.2-1.fc38.ppc64le

## How to reproduce

Just use mpv to play any video: mpv demo.mp4
The app would crash and yield following errors:

```
Cannot find target for triple amdgcn-- Unable to find target for this triple (no targets are registered)
Segmentation fault (core dumped)
```

Upon closer look, the stack trace is:

```
LLVMCreateTargetMachine (T=0x0, Triple=0x7fffa61a66a0 "amdgcn--", CPU=0x7fffa61a6660 "gfx1032", Features=0x7fffa61005a0 "", Level=LLVMCodeGenLevelDefault, Reloc=LLVMRelocDefault, 
    CodeModel=<optimized out>) at /usr/src/debug/llvm15-15.0.7-4.fc38.ppc64le/lib/Target/TargetMachineC.cpp:146
146       return wrap(unwrap(T)->createTargetMachine(Triple, CPU, Features, opt, RM, CM,                                                                                                      
(gdb) bt
#0  LLVMCreateTargetMachine(LLVMTargetRef, char const*, char const*, char const*, LLVMCodeGenOptLevel, LLVMRelocMode, LLVMCodeModel)
    (T=0x0, Triple=0x7fffa61a66a0 "amdgcn--", CPU=0x7fffa61a6660 "gfx1032", Features=0x7fffa61005a0 "", Level=LLVMCodeGenLevelDefault, Reloc=LLVMRelocDefault, CodeModel=<optimized out>)
    at /usr/src/debug/llvm15-15.0.7-4.fc38.ppc64le/lib/Target/TargetMachineC.cpp:146
#1  0x00007fffa5c541f8 in ac_create_target_machine
    (family=family@entry=CHIP_NAVI23, tm_options=tm_options@entry=0, level=level@entry=LLVMCodeGenLevelDefault, out_triple=out_triple@entry=0x7fffde19c970)
    at ../src/amd/llvm/ac_llvm_util.c:205
#2  0x00007fffa5c54808 in ac_init_llvm_compiler (compiler=0x7fffb436f090, family=CHIP_NAVI23, tm_options=0) at ../src/amd/llvm/ac_llvm_util.c:309
#3  0x00007fffa5b552a4 in si_init_compiler (sscreen=sscreen@entry=0x7fffb436e530, compiler=compiler@entry=0x7fffb436f090) at ../src/gallium/drivers/radeonsi/si_pipe.c:153
#4  0x00007fffa5b55828 in radeonsi_screen_create_impl (ws=<optimized out>, config=0x7fffde19cd28) at ../src/gallium/drivers/radeonsi/si_pipe.c:1171
#5  0x00007fffb998e648 in amdgpu_winsys_create (fd=<optimized out>, config=0x7fffde19cd28, screen_create=0x7fffa5b55350 <radeonsi_screen_create_impl>)
    at ../src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c:579
#6  0x00007fffa5b56744 in radeonsi_screen_create (fd=16, config=0x7fffde19cd28) at ../src/gallium/drivers/radeonsi/si_pipe.c:1506
#7  0x00007fffa5860afc in pipe_radeonsi_create_screen (fd=<optimized out>, config=<optimized out>) at ../src/gallium/auxiliary/target-helpers/drm_helper.h:222
#8  0x00007fffa59f802c in pipe_loader_drm_create_screen (dev=<optimized out>, config=<optimized out>, sw_vk=<optimized out>) at ../src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c:270
#9  0x00007fffa59f7f68 in pipe_loader_create_screen_vk (dev=0x7fffb436acf0, sw_vk=false) at ../src/gallium/auxiliary/pipe-loader/pipe_loader.c:171
#10 0x00007fffa5878df8 in vl_dri3_screen_create (display=<optimized out>, screen=<optimized out>) at ../src/gallium/auxiliary/vl/vl_winsys_dri3.c:836
#11 0x00007fffa5863848 in __vaDriverInit_1_18 (ctx=0x7fffb42cbed0) at ../src/gallium/frontends/va/context.c:142
#12 0x00007ffff4d61598 in va_openDriver (dpy=dpy@entry=0x7fffb43122a0, driver_name=0x7fffb42ac950 "radeonsi") at ../va/va.c:522
#13 0x00007ffff4d65980 in vaInitialize (dpy=0x7fffb43122a0, major_version=0x7fffde19d29c, minor_version=0x7fffde19d298) at ../va/va.c:740
#14 0x00000001001f0a6c in va_initialize (display=0x7fffb43122a0, plog=0x7fffb43121c0, probing=true) at ../video/vaapi.c:116
#15 0x00000001001a1aa0 in init (hw=0x7fffb43114c0) at ../video/out/hwdec/hwdec_vaapi.c:155
#16 0x000000010017da2c in ra_hwdec_load_driver (is_auto=false, drv=0x1003ac738 <ra_hwdec_vaapi>, devs=0x7fffb4312120, global=0x100416330, log=0x1004b32c0, ra=0x7fffb42b2380)
    at ../video/out/gpu/hwdec.c:103
#17 load_add_hwdec (is_auto=false, drv=0x1003ac738 <ra_hwdec_vaapi>, devs=0x7fffb4312120, ctx=0x7fffb430f9e0) at ../video/out/gpu/hwdec.c:237
#18 load_add_hwdec (ctx=ctx@entry=0x7fffb430f9e0, devs=devs@entry=0x7fffb4312120, drv=0x1003ac738 <ra_hwdec_vaapi>, is_auto=false) at ../video/out/gpu/hwdec.c:227
#19 0x0000000100183ef4 in ra_hwdec_ctx_load_fmt (ctx=0x7fffb430f9e0, devs=0x7fffb4312120, params=0x7fffffffe1e8) at ../video/out/gpu/hwdec.c:339
#20 0x00000001001ba7ec in gl_video_load_hwdecs_for_img_fmt (params=<optimized out>, devs=<optimized out>, p=0x7fffb42cd590) at ../video/out/gpu/video.c:4340
#21 request_hwdec_api (data=<optimized out>, vo=0x1004b3350) at ../video/out/vo_gpu.c:131
#22 control (vo=0x1004b3350, request=<optimized out>, data=<optimized out>) at ../video/out/vo_gpu.c:202
#23 0x00000001001b263c in run_control (p=0x7fffffffe138) at ../video/out/vo.c:659
#24 0x00000001000d2c5c in mp_dispatch_queue_process (queue=0x10045cd00, timeout=0) at ../misc/dispatch.c:300
#25 0x00000001001b962c in vo_thread (ptr=0x1004b3350) at ../video/out/vo.c:1098
#26 0x00007ffff3ab7bc4 in start_thread (arg=0x7fffde19e3e0) at pthread_create.c:444
#27 0x00007ffff3b68f84 in clone () at ../sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S:107
```

and dmesg yields:

```
[  216.939956] mpv/vo[3906]: segfault (11) at 60 nip 7fff1aaf6b04 lr 7fff1aaf6afc code 1 in libLLVM-15.so[7fff18470000+3cd0000]
[  216.939971] mpv/vo[3906]: code: 7fa3eb78 4ba3f9e9 e8410018 7c781b78 283e0000 3a800000 3ae00000 41820014 
[  216.939975] mpv/vo[3906]: code: 7fc3f378 4ba3f9c9 e8410018 7c771b78 <eabc0060> 28350000 418200cc 3879ffff 
```

## Questions

1/ Is there any reason why we still use LLVM 15 for this package? Should we be on v16?

2/
Comment 2 trung.le 2023-04-25 13:37:59 CEST
The testing RPM works for me. Great thanks. Closing this ticket now