Do not reset the command buffer command count each time

This commit is contained in:
Kelebek1 2023-09-07 20:53:48 +01:00
parent 69949e7964
commit 4baaaf6a99
5 changed files with 14 additions and 27 deletions

View File

@ -88,8 +88,13 @@ MailboxMessage AudioRenderer::Receive(Direction dir, bool block) {
return mailbox.Receive(dir, block); return mailbox.Receive(dir, block);
} }
void AudioRenderer::SetCommandBuffer(s32 session_id, CommandBuffer& buffer) noexcept { void AudioRenderer::SetCommandBuffer(s32 session_id, CpuAddr buffer, u64 size, u64 time_limit,
command_buffers[session_id] = buffer; u64 applet_resource_user_id, 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].reset_buffer = reset;
} }
u32 AudioRenderer::GetRemainCommandCount(s32 session_id) const noexcept { u32 AudioRenderer::GetRemainCommandCount(s32 session_id) const noexcept {

View File

@ -75,7 +75,8 @@ public:
void Send(Direction dir, MailboxMessage message); void Send(Direction dir, MailboxMessage message);
MailboxMessage Receive(Direction dir, bool block = true); MailboxMessage Receive(Direction dir, bool block = true);
void SetCommandBuffer(s32 session_id, CommandBuffer& buffer) noexcept; void SetCommandBuffer(s32 session_id, CpuAddr buffer, u64 size, u64 time_limit,
u64 applet_resource_user_id, bool reset) noexcept;
u32 GetRemainCommandCount(s32 session_id) const noexcept; u32 GetRemainCommandCount(s32 session_id) const noexcept;
void ClearRemainCommandCount(s32 session_id) noexcept; void ClearRemainCommandCount(s32 session_id) noexcept;
u64 GetRenderingStartTick(s32 session_id) const noexcept; u64 GetRenderingStartTick(s32 session_id) const noexcept;

View File

@ -37,11 +37,6 @@ u32 CommandListProcessor::GetRemainingCommandCount() const {
return command_count - processed_command_count; return command_count - processed_command_count;
} }
void CommandListProcessor::SetBuffer(const CpuAddr buffer, const u64 size) {
commands = reinterpret_cast<u8*>(buffer + sizeof(Renderer::CommandListHeader));
commands_buffer_size = size;
}
Sink::SinkStream* CommandListProcessor::GetOutputSinkStream() const { Sink::SinkStream* CommandListProcessor::GetOutputSinkStream() const {
return stream; return stream;
} }

View File

@ -56,14 +56,6 @@ public:
*/ */
u32 GetRemainingCommandCount() const; u32 GetRemainingCommandCount() const;
/**
* Set the command buffer.
*
* @param buffer - The buffer to use.
* @param size - The size of the buffer.
*/
void SetBuffer(CpuAddr buffer, u64 size);
/** /**
* Get the stream for this command list. * Get the stream for this command list.
* *

View File

@ -609,17 +609,11 @@ void System::SendCommandToDsp() {
time_limit_percent = 70.0f; time_limit_percent = 70.0f;
} }
AudioRenderer::CommandBuffer command_buffer{ auto time_limit{
.buffer{translated_addr},
.size{command_size},
.time_limit{
static_cast<u64>((time_limit_percent / 100) * 2'880'000.0 * static_cast<u64>((time_limit_percent / 100) * 2'880'000.0 *
(static_cast<f32>(render_time_limit_percent) / 100.0f))}, (static_cast<f32>(render_time_limit_percent) / 100.0f))};
.applet_resource_user_id{applet_resource_user_id}, audio_renderer.SetCommandBuffer(session_id, translated_addr, command_size, time_limit,
.reset_buffer{reset_command_buffers}, applet_resource_user_id, reset_command_buffers);
};
audio_renderer.SetCommandBuffer(session_id, command_buffer);
reset_command_buffers = false; reset_command_buffers = false;
command_buffer_size = command_size; command_buffer_size = command_size;
if (remaining_command_count == 0) { if (remaining_command_count == 0) {