[PR #4065] [MERGED] Kernel.Event: Implement kqueue and kevent #3912

Closed
opened 2026-02-27 22:05:26 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/shadps4-emu/shadPS4/pull/4065
Author: @StevenMiller123
Created: 2/22/2026
Status: Merged
Merged: 2/22/2026
Merged by: @georgemoralis

Base: mainHead: kqueue-kevent


📝 Commits (10+)

  • b1ae80c Remove dead code from EqueueInternal::WaitForEvents
  • f7a0075 Refactor type names
  • 8aa4d92 Properly define OrbisKernelEqueue as a handle
  • 60acea8 Clang
  • d6d8ada Widen OrbisKernelEqueue type
  • 4ca1ac5 kqueue implementation
  • bcaf120 Hardware-accurate timer data
  • caae979 Move callback scheduling to EqueueInternal::AddEvent
  • 30e6db4 posix_kevent
  • acd7034 Log calls

📊 Changes

10 files changed (+366 additions, -197 deletions)

View changed files

📝 src/core/file_sys/fs.h (+2 -1)
📝 src/core/libraries/gnmdriver/gnmdriver.cpp (+17 -13)
📝 src/core/libraries/gnmdriver/gnmdriver.h (+3 -3)
📝 src/core/libraries/kernel/equeue.cpp (+285 -134)
📝 src/core/libraries/kernel/equeue.h (+19 -11)
📝 src/core/libraries/kernel/file_system.cpp (+2 -1)
📝 src/core/libraries/videoout/driver.cpp (+2 -2)
📝 src/core/libraries/videoout/driver.h (+2 -2)
📝 src/core/libraries/videoout/video_out.cpp (+30 -26)
📝 src/core/libraries/videoout/video_out.h (+4 -4)

📄 Description

The bulk of this PR is a refactor, swapping our SceKernelEqueue to a 64-bit integer to match real hardware behavior, and implementing the necessary structure to store equeues instead of relying on games passing them around. I also renamed our structs to OrbisKernel prefixes to match our modern standards.
Additionally, to make this implementation reasonable, I moved timer scheduling to EqueueInternal::AddEvent, and changed logic for data storage in timer and small timer events to match libkernel behavior.

This needs testing, the only title I own that calls these is Assassin's Creed Unity, and that isn't really affected by this, since it's just using kevent to add a read event to their equeue.

As far as I've tested locally, I haven't broken anything involving normal equeue event usage.


🔄 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/4065 **Author:** [@StevenMiller123](https://github.com/StevenMiller123) **Created:** 2/22/2026 **Status:** ✅ Merged **Merged:** 2/22/2026 **Merged by:** [@georgemoralis](https://github.com/georgemoralis) **Base:** `main` ← **Head:** `kqueue-kevent` --- ### 📝 Commits (10+) - [`b1ae80c`](https://github.com/shadps4-emu/shadPS4/commit/b1ae80c167fd9c0921dc187a6b2d6b09083ac4fc) Remove dead code from EqueueInternal::WaitForEvents - [`f7a0075`](https://github.com/shadps4-emu/shadPS4/commit/f7a007566b85255b8dc04f81a9ee7f2303f4b5cb) Refactor type names - [`8aa4d92`](https://github.com/shadps4-emu/shadPS4/commit/8aa4d9210d684457f9af9f21491e7a946b2d7f94) Properly define OrbisKernelEqueue as a handle - [`60acea8`](https://github.com/shadps4-emu/shadPS4/commit/60acea86effb4b5c64cb41566fa33866a48c6a44) Clang - [`d6d8ada`](https://github.com/shadps4-emu/shadPS4/commit/d6d8ada8e7328f82e84ef2c391ca133cb3cde1d2) Widen OrbisKernelEqueue type - [`4ca1ac5`](https://github.com/shadps4-emu/shadPS4/commit/4ca1ac5b0f22a2fc300e56ecc2870d7f83c95405) kqueue implementation - [`bcaf120`](https://github.com/shadps4-emu/shadPS4/commit/bcaf120b275dd528cd270f105580cf1ded5fa8e5) Hardware-accurate timer data - [`caae979`](https://github.com/shadps4-emu/shadPS4/commit/caae9799f4790c316a55122421de5a791f6d62e3) Move callback scheduling to EqueueInternal::AddEvent - [`30e6db4`](https://github.com/shadps4-emu/shadPS4/commit/30e6db4d41d9250b01100e93134c0f5ed7fe8ca3) posix_kevent - [`acd7034`](https://github.com/shadps4-emu/shadPS4/commit/acd7034b1c3e7c104d1430522ebeba626872eea2) Log calls ### 📊 Changes **10 files changed** (+366 additions, -197 deletions) <details> <summary>View changed files</summary> 📝 `src/core/file_sys/fs.h` (+2 -1) 📝 `src/core/libraries/gnmdriver/gnmdriver.cpp` (+17 -13) 📝 `src/core/libraries/gnmdriver/gnmdriver.h` (+3 -3) 📝 `src/core/libraries/kernel/equeue.cpp` (+285 -134) 📝 `src/core/libraries/kernel/equeue.h` (+19 -11) 📝 `src/core/libraries/kernel/file_system.cpp` (+2 -1) 📝 `src/core/libraries/videoout/driver.cpp` (+2 -2) 📝 `src/core/libraries/videoout/driver.h` (+2 -2) 📝 `src/core/libraries/videoout/video_out.cpp` (+30 -26) 📝 `src/core/libraries/videoout/video_out.h` (+4 -4) </details> ### 📄 Description The bulk of this PR is a refactor, swapping our SceKernelEqueue to a 64-bit integer to match real hardware behavior, and implementing the necessary structure to store equeues instead of relying on games passing them around. I also renamed our structs to OrbisKernel prefixes to match our modern standards. Additionally, to make this implementation reasonable, I moved timer scheduling to `EqueueInternal::AddEvent`, and changed logic for data storage in timer and small timer events to match libkernel behavior. This needs testing, the only title I own that calls these is Assassin's Creed Unity, and that isn't really affected by this, since it's just using kevent to add a read event to their equeue. As far as I've tested locally, I haven't broken anything involving normal equeue event usage. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 22:05:26 +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#3912
No description provided.