videoout: Make present thread realtime on macOS. (#990)

This commit is contained in:
squidbus 2024-09-19 15:28:35 -07:00 committed by GitHub
parent 60f315a54d
commit 048b8aef58
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 50 additions and 2 deletions

View file

@ -261,8 +261,11 @@ void VideoOutDriver::SubmitFlipInternal(VideoOutPort* port, s32 index, s64 flip_
}
void VideoOutDriver::PresentThread(std::stop_token token) {
static constexpr std::chrono::milliseconds VblankPeriod{16};
static constexpr std::chrono::nanoseconds VblankPeriod{16666667};
const auto vblank_period = VblankPeriod / Config::vblankDiv();
Common::SetCurrentThreadName("PresentThread");
Common::SetCurrentThreadRealtime(vblank_period);
const auto receive_request = [this] -> Request {
std::scoped_lock lk{mutex};
@ -274,7 +277,6 @@ void VideoOutDriver::PresentThread(std::stop_token token) {
return {};
};
auto vblank_period = VblankPeriod / Config::vblankDiv();
auto delay = std::chrono::microseconds{0};
while (!token.stop_requested()) {
// Sleep for most of the vblank duration.