diff options
Diffstat (limited to 'src/audio_core/renderer')
| -rw-r--r-- | src/audio_core/renderer/audio_renderer.cpp | 7 | ||||
| -rw-r--r-- | src/audio_core/renderer/audio_renderer.h | 4 | ||||
| -rw-r--r-- | src/audio_core/renderer/behavior/info_updater.cpp | 9 | ||||
| -rw-r--r-- | src/audio_core/renderer/behavior/info_updater.h | 10 | ||||
| -rw-r--r-- | src/audio_core/renderer/memory/pool_mapper.cpp | 22 | ||||
| -rw-r--r-- | src/audio_core/renderer/memory/pool_mapper.h | 14 | ||||
| -rw-r--r-- | src/audio_core/renderer/system.cpp | 10 | ||||
| -rw-r--r-- | src/audio_core/renderer/system.h | 8 |
8 files changed, 45 insertions, 39 deletions
diff --git a/src/audio_core/renderer/audio_renderer.cpp b/src/audio_core/renderer/audio_renderer.cpp index df03d03aa..7c728cb86 100644 --- a/src/audio_core/renderer/audio_renderer.cpp +++ b/src/audio_core/renderer/audio_renderer.cpp | |||
| @@ -17,9 +17,8 @@ Renderer::Renderer(Core::System& system_, Manager& manager_, Kernel::KEvent* ren | |||
| 17 | 17 | ||
| 18 | Result Renderer::Initialize(const AudioRendererParameterInternal& params, | 18 | Result Renderer::Initialize(const AudioRendererParameterInternal& params, |
| 19 | Kernel::KTransferMemory* transfer_memory, | 19 | Kernel::KTransferMemory* transfer_memory, |
| 20 | const u64 transfer_memory_size, const u32 process_handle, | 20 | const u64 transfer_memory_size, Kernel::KProcess* process_handle, |
| 21 | Kernel::KProcess& process, const u64 applet_resource_user_id, | 21 | const u64 applet_resource_user_id, const s32 session_id) { |
| 22 | const s32 session_id) { | ||
| 23 | if (params.execution_mode == ExecutionMode::Auto) { | 22 | if (params.execution_mode == ExecutionMode::Auto) { |
| 24 | if (!manager.AddSystem(system)) { | 23 | if (!manager.AddSystem(system)) { |
| 25 | LOG_ERROR(Service_Audio, | 24 | LOG_ERROR(Service_Audio, |
| @@ -30,7 +29,7 @@ Result Renderer::Initialize(const AudioRendererParameterInternal& params, | |||
| 30 | } | 29 | } |
| 31 | 30 | ||
| 32 | initialized = true; | 31 | initialized = true; |
| 33 | system.Initialize(params, transfer_memory, transfer_memory_size, process_handle, process, | 32 | system.Initialize(params, transfer_memory, transfer_memory_size, process_handle, |
| 34 | applet_resource_user_id, session_id); | 33 | applet_resource_user_id, session_id); |
| 35 | 34 | ||
| 36 | return ResultSuccess; | 35 | return ResultSuccess; |
diff --git a/src/audio_core/renderer/audio_renderer.h b/src/audio_core/renderer/audio_renderer.h index 1219f74ca..f16adeda7 100644 --- a/src/audio_core/renderer/audio_renderer.h +++ b/src/audio_core/renderer/audio_renderer.h | |||
| @@ -38,14 +38,14 @@ public: | |||
| 38 | * @param params - Input parameters to initialize the system with. | 38 | * @param params - Input parameters to initialize the system with. |
| 39 | * @param transfer_memory - Game-supplied memory for all workbuffers. Unused. | 39 | * @param transfer_memory - Game-supplied memory for all workbuffers. Unused. |
| 40 | * @param transfer_memory_size - Size of the transfer memory. Unused. | 40 | * @param transfer_memory_size - Size of the transfer memory. Unused. |
| 41 | * @param process_handle - Process handle, also used for memory. Unused. | 41 | * @param process_handle - Process handle, also used for memory. |
| 42 | * @param applet_resource_user_id - Applet id for this renderer. Unused. | 42 | * @param applet_resource_user_id - Applet id for this renderer. Unused. |
| 43 | * @param session_id - Session id of this renderer. | 43 | * @param session_id - Session id of this renderer. |
| 44 | * @return Result code. | 44 | * @return Result code. |
| 45 | */ | 45 | */ |
| 46 | Result Initialize(const AudioRendererParameterInternal& params, | 46 | Result Initialize(const AudioRendererParameterInternal& params, |
| 47 | Kernel::KTransferMemory* transfer_memory, u64 transfer_memory_size, | 47 | Kernel::KTransferMemory* transfer_memory, u64 transfer_memory_size, |
| 48 | u32 process_handle, Kernel::KProcess& process, u64 applet_resource_user_id, | 48 | Kernel::KProcess* process_handle, u64 applet_resource_user_id, |
| 49 | s32 session_id); | 49 | s32 session_id); |
| 50 | 50 | ||
| 51 | /** | 51 | /** |
diff --git a/src/audio_core/renderer/behavior/info_updater.cpp b/src/audio_core/renderer/behavior/info_updater.cpp index 667711e17..163127789 100644 --- a/src/audio_core/renderer/behavior/info_updater.cpp +++ b/src/audio_core/renderer/behavior/info_updater.cpp | |||
| @@ -18,11 +18,10 @@ | |||
| 18 | namespace AudioCore::Renderer { | 18 | namespace AudioCore::Renderer { |
| 19 | 19 | ||
| 20 | InfoUpdater::InfoUpdater(std::span<const u8> input_, std::span<u8> output_, | 20 | InfoUpdater::InfoUpdater(std::span<const u8> input_, std::span<u8> output_, |
| 21 | const u32 process_handle_, BehaviorInfo& behaviour_) | 21 | Kernel::KProcess* process_handle_, BehaviorInfo& behaviour_) |
| 22 | : input{input_.data() + sizeof(UpdateDataHeader)}, | 22 | : input{input_.data() + sizeof(UpdateDataHeader)}, input_origin{input_}, |
| 23 | input_origin{input_}, output{output_.data() + sizeof(UpdateDataHeader)}, | 23 | output{output_.data() + sizeof(UpdateDataHeader)}, output_origin{output_}, |
| 24 | output_origin{output_}, in_header{reinterpret_cast<const UpdateDataHeader*>( | 24 | in_header{reinterpret_cast<const UpdateDataHeader*>(input_origin.data())}, |
| 25 | input_origin.data())}, | ||
| 26 | out_header{reinterpret_cast<UpdateDataHeader*>(output_origin.data())}, | 25 | out_header{reinterpret_cast<UpdateDataHeader*>(output_origin.data())}, |
| 27 | expected_input_size{input_.size()}, expected_output_size{output_.size()}, | 26 | expected_input_size{input_.size()}, expected_output_size{output_.size()}, |
| 28 | process_handle{process_handle_}, behaviour{behaviour_} { | 27 | process_handle{process_handle_}, behaviour{behaviour_} { |
diff --git a/src/audio_core/renderer/behavior/info_updater.h b/src/audio_core/renderer/behavior/info_updater.h index fb4b7d25a..4f27a817e 100644 --- a/src/audio_core/renderer/behavior/info_updater.h +++ b/src/audio_core/renderer/behavior/info_updater.h | |||
| @@ -8,6 +8,10 @@ | |||
| 8 | #include "common/common_types.h" | 8 | #include "common/common_types.h" |
| 9 | #include "core/hle/service/audio/errors.h" | 9 | #include "core/hle/service/audio/errors.h" |
| 10 | 10 | ||
| 11 | namespace Kernel { | ||
| 12 | class KProcess; | ||
| 13 | } | ||
| 14 | |||
| 11 | namespace AudioCore::Renderer { | 15 | namespace AudioCore::Renderer { |
| 12 | class BehaviorInfo; | 16 | class BehaviorInfo; |
| 13 | class VoiceContext; | 17 | class VoiceContext; |
| @@ -39,8 +43,8 @@ class InfoUpdater { | |||
| 39 | static_assert(sizeof(UpdateDataHeader) == 0x40, "UpdateDataHeader has the wrong size!"); | 43 | static_assert(sizeof(UpdateDataHeader) == 0x40, "UpdateDataHeader has the wrong size!"); |
| 40 | 44 | ||
| 41 | public: | 45 | public: |
| 42 | explicit InfoUpdater(std::span<const u8> input, std::span<u8> output, u32 process_handle, | 46 | explicit InfoUpdater(std::span<const u8> input, std::span<u8> output, |
| 43 | BehaviorInfo& behaviour); | 47 | Kernel::KProcess* process_handle, BehaviorInfo& behaviour); |
| 44 | 48 | ||
| 45 | /** | 49 | /** |
| 46 | * Update the voice channel resources. | 50 | * Update the voice channel resources. |
| @@ -197,7 +201,7 @@ private: | |||
| 197 | /// Expected output size, see CheckConsumedSize | 201 | /// Expected output size, see CheckConsumedSize |
| 198 | u64 expected_output_size; | 202 | u64 expected_output_size; |
| 199 | /// Unused | 203 | /// Unused |
| 200 | u32 process_handle; | 204 | Kernel::KProcess* process_handle; |
| 201 | /// Behaviour | 205 | /// Behaviour |
| 202 | BehaviorInfo& behaviour; | 206 | BehaviorInfo& behaviour; |
| 203 | }; | 207 | }; |
diff --git a/src/audio_core/renderer/memory/pool_mapper.cpp b/src/audio_core/renderer/memory/pool_mapper.cpp index 999bb746b..1df786feb 100644 --- a/src/audio_core/renderer/memory/pool_mapper.cpp +++ b/src/audio_core/renderer/memory/pool_mapper.cpp | |||
| @@ -8,13 +8,13 @@ | |||
| 8 | 8 | ||
| 9 | namespace AudioCore::Renderer { | 9 | namespace AudioCore::Renderer { |
| 10 | 10 | ||
| 11 | PoolMapper::PoolMapper(u32 process_handle_, bool force_map_) | 11 | PoolMapper::PoolMapper(Kernel::KProcess* process_handle_, bool force_map_) |
| 12 | : process_handle{process_handle_}, force_map{force_map_} {} | 12 | : process_handle{process_handle_}, force_map{force_map_} {} |
| 13 | 13 | ||
| 14 | PoolMapper::PoolMapper(u32 process_handle_, std::span<MemoryPoolInfo> pool_infos_, u32 pool_count_, | 14 | PoolMapper::PoolMapper(Kernel::KProcess* process_handle_, std::span<MemoryPoolInfo> pool_infos_, |
| 15 | bool force_map_) | 15 | u32 pool_count_, bool force_map_) |
| 16 | : process_handle{process_handle_}, pool_infos{pool_infos_.data()}, | 16 | : process_handle{process_handle_}, pool_infos{pool_infos_.data()}, pool_count{pool_count_}, |
| 17 | pool_count{pool_count_}, force_map{force_map_} {} | 17 | force_map{force_map_} {} |
| 18 | 18 | ||
| 19 | void PoolMapper::ClearUseState(std::span<MemoryPoolInfo> pools, const u32 count) { | 19 | void PoolMapper::ClearUseState(std::span<MemoryPoolInfo> pools, const u32 count) { |
| 20 | for (u32 i = 0; i < count; i++) { | 20 | for (u32 i = 0; i < count; i++) { |
| @@ -106,15 +106,17 @@ bool PoolMapper::IsForceMapEnabled() const { | |||
| 106 | return force_map; | 106 | return force_map; |
| 107 | } | 107 | } |
| 108 | 108 | ||
| 109 | u32 PoolMapper::GetProcessHandle(const MemoryPoolInfo* pool) const { | 109 | Kernel::KProcess* PoolMapper::GetProcessHandle(const MemoryPoolInfo* pool) const { |
| 110 | switch (pool->GetLocation()) { | 110 | switch (pool->GetLocation()) { |
| 111 | case MemoryPoolInfo::Location::CPU: | 111 | case MemoryPoolInfo::Location::CPU: |
| 112 | return process_handle; | 112 | return process_handle; |
| 113 | case MemoryPoolInfo::Location::DSP: | 113 | case MemoryPoolInfo::Location::DSP: |
| 114 | return Kernel::Svc::CurrentProcess; | 114 | // return Kernel::Svc::CurrentProcess; |
| 115 | return nullptr; | ||
| 115 | } | 116 | } |
| 116 | LOG_WARNING(Service_Audio, "Invalid MemoryPoolInfo location!"); | 117 | LOG_WARNING(Service_Audio, "Invalid MemoryPoolInfo location!"); |
| 117 | return Kernel::Svc::CurrentProcess; | 118 | // return Kernel::Svc::CurrentProcess; |
| 119 | return nullptr; | ||
| 118 | } | 120 | } |
| 119 | 121 | ||
| 120 | bool PoolMapper::Map([[maybe_unused]] const u32 handle, [[maybe_unused]] const CpuAddr cpu_addr, | 122 | bool PoolMapper::Map([[maybe_unused]] const u32 handle, [[maybe_unused]] const CpuAddr cpu_addr, |
| @@ -147,14 +149,14 @@ bool PoolMapper::Unmap([[maybe_unused]] const u32 handle, [[maybe_unused]] const | |||
| 147 | } | 149 | } |
| 148 | 150 | ||
| 149 | bool PoolMapper::Unmap(MemoryPoolInfo& pool) const { | 151 | bool PoolMapper::Unmap(MemoryPoolInfo& pool) const { |
| 150 | [[maybe_unused]] u32 handle{0}; | 152 | [[maybe_unused]] Kernel::KProcess* handle{}; |
| 151 | 153 | ||
| 152 | switch (pool.GetLocation()) { | 154 | switch (pool.GetLocation()) { |
| 153 | case MemoryPoolInfo::Location::CPU: | 155 | case MemoryPoolInfo::Location::CPU: |
| 154 | handle = process_handle; | 156 | handle = process_handle; |
| 155 | break; | 157 | break; |
| 156 | case MemoryPoolInfo::Location::DSP: | 158 | case MemoryPoolInfo::Location::DSP: |
| 157 | handle = Kernel::Svc::CurrentProcess; | 159 | // handle = Kernel::Svc::CurrentProcess; |
| 158 | break; | 160 | break; |
| 159 | } | 161 | } |
| 160 | // nn::audio::dsp::UnmapUserPointer(handle, pool->cpu_address, pool->size); | 162 | // nn::audio::dsp::UnmapUserPointer(handle, pool->cpu_address, pool->size); |
diff --git a/src/audio_core/renderer/memory/pool_mapper.h b/src/audio_core/renderer/memory/pool_mapper.h index 95ae5d8ea..fb5122b73 100644 --- a/src/audio_core/renderer/memory/pool_mapper.h +++ b/src/audio_core/renderer/memory/pool_mapper.h | |||
| @@ -10,6 +10,10 @@ | |||
| 10 | #include "common/common_types.h" | 10 | #include "common/common_types.h" |
| 11 | #include "core/hle/service/audio/errors.h" | 11 | #include "core/hle/service/audio/errors.h" |
| 12 | 12 | ||
| 13 | namespace Kernel { | ||
| 14 | class KProcess; | ||
| 15 | } | ||
| 16 | |||
| 13 | namespace AudioCore::Renderer { | 17 | namespace AudioCore::Renderer { |
| 14 | class AddressInfo; | 18 | class AddressInfo; |
| 15 | 19 | ||
| @@ -18,9 +22,9 @@ class AddressInfo; | |||
| 18 | */ | 22 | */ |
| 19 | class PoolMapper { | 23 | class PoolMapper { |
| 20 | public: | 24 | public: |
| 21 | explicit PoolMapper(u32 process_handle, bool force_map); | 25 | explicit PoolMapper(Kernel::KProcess* process_handle, bool force_map); |
| 22 | explicit PoolMapper(u32 process_handle, std::span<MemoryPoolInfo> pool_infos, u32 pool_count, | 26 | explicit PoolMapper(Kernel::KProcess* process_handle, std::span<MemoryPoolInfo> pool_infos, |
| 23 | bool force_map); | 27 | u32 pool_count, bool force_map); |
| 24 | 28 | ||
| 25 | /** | 29 | /** |
| 26 | * Clear the usage state for all given pools. | 30 | * Clear the usage state for all given pools. |
| @@ -98,7 +102,7 @@ public: | |||
| 98 | * @return CurrentProcessHandle if location == DSP, | 102 | * @return CurrentProcessHandle if location == DSP, |
| 99 | * the PoolMapper's process_handle if location == CPU | 103 | * the PoolMapper's process_handle if location == CPU |
| 100 | */ | 104 | */ |
| 101 | u32 GetProcessHandle(const MemoryPoolInfo* pool) const; | 105 | Kernel::KProcess* GetProcessHandle(const MemoryPoolInfo* pool) const; |
| 102 | 106 | ||
| 103 | /** | 107 | /** |
| 104 | * Map the given region with the given handle. This is a no-op. | 108 | * Map the given region with the given handle. This is a no-op. |
| @@ -167,7 +171,7 @@ public: | |||
| 167 | 171 | ||
| 168 | private: | 172 | private: |
| 169 | /// Process handle for this mapper, used when location == CPU | 173 | /// Process handle for this mapper, used when location == CPU |
| 170 | u32 process_handle; | 174 | Kernel::KProcess* process_handle{}; |
| 171 | /// List of memory pools assigned to this mapper | 175 | /// List of memory pools assigned to this mapper |
| 172 | MemoryPoolInfo* pool_infos{}; | 176 | MemoryPoolInfo* pool_infos{}; |
| 173 | /// The number of pools | 177 | /// The number of pools |
diff --git a/src/audio_core/renderer/system.cpp b/src/audio_core/renderer/system.cpp index ca656edae..c30d68426 100644 --- a/src/audio_core/renderer/system.cpp +++ b/src/audio_core/renderer/system.cpp | |||
| @@ -102,8 +102,8 @@ System::System(Core::System& core_, Kernel::KEvent* adsp_rendered_event_) | |||
| 102 | 102 | ||
| 103 | Result System::Initialize(const AudioRendererParameterInternal& params, | 103 | Result System::Initialize(const AudioRendererParameterInternal& params, |
| 104 | Kernel::KTransferMemory* transfer_memory, u64 transfer_memory_size, | 104 | Kernel::KTransferMemory* transfer_memory, u64 transfer_memory_size, |
| 105 | u32 process_handle_, Kernel::KProcess& process_, | 105 | Kernel::KProcess* process_handle_, u64 applet_resource_user_id_, |
| 106 | u64 applet_resource_user_id_, s32 session_id_) { | 106 | s32 session_id_) { |
| 107 | if (!CheckValidRevision(params.revision)) { | 107 | if (!CheckValidRevision(params.revision)) { |
| 108 | return Service::Audio::ResultInvalidRevision; | 108 | return Service::Audio::ResultInvalidRevision; |
| 109 | } | 109 | } |
| @@ -119,7 +119,6 @@ Result System::Initialize(const AudioRendererParameterInternal& params, | |||
| 119 | behavior.SetUserLibRevision(params.revision); | 119 | behavior.SetUserLibRevision(params.revision); |
| 120 | 120 | ||
| 121 | process_handle = process_handle_; | 121 | process_handle = process_handle_; |
| 122 | process = &process_; | ||
| 123 | applet_resource_user_id = applet_resource_user_id_; | 122 | applet_resource_user_id = applet_resource_user_id_; |
| 124 | session_id = session_id_; | 123 | session_id = session_id_; |
| 125 | 124 | ||
| @@ -132,7 +131,8 @@ Result System::Initialize(const AudioRendererParameterInternal& params, | |||
| 132 | render_device = params.rendering_device; | 131 | render_device = params.rendering_device; |
| 133 | execution_mode = params.execution_mode; | 132 | execution_mode = params.execution_mode; |
| 134 | 133 | ||
| 135 | process->GetMemory().ZeroBlock(transfer_memory->GetSourceAddress(), transfer_memory_size); | 134 | process_handle->GetMemory().ZeroBlock(transfer_memory->GetSourceAddress(), |
| 135 | transfer_memory_size); | ||
| 136 | 136 | ||
| 137 | // Note: We're not actually using the transfer memory because it's a pain to code for. | 137 | // Note: We're not actually using the transfer memory because it's a pain to code for. |
| 138 | // Allocate the memory normally instead and hope the game doesn't try to read anything back | 138 | // Allocate the memory normally instead and hope the game doesn't try to read anything back |
| @@ -616,7 +616,7 @@ void System::SendCommandToDsp() { | |||
| 616 | static_cast<u64>((time_limit_percent / 100) * 2'880'000.0 * | 616 | static_cast<u64>((time_limit_percent / 100) * 2'880'000.0 * |
| 617 | (static_cast<f32>(render_time_limit_percent) / 100.0f))}; | 617 | (static_cast<f32>(render_time_limit_percent) / 100.0f))}; |
| 618 | audio_renderer.SetCommandBuffer(session_id, translated_addr, command_size, time_limit, | 618 | audio_renderer.SetCommandBuffer(session_id, translated_addr, command_size, time_limit, |
| 619 | applet_resource_user_id, process, | 619 | applet_resource_user_id, process_handle, |
| 620 | reset_command_buffers); | 620 | reset_command_buffers); |
| 621 | reset_command_buffers = false; | 621 | reset_command_buffers = false; |
| 622 | command_buffer_size = command_size; | 622 | command_buffer_size = command_size; |
diff --git a/src/audio_core/renderer/system.h b/src/audio_core/renderer/system.h index 753a0b796..3533a74ef 100644 --- a/src/audio_core/renderer/system.h +++ b/src/audio_core/renderer/system.h | |||
| @@ -74,14 +74,14 @@ public: | |||
| 74 | * @param params - Input parameters to initialize the system with. | 74 | * @param params - Input parameters to initialize the system with. |
| 75 | * @param transfer_memory - Game-supplied memory for all workbuffers. Unused. | 75 | * @param transfer_memory - Game-supplied memory for all workbuffers. Unused. |
| 76 | * @param transfer_memory_size - Size of the transfer memory. Unused. | 76 | * @param transfer_memory_size - Size of the transfer memory. Unused. |
| 77 | * @param process_handle - Process handle, also used for memory. Unused. | 77 | * @param process_handle - Process handle, also used for memory. |
| 78 | * @param applet_resource_user_id - Applet id for this renderer. Unused. | 78 | * @param applet_resource_user_id - Applet id for this renderer. Unused. |
| 79 | * @param session_id - Session id of this renderer. | 79 | * @param session_id - Session id of this renderer. |
| 80 | * @return Result code. | 80 | * @return Result code. |
| 81 | */ | 81 | */ |
| 82 | Result Initialize(const AudioRendererParameterInternal& params, | 82 | Result Initialize(const AudioRendererParameterInternal& params, |
| 83 | Kernel::KTransferMemory* transfer_memory, u64 transfer_memory_size, | 83 | Kernel::KTransferMemory* transfer_memory, u64 transfer_memory_size, |
| 84 | u32 process_handle, Kernel::KProcess& process, u64 applet_resource_user_id, | 84 | Kernel::KProcess* process_handle, u64 applet_resource_user_id, |
| 85 | s32 session_id); | 85 | s32 session_id); |
| 86 | 86 | ||
| 87 | /** | 87 | /** |
| @@ -278,9 +278,7 @@ private: | |||
| 278 | /// Does what locks do | 278 | /// Does what locks do |
| 279 | std::mutex lock{}; | 279 | std::mutex lock{}; |
| 280 | /// Process this audio render is operating within, used for memory reads/writes. | 280 | /// Process this audio render is operating within, used for memory reads/writes. |
| 281 | Kernel::KProcess* process{}; | 281 | Kernel::KProcess* process_handle{}; |
| 282 | /// Handle for the process for this system, unused | ||
| 283 | u32 process_handle{}; | ||
| 284 | /// Applet resource id for this system, unused | 282 | /// Applet resource id for this system, unused |
| 285 | u64 applet_resource_user_id{}; | 283 | u64 applet_resource_user_id{}; |
| 286 | /// Controls performance input and output | 284 | /// Controls performance input and output |