fix(libSceAgcDriver): raise the graphics end-of-pipe event from flip packets #4215

Merged
Mouad-Scriptz-0 merged 1 commit from upstream-pr/4215 into main 2026-10-13 14:39:04 +00:00
Mouad-Scriptz-0 commented 2026-10-12 01:39:33 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Mouad-Scriptz-0 on 2026-10-12T01:39:33Z.


What

sceAgcDriverAddEqEvent registers a queue's end-of-pipe event, and the driver raised it only for a RELEASE_MEM whose INT_SEL asks for an interrupt. Minecraft (PPSA17221) registers the graphics event, never requests an interrupt in its releases, and after each sceAgcDcbSetFlip waits on the event while holding its render lock: it presented one frame and every thread then waited on that lock (sceKernelWaitEqueue on GraphicsEventQueue with the one registered event never triggered, sampled with eu-stack), so the title sat at its first frame forever.

  • A flip packet now delivers the queue's end-of-pipe event once the work recorded before it completes (AfterRecordedWork, as the RELEASE_MEM path does), or at once when nothing is recorded.
  • agc_driver_submit's end-of-pipe case gains a flip: a registered video output receives the flip and the graphics event arrives with data 1, type 0, and is cleared afterwards.
  • TechnicalDebt records that whether the console raises the event from the flip itself or from an interrupt in its flip sequence is not measured, and that a title waiting only on release interrupts now sees one extra event per flip.

