Skip to content

fix(agc): bring the driver tests back to green after the recorder rewrite - #69

Closed
ShahabAhmed01 wants to merge 3 commits into
boykopovar:mainfrom
ShahabAhmed01:fix/agc-recorder-test-regressions
Closed

ShahabAhmed01 wants to merge 3 commits into
boykopovar:mainfrom
ShahabAhmed01:fix/agc-recorder-test-regressions

Conversation

@ShahabAhmed01

@ShahabAhmed01 ShahabAhmed01 commented Sep 28, 2026 •

Copy link
Copy Markdown

No description provided.

Copilot AI lite review requested due to automatic review settings September 28, 2026 08:15

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The blocking suspend-point contract and Windows memory-scope behavior require resolution.

Review effort: Lite
Findings: 1 High severity

Open (1)
What changed in this PR

Restores AGC driver test compatibility after the recorder rewrite.

Changes:

  • Restores guest-memory range resolution.
  • Reintroduces suspend-boundary waiting.
  • Updates worker-failure coverage to use an unmapped write.
File Summary
core/​libs/​prx/​libSceAgcDriver/​tests/​Submit.cpp Updates worker-failure test coverage.
core/​libs/​prx/​libSceAgcDriver/​Execution/​src/​GuestMemory.cpp Restores access-scope resolution; Windows module-state ownership remains unresolved.
core/​libs/​prx/​libSceAgcDriver/​Execution/​src/​Driver.cpp Reintroduces suspend-boundary waiting, requiring confirmation of the intended API contract.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

// cannot be suspended while its own packets are still unexecuted. Nothing is drained here.
++suspendWaiters;
changed.notify_all();
changed.wait(lock, [&] { return failure != nullptr || stopping || completed >= target; });
- CheckRange resolved the range through MemoryAccessScope before verifying it. The guest memory rewrite dropped that call together with the libc tracking hook it forwarded to, so nothing resolves a range the driver reads or writes any more.
- MemoryAccessScope and the PM4 test survived the rewrite, so `agc_driver_pm4` failed at "WRITE_DATA did not synchronize its destination": the resolver never saw the destination and no range was synchronized before the write.
- No scope is installed outside the test, so the resolver stays a no-op on the game path.
- The recorder rewrite enqueued the boundary submission and returned, so sceAgcSuspendPoint ordered nothing: `agc_driver_flip` failed at "suspend completed before preceding work" and then deadlocked in shutdown, because the flip it blocked on was never released.
- The wait ends when the workers have executed the boundary (recorded and submitted), not when the GPU is idle, so the device drain the suspend point used to do every frame stays gone.
- A suspend point now shares WaitIdle's completion notification (`suspendWaiters`): a worker skips the notify while nobody waits, and the boundary would otherwise never wake the caller.
- A dispatch the driver cannot recompile is skipped since the recorder rewrite, so the dispatch the test submitted never failed the worker: WaitIdle returned, the expectation threw inside a thread and `agc_driver` crashed instead of reporting a failure.
- A WRITE_DATA to an unmapped guest range still fails on the worker, so it now triggers the failure the test covers: idle, the following DCB, AGR and ACB submissions and shutdown all propagate it.
- The dispatch is still submitted first and WaitIdle must return from it, so a dispatch that starts failing the worker again is caught here too.
@ShahabAhmed01
ShahabAhmed01 force-pushed the fix/agc-recorder-test-regressions branch from ec9349a to c438346 Compare September 28, 2026 08:30
@boykopovar

Copy link
Copy Markdown
Owner

Thanks for the fixes. Before merging, please address two points:

  • Keep SuspendPoint non-blocking and update the old test. Although the proposed barrier does not drain the GPU, a worker can block in WAIT_REG_MEM waiting for a CPU write made after SuspendPoint returns. Waiting for that worker creates a circular dependency.
  • Please rebase onto current main and adapt the worker-failure test to PR fix(video): terminate process on gpu and presentation thread failures #72. Exceptions reaching the GPU worker, presentation, or vblank handlers now call std::terminate(). The test should verify process termination in a subprocess instead of expecting propagated exceptions. Window closure is one such case; graceful shutdown of all guest threads is not implemented yet.

Restoring MemoryAccessScope::Resolve looks reasonable, but the Windows DLL/TLS ownership issue still needs the complementary fix.

@ShahabAhmed01
ShahabAhmed01 deleted the fix/agc-recorder-test-regressions branch September 28, 2026 09:57
Celegans12 pushed a commit to Celegans12/AnyPS5-Ghost-of-Yotei that referenced this pull request Nov 19, 2026
…w-restore

fix(kyty): keep read-only mapped views read-only when the page tracker restores them on Windows
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants