Skip to content

fix(agc): cover the console's DCC key extent for 1, 2, 8 and 16-byte elements - #7896

Closed
eljackjoestar-cmd wants to merge 1 commit into
boykopovar:mainfrom
eljackjoestar-cmd:fix/dcc-key-extent-element-sizes
Closed

eljackjoestar-cmd wants to merge 1 commit into
boykopovar:mainfrom
eljackjoestar-cmd:fix/dcc-key-extent-element-sizes

Conversation

@eljackjoestar-cmd

Copy link
Copy Markdown
Contributor

What

DccKeyCount took the console's DCC key extent only for 4-byte SW_64KB_R_X surfaces: 512x512-texel meta blocks of 4 KiB of keys, measured in #788. Every other element size kept one key per 256 bytes.

addrlib's GFX10 meta blocks hold 4 KiB of keys over 2^(20 - log2 element bytes) texels, the odd bit going to the width:

Element bytes Meta block (texels)
1 1024x1024
2 1024x512
4 512x512
8 512x256
16 256x256

The extent now follows these blocks for 1, 2, 4, 8 and 16-byte elements. Other element sizes (12-byte) and other tile modes keep one key per 256 bytes. The 4-byte result is unchanged.

Effect on PPSA28099. Its start screen showed a black sky.

  • The title fast-clears its 8-byte separate translucency target (2420x1364, 418 x 64 KiB) with a uniform fill of 0x1e000 key bytes: 5x6 meta blocks of 512x256 texels.
  • DccKeyCount gave 0x1a200, so the fill was longer than the image's key extent. The title's transient allocator also places other live images over that memory. StorageTexture::keysFillMatches therefore classified the fill by its overlaps instead of as the target's key fill.
  • The target kept stale texels. TSR then composed the scene with them (scene * translucency.a + translucency.rgb), and the sky turned black.

With the 8-byte extent, the fill is the target's key fill and the sky renders.

The debt entry "DCC key stores" is cut to what stays open: the 1, 2 and 16-byte extents follow addrlib and are not measured.

New KeyCountTests cases (agc_display_buffer_dcc):

  • 8-byte surfaces at 1920x1080, 2420x1364 and 128x64;
  • 1, 2 and 16-byte surfaces at 1920x1080;
  • a 12-byte surface, which stays at one key per 256 bytes;
  • an 8-byte SW_64KB_D_X surface;
  • an 8-byte surface descriptor, pipe-aligned and not.

Tested

Windows 11 Pro 26300, Ryzen 7 7800X3D, NVIDIA GeForce RTX 5070 (driver 617.14), WinLibs GCC 15.2 UCRT, Release.

Focused tests. Run on main 6762694 and on this branch, same machine, with VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ANYPS5_NO_SHADER_CACHE=1 ANYPS5_REQUIRE_VULKAN=1 ctest --test-dir build -R <pattern> -V. The tests include agc_display_buffer_dcc, agc_dcc_key_sharing, agc_driver_fill_cover_keys, agc_driver_dcc_key_presync, agc_driver_dcc_keys_first_write, agc_driver_memory_value_fill and agc_driver_staged_clear_sampled_read.

  • 63/63 pass on both.
  • Neither log contains was not found but was requested by env var VK_INSTANCE_LAYERS.
  • Both logs hold the same two validation errors, from agc_driver_indirect_arguments_pending_producer: VUID-vkCmdWaitEvents-srcStageMask-01158 and VUID-vkSetEvent-event-09543. This change adds none.
The 63 focused tests (same set on main and the change)

