summaryrefslogtreecommitdiff
path: root/src/audio_core/adsp
diff options
context:
space:
mode:
authorGravatar Kelebek12024-01-28 17:45:01 +0000
committerGravatar Kelebek12024-01-28 18:51:43 +0000
commit19a2f12692f2ba871b4bec7c56757a455bf03e7d (patch)
tree52aa105751bffd4b9bb671e307c3922bc0d0a6a0 /src/audio_core/adsp
parentMerge pull request #12808 from t895/uri-moment (diff)
downloadyuzu-19a2f12692f2ba871b4bec7c56757a455bf03e7d.tar.gz
yuzu-19a2f12692f2ba871b4bec7c56757a455bf03e7d.tar.xz
yuzu-19a2f12692f2ba871b4bec7c56757a455bf03e7d.zip
Use the input process handle to get the correct application's memory
Diffstat (limited to 'src/audio_core/adsp')
-rw-r--r--src/audio_core/adsp/apps/audio_renderer/audio_renderer.cpp7
-rw-r--r--src/audio_core/adsp/apps/audio_renderer/audio_renderer.h7
-rw-r--r--src/audio_core/adsp/apps/audio_renderer/command_buffer.h5
-rw-r--r--src/audio_core/adsp/apps/audio_renderer/command_list_processor.cpp7
-rw-r--r--src/audio_core/adsp/apps/audio_renderer/command_list_processor.h7
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) {
89} 89}
90 90
91void AudioRenderer::SetCommandBuffer(s32 session_id, CpuAddr buffer, u64 size, u64 time_limit, 91void AudioRenderer::SetCommandBuffer(s32 session_id, CpuAddr buffer, u64 size, u64 time_limit,
92 u64 applet_resource_user_id, bool reset) noexcept { 92 u64 applet_resource_user_id, Kernel::KProcess* process,
93 bool reset) noexcept {
93 command_buffers[session_id].buffer = buffer; 94 command_buffers[session_id].buffer = buffer;
94 command_buffers[session_id].size = size; 95 command_buffers[session_id].size = size;
95 command_buffers[session_id].time_limit = time_limit; 96 command_buffers[session_id].time_limit = time_limit;
96 command_buffers[session_id].applet_resource_user_id = applet_resource_user_id; 97 command_buffers[session_id].applet_resource_user_id = applet_resource_user_id;
98 command_buffers[session_id].process = process;
97 command_buffers[session_id].reset_buffer = reset; 99 command_buffers[session_id].reset_buffer = reset;
98} 100}
99 101
@@ -173,7 +175,8 @@ void AudioRenderer::Main(std::stop_token stop_token) {
173 // If there are no remaining commands (from the previous list), 175 // If there are no remaining commands (from the previous list),
174 // this is a new command list, initialize it. 176 // this is a new command list, initialize it.
175 if (command_buffer.remaining_command_count == 0) { 177 if (command_buffer.remaining_command_count == 0) {
176 command_list_processor.Initialize(system, command_buffer.buffer, 178 command_list_processor.Initialize(system, *command_buffer.process,
179 command_buffer.buffer,
177 command_buffer.size, streams[index]); 180 command_buffer.size, streams[index]);
178 } 181 }
179 182
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 {
19class System; 19class System;
20} // namespace Core 20} // namespace Core
21 21
22namespace Kernel {
23class KProcess;
24}
25
22namespace AudioCore { 26namespace AudioCore {
23namespace Sink { 27namespace Sink {
24class Sink; 28class Sink;
@@ -69,7 +73,8 @@ public:
69 u32 Receive(Direction dir); 73 u32 Receive(Direction dir);
70 74
71 void SetCommandBuffer(s32 session_id, CpuAddr buffer, u64 size, u64 time_limit, 75 void SetCommandBuffer(s32 session_id, CpuAddr buffer, u64 size, u64 time_limit,
72 u64 applet_resource_user_id, bool reset) noexcept; 76 u64 applet_resource_user_id, Kernel::KProcess* process,
77 bool reset) noexcept;
73 u32 GetRemainCommandCount(s32 session_id) const noexcept; 78 u32 GetRemainCommandCount(s32 session_id) const noexcept;
74 void ClearRemainCommandCount(s32 session_id) noexcept; 79 void ClearRemainCommandCount(s32 session_id) noexcept;
75 u64 GetRenderingStartTick(s32 session_id) const noexcept; 80 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 @@
6#include "audio_core/common/common.h" 6#include "audio_core/common/common.h"
7#include "common/common_types.h" 7#include "common/common_types.h"
8 8
9namespace Kernel {
10class KProcess;
11}
12
9namespace AudioCore::ADSP::AudioRenderer { 13namespace AudioCore::ADSP::AudioRenderer {
10 14
11struct CommandBuffer { 15struct CommandBuffer {
@@ -14,6 +18,7 @@ struct CommandBuffer {
14 u64 size{}; 18 u64 size{};
15 u64 time_limit{}; 19 u64 time_limit{};
16 u64 applet_resource_user_id{}; 20 u64 applet_resource_user_id{};
21 Kernel::KProcess* process{};
17 bool reset_buffer{}; 22 bool reset_buffer{};
18 // Set by the DSP 23 // Set by the DSP
19 u32 remaining_command_count{}; 24 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 @@
9#include "common/settings.h" 9#include "common/settings.h"
10#include "core/core.h" 10#include "core/core.h"
11#include "core/core_timing.h" 11#include "core/core_timing.h"
12#include "core/hle/kernel/k_process.h"
12#include "core/memory.h" 13#include "core/memory.h"
13 14
14namespace AudioCore::ADSP::AudioRenderer { 15namespace AudioCore::ADSP::AudioRenderer {
15 16
16void CommandListProcessor::Initialize(Core::System& system_, CpuAddr buffer, u64 size, 17void CommandListProcessor::Initialize(Core::System& system_, Kernel::KProcess& process,
17 Sink::SinkStream* stream_) { 18 CpuAddr buffer, u64 size, Sink::SinkStream* stream_) {
18 system = &system_; 19 system = &system_;
19 memory = &system->ApplicationMemory(); 20 memory = &process.GetMemory();
20 stream = stream_; 21 stream = stream_;
21 header = reinterpret_cast<Renderer::CommandListHeader*>(buffer); 22 header = reinterpret_cast<Renderer::CommandListHeader*>(buffer);
22 commands = reinterpret_cast<u8*>(buffer + sizeof(Renderer::CommandListHeader)); 23 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;
16class System; 16class System;
17} // namespace Core 17} // namespace Core
18 18
19namespace Kernel {
20class KProcess;
21}
22
19namespace AudioCore { 23namespace AudioCore {
20namespace Sink { 24namespace Sink {
21class SinkStream; 25class SinkStream;
@@ -40,7 +44,8 @@ public:
40 * @param size - The size of the buffer. 44 * @param size - The size of the buffer.
41 * @param stream - The stream to be used for sending the samples. 45 * @param stream - The stream to be used for sending the samples.
42 */ 46 */
43 void Initialize(Core::System& system, CpuAddr buffer, u64 size, Sink::SinkStream* stream); 47 void Initialize(Core::System& system, Kernel::KProcess& process, CpuAddr buffer, u64 size,
48 Sink::SinkStream* stream);
44 49
45 /** 50 /**
46 * Set the maximum processing time for this command list. 51 * Set the maximum processing time for this command list.