feat(agc): present DCC display buffers whose keys are uncompressed or fast-cleared #648

Merged
Celegans12 merged 1 commit from upstream-pr/648 into main 2026-10-05 23:11:16 +00:00
Celegans12 commented 2026-10-05 10:55:06 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Celegans12 on 2026-10-05T10:55:06Z.


What

sceVideoOutRegisterBuffers2 throws "VideoOut: DCC presentation is not implemented" for DCC-compressed (category 1) buffers, which PPSA26344 registers.

  • Registration: a category 1 buffer needs DCC metadata and the tiled layout, and dcc_control may only use the CB_DCC_CONTROL block layout bits 0x10026c. Buffers registered without DCC take the old path unchanged.
  • Flip: CurrentDccKeys reads the keys behind their recorded writers, one byte per 256 bytes as in the driver's DCC model, not in the console's metadata layout.
    • Uncompressed keys present the stored texels as before.
    • One clear code (0000, 0001, 1110, 1111, or the register clear color) is presented with a GPU clear of the scaler's source image.
    • A pending storage image is presented when it serves the keys (StorageImageServesKeys, #466) and its own key fill is not the current code; it is refreshed first when its texels or keys moved.
  • Still throws: mixed or unreadable keys; register-clear keys over a pending image (its key state reads them as uncompressed, so whether its results precede the clear is unknown); a clear color wider than 32 bits; dcc_control bits outside 0x10026c; category 0 with DCC fields; an unknown category; DCC on a linear buffer; missing metadata.
  • Blue-low 10-bit format (A2R10G10B10): uncompressed keys, the register clear color and the 0000 code are presented; the 0001, 1110 and 1111 codes throw until LayoutFor maps the format in #764.
  • Lock: the presenter may wait for a recorded writer of the keys, such as a title kernel, while holding GuestMemory::GpuMutex; a pending key fill or the driver's own key store is read without a wait (#458).
  • Evidence: PPSA26344 v1.008 registers both buffers with category 1 at 0xcd004a. The attribute comes from the libSceAgc helper linked into the title (0x16162a0): dcc_control from 0x1616450, which produces only 0x24, 0x48, 0x208 and 0x100024, and a clear color of 0. The key codes are those of the driver's DCC model (#132, #163, #466), which match Mesa's gfx10 codes.
  • TechnicalDebt records the assumed meaning of dcc_control and the clear color, and the key states this path presents.
  • #419 extends the CB metadata pass whose eliminate and decompress modes rewrite these keys, and edits other lines of VulkanDevice.cpp and the AgcDriver CMakeLists.txt; both files merge cleanly.
  • #709 adds a TechnicalDebt line after the same sceVideoOutRegisterBuffers2 line, so whichever lands second needs a one-line rebase.

Tested

  • Windows 11, MinGW-w64 GCC 15.2.0, based on main bc24783e: configure -DBUILD_TESTING=ON, full build, --target libs, ctest:
  • 319/319 tests pass (ctest --output-on-failure)
  • New agc_display_buffer_dcc (ctest): the presented pixel of every clear code on B8G8R8A8, of the register clear color on all four display formats, of 0001 on R8G8B8A8 and of 0001 and 1110 on A2B10G10R10, and a row for each key state and buffer that DisplayBufferClearPixel or DisplayBufferSize rejects; it does not build on main.
  • video_out_flip_tests decode (not part of ctest): accepted and rejected dcc_control, tiling, metadata and category values.
  • video_out_flip_tests dcc (needs a GPU and a display, not part of ctest, as in #417): flips with keys 0x00, 0xff, 0x20 and 0xc0; with APS5_DUMP_FRAMES=4 every frame holds exactly the clear value or the stored texels.
  • PPSA26344 v1.008: both buffers now register (on main this throws). On current main with our other open pull requests the title runs on to an unrelated shader stop before its first flip, so the presentation of its DCC buffers is not exercised yet.
  • Not tested: the pending storage image branch, PPSA21564 and Dreaming Sarah, Linux (CI), console behaviour.

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
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4743821852 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/648). Originally posted by [Celegans12](https://github.com/Celegans12) on 2026-10-05T10:55:06Z. --- ### What `sceVideoOutRegisterBuffers2` throws "VideoOut: DCC presentation is not implemented" for DCC-compressed (category 1) buffers, which PPSA26344 registers. - **Registration:** a category 1 buffer needs DCC metadata and the tiled layout, and `dcc_control` may only use the CB_DCC_CONTROL block layout bits 0x10026c. Buffers registered without DCC take the old path unchanged. - **Flip:** `CurrentDccKeys` reads the keys behind their recorded writers, one byte per 256 bytes as in the driver's DCC model, not in the console's metadata layout. - Uncompressed keys present the stored texels as before. - One clear code (0000, 0001, 1110, 1111, or the register clear color) is presented with a GPU clear of the scaler's source image. - A pending storage image is presented when it serves the keys (`StorageImageServesKeys`, #466) and its own key fill is not the current code; it is refreshed first when its texels or keys moved. - **Still throws:** mixed or unreadable keys; register-clear keys over a pending image (its key state reads them as uncompressed, so whether its results precede the clear is unknown); a clear color wider than 32 bits; `dcc_control` bits outside 0x10026c; category 0 with DCC fields; an unknown category; DCC on a linear buffer; missing metadata. - **Blue-low 10-bit format (A2R10G10B10):** uncompressed keys, the register clear color and the 0000 code are presented; the 0001, 1110 and 1111 codes throw until `LayoutFor` maps the format in #764. - **Lock:** the presenter may wait for a recorded writer of the keys, such as a title kernel, while holding `GuestMemory::GpuMutex`; a pending key fill or the driver's own key store is read without a wait (#458). - **Evidence:** PPSA26344 v1.008 registers both buffers with category 1 at 0xcd004a. The attribute comes from the libSceAgc helper linked into the title (0x16162a0): `dcc_control` from 0x1616450, which produces only 0x24, 0x48, 0x208 and 0x100024, and a clear color of 0. The key codes are those of the driver's DCC model (#132, #163, #466), which match Mesa's gfx10 codes. - TechnicalDebt records the assumed meaning of `dcc_control` and the clear color, and the key states this path presents. - #419 extends the CB metadata pass whose eliminate and decompress modes rewrite these keys, and edits other lines of `VulkanDevice.cpp` and the AgcDriver `CMakeLists.txt`; both files merge cleanly. - #709 adds a TechnicalDebt line after the same `sceVideoOutRegisterBuffers2` line, so whichever lands second needs a one-line rebase. ### Tested - Windows 11, MinGW-w64 GCC 15.2.0, based on `main` bc24783e: configure `-DBUILD_TESTING=ON`, full build, `--target libs`, `ctest`: - 319/319 tests pass (`ctest --output-on-failure`) - New `agc_display_buffer_dcc` (ctest): the presented pixel of every clear code on B8G8R8A8, of the register clear color on all four display formats, of 0001 on R8G8B8A8 and of 0001 and 1110 on A2B10G10R10, and a row for each key state and buffer that `DisplayBufferClearPixel` or `DisplayBufferSize` rejects; it does not build on `main`. - `video_out_flip_tests decode` (not part of ctest): accepted and rejected `dcc_control`, tiling, metadata and category values. - `video_out_flip_tests dcc` (needs a GPU and a display, not part of ctest, as in #417): flips with keys 0x00, 0xff, 0x20 and 0xc0; with `APS5_DUMP_FRAMES=4` every frame holds exactly the clear value or the stored texels. - PPSA26344 v1.008: both buffers now register (on `main` this throws). On current `main` with our other open pull requests the title runs on to an unrelated shader stop before its first flip, so the presentation of its DCC buffers is not exercised yet. - Not tested: the pending storage image branch, PPSA21564 and Dreaming Sarah, Linux (CI), console behaviour. ### Checklist - [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
merwie commented 2026-10-05 18:02:51 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by merwie on 2026-10-05T18:02:51Z.


Tested with PPSA12544 (Hollow Knight: Silksong, Unity) on Windows 11, Radeon RX 9070 XT, merged onto main together with the title's other startup fixes (#698, #699, #700, #702, #705, #709, #710).

Without this PR the title stops at VideoOut: DCC presentation is not implemented when it registers its display buffers. With it, registration succeeds and the title continues (Vulkan device and swapchain already created, then save data setup, UnitySubsystems, globalgamemanagers.assets, unity default resources). The title stops later for unrelated reasons before its first flip, so presentation of the DCC buffers itself is not exercised yet. Bring-up notes: #726.

(Report written with AI assistance.)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6000187435 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/648#issuecomment-6000187435). Originally posted by [merwie](https://github.com/merwie) on 2026-10-05T18:02:51Z. --- Tested with PPSA12544 (Hollow Knight: Silksong, Unity) on Windows 11, Radeon RX 9070 XT, merged onto `main` together with the title's other startup fixes (#698, #699, #700, #702, #705, #709, #710). Without this PR the title stops at `VideoOut: DCC presentation is not implemented` when it registers its display buffers. With it, registration succeeds and the title continues (Vulkan device and swapchain already created, then save data setup, `UnitySubsystems`, `globalgamemanagers.assets`, `unity default resources`). The title stops later for unrelated reasons before its first flip, so presentation of the DCC buffers itself is not exercised yet. Bring-up notes: #726. (Report written with AI assistance.)
oneandonlydean commented 2026-10-05 19:45:35 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-05T19:45:35Z.


Thanks, the presentation part reads well to me. Only category 1 buffers carry the DCC fields, so uncompressed buffers keep the old path. A single clear code is presented as a clear of the scaler's source image, and the clear goes through the same 8-bit conversion and channel order as the detiled path. Mixed keys, and register-clear keys over a pending image, still throw, and that seems the right call.

On your offer to split out the LayoutFor change: yes please, if you don't mind. Adding VK_FORMAT_A2R10G10B10_UNORM_PACK32 changes the draw path for every title. Alternate-swap 2_10_10_10 DCC targets under clear keys now get the clear value instead of their stored texels, and clearTexel no longer throws for them. That part needs its own check on PPSA21564, while the DCC presentation itself doesn't change anything for it: its display buffers are category 0, so with dccAddress 0 the flip path is the same as on main. With the split, this PR can go in after #647 without waiting for that check.

DccAlphaOnMsb doesn't change with the new case (it already defaulted to 4 channels), so the split shouldn't need any other edits.

A small note: this conflicts with #709 in TechnicalDebt.md only, so whichever lands second needs a one-line rebase.

Locally (Linux, GCC, NVIDIA), merged on #647: agc_display_buffer_dcc passes, also 20 times in a row (it uses the new DisplayBufferClearPixel, so it can't build on main), and video_out_flip_tests decode passes.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6001770978 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/648#issuecomment-6001770978). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-05T19:45:35Z. --- Thanks, the presentation part reads well to me. Only category 1 buffers carry the DCC fields, so uncompressed buffers keep the old path. A single clear code is presented as a clear of the scaler's source image, and the clear goes through the same 8-bit conversion and channel order as the detiled path. Mixed keys, and register-clear keys over a pending image, still throw, and that seems the right call. On your offer to split out the `LayoutFor` change: yes please, if you don't mind. Adding `VK_FORMAT_A2R10G10B10_UNORM_PACK32` changes the draw path for every title. Alternate-swap 2_10_10_10 DCC targets under clear keys now get the clear value instead of their stored texels, and `clearTexel` no longer throws for them. That part needs its own check on PPSA21564, while the DCC presentation itself doesn't change anything for it: its display buffers are category 0, so with `dccAddress` 0 the flip path is the same as on main. With the split, this PR can go in after #647 without waiting for that check. `DccAlphaOnMsb` doesn't change with the new case (it already defaulted to 4 channels), so the split shouldn't need any other edits. A small note: this conflicts with #709 in `TechnicalDebt.md` only, so whichever lands second needs a one-line rebase. Locally (Linux, GCC, NVIDIA), merged on #647: `agc_display_buffer_dcc` passes, also 20 times in a row (it uses the new `DisplayBufferClearPixel`, so it can't build on main), and `video_out_flip_tests decode` passes.
github-actions[bot] commented 2026-10-05 21:03:18 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-05T21:03:18Z.


Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
#709 docs/dev/TechnicalDebt.md L31
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6002876377 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/648#issuecomment-6002876377). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-05T21:03:18Z. --- <!-- pr-overlap --> Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in **Depends on**. | Pull request | Conflicting files (lines on `main`) | Same exports | Same new files | |---|---|---|---| | #709 | `docs/dev/TechnicalDebt.md` [L31](https://github.com/boykopovar/AnyPS5/blob/7072c9049be12af487b3c158dd243cb8c18d9bbc/docs/dev/TechnicalDebt.md#L31) | | |
Celegans12 commented 2026-10-05 22:01:02 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Celegans12 on 2026-10-05T22:01:02Z.


Thanks. Split out as #764: the LayoutFor case for VK_FORMAT_A2R10G10B10_UNORM_PACK32, alone on main. Its agc_driver_graphics rows run the eliminate pass and FillDccClear (the call a draw into a copied target makes) for both swaps of COLOR_2_10_10_10, and fail on main at the alternate-swap 0001 row.

This PR is now one commit on main bc24783e, without that line:

  • The A2R10G10B10 1111 row of agc_display_buffer_dcc moved out with it. On this PR alone, a blue-low 10-bit display buffer under 0001, 1110 or 1111 keys throws, and the message now says the display format has to encode the clear code. 0000 and the register clear still present, because neither goes through LayoutFor.
  • Nothing else changed. ctest 319/319 on Windows. video_out_flip_tests decode and dcc (RTX 3080 Laptop) pass.
  • The description now names the #709 TechnicalDebt line.
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6003945338 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/648#issuecomment-6003945338). Originally posted by [Celegans12](https://github.com/Celegans12) on 2026-10-05T22:01:02Z. --- Thanks. Split out as #764: the `LayoutFor` case for `VK_FORMAT_A2R10G10B10_UNORM_PACK32`, alone on `main`. Its `agc_driver_graphics` rows run the eliminate pass and `FillDccClear` (the call a draw into a copied target makes) for both swaps of COLOR_2_10_10_10, and fail on `main` at the alternate-swap 0001 row. This PR is now one commit on `main` bc24783e, without that line: - The `A2R10G10B10 1111` row of `agc_display_buffer_dcc` moved out with it. On this PR alone, a blue-low 10-bit display buffer under 0001, 1110 or 1111 keys throws, and the message now says the display format has to encode the clear code. 0000 and the register clear still present, because neither goes through `LayoutFor`. - Nothing else changed. ctest 319/319 on Windows. `video_out_flip_tests decode` and `dcc` (RTX 3080 Laptop) pass. - The description now names the #709 TechnicalDebt line.
merwie commented 2026-10-05 22:24:03 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by merwie on 2026-10-05T22:24:03Z.


More data from PPSA12544 (Hollow Knight: Silksong), now that it renders (bring-up: #726). With this PR the title gets to its first flips and then stops at:

VideoOut: display buffer 0x217de0000 reads mixed DCC keys at 0x21155e000: presenting DCC metadata that is not uniformly uncompressed or fast-cleared is not implemented

The display buffers are 1920x1080 (padded to 1920x1152, so DisplayBufferSize covers 34560 keys). A histogram of the keys DisplayKeys classifies:

  • 0xff (uncompressed): 33552
  • 0x00 (clear 0000): 1008
  • first key differing from key 0: index 32784; the visible 1920x1080 image is 32400 keys

So every non-uncompressed key sits past the first 32400 keys, in the last 128-row tile row, which holds visible rows 1024..1079 and padding rows 1080..1151. A pending resident StorageTexture exists for the buffer (the title writes it from a compute pass).

As a local experiment I classified only the first width * height * 4 bytes' keys (std::min(bytes, width * height * 4) in DisplayKeys). The keys are then uniformly uncompressed, the resident image is presented and the title runs at ~60 fps for minutes. Correction: I had not checked the output, and every presented frame was black. The black frames came from a separate rejection of PA_SC_MODE_CNTL_1 bit 17 (#840). With that fixed, the logo, notices and title menu render correctly through this path. That prefix is only an approximation of "blocks that hold visible pixels" under the 64 KiB tiling, so I am not proposing it as is; a version that maps each key to its tile rows and ignores blocks entirely below height would be the general form. Happy to test any variant against this title.

(Report written with AI assistance.)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6004376680 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/648#issuecomment-6004376680). Originally posted by [merwie](https://github.com/merwie) on 2026-10-05T22:24:03Z. --- More data from PPSA12544 (Hollow Knight: Silksong), now that it renders (bring-up: #726). With this PR the title gets to its first flips and then stops at: ``` VideoOut: display buffer 0x217de0000 reads mixed DCC keys at 0x21155e000: presenting DCC metadata that is not uniformly uncompressed or fast-cleared is not implemented ``` The display buffers are 1920x1080 (padded to 1920x1152, so `DisplayBufferSize` covers 34560 keys). A histogram of the keys `DisplayKeys` classifies: - `0xff` (uncompressed): 33552 - `0x00` (clear 0000): 1008 - first key differing from key 0: index 32784; the visible 1920x1080 image is 32400 keys So every non-uncompressed key sits past the first 32400 keys, in the last 128-row tile row, which holds visible rows 1024..1079 and padding rows 1080..1151. A pending resident `StorageTexture` exists for the buffer (the title writes it from a compute pass). As a local experiment I classified only the first `width * height * 4` bytes' keys (`std::min(bytes, width * height * 4)` in `DisplayKeys`). The keys are then uniformly uncompressed, the resident image is presented and the title runs at ~60 fps for minutes. **Correction:** I had not checked the output, and every presented frame was black. The black frames came from a separate rejection of `PA_SC_MODE_CNTL_1` bit 17 (#840). With that fixed, the logo, notices and title menu render correctly through this path. That prefix is only an approximation of "blocks that hold visible pixels" under the 64 KiB tiling, so I am not proposing it as is; a version that maps each key to its tile rows and ignores blocks entirely below `height` would be the general form. Happy to test any variant against this title. (Report written with AI assistance.)
Celegans12 commented 2026-10-05 22:36:56 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Celegans12 on 2026-10-05T22:36:56Z.


Thanks, that histogram pins it down. I'll do the general form as a separate pull request stacked on this one, so this PR doesn't wait for it:

  • Each key is mapped through the display tiling to the pixels its 256-byte block covers.
  • Only keys whose block holds at least one pixel inside width x height are classified.
  • A non-uniform key in a block with a visible pixel still throws.

I'll link it here once it passes; a run against PPSA12544 would be very welcome.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6004590984 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/648#issuecomment-6004590984). Originally posted by [Celegans12](https://github.com/Celegans12) on 2026-10-05T22:36:56Z. --- Thanks, that histogram pins it down. I'll do the general form as a separate pull request stacked on this one, so this PR doesn't wait for it: - Each key is mapped through the display tiling to the pixels its 256-byte block covers. - Only keys whose block holds at least one pixel inside `width` x `height` are classified. - A non-uniform key in a block with a visible pixel still throws. I'll link it here once it passes; a run against PPSA12544 would be very welcome.
Celegans12 commented 2026-10-06 00:20:11 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Celegans12 on 2026-10-06T00:20:11Z.


@merwie the general form is up as #788, on current main:

  • Each key's 256-byte block is mapped through the display tiling. Under 64 KiB tiles it is one 8x8 pixel square, so for 1920x1080 that is 32400 of the 34560 keys.
  • Only keys whose square holds a presented pixel are classified. Keys that cover only padding no longer count, and a non-uniform key in a square with a visible pixel still throws.

If you can run PPSA12544 on it, the result would be a useful data point for that PR.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6006325627 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/648#issuecomment-6006325627). Originally posted by [Celegans12](https://github.com/Celegans12) on 2026-10-06T00:20:11Z. --- @merwie the general form is up as #788, on current `main`: - Each key's 256-byte block is mapped through the display tiling. Under 64 KiB tiles it is one 8x8 pixel square, so for 1920x1080 that is 32400 of the 34560 keys. - Only keys whose square holds a presented pixel are classified. Keys that cover only padding no longer count, and a non-uniform key in a square with a visible pixel still throws. If you can run PPSA12544 on it, the result would be a useful data point for that PR.
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!648
No description provided.