mirror of
https://github.com/HackerN64/HackerOoT.git
synced 2026-01-21 10:37:37 -08:00
Scheduling Fixes (#117)
* Fix mod_assets.py for python 3.8 * sched.c: Defer RSP task completion signal until after the scheduler has started the next task to improve throughput * audio_thread_manager.c: Delay audio thread updates to give the graphics microcode time to generate work for the RDP before it has to yield * audio_thread_manager.c: Bump audio update delay to 3ms Co-authored-by: Sauraen <sauraen@gmail.com> --------- Co-authored-by: Sauraen <sauraen@gmail.com>
This commit is contained in:
@@ -23,6 +23,15 @@ void AudioMgr_NotifyTaskDone(AudioMgr* audioMgr) {
|
||||
void AudioMgr_HandleRetrace(AudioMgr* audioMgr) {
|
||||
AudioTask* rspTask;
|
||||
|
||||
// Delay the audio update by 3ms so that gfx has time to get going before it has to yield
|
||||
OSTimer timer;
|
||||
OSMesgQueue mq;
|
||||
OSMesg mbuf;
|
||||
osCreateMesgQueue(&mq, &mbuf, 1);
|
||||
osSetTimer(&timer, OS_USEC_TO_CYCLES(3000), 0, &mq, NULL);
|
||||
osRecvMesg(&mq, NULL, OS_MESG_BLOCK);
|
||||
osStopTimer(&timer);
|
||||
|
||||
if (R_AUDIOMGR_DEBUG_LEVEL > AUDIOMGR_DEBUG_LEVEL_NONE) {
|
||||
// Inhibit audio rsp task processing
|
||||
audioMgr->rspTask = NULL;
|
||||
|
||||
@@ -552,7 +552,9 @@ void Sched_HandleRSPDone(Scheduler* sc) {
|
||||
|
||||
SCHED_DEBUG_PRINTF("RSP DONE %d %d", curRSPTask->state & OS_SC_YIELD, osSpTaskYielded(&curRSPTask->list));
|
||||
|
||||
if ((curRSPTask->state & OS_SC_YIELD) && osSpTaskYielded(&curRSPTask->list)) {
|
||||
s32 inYield = (curRSPTask->state & OS_SC_YIELD) && osSpTaskYielded(&curRSPTask->list);
|
||||
|
||||
if (inYield) {
|
||||
SCHED_DEBUG_PRINTF("[YIELDED]\n");
|
||||
|
||||
// Task yielded, set yielded state
|
||||
@@ -568,10 +570,6 @@ void Sched_HandleRSPDone(Scheduler* sc) {
|
||||
#if ENABLE_PROFILER
|
||||
Profiler_RSPDoneNotYield(curRSPTask->flags);
|
||||
#endif
|
||||
|
||||
// Task has completed on the RSP, unset RSP flag and check if the task is fully complete
|
||||
curRSPTask->state &= ~OS_SC_SP;
|
||||
Sched_TaskComplete(sc, curRSPTask);
|
||||
}
|
||||
|
||||
// Run next task in the queue if there is one and the necessary resources are available
|
||||
@@ -580,6 +578,13 @@ void Sched_HandleRSPDone(Scheduler* sc) {
|
||||
Sched_RunTask(sc, nextRSP, nextRDP);
|
||||
}
|
||||
SCHED_DEBUG_PRINTF("SP sc:%08x sp:%08x dp:%08x state:%x\n", sc, nextRSP, nextRDP, state);
|
||||
|
||||
// Defer task completion signal until after the next task has been staged for maximum throughput
|
||||
if (!inYield) {
|
||||
// Task has completed on the RSP, unset RSP flag and check if the task is fully complete
|
||||
curRSPTask->state &= ~OS_SC_SP;
|
||||
Sched_TaskComplete(sc, curRSPTask);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -101,6 +101,12 @@ def update_cache_time(root: str) -> int:
|
||||
return last_time
|
||||
|
||||
|
||||
def remove_suffix(input_string, suffix):
|
||||
if suffix and input_string.endswith(suffix):
|
||||
return input_string[:-len(suffix)]
|
||||
return input_string
|
||||
|
||||
|
||||
def main():
|
||||
global allow_print
|
||||
|
||||
@@ -109,7 +115,7 @@ def main():
|
||||
args = parser.parse_args()
|
||||
allow_print = args.verbose
|
||||
|
||||
root = os.path.dirname(os.path.realpath(__file__)).removesuffix("/tools")
|
||||
root = remove_suffix(os.path.dirname(os.path.realpath(__file__)), "/tools")
|
||||
last_cache_time = update_cache_time(root)
|
||||
copied_files = copy_all(root)
|
||||
remove_stale_assets(root, copied_files, last_cache_time)
|
||||
|
||||
Reference in New Issue
Block a user