Merge pull request #8935 from JosJuice/di-read-latency

DVDInterface: Increase the latency for read commands
This commit is contained in:
LC 2020-09-07 22:31:18 -04:00 committed by GitHub
commit 48cfc32bf3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 13 deletions

View File

@ -43,9 +43,11 @@
#include "VideoCommon/OnScreenDisplay.h"
// The minimum time it takes for the DVD drive to process a command (in
// microseconds)
constexpr u64 COMMAND_LATENCY_US = 300;
// The minimum time it takes for the DVD drive to process a command (in microseconds)
constexpr u64 MINIMUM_COMMAND_LATENCY_US = 300;
// The time it takes for a read command to start (in microseconds)
constexpr u64 READ_COMMAND_LATENCY_US = 600;
// The size of the streaming buffer.
constexpr u64 STREAMING_BUFFER_SIZE = 1024 * 1024;
@ -1208,10 +1210,10 @@ void ExecuteCommand(ReplyType reply_type)
if (!command_handled_by_thread)
{
// TODO: Needs testing to determine if COMMAND_LATENCY_US is accurate for this
CoreTiming::ScheduleEvent(COMMAND_LATENCY_US * (SystemTimers::GetTicksPerSecond() / 1000000),
s_finish_executing_command,
PackFinishExecutingCommandUserdata(reply_type, interrupt_type));
// TODO: Needs testing to determine if MINIMUM_COMMAND_LATENCY_US is accurate for this
CoreTiming::ScheduleEvent(
MINIMUM_COMMAND_LATENCY_US * (SystemTimers::GetTicksPerSecond() / 1000000),
s_finish_executing_command, PackFinishExecutingCommandUserdata(reply_type, interrupt_type));
}
}
@ -1227,10 +1229,10 @@ void PerformDecryptingRead(u32 position, u32 length, u32 output_address,
if (!command_handled_by_thread)
{
// TODO: Needs testing to determine if COMMAND_LATENCY_US is accurate for this
CoreTiming::ScheduleEvent(COMMAND_LATENCY_US * (SystemTimers::GetTicksPerSecond() / 1000000),
s_finish_executing_command,
PackFinishExecutingCommandUserdata(reply_type, interrupt_type));
// TODO: Needs testing to determine if MINIMUM_COMMAND_LATENCY_US is accurate for this
CoreTiming::ScheduleEvent(
MINIMUM_COMMAND_LATENCY_US * (SystemTimers::GetTicksPerSecond() / 1000000),
s_finish_executing_command, PackFinishExecutingCommandUserdata(reply_type, interrupt_type));
}
}
@ -1405,8 +1407,8 @@ static void ScheduleReads(u64 offset, u32 length, const DiscIO::Partition& parti
"Schedule reads: offset=0x%" PRIx64 " length=0x%" PRIx32 " address=0x%" PRIx32, offset,
length, output_address);
// The DVD drive's minimum turnaround time on a command, based on a hardware test.
s64 ticks_until_completion = COMMAND_LATENCY_US * (SystemTimers::GetTicksPerSecond() / 1000000);
s64 ticks_until_completion =
READ_COMMAND_LATENCY_US * (SystemTimers::GetTicksPerSecond() / 1000000);
u32 buffered_blocks = 0;
u32 unbuffered_blocks = 0;