From 85dc40ad2320e6b3965faef7f5ba252193c1969c Mon Sep 17 00:00:00 2001 From: cow Date: Mon, 21 Oct 2024 23:24:41 +0000 Subject: [PATCH] kepler_compute: use safe memory read If unsafe read is done there can sometimes be corrupt data in the KeplerCompute::ProcessLaunch qmd structure. Fixes GPU crashes in 'Princess Peach: Showtime!' when using vulkan renderer. Requires using "Accuracy Level High" (crashes will still happen if using "Normal"). Tested on Radeon 6750XT, Linux 6.11.2, Mesa 24.2.5 (RADV driver). Unsafe read was introduced in 115792158d3ac4ca746d1775f2381e8f8dd18582 "VideoCore: Implement DispatchIndirect" How did I debug this: - Used VK_LAYER_KHRONOS_validation which found invalid vkCmdDispatch (along with a lot of other noise!) - Instrumented all calls to vulkan Dispatch(), set breakpoint when grid_dim_x > 1024 (an obviously invalid value). Found dispatch came from RasterizerVulkan::DispatchCompute(). - Commented out DispatchCompute() entirely, game runs with no crashes but some graphics effects are missing. - Keep going one layer up, observe corrupted `launch_description` in KeplerCompute::ProcessLaunch() - Attempted safe ReadBlock (`which = VideoCommon::CacheType::All`) instead of ReadBlockUnsafe in KeplerCompute::ProcessLaunch(), did not help - Go one layer up to DmaPusher. Switch to safe_process(). No more corrupt `launch_description`. --- src/video_core/dma_pusher.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/video_core/dma_pusher.cpp b/src/video_core/dma_pusher.cpp index fb2060ca4..2fa3a3cec 100644 --- a/src/video_core/dma_pusher.cpp +++ b/src/video_core/dma_pusher.cpp @@ -103,11 +103,6 @@ bool DmaPusher::Step() { unsafe_process(); return true; } - if (subchannel_type[dma_state.subchannel] == Engines::EngineTypes::KeplerCompute && - dma_state.method == ComputeInline) { - unsafe_process(); - return true; - } safe_process(); return true; }