With this (and the imports of #4118) Minecraft runs: menus, world creation and play on an Intel Arc Meteor Lake iGPU.

Tested

Fedora 44 (kernel 7.2.8, GCC 16.2.1, Ninja, Release, BUILD_TESTING=ON, Intel Arc Meteor Lake, Mesa 26.2.3), worktree on main bab7b328: agc_driver_submit passes (the new flip case fails without the change); tools/check_conventions.py --base origin/main and git diff --check pass. Minecraft (PPSA17221) runs (Linux). Not tested on Windows.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes (Claude Code)

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4823927706 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4215). Originally posted by [Mouad-Scriptz-0](https://github.com/Mouad-Scriptz-0) on 2026-10-12T01:39:33Z. --- ### What `sceAgcDriverAddEqEvent` registers a queue's end-of-pipe event, and the driver raised it only for a `RELEASE_MEM` whose `INT_SEL` asks for an interrupt. Minecraft (PPSA17221) registers the graphics event, never requests an interrupt in its releases, and after each `sceAgcDcbSetFlip` waits on the event while holding its render lock: it presented one frame and every thread then waited on that lock (`sceKernelWaitEqueue` on `GraphicsEventQueue` with the one registered event never triggered, sampled with `eu-stack`), so the title sat at its first frame forever. - A flip packet now delivers the queue's end-of-pipe event once the work recorded before it completes (`AfterRecordedWork`, as the `RELEASE_MEM` path does), or at once when nothing is recorded. - `agc_driver_submit`'s end-of-pipe case gains a flip: a registered video output receives the flip and the graphics event arrives with `data` 1, type 0, and is cleared afterwards. - TechnicalDebt records that whether the console raises the event from the flip itself or from an interrupt in its flip sequence is not measured, and that a title waiting only on release interrupts now sees one extra event per flip. With this (and the imports of #4118) Minecraft runs: menus, world creation and play on an Intel Arc Meteor Lake iGPU. ### Tested Fedora 44 (kernel 7.2.8, GCC 16.2.1, Ninja, Release, `BUILD_TESTING=ON`, Intel Arc Meteor Lake, Mesa 26.2.3), worktree on `main` bab7b328: `agc_driver_submit` passes (the new flip case fails without the change); `tools/check_conventions.py --base origin/main` and `git diff --check` pass. Minecraft (PPSA17221) runs (Linux). Not tested on Windows. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] AI-assisted: yes (Claude Code) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
johnmaia commented 2026-10-13 13:36:53 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by johnmaia on 2026-10-13T13:36:53Z.


Windows run, since the description says Windows is untested. Setup: Windows 11 (26300), WinLibs GCC 15.2.0 r7, Release, BUILD_TESTING=ON, ctest -j4 --timeout 300. Head 74389909f merged into main 3faa9cb40; the only conflict is docs/dev/TechnicalDebt.md, where I kept main's text. Two GPUs: RTX 4080 (NVIDIA 617.42) and Intel UHD 770 (101.6129).

  • Submit.cpp builds into agc_driver_tests, which is EXCLUDE_FROM_ALL and not registered with ctest, so I built it and ran it by hand, with ctest's PATH (build/core/libs/libs/unpatched). AGC driver submit tests passed on both GPUs.
  • Negative control: the same test with PacketExecution.cpp from main fails on both GPUs with flip did not raise the graphics end-of-pipe event.
  • The full ctest suite passes 1074 of 1074 on both GPUs.
  • The PR conflicts with main in docs/dev/TechnicalDebt.md (the debt split), so it needs a rebase with python3 tools/debt_split.py resolve.

Not tested: a title.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6146813393 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4215#issuecomment-6146813393). Originally posted by [johnmaia](https://github.com/johnmaia) on 2026-10-13T13:36:53Z. --- Windows run, since the description says Windows is untested. Setup: Windows 11 (26300), WinLibs GCC 15.2.0 r7, Release, `BUILD_TESTING=ON`, `ctest -j4 --timeout 300`. Head 74389909f merged into `main` 3faa9cb40; the only conflict is `docs/dev/TechnicalDebt.md`, where I kept `main`'s text. Two GPUs: RTX 4080 (NVIDIA 617.42) and Intel UHD 770 (101.6129). - `Submit.cpp` builds into `agc_driver_tests`, which is `EXCLUDE_FROM_ALL` and not registered with ctest, so I built it and ran it by hand, with ctest's `PATH` (`build/core/libs/libs/unpatched`). `AGC driver submit tests passed` on both GPUs. - Negative control: the same test with `PacketExecution.cpp` from `main` fails on both GPUs with `flip did not raise the graphics end-of-pipe event`. - The full ctest suite passes 1074 of 1074 on both GPUs. - The PR conflicts with `main` in `docs/dev/TechnicalDebt.md` (the debt split), so it needs a rebase with `python3 tools/debt_split.py resolve`. Not tested: a title. AI-assisted: yes (Claude Code)
adriadam10 commented 2026-10-13 14:15:28 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-13T14:15:28Z.


Rebased onto main (only conflict was the debt split: the line now lives in docs/dev/debt/libSceAgcDriver.md). Checked the agc_driver flip case passes and fails without the PacketExecution.cpp change, and the libSceAgcDriver ctest scope is green apart from agc_driver_tessellation, which segfaults on main too. Windows run by @johnmaia confirms the same on NVIDIA and Intel. Merging once the full Build is green.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6147584991 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4215#issuecomment-6147584991). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-13T14:15:28Z. --- Rebased onto `main` (only conflict was the debt split: the line now lives in `docs/dev/debt/libSceAgcDriver.md`). Checked the `agc_driver` flip case passes and fails without the `PacketExecution.cpp` change, and the libSceAgcDriver ctest scope is green apart from `agc_driver_tessellation`, which segfaults on `main` too. Windows run by @johnmaia confirms the same on NVIDIA and Intel. Merging once the full Build is green.
fma-rc commented 2026-10-18 14:51:51 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by fma-rc on 2026-10-18T14:51:51Z.


@Mouad-Scriptz-0 a question about the Minecraft case this PR fixed. The end-of-pipe event delivered after every flip packet makes Death Stranding 2 call a null handler on its first flip (#6462). Its graphics event handler table is still empty at that moment, so a bare sceAgcDcbSetFlip can't be raising that event on a console.

To replace the per-flip event without hanging Minecraft again I need to know what Minecraft submits between two flips. Does its command buffer carry a RELEASE_MEM or EVENT_WRITE_EOP with an interrupt select, and on which queue? Which id and udata does it pass to sceAgcDriverAddEqEvent? A log of its submitted packets around two flips would answer both.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6251315084 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4215#issuecomment-6251315084). Originally posted by [fma-rc](https://github.com/fma-rc) on 2026-10-18T14:51:51Z. --- @Mouad-Scriptz-0 a question about the Minecraft case this PR fixed. The end-of-pipe event delivered after every flip packet makes Death Stranding 2 call a null handler on its first flip (#6462). Its graphics event handler table is still empty at that moment, so a bare `sceAgcDcbSetFlip` can't be raising that event on a console. To replace the per-flip event without hanging Minecraft again I need to know what Minecraft submits between two flips. Does its command buffer carry a `RELEASE_MEM` or `EVENT_WRITE_EOP` with an interrupt select, and on which queue? Which id and udata does it pass to `sceAgcDriverAddEqEvent`? A log of its submitted packets around two flips would answer both.
Sign in to join this conversation.
No reviewers
No labels
No milestone
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.

Reference
boykopovar/AnyPS5!4215
No description provided.