[PR #990] [MERGED] videoout: Make present thread realtime on macOS. #1866

Closed
opened 2026-02-27 21:14:15 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/shadps4-emu/shadPS4/pull/990
Author: @squidbus
Created: 9/19/2024
Status: Merged
Merged: 9/19/2024
Merged by: @raphaelthegreat

Base: mainHead: present-realtime


📝 Commits (1)

  • 243f8b5 videoout: Make present thread realtime on macOS.

📊 Changes

3 files changed (+50 additions, -2 deletions)

View changed files

📝 src/common/thread.cpp (+43 -0)
📝 src/common/thread.h (+3 -0)
📝 src/core/libraries/videoout/driver.cpp (+4 -2)

📄 Description

Adds a helper to set up threads with real-time scheduling, and uses it in videoout for the present thread to make sure the sleep timing for v-blanks is as accurate as possible. This fixes issues on macOS where presenting is too slow due to inaccurate sleep timing. I've also extended the v-blank period out to nanoseconds to make it more precise since it was actually running slightly too fast after fixing the sleep times; this may need further tuning to the exact v-blank period of the PS4, but for now it's just set for 60 FPS.

Note that the real-time scheduling helper is only implemented for macOS currently. If any other platforms need it in the future, it can be implemented for them as well, but I don't have the knowledge necessary to implement this for all platforms.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/shadps4-emu/shadPS4/pull/990 **Author:** [@squidbus](https://github.com/squidbus) **Created:** 9/19/2024 **Status:** ✅ Merged **Merged:** 9/19/2024 **Merged by:** [@raphaelthegreat](https://github.com/raphaelthegreat) **Base:** `main` ← **Head:** `present-realtime` --- ### 📝 Commits (1) - [`243f8b5`](https://github.com/shadps4-emu/shadPS4/commit/243f8b54cac251e15e1ad24b4591fcf3865c50a4) videoout: Make present thread realtime on macOS. ### 📊 Changes **3 files changed** (+50 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `src/common/thread.cpp` (+43 -0) 📝 `src/common/thread.h` (+3 -0) 📝 `src/core/libraries/videoout/driver.cpp` (+4 -2) </details> ### 📄 Description Adds a helper to set up threads with real-time scheduling, and uses it in `videoout` for the present thread to make sure the sleep timing for v-blanks is as accurate as possible. This fixes issues on macOS where presenting is too slow due to inaccurate sleep timing. I've also extended the v-blank period out to nanoseconds to make it more precise since it was actually running slightly too fast after fixing the sleep times; this may need further tuning to the exact v-blank period of the PS4, but for now it's just set for 60 FPS. Note that the real-time scheduling helper is only implemented for macOS currently. If any other platforms need it in the future, it can be implemented for them as well, but I don't have the knowledge necessary to implement this for all platforms. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 21:14:15 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/shadPS4#1866
No description provided.