diff options
Diffstat (limited to 'src/audio_core/renderer/system.cpp')
| -rw-r--r-- | src/audio_core/renderer/system.cpp | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/src/audio_core/renderer/system.cpp b/src/audio_core/renderer/system.cpp index 6e07baa54..8f02754c5 100644 --- a/src/audio_core/renderer/system.cpp +++ b/src/audio_core/renderer/system.cpp | |||
| @@ -4,12 +4,13 @@ | |||
| 4 | #include <chrono> | 4 | #include <chrono> |
| 5 | #include <span> | 5 | #include <span> |
| 6 | 6 | ||
| 7 | #include "audio_core/adsp/apps/audio_renderer/audio_renderer.h" | ||
| 8 | #include "audio_core/adsp/apps/audio_renderer/command_buffer.h" | ||
| 7 | #include "audio_core/audio_core.h" | 9 | #include "audio_core/audio_core.h" |
| 8 | #include "audio_core/common/audio_renderer_parameter.h" | 10 | #include "audio_core/common/audio_renderer_parameter.h" |
| 9 | #include "audio_core/common/common.h" | 11 | #include "audio_core/common/common.h" |
| 10 | #include "audio_core/common/feature_support.h" | 12 | #include "audio_core/common/feature_support.h" |
| 11 | #include "audio_core/common/workbuffer_allocator.h" | 13 | #include "audio_core/common/workbuffer_allocator.h" |
| 12 | #include "audio_core/renderer/adsp/adsp.h" | ||
| 13 | #include "audio_core/renderer/behavior/info_updater.h" | 14 | #include "audio_core/renderer/behavior/info_updater.h" |
| 14 | #include "audio_core/renderer/command/command_buffer.h" | 15 | #include "audio_core/renderer/command/command_buffer.h" |
| 15 | #include "audio_core/renderer/command/command_generator.h" | 16 | #include "audio_core/renderer/command/command_generator.h" |
| @@ -34,7 +35,7 @@ | |||
| 34 | #include "core/hle/kernel/k_transfer_memory.h" | 35 | #include "core/hle/kernel/k_transfer_memory.h" |
| 35 | #include "core/memory.h" | 36 | #include "core/memory.h" |
| 36 | 37 | ||
| 37 | namespace AudioCore::AudioRenderer { | 38 | namespace AudioCore::Renderer { |
| 38 | 39 | ||
| 39 | u64 System::GetWorkBufferSize(const AudioRendererParameterInternal& params) { | 40 | u64 System::GetWorkBufferSize(const AudioRendererParameterInternal& params) { |
| 40 | BehaviorInfo behavior; | 41 | BehaviorInfo behavior; |
| @@ -95,7 +96,8 @@ u64 System::GetWorkBufferSize(const AudioRendererParameterInternal& params) { | |||
| 95 | } | 96 | } |
| 96 | 97 | ||
| 97 | System::System(Core::System& core_, Kernel::KEvent* adsp_rendered_event_) | 98 | System::System(Core::System& core_, Kernel::KEvent* adsp_rendered_event_) |
| 98 | : core{core_}, adsp{core.AudioCore().GetADSP()}, adsp_rendered_event{adsp_rendered_event_} {} | 99 | : core{core_}, audio_renderer{core.AudioCore().ADSP().AudioRenderer()}, |
| 100 | adsp_rendered_event{adsp_rendered_event_} {} | ||
| 99 | 101 | ||
| 100 | Result System::Initialize(const AudioRendererParameterInternal& params, | 102 | Result System::Initialize(const AudioRendererParameterInternal& params, |
| 101 | Kernel::KTransferMemory* transfer_memory, u64 transfer_memory_size, | 103 | Kernel::KTransferMemory* transfer_memory, u64 transfer_memory_size, |
| @@ -443,7 +445,7 @@ void System::Stop() { | |||
| 443 | Result System::Update(std::span<const u8> input, std::span<u8> performance, std::span<u8> output) { | 445 | Result System::Update(std::span<const u8> input, std::span<u8> performance, std::span<u8> output) { |
| 444 | std::scoped_lock l{lock}; | 446 | std::scoped_lock l{lock}; |
| 445 | 447 | ||
| 446 | const auto start_time{core.CoreTiming().GetClockTicks()}; | 448 | const auto start_time{core.CoreTiming().GetGlobalTimeNs().count()}; |
| 447 | std::memset(output.data(), 0, output.size()); | 449 | std::memset(output.data(), 0, output.size()); |
| 448 | 450 | ||
| 449 | InfoUpdater info_updater(input, output, process_handle, behavior); | 451 | InfoUpdater info_updater(input, output, process_handle, behavior); |
| @@ -535,7 +537,7 @@ Result System::Update(std::span<const u8> input, std::span<u8> performance, std: | |||
| 535 | adsp_rendered_event->Clear(); | 537 | adsp_rendered_event->Clear(); |
| 536 | num_times_updated++; | 538 | num_times_updated++; |
| 537 | 539 | ||
| 538 | const auto end_time{core.CoreTiming().GetClockTicks()}; | 540 | const auto end_time{core.CoreTiming().GetGlobalTimeNs().count()}; |
| 539 | ticks_spent_updating += end_time - start_time; | 541 | ticks_spent_updating += end_time - start_time; |
| 540 | 542 | ||
| 541 | return ResultSuccess; | 543 | return ResultSuccess; |
| @@ -583,7 +585,7 @@ void System::SendCommandToDsp() { | |||
| 583 | if (initialized) { | 585 | if (initialized) { |
| 584 | if (active) { | 586 | if (active) { |
| 585 | terminate_event.Reset(); | 587 | terminate_event.Reset(); |
| 586 | const auto remaining_command_count{adsp.GetRemainCommandCount(session_id)}; | 588 | const auto remaining_command_count{audio_renderer.GetRemainCommandCount(session_id)}; |
| 587 | u64 command_size{0}; | 589 | u64 command_size{0}; |
| 588 | 590 | ||
| 589 | if (remaining_command_count) { | 591 | if (remaining_command_count) { |
| @@ -607,26 +609,24 @@ void System::SendCommandToDsp() { | |||
| 607 | time_limit_percent = 70.0f; | 609 | time_limit_percent = 70.0f; |
| 608 | } | 610 | } |
| 609 | 611 | ||
| 610 | ADSP::CommandBuffer command_buffer{ | 612 | AudioRenderer::CommandBuffer command_buffer{ |
| 611 | .buffer{translated_addr}, | 613 | .buffer{translated_addr}, |
| 612 | .size{command_size}, | 614 | .size{command_size}, |
| 613 | .time_limit{ | 615 | .time_limit{ |
| 614 | static_cast<u64>((time_limit_percent / 100) * 2'880'000.0 * | 616 | static_cast<u64>((time_limit_percent / 100) * 2'880'000.0 * |
| 615 | (static_cast<f32>(render_time_limit_percent) / 100.0f))}, | 617 | (static_cast<f32>(render_time_limit_percent) / 100.0f))}, |
| 616 | .remaining_command_count{remaining_command_count}, | ||
| 617 | .reset_buffers{reset_command_buffers}, | ||
| 618 | .applet_resource_user_id{applet_resource_user_id}, | 618 | .applet_resource_user_id{applet_resource_user_id}, |
| 619 | .render_time_taken{adsp.GetRenderTimeTaken(session_id)}, | 619 | .reset_buffer{reset_command_buffers}, |
| 620 | }; | 620 | }; |
| 621 | 621 | ||
| 622 | adsp.SendCommandBuffer(session_id, command_buffer); | 622 | audio_renderer.SetCommandBuffer(session_id, command_buffer); |
| 623 | reset_command_buffers = false; | 623 | reset_command_buffers = false; |
| 624 | command_buffer_size = command_size; | 624 | command_buffer_size = command_size; |
| 625 | if (remaining_command_count == 0) { | 625 | if (remaining_command_count == 0) { |
| 626 | adsp_rendered_event->Signal(); | 626 | adsp_rendered_event->Signal(); |
| 627 | } | 627 | } |
| 628 | } else { | 628 | } else { |
| 629 | adsp.ClearRemainCount(session_id); | 629 | audio_renderer.ClearRemainCommandCount(session_id); |
| 630 | terminate_event.Set(); | 630 | terminate_event.Set(); |
| 631 | } | 631 | } |
| 632 | } | 632 | } |
| @@ -635,7 +635,7 @@ void System::SendCommandToDsp() { | |||
| 635 | u64 System::GenerateCommand(std::span<u8> in_command_buffer, | 635 | u64 System::GenerateCommand(std::span<u8> in_command_buffer, |
| 636 | [[maybe_unused]] u64 command_buffer_size_) { | 636 | [[maybe_unused]] u64 command_buffer_size_) { |
| 637 | PoolMapper::ClearUseState(memory_pool_workbuffer, memory_pool_count); | 637 | PoolMapper::ClearUseState(memory_pool_workbuffer, memory_pool_count); |
| 638 | const auto start_time{core.CoreTiming().GetClockTicks()}; | 638 | const auto start_time{core.CoreTiming().GetGlobalTimeNs().count()}; |
| 639 | 639 | ||
| 640 | auto command_list_header{reinterpret_cast<CommandListHeader*>(in_command_buffer.data())}; | 640 | auto command_list_header{reinterpret_cast<CommandListHeader*>(in_command_buffer.data())}; |
| 641 | 641 | ||
| @@ -732,10 +732,10 @@ u64 System::GenerateCommand(std::span<u8> in_command_buffer, | |||
| 732 | effect_context.UpdateStateByDspShared(); | 732 | effect_context.UpdateStateByDspShared(); |
| 733 | } | 733 | } |
| 734 | 734 | ||
| 735 | const auto end_time{core.CoreTiming().GetClockTicks()}; | 735 | const auto end_time{core.CoreTiming().GetGlobalTimeNs().count()}; |
| 736 | total_ticks_elapsed += end_time - start_time; | 736 | total_ticks_elapsed += end_time - start_time; |
| 737 | num_command_lists_generated++; | 737 | num_command_lists_generated++; |
| 738 | render_start_tick = adsp.GetRenderingStartTick(session_id); | 738 | render_start_tick = audio_renderer.GetRenderingStartTick(session_id); |
| 739 | frames_elapsed++; | 739 | frames_elapsed++; |
| 740 | 740 | ||
| 741 | return command_buffer.size; | 741 | return command_buffer.size; |
| @@ -819,4 +819,4 @@ u32 System::DropVoices(CommandBuffer& command_buffer, u32 estimated_process_time | |||
| 819 | return voices_dropped; | 819 | return voices_dropped; |
| 820 | } | 820 | } |
| 821 | 821 | ||
| 822 | } // namespace AudioCore::AudioRenderer | 822 | } // namespace AudioCore::Renderer |