Skip to content

feat(agc): implement sceAgcGetPacketSize - #772

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
adriadam10:feat/agc-get-packet-size
Oct 5, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
adriadam10:feat/agc-get-packet-size

Conversation

@adriadam10

Copy link
Copy Markdown
Collaborator

What

Implements sceAgcGetPacketSize (was a throwing stub): returns the size in dwords of the PM4 packet at packet.

  • Type-3 header: count + 2 (bits 16-29), as KytyPS5 AgcGetPacketSize (src/libs/agc.cpp).
  • Header-only NOP ((header & 0x3fffff00) == 0x3fff1000, i.e. 0xffff10xx): 1. Same mask as KytyPS5; matches Mesa's PKT3_NOP_PAD (PKT3(PKT3_NOP, 0x3fff, 0), "header-only version", src/amd/common/sid.h, padded by radv/radeonsi).
  • Not a type-3 header (types 0-2): throws. KytyPS5 ignores the type bits (a type-2 filler would give 2, a type-0 0x3fff10xx 1), while PM4 makes a type-2 filler 1 dword, so the references disagree and the call throws instead of guessing. Same check as sceAgcDcbGetSystemSoftwareVersion next to it.
  • Null or misaligned pointer: throws (CheckAddress), like the other functions in PacketInfo.cpp.

No other reference has a body (shadPS4 and fpPS4: name only; SharpProspero: signature only).

New test agc_packet_info_tests (tests/PacketInfo.cpp, in ctest). It isn't added to agc_command_tests because that target isn't registered in ctest and already fails on main ("expected an exception").

Tested

Linux, GCC Release: agc_packet_info_tests passes. It checks real headers (SET_SH_REG count 4 → 6, NOP count 0 → 2, count 0x3ffe → 0x4000, non-NOP count 0x3fff → 0x4001, 0xffff1000/0xffff1001/0xffff10fc → 1), that the packet is left unmodified, and the rejections (types 0/1/2, null, misaligned). Fails on main (the stub throws). I also broke each piece on purpose (pad value, +2, NOP mask, type check, address check) and each change made the test fail. All the other agc_* tests pass, apart from agc_driver_pixel_helper_lanes/pixel_lds/pixel_lds_lane_slots, which also fail on main on local RADV (wave32 on a 64-lane subgroup).

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

Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown

Progress report (bc24783 → 40c1910)

📈 System libraries: 79.57% (+0.03%, +1 implemented functions)

✅ 1 implemented
Library Name
libSceAgc sceAgcGetPacketSize

@oneandonlydean
oneandonlydean merged commit 590b57f into boykopovar:main Oct 5, 2026
3 checks passed
@adriadam10
adriadam10 deleted the feat/agc-get-packet-size branch October 6, 2026 20:22
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.

2 participants