agc_command_batch_fence_failure, agc_compute_descriptor_layout_flags, agc_copy_input_kept_bytes, agc_dcc_key_sharing, agc_depth_copy_kept_bytes, agc_descriptor_cache, agc_descriptor_pool_reset_failure, agc_display_buffer_dcc, agc_driver_address_space_teardown, agc_driver_alpha_to_coverage_state, agc_driver_buffer_descriptor_runtime, agc_driver_covered_centroid_state, agc_driver_dcc_key_presync, agc_driver_dcc_keys_first_write, agc_driver_fill_cover_keys, agc_driver_gpu_indirect_arguments_misaligned_writer_ahead, agc_driver_gpu_indirect_arguments_written_ahead, agc_driver_graphics, agc_driver_guarded_null_pointer, agc_driver_indirect_arguments_pending_producer, agc_driver_indirect_arguments_written_ahead, agc_driver_indirect_patched_stage, agc_driver_memory_value_fill, agc_driver_mesh, agc_driver_mesh_draw_relocation, agc_driver_mesh_index_cache, agc_driver_mesh_provoking_layer, agc_driver_mesh_provoking_vertex, agc_driver_msaa_dcc_state, agc_driver_rect_list_indirect, agc_driver_sample_location_grid_fallback, agc_driver_sparse_indirect_indices, agc_driver_sparse_indirect_indices_unreadable, agc_driver_staged_clear_sampled_read, agc_driver_undithered_alpha_to_coverage_state, agc_driver_unused_viewport_depth, agc_heap_mirror_run_unwatch, agc_heap_mirror_run_unwatch_no_space_cache, agc_heap_mirror_unwatch, agc_heap_mirror_unwatch_no_space_cache, agc_pipeline_journal, agc_pipeline_library_clear_waits_for_build, agc_pipeline_store_lazy_buffer_pool, agc_shader_bindless, agc_shader_entry_lane_proof_budget, agc_shader_frontend_pair, agc_shader_frontend_pair_off, agc_shader_layout_pair, agc_shader_layout_pair_off, agc_shader_memory, agc_shader_quad_mask_no_demote, agc_shader_selected_records_direct_image_limit, agc_shader_selected_records_direct_pair_limit, agc_shader_selected_records_image_limit, agc_shader_selected_records_pair_limit, agc_shader_srt_read_patching, agc_shader_table_snapshot_reuse, agc_shader_type_zero_image_materialization, agc_sparse_buffer_holes, agc_sparse_heap_mirror_unwatch, agc_sparse_heap_mirror_unwatch_no_space_cache, agc_write_tracking, agc_write_watch_coverage

Title. PPSA28099 start screen at 3840x2160. main cannot run this title: at 6762694 it stops at boot with indirect register sentinel semantics are not implemented (Execution/src/Pm4.cpp:47). The check used the base the title runs on: main a62c724 with #6094 and #6160 (both merged since), #6146, #6366 and #7644.

  • Before this change, the sky turns black once the screen has settled (frame dumps from three runs).
  • After it, the sky renders in the dumped frames.

Overlap. tools/pr_overlap.py --branch lists #7480, which adds a debt entry on the line next to the edited one (docs/dev/debt/libSceAgcDriver.md). The conflict is textual only. The other PRs it lists conflict with main and share DccMetadata.cpp or the debt file; none of them changes DccKeyCount.

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 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: PPSA28099 (black sky on the start screen; no Game bring-up discussion exists yet)
  • GPUs tested: NVIDIA GeForce RTX 5070, driver 617.14, Windows 11 Pro 26300 (focused tests with the validation layer, and PPSA28099). Linux not run.
  • AI-assisted: yes (Claude Code)

…elements

