Drastically reduce cpu time wasted by XMADecoderThread spinning, went from 13% of all cpu time to about 0.6% in my tests

Commented out lock in WatchMemoryRange, lock is always held by caller
properly set the value/check the irql for spinlocks in xboxkrnl_threading
This commit is contained in:
chss95cs@gmail.com
2022-10-15 03:07:07 -07:00
parent ecf6bfbbdf
commit efbeae660c
6 changed files with 62 additions and 42 deletions

View File

@@ -177,14 +177,7 @@ void XmaDecoder::WorkerThreadMain() {
} else {
idle_loop_count = 0;
}
if (idle_loop_count > 500) {
// Idle for an extended period. Introduce a 20ms wait.
xe::threading::Wait(work_event_.get(), false,
std::chrono::milliseconds(20));
}
xe::threading::MaybeYield();
xe::threading::Wait(work_event_.get(), false);
}
}
@@ -316,7 +309,7 @@ void XmaDecoder::WriteRegister(uint32_t addr, uint32_t value) {
}
}
// Signal the decoder thread to start processing.
work_event_->Set();
work_event_->SetBoostPriority();
} else if (r >= XmaRegister::Context0Lock && r <= XmaRegister::Context9Lock) {
// Context lock command.
// This requests a lock by flagging the context.