diff options
author | liamwhite <liamwhite@users.noreply.github.com> | 2024-01-28 21:02:22 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-28 21:02:22 +0100 |
commit | 5561a08d59f816b61ed6fab2131ee5d40cc51db7 (patch) | |
tree | b518bb8b995747b83508eeb0f74acd5a1a5c287a /src/audio_core/adsp | |
parent | Merge pull request #12833 from merryhime/vsync-crash (diff) | |
parent | Use the input process handle to get the correct application's memory (diff) | |
download | yuzu-5561a08d59f816b61ed6fab2131ee5d40cc51db7.tar yuzu-5561a08d59f816b61ed6fab2131ee5d40cc51db7.tar.gz yuzu-5561a08d59f816b61ed6fab2131ee5d40cc51db7.tar.bz2 yuzu-5561a08d59f816b61ed6fab2131ee5d40cc51db7.tar.lz yuzu-5561a08d59f816b61ed6fab2131ee5d40cc51db7.tar.xz yuzu-5561a08d59f816b61ed6fab2131ee5d40cc51db7.tar.zst yuzu-5561a08d59f816b61ed6fab2131ee5d40cc51db7.zip |
Diffstat (limited to '')
5 files changed, 26 insertions, 7 deletions
diff --git a/src/audio_core/adsp/apps/audio_renderer/audio_renderer.cpp b/src/audio_core/adsp/apps/audio_renderer/audio_renderer.cpp index ef301d8b4..7a76c3d0b 100644 --- a/src/audio_core/adsp/apps/audio_renderer/audio_renderer.cpp +++ b/src/audio_core/adsp/apps/audio_renderer/audio_renderer.cpp @@ -89,11 +89,13 @@ u32 AudioRenderer::Receive(Direction dir) { } void AudioRenderer::SetCommandBuffer(s32 session_id, CpuAddr buffer, u64 size, u64 time_limit, - u64 applet_resource_user_id, bool reset) noexcept { + u64 applet_resource_user_id, Kernel::KProcess* process, + bool reset) noexcept { command_buffers[session_id].buffer = buffer; command_buffers[session_id].size = size; command_buffers[session_id].time_limit = time_limit; command_buffers[session_id].applet_resource_user_id = applet_resource_user_id; + command_buffers[session_id].process = process; command_buffers[session_id].reset_buffer = reset; } @@ -173,7 +175,8 @@ void AudioRenderer::Main(std::stop_token stop_token) { // If there are no remaining commands (from the previous list), // this is a new command list, initialize it. if (command_buffer.remaining_command_count == 0) { - command_list_processor.Initialize(system, command_buffer.buffer, + command_list_processor.Initialize(system, *command_buffer.process, + command_buffer.buffer, command_buffer.size, streams[index]); } diff --git a/src/audio_core/adsp/apps/audio_renderer/audio_renderer.h b/src/audio_core/adsp/apps/audio_renderer/audio_renderer.h index 57b89d9fe..875266f27 100644 --- a/src/audio_core/adsp/apps/audio_renderer/audio_renderer.h +++ b/src/audio_core/adsp/apps/audio_renderer/audio_renderer.h @@ -19,6 +19,10 @@ namespace Core { class System; } // namespace Core +namespace Kernel { +class KProcess; +} + namespace AudioCore { namespace Sink { class Sink; @@ -69,7 +73,8 @@ public: u32 Receive(Direction dir); void SetCommandBuffer(s32 session_id, CpuAddr buffer, u64 size, u64 time_limit, - u64 applet_resource_user_id, bool reset) noexcept; + u64 applet_resource_user_id, Kernel::KProcess* process, + bool reset) noexcept; u32 GetRemainCommandCount(s32 session_id) const noexcept; void ClearRemainCommandCount(s32 session_id) noexcept; u64 GetRenderingStartTick(s32 session_id) const noexcept; diff --git a/src/audio_core/adsp/apps/audio_renderer/command_buffer.h b/src/audio_core/adsp/apps/audio_renderer/command_buffer.h index 3fd1b09dc..d6a721f34 100644 --- a/src/audio_core/adsp/apps/audio_renderer/command_buffer.h +++ b/src/audio_core/adsp/apps/audio_renderer/command_buffer.h @@ -6,6 +6,10 @@ #include "audio_core/common/common.h" #include "common/common_types.h" +namespace Kernel { +class KProcess; +} + namespace AudioCore::ADSP::AudioRenderer { struct CommandBuffer { @@ -14,6 +18,7 @@ struct CommandBuffer { u64 size{}; u64 time_limit{}; u64 applet_resource_user_id{}; + Kernel::KProcess* process{}; bool reset_buffer{}; // Set by the DSP u32 remaining_command_count{}; diff --git a/src/audio_core/adsp/apps/audio_renderer/command_list_processor.cpp b/src/audio_core/adsp/apps/audio_renderer/command_list_processor.cpp index 24e4d0496..eef2c0b89 100644 --- a/src/audio_core/adsp/apps/audio_renderer/command_list_processor.cpp +++ b/src/audio_core/adsp/apps/audio_renderer/command_list_processor.cpp @@ -9,14 +9,15 @@ #include "common/settings.h" #include "core/core.h" #include "core/core_timing.h" +#include "core/hle/kernel/k_process.h" #include "core/memory.h" namespace AudioCore::ADSP::AudioRenderer { -void CommandListProcessor::Initialize(Core::System& system_, CpuAddr buffer, u64 size, - Sink::SinkStream* stream_) { +void CommandListProcessor::Initialize(Core::System& system_, Kernel::KProcess& process, + CpuAddr buffer, u64 size, Sink::SinkStream* stream_) { system = &system_; - memory = &system->ApplicationMemory(); + memory = &process.GetMemory(); stream = stream_; header = reinterpret_cast<Renderer::CommandListHeader*>(buffer); commands = reinterpret_cast<u8*>(buffer + sizeof(Renderer::CommandListHeader)); diff --git a/src/audio_core/adsp/apps/audio_renderer/command_list_processor.h b/src/audio_core/adsp/apps/audio_renderer/command_list_processor.h index 4e5fb793e..944e82505 100644 --- a/src/audio_core/adsp/apps/audio_renderer/command_list_processor.h +++ b/src/audio_core/adsp/apps/audio_renderer/command_list_processor.h @@ -16,6 +16,10 @@ class Memory; class System; } // namespace Core +namespace Kernel { +class KProcess; +} + namespace AudioCore { namespace Sink { class SinkStream; @@ -40,7 +44,8 @@ public: * @param size - The size of the buffer. * @param stream - The stream to be used for sending the samples. */ - void Initialize(Core::System& system, CpuAddr buffer, u64 size, Sink::SinkStream* stream); + void Initialize(Core::System& system, Kernel::KProcess& process, CpuAddr buffer, u64 size, + Sink::SinkStream* stream); /** * Set the maximum processing time for this command list. |