From 7c4b4765bf7a77da1ce3793ca8a496c06e44d693 Mon Sep 17 00:00:00 2001 From: Billy Laws Date: Sat, 3 Dec 2022 19:53:09 +0000 Subject: [PATCH] Reduce thresholds for slot increase and buffer/texture fast readback --- app/src/main/cpp/skyline/gpu/buffer.h | 4 ++-- .../main/cpp/skyline/gpu/interconnect/command_executor.cpp | 3 ++- app/src/main/cpp/skyline/gpu/interconnect/command_executor.h | 2 +- app/src/main/cpp/skyline/gpu/texture/texture.h | 4 ++-- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/app/src/main/cpp/skyline/gpu/buffer.h b/app/src/main/cpp/skyline/gpu/buffer.h index 1b286748..5d051cf4 100644 --- a/app/src/main/cpp/skyline/gpu/buffer.h +++ b/app/src/main/cpp/skyline/gpu/buffer.h @@ -90,8 +90,8 @@ namespace skyline::gpu { static constexpr size_t FrequentlyLockedThreshold{2}; //!< Threshold for the number of times a buffer can be locked (not from context locks, only normal) before it should be considered frequently locked size_t accumulatedCpuLockCounter{}; //!< Number of times buffer has been locked through non-ContextLocks - static constexpr size_t FastReadbackHackWaitCountThreshold{8}; //!< Threshold for the number of times a buffer can be waited on before it should be considered for the readback hack - static constexpr std::chrono::nanoseconds FastReadbackHackWaitTimeThreshold{constant::NsInSecond / 2}; //!< Threshold for the amount of time buffer texture can be waited on before it should be considered for the readback hack, `SkipReadbackHackWaitCountThreshold` needs to be hit before this + static constexpr size_t FastReadbackHackWaitCountThreshold{6}; //!< Threshold for the number of times a buffer can be waited on before it should be considered for the readback hack + static constexpr std::chrono::nanoseconds FastReadbackHackWaitTimeThreshold{constant::NsInSecond /4}; //!< Threshold for the amount of time buffer texture can be waited on before it should be considered for the readback hack, `SkipReadbackHackWaitCountThreshold` needs to be hit before this size_t accumulatedGuestWaitCounter{}; //!< Total number of times the buffer has been waited on std::chrono::nanoseconds accumulatedGuestWaitTime{}; //!< Amount of time the buffer has been waited on for since the `FastReadbackHackWaitTimeThreshold`th wait on it by the guest diff --git a/app/src/main/cpp/skyline/gpu/interconnect/command_executor.cpp b/app/src/main/cpp/skyline/gpu/interconnect/command_executor.cpp index 916d9efd..9f4531ed 100644 --- a/app/src/main/cpp/skyline/gpu/interconnect/command_executor.cpp +++ b/app/src/main/cpp/skyline/gpu/interconnect/command_executor.cpp @@ -150,7 +150,8 @@ namespace skyline::gpu::interconnect { renderDocApi->EndFrameCapture(RENDERDOC_DEVICEPOINTER_FROM_VKINSTANCE(instance), nullptr); slot->capture = false; - if (slot->didWait && slots.size() < (1U << *state.settings->executorSlotCountScale)) { + if (slot->didWait && (slots.size() + 1) < (1U << *state.settings->executorSlotCountScale)) { + outgoing.Push(&slots.emplace_back(gpu)); outgoing.Push(&slots.emplace_back(gpu)); slot->didWait = false; } diff --git a/app/src/main/cpp/skyline/gpu/interconnect/command_executor.h b/app/src/main/cpp/skyline/gpu/interconnect/command_executor.h index 5dd470c7..8df06b4d 100644 --- a/app/src/main/cpp/skyline/gpu/interconnect/command_executor.h +++ b/app/src/main/cpp/skyline/gpu/interconnect/command_executor.h @@ -63,7 +63,7 @@ namespace skyline::gpu::interconnect { }; private: - static constexpr size_t GrowThresholdNs{constant::NsInMillisecond / 4}; //!< The wait time threshold at which the slot count will be increased + static constexpr size_t GrowThresholdNs{constant::NsInMillisecond / 50}; //!< The wait time threshold at which the slot count will be increased const DeviceState &state; CircularQueue incoming; //!< Slots pending recording CircularQueue outgoing; //!< Slots that have been submitted, may still be active on the GPU diff --git a/app/src/main/cpp/skyline/gpu/texture/texture.h b/app/src/main/cpp/skyline/gpu/texture/texture.h index 641a1112..d9866d07 100644 --- a/app/src/main/cpp/skyline/gpu/texture/texture.h +++ b/app/src/main/cpp/skyline/gpu/texture/texture.h @@ -450,8 +450,8 @@ namespace skyline::gpu { static constexpr size_t FrequentlyLockedThreshold{2}; //!< Threshold for the number of times a texture can be locked (not from context locks, only normal) before it should be considered frequently locked size_t accumulatedCpuLockCounter{}; - static constexpr size_t SkipReadbackHackWaitCountThreshold{8}; //!< Threshold for the number of times a texture can be waited on before it should be considered for the readback hack - static constexpr std::chrono::nanoseconds SkipReadbackHackWaitTimeThreshold{constant::NsInSecond / 2}; //!< Threshold for the amount of time a texture can be waited on before it should be considered for the readback hack, `SkipReadbackHackWaitCountThreshold` needs to be hit before this + static constexpr size_t SkipReadbackHackWaitCountThreshold{6}; //!< Threshold for the number of times a texture can be waited on before it should be considered for the readback hack + static constexpr std::chrono::nanoseconds SkipReadbackHackWaitTimeThreshold{constant::NsInSecond / 4}; //!< Threshold for the amount of time a texture can be waited on before it should be considered for the readback hack, `SkipReadbackHackWaitCountThreshold` needs to be hit before this size_t accumulatedGuestWaitCounter{}; //!< Total number of times the texture has been waited on std::chrono::nanoseconds accumulatedGuestWaitTime{}; //!< Amount of time the texture has been waited on for since the `SkipReadbackHackWaitCountThreshold`th wait on it by the guest