From 98e38723530eb60e3f2c5ad509174f48f98ae882 Mon Sep 17 00:00:00 2001 From: Subv Date: Wed, 8 Nov 2017 23:14:40 -0500 Subject: [PATCH] Kernel/IPC: Use 39 microseconds for the SendSyncRequest delay approximation. As measured by the time it takes for to return when performing the SetLcdForceBlack IPC request to the GSP:GPU service in a n3DS with firmware 11.6 See https://gist.github.com/ds84182/ecdbbd25b56a29bd4e5b32a7544b8e92 for the source code of the test. --- src/core/hle/kernel/server_session.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/core/hle/kernel/server_session.cpp b/src/core/hle/kernel/server_session.cpp index 07f54d56d..5b61b52cb 100644 --- a/src/core/hle/kernel/server_session.cpp +++ b/src/core/hle/kernel/server_session.cpp @@ -81,8 +81,11 @@ ResultCode ServerSession::HandleSyncRequest(SharedPtr thread) { // starvation when a thread only does sync requests to HLE services while a // lower-priority thread is waiting to run. - // TODO(Subv): Figure out a good value for this. - static constexpr u64 IPCDelayNanoseconds = 100; + // This delay was approximated in a homebrew application by measuring the average time + // it takes for svcSendSyncRequest to return when performing the SetLcdForceBlack IPC + // request to the GSP:GPU service in a n3DS with firmware 11.6. The measured values have + // a high variance and vary between models. + static constexpr u64 IPCDelayNanoseconds = 39000; thread->WakeAfterDelay(IPCDelayNanoseconds); } else { // Add the thread to the list of threads that have issued a sync request with this