fix(libSceAgcDriver): support unified-memory GPUs in draw input mirror and reuse tests #25537

Closed
shripad-jyothinath wants to merge 1 commit from upstream-pr/25537 into main
shripad-jyothinath commented 2026-11-22 07:52:57 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by shripad-jyothinath on 2026-11-22T07:52:57Z.


What

Support unified-memory GPUs in AGC draw input mirror and reuse tests in core/libs/prx/libSceAgcDriver/tests/Recorder.cpp.
On unified-memory devices (integrated GPUs / UMA where all memory heaps are device-local, such as Intel Arc MTL, AMD APUs, Apple Silicon), Recorder::mirrorDrawInput deliberately avoids allocating a separate device-local mirror buffer because all memory is already on a device-local heap.
This update conditions mirror expectations on context.HostMemoryType(~0u).has_value():

  • vertexWindowMirrorTests: Return early if !device.GetContext().HostMemoryType(~0u).
  • drawInputMirrorTests: Compute mirrors = Recorder::DrawInputMirrors() && context.HostMemoryType(~0u).has_value(), verifying that inputs are kept in place without mirroring when all memory is device-local.
  • drawInputReuseTests: Compute mirrors = Recorder::DrawInputMirrors() && context.HostMemoryType(~0u).has_value(), ensuring servedFrom expects copy.buffer == host when mirrors are not allocated.
  • main(): Guard vertexWindowMirrorTests(device) with device.GetContext().HostMemoryType(~0u).has_value().

Tested

Ubuntu 24.04 (Linux 7.4.0-rc1):

  • Intel Arc Graphics (MTL), ANV driver: ctest --test-dir build -R agc_draw_input -V passed 6/6 tests (previously agc_draw_input_mirrors and agc_draw_input_reuse failed).
  • ctest --test-dir build -R "^agc_driver_recorder$" -V passed.
  • llvmpipe (CPU Vulkan): VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/lvp_icd.json ./build/tests/agc_driver_recorder_tests --draw-input-mirrors-only passed.

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 and the licence notice of code adapted from upstream (see AGENTS.md)
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • 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
  • Fixes: none
  • Unblocks: none
  • GPUs tested: Intel Arc Graphics (MTL), driver ANV (Mesa 24.0.9-0ubuntu0.3), Ubuntu 24.04 (Linux 7.4.0-rc1); llvmpipe (LLVM 20.1.2)
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5437031634 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/25537). Originally posted by [shripad-jyothinath](https://github.com/shripad-jyothinath) on 2026-11-22T07:52:57Z. --- ### What Support unified-memory GPUs in AGC draw input mirror and reuse tests in `core/libs/prx/libSceAgcDriver/tests/Recorder.cpp`. On unified-memory devices (integrated GPUs / UMA where all memory heaps are device-local, such as Intel Arc MTL, AMD APUs, Apple Silicon), `Recorder::mirrorDrawInput` deliberately avoids allocating a separate device-local mirror buffer because all memory is already on a device-local heap. This update conditions mirror expectations on `context.HostMemoryType(~0u).has_value()`: - `vertexWindowMirrorTests`: Return early if `!device.GetContext().HostMemoryType(~0u)`. - `drawInputMirrorTests`: Compute `mirrors = Recorder::DrawInputMirrors() && context.HostMemoryType(~0u).has_value()`, verifying that inputs are kept in place without mirroring when all memory is device-local. - `drawInputReuseTests`: Compute `mirrors = Recorder::DrawInputMirrors() && context.HostMemoryType(~0u).has_value()`, ensuring `servedFrom` expects `copy.buffer == host` when mirrors are not allocated. - `main()`: Guard `vertexWindowMirrorTests(device)` with `device.GetContext().HostMemoryType(~0u).has_value()`. ### Tested Ubuntu 24.04 (Linux 7.4.0-rc1): - Intel Arc Graphics (MTL), ANV driver: `ctest --test-dir build -R agc_draw_input -V` passed 6/6 tests (previously `agc_draw_input_mirrors` and `agc_draw_input_reuse` failed). - `ctest --test-dir build -R "^agc_driver_recorder$" -V` passed. - llvmpipe (CPU Vulkan): `VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/lvp_icd.json ./build/tests/agc_driver_recorder_tests --draw-input-mirrors-only` passed. ### 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) and the licence notice of code adapted from upstream (see AGENTS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [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] Fixes: none - [x] Unblocks: none - [x] GPUs tested: Intel Arc Graphics (MTL), driver ANV (Mesa 24.0.9-0ubuntu0.3), Ubuntu 24.04 (Linux 7.4.0-rc1); llvmpipe (LLVM 20.1.2) - [x] AI-assisted: yes
MarcZX10 commented 2026-11-22 07:56:25 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-22T07:56:25Z.

Review: APPROVED


Reviewed — looks good

Nothing in the inspected changes blocks merging; the UMA-aware mirror expectations match the implementation’s decision to return no mirror when no host memory type exists.

What I ran

Reviewed head c8167481e76b804cb86e787d1f5261485c33e1f0. No commands or tests were run; the reported test results are from the PR description.

Results

Check Result Note
Changed-line review passed Five added lines inspected
Runtime tests not run Author reports 6/6 and recorder tests passed

Findings

Blocking

None.

Non-blocking

None.

Not verified

The changed file was read at all five changed line ranges, with surrounding functions and related implementation. No files were excluded by review inspection; the complete 19,035-line file was not read. Runtime behavior, the reported GPU and llvmpipe tests, and other platforms were not independently verified.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6011131343 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/25537#pullrequestreview-6011131343). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-22T07:56:25Z. **Review:** APPROVED --- # Reviewed — looks good Nothing in the inspected changes blocks merging; the UMA-aware mirror expectations match the implementation’s decision to return no mirror when no host memory type exists. ## What I ran Reviewed head `c8167481e76b804cb86e787d1f5261485c33e1f0`. No commands or tests were run; the reported test results are from the PR description. ## Results | Check | Result | Note | |---|---|---| | Changed-line review | passed | Five added lines inspected | | Runtime tests | not run | Author reports 6/6 and recorder tests passed | ## Findings ### Blocking None. ### Non-blocking None. ## Not verified The changed file was read at all five changed line ranges, with surrounding functions and related implementation. No files were excluded by review inspection; the complete 19,035-line file was not read. Runtime behavior, the reported GPU and llvmpipe tests, and other platforms were not independently verified. ## To get this to a good state Nothing is required.

Pull request closed

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!25537
No description provided.