Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #8935 from JosJuice/di-read-latency
DVDInterface: Increase the latency for read commands
  • Loading branch information
lioncash committed Sep 8, 2020
2 parents e7e5175 + 327b985 commit 48cfc32
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions Source/Core/Core/HW/DVD/DVDInterface.cpp
Expand Up @@ -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;
Expand Down Expand Up @@ -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));
}
}

Expand All @@ -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));
}
}

Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 48cfc32

Please sign in to comment.