Skip to content

fix(agc): name the reason when /dev/udmabuf cannot be opened - #1688

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
johnmaia:fix/agc-udmabuf-permission
Oct 10, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
johnmaia:fix/agc-udmabuf-permission

Conversation

@johnmaia

@johnmaia johnmaia commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

What

On Linux, shared direct memory is imported through /dev/udmabuf (#943) when the driver imports dma-buf memory. Many distributions create the node as root:kvm with mode 0660 (#943's checklist notes this, and its test machine had a per-user ACL), so a user outside the kvm group cannot open it. The ranges are then copied instead of imported, and GPU stores through FLAT/GLOBAL addresses to them fail. The only trace was the import step and a Vulkan result, which hides errno:

[gpu] host import of 0x7b76a9e00000+0x2000000 failed at open /dev/udmabuf (-1000072003); falling back to copies
[gpu] deferred write-back failed: BDA access failed: address=0x7b76a9e00000 instruction=0x260 bytes=4 stage=4 reason=2; the store hit 0x7b76a9e00000+0x2000000, read-only in the BDA table: ...

DOOM PPSA99666 (homebrew) presents through a compute kernel that stores into a 32 MiB direct memory range, so on such a machine it logs video: GPU presentation failed, switching to the CPU scaler.

  • udmabufDevice prints the open error once, with the fix for EACCES:
    [gpu] open /dev/udmabuf: Permission denied; shared direct memory is copied instead of imported, and GPU stores through FLAT/GLOBAL addresses do not reach it (give the user read-write access to /dev/udmabuf, for example through the kvm group)
    
    The device is only opened where context.dmaBufImport is set, so nothing is printed on the NVIDIA proprietary driver (fix(agc): keep dma-buf import off the NVIDIA proprietary driver #1329).
  • docs/user/USAGE.md documents the requirement next to the Windows direct memory note, including the 64 MiB size_limit_mb above which ranges are copied anyway (feat(agc): import shared direct memory through udmabuf on Linux #943).

No behaviour change.

Tested

Linux, Ubuntu 24.04.5, GCC 13.3, RX 7600 (RADV, Mesa 25.2.8), /dev/udmabuf root:kvm 0660.

run /dev/udmabuf failures BDA access failed DOOM presentation
user without access, main 3, no reason given 2 switches to the CPU scaler
user without access, this PR same, after the new line naming Permission denied 2 switches to the CPU scaler
user with access (ACL, then kvm group) 0 0 stays on AGC compute presentation
  • DOOM v1.1.1 built from source, relinked with --exclude-sce-module libc.prx on main, run under Xvfb. The run without access used a private mount namespace in which /dev/udmabuf was a root-only file, with the process running as the normal user.
  • ctest -R "agc|guest_agc" with ANYPS5_REQUIRE_VULKAN=1: 227/227 with access; the new line does not appear.
  • Windows: not built; the change is inside the existing #ifndef _WIN32 block.

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

🤖 Generated with Claude Code

@github-actions github-actions Bot added docs agc libSceAgc* labels Oct 8, 2026
@johnmaia

johnmaia commented Oct 8, 2026

Copy link
Copy Markdown
Contributor Author

End-to-end check with a display, on this PR's head: Linux, RX 7600 (RADV, Mesa 25.2.8), headless weston + Xwayland, DOOM PPSA99666 v1.1.1 built from source (byte-identical to the release), relinked with --exclude-sce-module libc.prx.

User without access to /dev/udmabuf (a private mount namespace with a root-only file over the node, process running as the normal user):

[gpu] open /dev/udmabuf: Permission denied; shared direct memory is copied instead of imported, and GPU stores through FLAT/GLOBAL addresses do not reach it (give the user read-write access to /dev/udmabuf, for example through the kvm group)
[gpu] deferred write-back failed: BDA access failed: address=... the store hit ...+0x2000000, read-only in the BDA table: ...
[debug:0] video: GPU presentation failed, switching to the CPU scaler

User in the kvm group: no import failures, no write-back failures, and the title stays on AGC compute presentation for the whole run. DOOM's own frame capture (test plan capture 120) of the GPU-presented frame matches a present cpu capture of the same frame in 93.5% of the detiled pixels; the rest are small differences from the kernel's bilinear scaling against the CPU path's nearest-neighbour scaling. On screen:

anyps5-1688-doom-rx7600

The first run after a rebuild can still fall back with gpu: frame 1 never completed: the cold compile of the kernel exceeds DOOM's 500 ms fence wait, as noted in #684. A second run stays on the GPU path.

aryanrawatispro-ship-it added a commit to aryanrawatispro-ship-it/AnyPS5 that referenced this pull request Oct 9, 2026
…mabuf

importWatchTests required the dma-buf import probe to succeed whenever
the device supports dma-buf import. The probe also needs /dev/udmabuf.
GitHub's Linux runner has no such node, and many distributions create
it as root:kvm 0660 (boykopovar#1688). The probe then fails at "open
/dev/udmabuf", and the suite stopped there in CI. The driver already
handles this case: such ranges are copied instead of imported.

When the probe fails at that step, the case now reports the dma-buf
probe as not tested, as it does when the device has no dma-buf import.
Any other probe failure still fails the case.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@popcoder565

Copy link
Copy Markdown
Contributor

Native Windows run, since no Windows results were posted. Setup: Windows 10 (19045), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release. Head 55be83f9, merged onto main 8b393b6 in one build with 31 other PRs that had no Windows run.

No title was run.

🤖 Addressed by Claude Code

On Linux, shared direct memory is imported through /dev/udmabuf (boykopovar#943).
Many distributions create it as root:kvm 0660, so a user outside the
kvm group cannot open it. The ranges are then copied instead of
imported, and GPU stores through FLAT/GLOBAL addresses to them fail
with "BDA access failed": DOOM PPSA99666's compute presenter falls back
to its CPU scaler. The only trace was "failed at open /dev/udmabuf
(-1000072003)", a Vulkan result that hides errno.

Print the open error once, with the fix for EACCES, and document the
requirement in USAGE.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@johnmaia
johnmaia force-pushed the fix/agc-udmabuf-permission branch from 55be83f to f70d2bd Compare October 9, 2026 22:49
aryanrawatispro-ship-it added a commit to aryanrawatispro-ship-it/AnyPS5 that referenced this pull request Oct 9, 2026
…mabuf

importWatchTests required the dma-buf import probe to succeed whenever
the device supports dma-buf import. The probe also needs /dev/udmabuf.
GitHub's Linux runner has no such node, and many distributions create
it as root:kvm 0660 (boykopovar#1688). The probe then fails at "open
/dev/udmabuf", and the suite stopped there in CI. The driver already
handles this case: such ranges are copied instead of imported.

When the probe fails at that step, the case now reports the dma-buf
probe as not tested, as it does when the device has no dma-buf import.
Any other probe failure still fails the case.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
oneandonlydean added a commit to oneandonlydean/AnyPS5 that referenced this pull request Oct 10, 2026
oneandonlydean added a commit to oneandonlydean/AnyPS5 that referenced this pull request Oct 10, 2026
@oneandonlydean
oneandonlydean merged commit 70e66d8 into boykopovar:main Oct 10, 2026
8 checks passed
SleglJan pushed a commit to SleglJan/AnyPS5 that referenced this pull request Oct 10, 2026
…ission

fix(agc): name the reason when /dev/udmabuf cannot be opened
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* docs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants