From 8830df1b9f10fccf16cc93d508cd276437bed5f7 Mon Sep 17 00:00:00 2001 From: Zephyron Date: Thu, 2 Jan 2025 16:38:18 +1000 Subject: [PATCH] video_core: Enforce safe memory reads for compute dispatch - Modify DmaPusher to use safe memory reads when handling compute operations at High GPU accuracy - Prevent potential memory corruption issues that could lead to invalid dispatch parameters - Previously, unsafe reads could result in corrupted launch_description data in KeplerCompute::ProcessLaunch, causing invalid vkCmdDispatch calls - By enforcing safe reads specifically for compute operations, we maintain performance for other GPU tasks while ensuring compute dispatch stability This change requires >= High GPU accuracy level to take effect. --- src/video_core/dma_pusher.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/video_core/dma_pusher.cpp b/src/video_core/dma_pusher.cpp index 7dbce41d37..0d594cb7a2 100644 --- a/src/video_core/dma_pusher.cpp +++ b/src/video_core/dma_pusher.cpp @@ -93,7 +93,17 @@ bool DmaPusher::Step() { ProcessCommands(headers); }; - if (Settings::IsGPULevelHigh() || (dma_state.method >= MacroRegistersStart)) { + // Only use unsafe reads for non-compute macro operations + if (Settings::IsGPULevelHigh()) { + const bool is_compute = (subchannel_type[dma_state.subchannel] == + Engines::EngineTypes::KeplerCompute); + + if (dma_state.method >= MacroRegistersStart && !is_compute) { + unsafe_process(); + return true; + } + + // Always use safe reads for compute operations safe_process(); return true; }