The emit_color_clear function in radv_meta_clear.c is causing a core dump with Cemu
Description
OS: Fedora 39
Mesa 23.3.5
GPU: AMD Radeon RX 7900 XTX (RADV NAVI31)
I compiled Cemu using this project: (but the issue also occurs if using the official Cemu appimage) https://github.com/leifliddy/podman-cemu-builder/blob/main/build.scripts/01-build.cemu.sh
This issue only started occurring after upgrading my video card from an Nvidia RTX 3070 to an AMD RX 7900 XTX. I mean it worked fine w/ the Nvidia proprietary drivers. But, it's not due to left over artifacts or anything -- as I ran Cemu from a "clean" environment.
I'm not sure whether this issue lies with Cemu or with Mesa, I'll try downgrading mesa later -- I'll also try using the main branch as well.
But I know this issue isn't new: https://www.reddit.com/r/EmuDeck/comments/x7g2lj/tekken_tag_2_through_cemu_crashes_on_character/
I did file a ticket with Cemu as well: https://github.com/cemu-project/Cemu/issues/1100
So here's the issue, when I run Tekken TT2 on Cemu, the menu works fine, but once I select a character for a fight -- Cemu crashes.
Error: signal 11:
/usr/lib64/libvulkan_radeon.so(+0xaba42) [0x7f28ba0aba42]
/lib64/libc.so.6(+0x3e9a0) [0x7f29e80019a0]
/usr/lib64/libvulkan_radeon.so(+0xaba42) [0x7f28ba0aba42]
/usr/lib64/libvulkan_radeon.so(+0xac0f6) [0x7f28ba0ac0f6]
/usr/lib64/libvulkan_radeon.so(+0xac30c) [0x7f28ba0ac30c]
/usr/lib64/libvulkan_radeon.so(+0xacd72) [0x7f28ba0acd72]
./Cemu() [0x5e4eb8]
./Cemu() [0x5e75b6]
./Cemu() [0x8848e2]
./Cemu() [0x87bb3f]
./Cemu() [0x59bd4f]
/lib64/libstdc++.so.6(+0xe31e3) [0x7f29e6ce31e3]
/lib64/libc.so.6(+0x8e897) [0x7f29e8051897]
/lib64/libc.so.6(+0x11580c) [0x7f29e80d880c]
Steps to reproduce
Download or install Cemu along with a copy Tekken TT2 (I know that's never going to happen), then procure an AMD's Navi 31 GPU and run it on F39 with mesa 23.3.5....oh and ensure the Cemu is configured to use the Vulkan api (which it should be default)
System information
Please post inxi -GSC -xx
output (fenced with triple backticks) OR fill information below manually
System:
Host: black.example.com Kernel: 6.7.5-200.fc39.x86_64 arch: x86_64 bits: 64
compiler: gcc v: 2.40-14.fc39
Desktop: Cinnamon v: 6.0.4 tk: GTK v: 3.24.41 wm: Muffin dm: LightDM
Distro: Fedora Linux 39 (Thirty Nine)
CPU:
Info: 16-core model: AMD Ryzen 9 7950X bits: 64 type: MT MCP arch: Zen 4
rev: 2 cache: L1: 1024 KiB L2: 16 MiB L3: 64 MiB
Speed (MHz): avg: 601 high: 3650 min/max: 400/5881 cores: 1: 3650 2: 400
3: 400 4: 400 5: 400 6: 400 7: 400 8: 400 9: 400 10: 400 11: 400 12: 400
13: 400 14: 400 15: 400 16: 400 17: 400 18: 400 19: 400 20: 400 21: 400
22: 400 23: 400 24: 400 25: 400 26: 400 27: 3593 28: 400 29: 400 30: 400
31: 400 32: 400 bogomips: 287462
Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3 svm
Graphics:
Device-1: AMD Navi 31 [Radeon RX 7900 XT/7900 XTX/7900M]
vendor: Sapphire NITRO+ driver: amdgpu v: kernel arch: RDNA-3 pcie:
speed: 16 GT/s lanes: 16 ports: active: DP-1 empty: DP-2,HDMI-A-1,HDMI-A-2
bus-ID: 03:00.0 chip-ID: 1002:744c
Display: x11 server: X.Org v: 1.20.14 with: Xwayland v: 23.2.4 driver: X:
loaded: amdgpu unloaded: fbdev,modesetting,radeon,vesa dri: radeonsi
gpu: amdgpu display-ID: :0 screens: 1
Screen-1: 0 s-res: 3840x2160 s-dpi: 96
Monitor-1: DP-1 mapped: DisplayPort-0 model: LG (GoldStar) HDR 4K
res: 3840x2160 dpi: 163 diag: 690mm (27.2")
API: EGL v: 1.5 platforms: device: 0 drv: radeonsi device: 1 drv: swrast
surfaceless: drv: radeonsi x11: drv: radeonsi inactive: gbm,wayland
API: OpenGL v: 4.6 compat-v: 4.5 vendor: amd mesa v: 23.3.5 glx-v: 1.4
direct-render: yes renderer: AMD Radeon RX 7900 XTX (radeonsi navi31 LLVM
17.0.6 DRM 3.57 6.7.5-200.fc39.x86_64) device-ID: 1002:744c
API: Vulkan v: 1.3.268 surfaces: xcb,xlib device: 0 type: discrete-gpu
driver: mesa radv device-ID: 1002:744c device: 1 type: cpu
driver: mesa llvmpipe device-ID: 10005:0000
If applicable
xorg-x11-server-Xorg-1.20.14-30
Regression
- Did it used to work in a previous Mesa version?
I'm not sure, as this issue started after swapping an Nvidia card for an AMD one. I'll try installing Fedora on a usb drive and installing an older version of Mesa
gdb
gdb Cemu core.MainThread.1000.9a22b0dc20db4405bb56fcdb330d478e.352706.1708782917000000
......
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Core was generated by `./Cemu-gcc-full'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x00007f36482aba42 in emit_color_clear (view_mask=0, clear_rect=0x7f3533dfe080, clear_att=0x7f3533dfe140, cmd_buffer=0x341cd00) at ../src/amd/vulkan/meta/radv_meta_clear.c:325
325 if (device->meta_state.color_clear[samples_log2][clear_att->colorAttachment].color_pipelines[fs_key] ==
[Current thread is 1 (Thread 0x7f3533e006c0 (LWP 151442))]
backtrace
(gdb) bt
#0 0x00007fbf0ecaba42 in emit_color_clear (view_mask=0, clear_rect=0x7fbdfdffe030, clear_att=0x7fbdfdffe0f0, cmd_buffer=0x4e72ab0) at ../src/amd/vulkan/meta/radv_meta_clear.c:325
#1 emit_clear (cmd_buffer=cmd_buffer@entry=0x4e72ab0, clear_att=clear_att@entry=0x7fbdfdffe0f0, clear_rect=clear_rect@entry=0x7fbdfdffe030, pre_flush=pre_flush@entry=0x0, post_flush=post_flush@entry=0x0, view_mask=view_mask@entry=0)
at ../src/amd/vulkan/meta/radv_meta_clear.c:1780
#2 0x00007fbf0ecac0f6 in radv_clear_image_layer
(cmd_buffer=cmd_buffer@entry=0x4e72ab0, image=image@entry=0x7fbd883fe660, image_layout=image_layout@entry=VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, range=range@entry=0x7fbdfdfff5b0, format=format@entry=VK_FORMAT_BC3_UNORM_BLOCK, level=level@entry=0, layer_count=1, clear_val=0x7fbdfdffe420) at ../src/amd/vulkan/meta/radv_meta_clear.c:2000
#3 0x00007fbf0ecac30c in radv_cmd_clear_image
(cmd_buffer=cmd_buffer@entry=0x4e72ab0, image=image@entry=0x7fbd883fe660, image_layout=image_layout@entry=VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, clear_value=clear_value@entry=0x7fbdfdfff680, range_count=range_count@entry=1, ranges=ranges@entry=0x7fbdfdfff5b0, cs=false) at ../src/amd/vulkan/meta/radv_meta_clear.c:2142
#4 0x00007fbf0ecacd72 in radv_CmdClearColorImage (commandBuffer=0x4e72ab0, image_h=0x7fbd883fe660, imageLayout=VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, pColor=0x7fbdfdfff680, rangeCount=1, pRanges=0x7fbdfdfff5b0)
at ../src/amd/vulkan/meta/radv_meta_clear.c:2179
#5 0x000000000061940e in VulkanRenderer::ClearColorImageRaw (this=0x49dc310, image=0x7fbd883fe660, sliceIndex=0, mipIndex=0, color=..., inputLayout=VK_IMAGE_LAYOUT_GENERAL, outputLayout=VK_IMAGE_LAYOUT_GENERAL)
at /root/cemu/src/Cafe/HW/Latte/Renderer/Vulkan/VulkanRenderer.cpp:2807
#6 0x00000000006194cb in VulkanRenderer::ClearColorImage (this=0x49dc310, vkTexture=0x7fbd883ff080, sliceIndex=0, mipIndex=0, color=..., outputLayout=VK_IMAGE_LAYOUT_GENERAL)
at /root/cemu/src/Cafe/HW/Latte/Renderer/Vulkan/VulkanRenderer.cpp:2826
#7 0x000000000061a948 in VulkanRenderer::texture_clearColorSlice (this=0x49dc310, hostTexture=0x7fbd883ff080, sliceIndex=0, mipIndex=0, r=0.968627453, g=0.968627453, b=0, a=0)
at /root/cemu/src/Cafe/HW/Latte/Renderer/Vulkan/VulkanRenderer.cpp:3182
#8 0x0000000000ba8ca8 in LatteRenderTarget_applyTextureColorClear (texture=0x7fbd883ff080, sliceIndex=0, mipIndex=0, r=0.968627453, g=0.968627453, b=0, a=0, eventCounter=90337)
at /root/cemu/src/Cafe/HW/Latte/Core/LatteRenderTarget.cpp:753
#9 0x0000000000ba8ffb in LatteRenderTarget_itHLEClearColorDepthStencil
(clearMask=1, colorBufferMPTR=428130304, colorBufferFormat=290, colorBufferTilemode=Latte::E_HWTILEMODE::TM_2D_TILED_THIN1, colorBufferWidth=64, colorBufferHeight=64, colorBufferPitch=64, colorBufferViewFirstSlice=0, colorBufferViewNumSlice=1, depthBufferMPTR=0, depthBufferFormat=0, depthBufferTileMode=Latte::E_HWTILEMODE::TM_LINEAR_GENERAL, depthBufferWidth=0, depthBufferHeight=0, depthBufferPitch=0, depthBufferViewFirstSlice=0, depthBufferViewNumSlice=0, r=0.968627453, g=0.968627453, b=0, a=0, clearDepth=0, clearStencil=0) at /root/cemu/src/Cafe/HW/Latte/Core/LatteRenderTarget.cpp:825
#10 0x0000000000b97613 in LatteCP_itHLEClearColorDepthStencil (cmd=0x7fbd9e0cc188, nWords=23) at /root/cemu/src/Cafe/HW/Latte/Core/LatteCommandProcessor.cpp:894
#11 0x0000000000b98906 in LatteCP_ProcessRingbuffer () at /root/cemu/src/Cafe/HW/Latte/Core/LatteCommandProcessor.cpp:1588
#12 0x00000000005ca24f in Latte_ThreadEntry () at /root/cemu/src/Cafe/HW/Latte/Core/LatteThread.cpp:200
#13 0x0000000000564ddf in std::__invoke_impl<int, int (*)()> (__f=@0x7fbde916a8c8: 0x5c9fd7 <Latte_ThreadEntry()>) at /usr/include/c++/13/bits/invoke.h:61
#14 0x0000000000564d98 in std::__invoke<int (*)()> (__fn=@0x7fbde916a8c8: 0x5c9fd7 <Latte_ThreadEntry()>) at /usr/include/c++/13/bits/invoke.h:96
#15 0x0000000000564d46 in std::thread::_Invoker<std::tuple<int (*)()> >::_M_invoke<0ul> (this=0x7fbde916a8c8) at /usr/include/c++/13/bits/std_thread.h:292
#16 0x0000000000564d1c in std::thread::_Invoker<std::tuple<int (*)()> >::operator() (this=0x7fbde916a8c8) at /usr/include/c++/13/bits/std_thread.h:299
#17 0x0000000000564d00 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<int (*)()> > >::_M_run (this=0x7fbde916a8c0) at /usr/include/c++/13/bits/std_thread.h:244
#18 0x00007fbf3aee31e3 in std::execute_native_thread_routine (__p=0x7fbde916a8c0) at ../../../../../libstdc++-v3/src/c++11/thread.cc:104
#19 0x00007fbf3acac897 in start_thread (arg=<optimized out>) at pthread_create.c:444
#20 0x00007fbf3ad3380c in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
Hopefully, someone understands that. Please let me know if you require any additional information.