DccKeyCount took the console's DCC extent only for 4-byte SW_64KB_R_X
surfaces and left every other element size at one key per 256 bytes.
addrlib's GFX10 meta blocks hold 4 KiB of keys over
2^(20 - log2 element bytes) texels, the odd bit going to the width, so a
2420x1364 8-byte target has 0x1e000 key bytes, not 0x1a200. A key fill
of that whole extent over memory that other live images overlap was
longer than the computed extent, so it was classified by its overlaps
instead of as a fast clear of the target, and the target kept stale
texels.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added the unblocks title Names a title ID on the Unblocks line label Oct 19, 2026
@github-actions

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 2434 docs/dev/debt/libSceAgcDriver.md
PR 4448 docs/dev/debt/libSceAgcDriver.md
PR 4449 docs/dev/debt/libSceAgcDriver.md
PR 5058 docs/dev/debt/libSceAgcDriver.md
PR 5372 docs/dev/debt/libSceAgcDriver.md
PR 5499 docs/dev/debt/libSceAgcDriver.md
PR 5925 docs/dev/debt/libSceAgcDriver.md
PR 6146 docs/dev/debt/libSceAgcDriver.md
PR 6186 core/libs/prx/libSceAgcDriver/Graphics/src/DccMetadata.cpp
PR 6194 docs/dev/debt/libSceAgcDriver.md
PR 6209 core/libs/prx/libSceAgcDriver/Graphics/src/DccMetadata.cpp
PR 6218 docs/dev/debt/libSceAgcDriver.md
PR 6223 docs/dev/debt/libSceAgcDriver.md
PR 6273 docs/dev/debt/libSceAgcDriver.md
PR 6280 docs/dev/debt/libSceAgcDriver.md
PR 6292 core/libs/prx/libSceAgcDriver/Graphics/src/DccMetadata.cpp
PR 6300 docs/dev/debt/libSceAgcDriver.md
PR 6412 docs/dev/debt/libSceAgcDriver.md
PR 6481 docs/dev/debt/libSceAgcDriver.md
PR 6498 docs/dev/debt/libSceAgcDriver.md
PR 6548 docs/dev/debt/libSceAgcDriver.md
PR 6549 docs/dev/debt/libSceAgcDriver.md
PR 6572 docs/dev/debt/libSceAgcDriver.md
PR 6588 docs/dev/debt/libSceAgcDriver.md
PR 6612 docs/dev/debt/libSceAgcDriver.md
PR 6615 core/libs/prx/libSceAgcDriver/Graphics/src/DccMetadata.cpp
PR 6636 docs/dev/debt/libSceAgcDriver.md
PR 6639 docs/dev/debt/libSceAgcDriver.md
PR 6683 docs/dev/debt/libSceAgcDriver.md
PR 6727 docs/dev/debt/libSceAgcDriver.md
PR 6741 docs/dev/debt/libSceAgcDriver.md
PR 6743 docs/dev/debt/libSceAgcDriver.md
PR 6801 docs/dev/debt/libSceAgcDriver.md
PR 6804 docs/dev/debt/libSceAgcDriver.md
PR 6808 docs/dev/debt/libSceAgcDriver.md
PR 6848 core/libs/prx/libSceAgcDriver/Graphics/src/DccMetadata.cpp
PR 6867 docs/dev/debt/libSceAgcDriver.md
PR 6868 docs/dev/debt/libSceAgcDriver.md
PR 6887 docs/dev/debt/libSceAgcDriver.md
PR 6926 docs/dev/debt/libSceAgcDriver.md
PR 6946 docs/dev/debt/libSceAgcDriver.md
PR 6947 docs/dev/debt/libSceAgcDriver.md
PR 6959 docs/dev/debt/libSceAgcDriver.md
PR 6965 docs/dev/debt/libSceAgcDriver.md
PR 6973 docs/dev/debt/libSceAgcDriver.md
PR 6977 docs/dev/debt/libSceAgcDriver.md
PR 6987 docs/dev/debt/libSceAgcDriver.md
PR 6989 docs/dev/debt/libSceAgcDriver.md
PR 6995 docs/dev/debt/libSceAgcDriver.md
PR 7002 docs/dev/debt/libSceAgcDriver.md
PR 7085 docs/dev/debt/libSceAgcDriver.md
PR 7256 docs/dev/debt/libSceAgcDriver.md
PR 7307 docs/dev/debt/libSceAgcDriver.md
PR 7310 docs/dev/debt/libSceAgcDriver.md
PR 7426 docs/dev/debt/libSceAgcDriver.md
PR 7446 docs/dev/debt/libSceAgcDriver.md
PR 7449 docs/dev/debt/libSceAgcDriver.md
PR 7505 docs/dev/debt/libSceAgcDriver.md
PR 7600 docs/dev/debt/libSceAgcDriver.md
PR 7604 docs/dev/debt/libSceAgcDriver.md
PR 7618 docs/dev/debt/libSceAgcDriver.md
PR 7642 docs/dev/debt/libSceAgcDriver.md
PR 7659 docs/dev/debt/libSceAgcDriver.md
PR 7668 docs/dev/debt/libSceAgcDriver.md
PR 7696 docs/dev/debt/libSceAgcDriver.md
PR 7717 docs/dev/debt/libSceAgcDriver.md
PR 7729 docs/dev/debt/libSceAgcDriver.md
PR 7800 docs/dev/debt/libSceAgcDriver.md
PR 7803 docs/dev/debt/libSceAgcDriver.md
PR 7844 docs/dev/debt/libSceAgcDriver.md
PR 7869 docs/dev/debt/libSceAgcDriver.md
PR 7883 docs/dev/debt/libSceAgcDriver.md
PR 7893 docs/dev/debt/libSceAgcDriver.md
PR 7910 docs/dev/debt/libSceAgcDriver.md
PR 7911 docs/dev/debt/libSceAgcDriver.md
PR 7912 docs/dev/debt/libSceAgcDriver.md
PR 7927 docs/dev/debt/libSceAgcDriver.md
PR 7948 docs/dev/debt/libSceAgcDriver.md
PR 7965 docs/dev/debt/libSceAgcDriver.md
PR 7978 docs/dev/debt/libSceAgcDriver.md
PR 8014 docs/dev/debt/libSceAgcDriver.md
PR 8026 core/libs/prx/libSceAgcDriver/Graphics/src/DccMetadata.cpp
PR 8046 docs/dev/debt/libSceAgcDriver.md
PR 8069 docs/dev/debt/libSceAgcDriver.md
PR 8070 docs/dev/debt/libSceAgcDriver.md
PR 8083 docs/dev/debt/libSceAgcDriver.md
PR 8099 docs/dev/debt/libSceAgcDriver.md
PR 8115 docs/dev/debt/libSceAgcDriver.md
PR 8121 docs/dev/debt/libSceAgcDriver.md
PR 8123 docs/dev/debt/libSceAgcDriver.md
PR 8145 docs/dev/debt/libSceAgcDriver.md
PR 8180 docs/dev/debt/libSceAgcDriver.md
PR 8206 docs/dev/debt/libSceAgcDriver.md
PR 8213 docs/dev/debt/libSceAgcDriver.md
PR 8223 docs/dev/debt/libSceAgcDriver.md
PR 8224 docs/dev/debt/libSceAgcDriver.md
PR 8261 docs/dev/debt/libSceAgcDriver.md
PR 8281 docs/dev/debt/libSceAgcDriver.md
PR 8283 docs/dev/debt/libSceAgcDriver.md
PR 8297 docs/dev/debt/libSceAgcDriver.md
PR 8317 docs/dev/debt/libSceAgcDriver.md
PR 8319 docs/dev/debt/libSceAgcDriver.md
PR 8365 docs/dev/debt/libSceAgcDriver.md
PR 8395 docs/dev/debt/libSceAgcDriver.md
PR 8401 docs/dev/debt/libSceAgcDriver.md
PR 8412 docs/dev/debt/libSceAgcDriver.md
PR 8419 docs/dev/debt/libSceAgcDriver.md
PR 8420 docs/dev/debt/libSceAgcDriver.md
PR 8423 docs/dev/debt/libSceAgcDriver.md
PR 8424 docs/dev/debt/libSceAgcDriver.md
PR 8426 docs/dev/debt/libSceAgcDriver.md
PR 8469 docs/dev/debt/libSceAgcDriver.md
PR 8519 docs/dev/debt/libSceAgcDriver.md
PR 8527 docs/dev/debt/libSceAgcDriver.md
PR 8538 docs/dev/debt/libSceAgcDriver.md
PR 8542 docs/dev/debt/libSceAgcDriver.md
PR 8563 docs/dev/debt/libSceAgcDriver.md
PR 8564 docs/dev/debt/libSceAgcDriver.md
PR 8592 docs/dev/debt/libSceAgcDriver.md
PR 8639 docs/dev/debt/libSceAgcDriver.md
PR 8672 docs/dev/debt/libSceAgcDriver.md
PR 8707 docs/dev/debt/libSceAgcDriver.md
PR 8740 docs/dev/debt/libSceAgcDriver.md
PR 8747 docs/dev/debt/libSceAgcDriver.md

@janzezno

Copy link
Copy Markdown
Contributor

agc_driver_srgb8_color_target fails with this change.

Host: Arch Linux, kernel 7.2.11, AMD Radeon RX 7900 GRE (RADV NAVI31), Mesa 26.2.5, GCC 16.2.1, Release, BUILD_TESTING=ON.
main ca74ef217; the DccMetadata.cpp and DisplayBufferDcc.cpp changes of head e1bf9720c applied on top.

  • PR: fails alone and in 5 of 5 runs of ctest -j12 -R '^agc_driver_':
    [gpu] color target 0x7f9f8d3a0000 stays non-resident: AGC graphics: DCC metadata 0x563b3630d500 is not writable over the 0x1000 key bytes of its surface (0x200 at one per 256 bytes): metadata smaller than the console's DCC extent is not modeled
    AGC graphics: the drawn 8_SRGB target kept compressed DCC keys
    
  • main: passes 10 of 10 alone and 5 of 5 under the same ctest -j12 run.

The fixture (tests/execution/Srgb8ColorTarget.cpp) is a 512x256 R8_SRGB SW_64KB_R_X target with 0x200 key bytes. Now that 1-byte elements take the meta-block path, DccKeyCount returns one 1024x1024 block, 0x1000 bytes, and the target is refused. The count and the refusal are on the CPU, so I expect the same on other devices; not checked. Either the fixture needs keys for the console extent or the 1-byte extent is wrong; I can't tell which from here.

The PR's own tests pass: ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ctest --test-dir build -R dcc -V --repeat until-fail:3, 8 of 8, no VUID-. The rest of the full suite matches main on this machine.

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* docs needs rebase Conflicts with main, rebase needed unblocks title Names a title ID on the Unblocks line

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants