fix(agc): wait for the display buffer's GPU writers before the presentation lock #7643

Open
EagleBearerYS wants to merge 4 commits from upstream-pr/7643 into main
EagleBearerYS commented 2026-10-18 19:20:33 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by EagleBearerYS on 2026-10-18T19:20:33Z.


What

On main, a present through guest memory reads the display buffer while the presenter holds the device lock. Driver::Present takes its second hold (Presentation.cpp ~108), and PresentDisplayBuffer reads the buffer under it: through GpuColorTransfer.cpp ~127, or ReadDisplayBuffer and DisplayBuffer.cpp ~252. That read's flush hook takes the lock again, nested. Because the hold isn't the outermost one (Recorder.cpp ~3605), the hook waits for the frame's recorded GPU writers with the lock held. Every queue worker and guest thread that needs the lock then stops for the frame's remaining GPU time, on each present.

The fix is fable-void's 531e45035 from his wip/new-gpu-path, with his authorship.

  • The presenter flushes the display buffer's GPU writes before it takes the lock, unless the buffer is presented from its resident image.
  • The hook then holds the lock only at the outermost level, and waits for the GPU without it.
  • The read under the lock still flushes, so a writer recorded in between is still waited for.

Ported onto main with two changes, both named in the commit:

  • graphicsContext() stands for his readyContext();
  • APS5_NO_EARLY_DISPLAY_FLUSH, with its ENVIRONMENT.md row, keeps the old order.

The test is new. His agc_driver_cpu_read_lock_waits needs his NewPathFixture and residency layer, and runs only on Windows, so agc_driver_present_lock_wait re-implements its presentation case on main.

  • What it does: it presents a linear 64×64 display buffer through a headless surface while a ≥ 300 ms compute dispatch on queue 0x20 writes it. Meanwhile it takes the device lock from the test thread.
  • What it checks:
    • the present has to wait for the writer;
    • the longest lock wait beside it has to stay under a quarter of the writer's time;
    • the pixels the present read, from its CPU frame dump, have to hold the writer's value, so the present stays ordered after its writer.
  • A device without VK_EXT_headless_surface skips.

Pending: a Windows run of the new test, and a title whose presents go through guest memory; none found so far. Resident Evil Village (PPSA01556) and 007 First Light (PPSA11386) at their menus, Astro's Playroom (PPSA01325) in gameplay, and, per thuanquang's report, Metal Gear Solid Master Collection (PPSA14363) and Persona 5 Royal (PPSA05110) present from the resident image (Persona 5 Royal sends at most one of about 1,300 presents through guest memory), where this PR's path doesn't run (see Tested). This stays a draft until then.

Tested

  • Linux, lavapipe (Mesa 25.2.8, LLVM 20.1.2), CI's configure flags, on a cloud worker, agc_driver_present_lock_wait:

    build present longest lock wait beside it result
    this branch 457–480 ms 0.004–0.56 ms passes; 20 of 20 with --repeat until-fail:20, at most 2.42 ms over 60 attempts
    the Presentation.cpp line reverted 462–476 ms 452–466 ms fails: "the device lock was held for 452.016613 ms while the present waited for the display buffer's GPU writer (507.629233 ms)"
    this branch with APS5_NO_EARLY_DISPLAY_FLUSH=1 462–477 ms 452–467 ms fails the same way

    The writer ran ~489–508 ms each time, and every present read its value.

  • The order check catches a misordered read. A temporary mutant removed the read's own flush (DisplayBuffer.cpp:252). With the switch set, the test fails: "the present read 0x00000000 from the display buffer before its GPU writer stored 0xd2000001".

  • CI's Linux mirror on main 218aa8f00 and on this branch:

    • main: 1,391 passed, 69 not run, 5 failed;
    • this branch: 1,392 passed, 69 not run, 5 failed.

    The 5 failures are the worker's known IPv6 tests. The only difference is the new test.

  • Windows, NVIDIA GeForce RTX 4090 (driver 617.42, Windows 11 Pro 26200, WinLibs GCC 15.2.0, Release), run by MaxLikesCode on this head merged into main ad502d717 (comment):

    • agc_driver_present_lock_wait skips 5 of 5 runs, with and without APS5_NO_EARLY_DISPLAY_FLUSH=1: the NVIDIA Windows driver has no VK_EXT_headless_surface, so this GPU can't run the test;
    • of the 975 tests tools/select_tests.py selects, 956 pass, 15 skip and 3 fail. The 3 fail the same way on main on that GPU without this PR: agc_driver_bda_device (#7584), agc_driver_image_table_reuse (#7710) and agc_driver_pixel_lds (#7708). tools/check_skips.py --job windows accepts the skips.
  • Windows, AMD Radeon RX 6700 XT (gfx1031, driver 32.0.21045.16010, Windows 11 26200, WinLibs GCC 15.2.0 r7, Release), run by thuanquang on fdc4da36d2 merged onto main e05ba6feeb (comment), per their report:

    • agc_driver_present_lock_wait skips: AMD's Windows driver has no VK_EXT_headless_surface either (its surface extensions are VK_KHR_surface and VK_KHR_win32_surface), so neither proprietary Windows driver can run the test;
    • of the 1,464 tests tools/select_tests.py selects for this change, all pass except agc_host_import_cut_lifetime, agc_driver_depth_plane_partial_store and agc_driver_sample_order_grid_reference, which fail the same way on unmodified main 4017310678 on that GPU (3 of 3 runs in each tree), and public_headers, which goes over its 30 s timeout there; its audit and its 64 compile batches pass when run on their own. tools/check_skips.py --job windows accepts all 10 skips.
  • Linux, RADV (the AMD Ryzen 9 7950X3D's integrated GPU, RADV RAPHAEL_MENDOCINO, Mesa 26.2.4; CachyOS, Linux 7.2.10, GCC 16.2.1, Release), run by SleglJan on this PR's 870ad5d6e on main b44d0127d with the open PRs 007 First Light needs (comment):

    • agc_driver_present_lock_wait passes 13 of 13 runs with this PR's order; in the 8 verbose ones, the longest device-lock wait beside a present is 0.001–0.025 ms;
    • with APS5_NO_EARLY_DISPLAY_FLUSH=1 it fails 5 of 5: the longest wait is 308.6–310.6 ms, behind a 347.2 ms display-buffer writer;
    • every read is 0xd2000001 in both arms. The machine's RTX 3080 (NVIDIA 615.78.08) has no VK_EXT_headless_surface on Linux, so the test can't run on it.
  • 007 First Light (PPSA11386), main menu, the same machine's RTX 3080, this PR's order, by SleglJan (same comment): the last [flip] line under APS5_PROFILE_DRAW=1 reads 2,518 presents from the resident image and 0 through guest memory, so this PR's path didn't run there, and no frame-time A/B was taken.

  • Astro's Playroom (PPSA01325), Linux, RTX 5080 (driver 615.78.08), run by fma-rc on 870ad5d6e7 (comment): frames in a 10 s gameplay window, two rounds with the order reversed in the second. This PR: 129 and 121. APS5_NO_EARLY_DISPLAY_FLUSH=1: 136 and 132. The GPU sat at P0 at a median 2812 MHz. These counts differ by 5 and 9 % on a path that the profiled round below shows doesn't run in Playroom's gameplay, so they read as run-to-run spread, not this PR.

  • Astro's Playroom (PPSA01325), one profiled round per arm on fdc4da36d2, by fma-rc (comment): the same RTX 5080, APS5_PROFILE_DRAW=1, the last report period before the 10 s trace window closed. The last [flip] line reads 3,521 presents from the resident image by default and 3,182 with APS5_NO_EARLY_DISPLAY_FLUSH=1, with 0 through guest memory in both (0 not pending, 0 unsuitable). So this PR's path doesn't run there either.

  • Metal Gear Solid Master Collection (PPSA14363) and Persona 5 Royal (PPSA05110), the same RX 6700 XT, by thuanquang (same comment), per their report: Metal Gear Solid Master Collection's [flip] lines read 0 presents through guest memory, and Persona 5 Royal sends at most one of about 1,300 that way, every other present coming from the resident image, so this PR's path doesn't run in either.

  • Resident Evil Village (PPSA01556), Windows 11 Home 26300, NVIDIA GeForce RTX 3070 Laptop GPU (driver 617.42), AMD Ryzen 9 5900HS: this PR's 870ad5d6e7 merged with 63d5414338 (#8926's fix) on main 1ff5c8ac5c. Each run sits at the main menu for 16 min with no input, with APS5_LAZY_SHADER_PREPARE=1 APS5_NO_GPL=1 APS5_HOST_IMPORT_MIB=6400 APS5_TRACE_SUMMARY_EVERY=1; the other arm adds APS5_NO_EARLY_DISPLAY_FLUSH=1. Order A B A B.

    this PR APS5_NO_EARLY_DISPLAY_FLUSH=1
    frames per second, 5–15 min after the menu 0.346, 0.363 (both: 0.355) 0.342, 0.370 (both: 0.356)
    frames per second, 2–8 min after the menu 0.344, 0.373 0.363, 0.437
    peak private bytes 25.3, 26.3 GB 26.6, 26.5 GB
    • The GPU was in P0 for 97–99% of nvidia-smi's samples (every ~0.1 s); clocks weren't locked (690–1785 MHz).
    • Village's menu doesn't run this PR's path. In one profiled 10-min run per arm (APS5_PROFILE_DRAW=1), the last [flip] line reads 4,366 presents from the resident image and 19 through guest memory with this PR, and 5,007 and 4 with the switch. The guest-memory counts are already there at the first line, at 573 and 583 presents, so they're boot presents. For a resident present PrepareDisplayRead returns before its flush, so at the menu the arms differ only by its PresentableResident lookup. This pair can't show the lock wait this PR removes; it only checks Village's menu for a regression. The switch's 2–8 min lead comes from its second run: its own two runs differ by 20% there.
    • In each arm, 2 of the 3 runs, counting the profiled one, ended in an access violation on the presenter thread when the harness closed the game. A run of 63d5414338 without this PR ended the same way.
  • Pending: a Windows run of the new test on a GPU whose driver has VK_EXT_headless_surface; a title whose presents go through guest memory, none found so far.

  • fdc4da36d2, a merge of main 938812df14. The only conflict was docs/dev/ENVIRONMENT.md, where main added APS5_NO_EMPTY_INDIRECT_SKIP next to this PR's APS5_NO_EARLY_DISPLAY_FLUSH; both rows are kept, in order, and the PR's own diff is unchanged. On GitHub's runners (run), of agc_driver_present_lock_wait, agc_driver_bda_device, agc_driver_image_table_reuse and agc_driver_pixel_lds, 3 pass 10 runs in a row on Linux and agc_driver_pixel_lds skips; on Windows all 4 skip without a Vulkan device; none fail. The libc and libkernel suites pass on both (119 and 201 tests on Linux, 146 and 211 on Windows), run with APS5_SKIP_TIMING_TESTS=1, which relaxes precise_wait's median bounds on GitHub's hosted runners.

  • 6afa8530c3, a merge of main 828ac0b2ae (run). The merge has no textual conflict, but without one change the new test doesn't build on main: orezraey's #10507 gave AgcDriverPresentBuffer_nid_postfix a const DisplayBuffer* plane parameter for the overlay plane. The test's two calls in PresentLockWait.cpp now pass nullptr for it, as main's other callers without a plane do, and the merge commit's message names it. This PR's other changed lines are the same.

    • ×10: agc_driver_present_lock_wait, agc_driver_bda_device, agc_driver_image_table_reuse and agc_driver_pixel_lds.
      • Linux: 4 run, 3 pass, 1 skip, 0 fail. agc_driver_present_lock_wait passed every run; the skip is agc_driver_pixel_lds.
      • Windows: 4 run, 0 pass, 4 skip (no Vulkan device), 0 fail.
      • The libc and libkernel suites run 199 and 308 tests on Linux and 226 and 330 on Windows, with 0 failed. The suites ran with APS5_SKIP_TIMING_TESTS=1, which relaxes precise_wait's median bounds on GitHub's hosted runners.

Checklist

  • Based on main 218aa8f00, and merges cleanly into 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 (none added)
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: lavapipe (Mesa 25.2.8, LLVM 20.1.2), Ubuntu 24.04; NVIDIA GeForce RTX 4090 (driver 617.42), Windows 11, by MaxLikesCode (the new test skips there without VK_EXT_headless_surface); RADV RAPHAEL_MENDOCINO (Mesa 26.2.4) and RTX 3080 (615.78.08), CachyOS, by SleglJan; RTX 5080 (615.78.08), Linux, by fma-rc; AMD Radeon RX 6700 XT (driver 32.0.21045.16010), Windows 11, by thuanquang (the new test skips there without VK_EXT_headless_surface); NVIDIA GeForce RTX 3070 Laptop GPU (driver 617.42), Windows 11, with Resident Evil Village
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4912075007 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7643). Originally posted by [EagleBearerYS](https://github.com/EagleBearerYS) on 2026-10-18T19:20:33Z. --- ### What On `main`, a present through guest memory reads the display buffer while the presenter holds the device lock. `Driver::Present` takes its second hold (`Presentation.cpp` ~108), and `PresentDisplayBuffer` reads the buffer under it: through `GpuColorTransfer.cpp` ~127, or `ReadDisplayBuffer` and `DisplayBuffer.cpp` ~252. That read's flush hook takes the lock again, nested. Because the hold isn't the outermost one (`Recorder.cpp` ~3605), the hook waits for the frame's recorded GPU writers with the lock held. Every queue worker and guest thread that needs the lock then stops for the frame's remaining GPU time, on each present. The fix is fable-void's 531e45035 from his `wip/new-gpu-path`, with his authorship. - The presenter flushes the display buffer's GPU writes before it takes the lock, unless the buffer is presented from its resident image. - The hook then holds the lock only at the outermost level, and waits for the GPU without it. - The read under the lock still flushes, so a writer recorded in between is still waited for. **Ported onto `main` with two changes,** both named in the commit: - `graphicsContext()` stands for his `readyContext()`; - `APS5_NO_EARLY_DISPLAY_FLUSH`, with its `ENVIRONMENT.md` row, keeps the old order. **The test is new.** His `agc_driver_cpu_read_lock_waits` needs his `NewPathFixture` and residency layer, and runs only on Windows, so `agc_driver_present_lock_wait` re-implements its presentation case on `main`. - **What it does:** it presents a linear 64×64 display buffer through a headless surface while a ≥ 300 ms compute dispatch on queue 0x20 writes it. Meanwhile it takes the device lock from the test thread. - **What it checks:** - the present has to wait for the writer; - the longest lock wait beside it has to stay under a quarter of the writer's time; - the pixels the present read, from its CPU frame dump, have to hold the writer's value, so the present stays ordered after its writer. - A device without `VK_EXT_headless_surface` skips. **Pending:** a Windows run of the new test, and a title whose presents go through guest memory; none found so far. Resident Evil Village (PPSA01556) and 007 First Light (PPSA11386) at their menus, Astro's Playroom (PPSA01325) in gameplay, and, per thuanquang's report, Metal Gear Solid Master Collection (PPSA14363) and Persona 5 Royal (PPSA05110) present from the resident image (Persona 5 Royal sends at most one of about 1,300 presents through guest memory), where this PR's path doesn't run (see Tested). This stays a draft until then. ### Tested - **Linux, lavapipe** (Mesa 25.2.8, LLVM 20.1.2), CI's configure flags, on a cloud worker, `agc_driver_present_lock_wait`: | build | present | longest lock wait beside it | result | |---|---|---|---| | this branch | 457–480 ms | 0.004–0.56 ms | passes; 20 of 20 with `--repeat until-fail:20`, at most 2.42 ms over 60 attempts | | the `Presentation.cpp` line reverted | 462–476 ms | 452–466 ms | fails: "the device lock was held for 452.016613 ms while the present waited for the display buffer's GPU writer (507.629233 ms)" | | this branch with `APS5_NO_EARLY_DISPLAY_FLUSH=1` | 462–477 ms | 452–467 ms | fails the same way | The writer ran ~489–508 ms each time, and every present read its value. - **The order check catches a misordered read.** A temporary mutant removed the read's own flush (`DisplayBuffer.cpp:252`). With the switch set, the test fails: "the present read 0x00000000 from the display buffer before its GPU writer stored 0xd2000001". - **CI's Linux mirror** on `main` 218aa8f00 and on this branch: - `main`: 1,391 passed, 69 not run, 5 failed; - this branch: 1,392 passed, 69 not run, 5 failed. The 5 failures are the worker's known IPv6 tests. The only difference is the new test. - **Windows, NVIDIA GeForce RTX 4090** (driver 617.42, Windows 11 Pro 26200, WinLibs GCC 15.2.0, Release), run by MaxLikesCode on this head merged into `main` ad502d717 ([comment](https://github.com/boykopovar/AnyPS5/pull/7643#issuecomment-6258339201)): - `agc_driver_present_lock_wait` skips 5 of 5 runs, with and without `APS5_NO_EARLY_DISPLAY_FLUSH=1`: the NVIDIA Windows driver has no `VK_EXT_headless_surface`, so this GPU can't run the test; - of the 975 tests `tools/select_tests.py` selects, 956 pass, 15 skip and 3 fail. The 3 fail the same way on `main` on that GPU without this PR: `agc_driver_bda_device` (#7584), `agc_driver_image_table_reuse` (#7710) and `agc_driver_pixel_lds` (#7708). `tools/check_skips.py --job windows` accepts the skips. - **Windows, AMD Radeon RX 6700 XT** (gfx1031, driver 32.0.21045.16010, Windows 11 26200, WinLibs GCC 15.2.0 r7, Release), run by thuanquang on fdc4da36d2 merged onto `main` e05ba6feeb ([comment](https://github.com/boykopovar/AnyPS5/pull/7643#issuecomment-6399276581)), per their report: - `agc_driver_present_lock_wait` skips: AMD's Windows driver has no `VK_EXT_headless_surface` either (its surface extensions are `VK_KHR_surface` and `VK_KHR_win32_surface`), so neither proprietary Windows driver can run the test; - of the 1,464 tests `tools/select_tests.py` selects for this change, all pass except `agc_host_import_cut_lifetime`, `agc_driver_depth_plane_partial_store` and `agc_driver_sample_order_grid_reference`, which fail the same way on unmodified `main` 4017310678 on that GPU (3 of 3 runs in each tree), and `public_headers`, which goes over its 30 s timeout there; its audit and its 64 compile batches pass when run on their own. `tools/check_skips.py --job windows` accepts all 10 skips. - **Linux, RADV** (the AMD Ryzen 9 7950X3D's integrated GPU, RADV RAPHAEL_MENDOCINO, Mesa 26.2.4; CachyOS, Linux 7.2.10, GCC 16.2.1, Release), run by SleglJan on this PR's 870ad5d6e on `main` b44d0127d with the open PRs 007 First Light needs ([comment](https://github.com/boykopovar/AnyPS5/pull/7643#issuecomment-6262249695)): - `agc_driver_present_lock_wait` passes 13 of 13 runs with this PR's order; in the 8 verbose ones, the longest device-lock wait beside a present is 0.001–0.025 ms; - with `APS5_NO_EARLY_DISPLAY_FLUSH=1` it fails 5 of 5: the longest wait is 308.6–310.6 ms, behind a 347.2 ms display-buffer writer; - every read is `0xd2000001` in both arms. The machine's RTX 3080 (NVIDIA 615.78.08) has no `VK_EXT_headless_surface` on Linux, so the test can't run on it. - **007 First Light (PPSA11386)**, main menu, the same machine's RTX 3080, this PR's order, by SleglJan (same comment): the last `[flip]` line under `APS5_PROFILE_DRAW=1` reads 2,518 presents from the resident image and 0 through guest memory, so this PR's path didn't run there, and no frame-time A/B was taken. - **Astro's Playroom (PPSA01325)**, Linux, RTX 5080 (driver 615.78.08), run by fma-rc on 870ad5d6e7 ([comment](https://github.com/boykopovar/AnyPS5/pull/7643#issuecomment-6270121764)): frames in a 10 s gameplay window, two rounds with the order reversed in the second. This PR: 129 and 121. `APS5_NO_EARLY_DISPLAY_FLUSH=1`: 136 and 132. The GPU sat at P0 at a median 2812 MHz. These counts differ by 5 and 9 % on a path that the profiled round below shows doesn't run in Playroom's gameplay, so they read as run-to-run spread, not this PR. - **Astro's Playroom (PPSA01325), one profiled round per arm on fdc4da36d2**, by fma-rc ([comment](https://github.com/boykopovar/AnyPS5/pull/7643#issuecomment-6390628381)): the same RTX 5080, `APS5_PROFILE_DRAW=1`, the last report period before the 10 s trace window closed. The last `[flip]` line reads 3,521 presents from the resident image by default and 3,182 with `APS5_NO_EARLY_DISPLAY_FLUSH=1`, with 0 through guest memory in both (`0 not pending, 0 unsuitable`). So this PR's path doesn't run there either. - **Metal Gear Solid Master Collection (PPSA14363) and Persona 5 Royal (PPSA05110)**, the same RX 6700 XT, by thuanquang (same comment), per their report: Metal Gear Solid Master Collection's `[flip]` lines read 0 presents through guest memory, and Persona 5 Royal sends at most one of about 1,300 that way, every other present coming from the resident image, so this PR's path doesn't run in either. - **Resident Evil Village (PPSA01556)**, Windows 11 Home 26300, NVIDIA GeForce RTX 3070 Laptop GPU (driver 617.42), AMD Ryzen 9 5900HS: this PR's 870ad5d6e7 merged with 63d5414338 (#8926's fix) on `main` 1ff5c8ac5c. Each run sits at the main menu for 16 min with no input, with `APS5_LAZY_SHADER_PREPARE=1 APS5_NO_GPL=1 APS5_HOST_IMPORT_MIB=6400 APS5_TRACE_SUMMARY_EVERY=1`; the other arm adds `APS5_NO_EARLY_DISPLAY_FLUSH=1`. Order A B A B. | | this PR | `APS5_NO_EARLY_DISPLAY_FLUSH=1` | |---|---|---| | frames per second, 5–15 min after the menu | 0.346, 0.363 (both: 0.355) | 0.342, 0.370 (both: 0.356) | | frames per second, 2–8 min after the menu | 0.344, 0.373 | 0.363, 0.437 | | peak private bytes | 25.3, 26.3 GB | 26.6, 26.5 GB | - The GPU was in P0 for 97–99% of `nvidia-smi`'s samples (every ~0.1 s); clocks weren't locked (690–1785 MHz). - **Village's menu doesn't run this PR's path.** In one profiled 10-min run per arm (`APS5_PROFILE_DRAW=1`), the last `[flip]` line reads 4,366 presents from the resident image and 19 through guest memory with this PR, and 5,007 and 4 with the switch. The guest-memory counts are already there at the first line, at 573 and 583 presents, so they're boot presents. For a resident present `PrepareDisplayRead` returns before its flush, so at the menu the arms differ only by its `PresentableResident` lookup. This pair can't show the lock wait this PR removes; it only checks Village's menu for a regression. The switch's 2–8 min lead comes from its second run: its own two runs differ by 20% there. - In each arm, 2 of the 3 runs, counting the profiled one, ended in an access violation on the presenter thread when the harness closed the game. A run of 63d5414338 without this PR ended the same way. - **Pending:** a Windows run of the new test on a GPU whose driver has `VK_EXT_headless_surface`; a title whose presents go through guest memory, none found so far. - **fdc4da36d2, a merge of `main` 938812df14.** The only conflict was `docs/dev/ENVIRONMENT.md`, where `main` added `APS5_NO_EMPTY_INDIRECT_SKIP` next to this PR's `APS5_NO_EARLY_DISPLAY_FLUSH`; both rows are kept, in order, and the PR's own diff is unchanged. On GitHub's runners ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/39965927862)), of `agc_driver_present_lock_wait`, `agc_driver_bda_device`, `agc_driver_image_table_reuse` and `agc_driver_pixel_lds`, 3 pass 10 runs in a row on Linux and `agc_driver_pixel_lds` skips; on Windows all 4 skip without a Vulkan device; none fail. The libc and libkernel suites pass on both (119 and 201 tests on Linux, 146 and 211 on Windows), run with `APS5_SKIP_TIMING_TESTS=1`, which relaxes `precise_wait`'s median bounds on GitHub's hosted runners. - **6afa8530c3, a merge of `main` 828ac0b2ae** ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/41180310405)). The merge has no textual conflict, but without one change the new test doesn't build on `main`: orezraey's #10507 gave `AgcDriverPresentBuffer_nid_postfix` a `const DisplayBuffer* plane` parameter for the overlay plane. The test's two calls in `PresentLockWait.cpp` now pass `nullptr` for it, as `main`'s other callers without a plane do, and the merge commit's message names it. This PR's other changed lines are the same. - **×10:** `agc_driver_present_lock_wait`, `agc_driver_bda_device`, `agc_driver_image_table_reuse` and `agc_driver_pixel_lds`. - Linux: 4 run, 3 pass, 1 skip, 0 fail. `agc_driver_present_lock_wait` passed every run; the skip is `agc_driver_pixel_lds`. - Windows: 4 run, 0 pass, 4 skip (no Vulkan device), 0 fail. - The libc and libkernel suites run 199 and 308 tests on Linux and 226 and 330 on Windows, with 0 failed. The suites ran with `APS5_SKIP_TIMING_TESTS=1`, which relaxes `precise_wait`'s median bounds on GitHub's hosted runners. ### Checklist - [x] Based on `main` 218aa8f00, and merges cleanly into 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 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 (none added) - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: lavapipe (Mesa 25.2.8, LLVM 20.1.2), Ubuntu 24.04; NVIDIA GeForce RTX 4090 (driver 617.42), Windows 11, by MaxLikesCode (the new test skips there without `VK_EXT_headless_surface`); RADV RAPHAEL_MENDOCINO (Mesa 26.2.4) and RTX 3080 (615.78.08), CachyOS, by SleglJan; RTX 5080 (615.78.08), Linux, by fma-rc; AMD Radeon RX 6700 XT (driver 32.0.21045.16010), Windows 11, by thuanquang (the new test skips there without `VK_EXT_headless_surface`); NVIDIA GeForce RTX 3070 Laptop GPU (driver 617.42), Windows 11, with Resident Evil Village - [x] AI-assisted: yes
MaxLikesCode commented 2026-10-19 02:26:14 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MaxLikesCode on 2026-10-19T02:26:14Z.


A Windows run, on NVIDIA: GeForce RTX 4090, driver 617.42, Windows 11 Pro 26200, WinLibs GCC 15.2.0 r7, Release, BUILD_TESTING=ON with every execution test built. This head (870ad5d6e) merged into main ad502d717.

  • agc_driver_present_lock_wait skips here, 5 of 5 runs, with and without APS5_NO_EARLY_DISPLAY_FLUSH=1: skipped, the device has no VK_EXT_headless_surface for a presentation window. The NVIDIA Windows driver does not expose that extension, so this GPU cannot exercise the new test.
  • No regressions in the tests the change reaches. tools/select_tests.py selected 975 of 1553 tests. 956 pass, 15 skip and 3 fail; the new test, built afterwards, skips as above. The 3 failures are the same ones main shows on this GPU without this PR: agc_driver_bda_device (#7584), agc_driver_image_table_reuse (#7710) and agc_driver_pixel_lds (#7708). tools/check_skips.py --job windows accepts the 15 skips.

So a Windows run of the new test still needs a GPU whose driver has VK_EXT_headless_surface.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6258339201 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7643#issuecomment-6258339201). Originally posted by [MaxLikesCode](https://github.com/MaxLikesCode) on 2026-10-19T02:26:14Z. --- A Windows run, on NVIDIA: GeForce RTX 4090, driver 617.42, Windows 11 Pro 26200, WinLibs GCC 15.2.0 r7, Release, `BUILD_TESTING=ON` with every execution test built. This head (870ad5d6e) merged into `main` ad502d717. - **`agc_driver_present_lock_wait` skips here**, 5 of 5 runs, with and without `APS5_NO_EARLY_DISPLAY_FLUSH=1`: `skipped, the device has no VK_EXT_headless_surface for a presentation window`. The NVIDIA Windows driver does not expose that extension, so this GPU cannot exercise the new test. - **No regressions in the tests the change reaches.** `tools/select_tests.py` selected 975 of 1553 tests. 956 pass, 15 skip and 3 fail; the new test, built afterwards, skips as above. The 3 failures are the same ones `main` shows on this GPU without this PR: `agc_driver_bda_device` (#7584), `agc_driver_image_table_reuse` (#7710) and `agc_driver_pixel_lds` (#7708). `tools/check_skips.py --job windows` accepts the 15 skips. So a Windows run of the new test still needs a GPU whose driver has `VK_EXT_headless_surface`. AI-assisted: yes (Claude Code)
EagleBearerYS commented 2026-10-19 02:29:34 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by EagleBearerYS on 2026-10-19T02:29:34Z.


@MaxLikesCode thank you for the Windows run and for checking the three failures against main. The skip makes sense: the test needs VK_EXT_headless_surface for its presentation window, and NVIDIA's Windows driver doesn't expose it. I've added your run to the Tested section, and a Windows run of the test itself still needs a driver that has the extension.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6258375147 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7643#issuecomment-6258375147). Originally posted by [EagleBearerYS](https://github.com/EagleBearerYS) on 2026-10-19T02:29:34Z. --- @MaxLikesCode thank you for the Windows run and for checking the three failures against `main`. The skip makes sense: the test needs `VK_EXT_headless_surface` for its presentation window, and NVIDIA's Windows driver doesn't expose it. I've added your run to the Tested section, and a Windows run of the test itself still needs a driver that has the extension.
SleglJan commented 2026-10-19 07:43:13 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by SleglJan on 2026-10-19T07:43:13Z.


@EagleBearerYS a Linux run on a machine with an NVIDIA card. The new test doesn't reach the RTX 3080 here, so its numbers below are from RADV on the CPU's integrated GPU, where it separates the two orders. In 007 First Light's menu, on the RTX 3080, every present came from the resident image, where the early flush doesn't apply, so I didn't take a frame-time A/B there.

Setup:

  • CachyOS, Linux 7.2.10, GCC 16.2.1, Release, BUILD_TESTING=ON. GPUs: RTX 3080 10 GB (NVIDIA 615.78.08) and the Ryzen 9 7950X3D's integrated GPU (RADV RAPHAEL_MENDOCINO, Mesa 26.2.4).
  • Tree: main b44d0127d plus the open PRs 007 needs, one squash each at its head:
  • ctest: of 1,557 tests, 1,540 pass, 16 skip and 1 fails. The failure is agc_driver_bda_device, which #7584 tracks on main: 9.19 s in the full run, and alone, "AGC graphics: vkWaitForFences graphics: Vulkan result 2" after 8.06 s.

agc_driver_present_lock_wait:

  • NVIDIA's Linux driver doesn't expose VK_EXT_headless_surface (vulkaninfo with only its ICD), but RADV does.
  • The skip check reads the instance's extensions, which the loader merges across drivers, so the test runs. Its first device selects the RTX 3080, and its windowed device then selects the integrated GPU. The test's log says Selected GPU name=AMD Ryzen 9 7950X3D 16-Core Processor (RADV RAPHAEL_MENDOCINO). The numbers below are that GPU's.
  • With VK_ICD_FILENAMES set to NVIDIA's ICD alone, the test skips: "the device has no VK_EXT_headless_surface for a presentation window".
  • This PR's order passes 13 of 13 runs, all with the same two-device selection. In the 8 verbose ones (24 attempts), each present takes 317.6–320.2 ms, and the longest device-lock wait beside it is 0.001–0.025 ms.
  • With APS5_NO_EARLY_DISPLAY_FLUSH=1 it fails 5 of 5 runs (15 attempts). Each present takes 318.9–320.7 ms, and the longest device-lock wait beside it is 308.6–310.6 ms, behind a 347.2 ms display-buffer writer.
  • Every read is 0xd2000001 in both arms.

007 First Light, main menu:

  • The run used this PR's order on the RTX 3080, in a 1500×844 XWayland window.
  • Switches: APS5_PROFILE_DRAW=1 and APS5_TRACE_SECONDS=1320:60, a 60 s trace window in the menu covering presents 2,153–2,317.
  • The title's executable is not patched. Pad input is scripted through APS5_PAD_INPUT_FILE; keyboard and mouse (APS5_NO_PAD_INPUT=1) and the physical controller are ignored.
  • The cumulative [flip] counter is printed every 10 s under the lock in PresentDisplayBuffer. At its last line, near the end of the run, it reads 2,518 presents from the resident image and 0 through guest memory. Its lines either side of the trace window read 2,127 and 2,322 resident, with 0 through guest memory both times.
  • PrepareDisplayRead makes the same PresentableResident lookup just before, outside the lock, and returns when it finds the image. With these counts it returns before FlushGpuWrites, though I didn't count that return directly.
  • An A/B of this PR there would differ only by that lookup, so I left it out.
  • For context, per present in the window (164 presents, frame p50 374.9 ms):
    • the presenter held the device lock 2.0 times, for 0.5 ms in total, with the longest single hold at 1.5 ms;
    • other threads waited 0.5 ms behind the present, against 131.8 ms behind queue dispatches.

Clocks on the RTX 3080 were not pinned. I measured them with nvidia-smi at 1 s intervals.

  • In the menu's trace window the GPU was in P2 in all 60 samples, at 2040 MHz graphics and 9251 MHz memory (nvidia-smi's maximums are 2220 and 9501 MHz). Power was 154 W at the median.
  • Over the whole run it was in P8 for 613 of the first 639 samples, while booting and loading; the other 26 were P2, P3 or P5, 24 of them in the first 41 s. After that it was in P2 for all 839 samples, the last 14 minutes, from before the title screen to the end.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6262249695 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7643#issuecomment-6262249695). Originally posted by [SleglJan](https://github.com/SleglJan) on 2026-10-19T07:43:13Z. --- @EagleBearerYS a Linux run on a machine with an NVIDIA card. The new test doesn't reach the RTX 3080 here, so its numbers below are from RADV on the CPU's integrated GPU, where it separates the two orders. In 007 First Light's menu, on the RTX 3080, every present came from the resident image, where the early flush doesn't apply, so I didn't take a frame-time A/B there. Setup: - CachyOS, Linux 7.2.10, GCC 16.2.1, Release, `BUILD_TESTING=ON`. GPUs: RTX 3080 10 GB (NVIDIA 615.78.08) and the Ryzen 9 7950X3D's integrated GPU (RADV RAPHAEL_MENDOCINO, Mesa 26.2.4). - Tree: `main` b44d0127d plus the open PRs 007 needs, one squash each at its head: - #5799 e32f5e161, #6868 aa8f73490, #5372 a0f27b550 and #6918 955e7c3c7; - #6567 04aef899a, merged since; - then this PR at 870ad5d6e. There are no local commits. The only conflicts were #6868's and #5372's, both in `docs/dev/debt/libSceAgcDriver.md`. - `ctest`: of 1,557 tests, 1,540 pass, 16 skip and 1 fails. The failure is `agc_driver_bda_device`, which #7584 tracks on `main`: 9.19 s in the full run, and alone, "AGC graphics: vkWaitForFences graphics: Vulkan result 2" after 8.06 s. `agc_driver_present_lock_wait`: - NVIDIA's Linux driver doesn't expose `VK_EXT_headless_surface` (`vulkaninfo` with only its ICD), but RADV does. - The skip check reads the instance's extensions, which the loader merges across drivers, so the test runs. Its first device selects the RTX 3080, and its windowed device then selects the integrated GPU. The test's log says `Selected GPU name=AMD Ryzen 9 7950X3D 16-Core Processor (RADV RAPHAEL_MENDOCINO)`. The numbers below are that GPU's. - With `VK_ICD_FILENAMES` set to NVIDIA's ICD alone, the test skips: "the device has no VK_EXT_headless_surface for a presentation window". - This PR's order passes 13 of 13 runs, all with the same two-device selection. In the 8 verbose ones (24 attempts), each present takes 317.6–320.2 ms, and the longest device-lock wait beside it is 0.001–0.025 ms. - With `APS5_NO_EARLY_DISPLAY_FLUSH=1` it fails 5 of 5 runs (15 attempts). Each present takes 318.9–320.7 ms, and the longest device-lock wait beside it is 308.6–310.6 ms, behind a 347.2 ms display-buffer writer. - Every read is `0xd2000001` in both arms. 007 First Light, main menu: - The run used this PR's order on the RTX 3080, in a 1500×844 XWayland window. - Switches: `APS5_PROFILE_DRAW=1` and `APS5_TRACE_SECONDS=1320:60`, a 60 s trace window in the menu covering presents 2,153–2,317. - The title's executable is not patched. Pad input is scripted through `APS5_PAD_INPUT_FILE`; keyboard and mouse (`APS5_NO_PAD_INPUT=1`) and the physical controller are ignored. - The cumulative `[flip]` counter is printed every 10 s under the lock in `PresentDisplayBuffer`. At its last line, near the end of the run, it reads 2,518 presents from the resident image and 0 through guest memory. Its lines either side of the trace window read 2,127 and 2,322 resident, with 0 through guest memory both times. - `PrepareDisplayRead` makes the same `PresentableResident` lookup just before, outside the lock, and returns when it finds the image. With these counts it returns before `FlushGpuWrites`, though I didn't count that return directly. - An A/B of this PR there would differ only by that lookup, so I left it out. - For context, per present in the window (164 presents, frame p50 374.9 ms): - the presenter held the device lock 2.0 times, for 0.5 ms in total, with the longest single hold at 1.5 ms; - other threads waited 0.5 ms behind the present, against 131.8 ms behind queue dispatches. Clocks on the RTX 3080 were not pinned. I measured them with `nvidia-smi` at 1 s intervals. - In the menu's trace window the GPU was in P2 in all 60 samples, at 2040 MHz graphics and 9251 MHz memory (`nvidia-smi`'s maximums are 2220 and 9501 MHz). Power was 154 W at the median. - Over the whole run it was in P8 for 613 of the first 639 samples, while booting and loading; the other 26 were P2, P3 or P5, 24 of them in the first 41 s. After that it was in P2 for all 839 samples, the last 14 minutes, from before the title screen to the end. AI-assisted: yes (Claude Code)
fma-rc commented 2026-10-19 14:51:14 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by fma-rc on 2026-10-19T14:51:14Z.


@EagleBearerYS here's Astro's Playroom (PPSA01325) on this head (870ad5d6e7), Linux, RTX 5080 (driver 615.78.08). Each run goes into the first level with Cross pressed and takes a 10 s trace window in the same gameplay scene. Two rounds, with the order reversed in the second.

Frames in the window round 1 round 2
this PR 129 121
APS5_NO_EARLY_DISPLAY_FLUSH=1 136 132

The switch was ahead in both rounds, by 5% and 9%. The GPU sat at P0 with a median graphics clock of 2812 MHz in all four runs, and the captures show the same intro, menu and gameplay with nothing missing. I didn't check which path Playroom's presents take on this card, so I can't say whether the early flush itself ran here.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6270121764 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7643#issuecomment-6270121764). Originally posted by [fma-rc](https://github.com/fma-rc) on 2026-10-19T14:51:14Z. --- @EagleBearerYS here's Astro's Playroom (PPSA01325) on this head (870ad5d6e7), Linux, RTX 5080 (driver 615.78.08). Each run goes into the first level with Cross pressed and takes a 10 s trace window in the same gameplay scene. Two rounds, with the order reversed in the second. | Frames in the window | round 1 | round 2 | |---|---|---| | this PR | 129 | 121 | | `APS5_NO_EARLY_DISPLAY_FLUSH=1` | 136 | 132 | The switch was ahead in both rounds, by 5% and 9%. The GPU sat at P0 with a median graphics clock of 2812 MHz in all four runs, and the captures show the same intro, menu and gameplay with nothing missing. I didn't check which path Playroom's presents take on this card, so I can't say whether the early flush itself ran here.
EagleBearerYS commented 2026-10-21 02:39:30 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by EagleBearerYS on 2026-10-21T02:39:30Z.


@SleglJan Thanks, that's the red/green GitHub's Windows runner can't give. On RADV the test passes 13 of 13 with this PR's order. With APS5_NO_EARLY_DISPLAY_FLUSH=1 it fails 5 of 5: the longest device-lock wait beside a present is 308.6–310.6 ms there, behind the display-buffer writer, against 0.001–0.025 ms with the change. Thanks also for the 007 First Light (PPSA11386) counters. With every present coming from the resident image, the change only adds the PresentableResident lookup there, so leaving the A/B out was right.

@fma-rc Thanks for the two rounds in Astro's Playroom (PPSA01325). The switch being ahead in both is worth a closer look, since the change should only move the flush out of the presentation lock. If you can run one more round of each arm with APS5_PROFILE_DRAW=1, the [flip] lines it prints every 10 s would show whether Playroom's presents come from the resident image or through guest memory, and so whether the early flush runs there at all.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6306636578 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7643#issuecomment-6306636578). Originally posted by [EagleBearerYS](https://github.com/EagleBearerYS) on 2026-10-21T02:39:30Z. --- @SleglJan Thanks, that's the red/green GitHub's Windows runner can't give. On RADV the test passes 13 of 13 with this PR's order. With `APS5_NO_EARLY_DISPLAY_FLUSH=1` it fails 5 of 5: the longest device-lock wait beside a present is 308.6–310.6 ms there, behind the display-buffer writer, against 0.001–0.025 ms with the change. Thanks also for the 007 First Light (PPSA11386) counters. With every present coming from the resident image, the change only adds the `PresentableResident` lookup there, so leaving the A/B out was right. @fma-rc Thanks for the two rounds in Astro's Playroom (PPSA01325). The switch being ahead in both is worth a closer look, since the change should only move the flush out of the presentation lock. If you can run one more round of each arm with `APS5_PROFILE_DRAW=1`, the `[flip]` lines it prints every 10 s would show whether Playroom's presents come from the resident image or through guest memory, and so whether the early flush runs there at all.
jotitadev commented 2026-10-31 11:17:59 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-31T11:17:59Z.

Review: COMMENTED


Update: EagleBearerYS is right. This is the known Mesa 25.3.0–26.0.3 headless WSI bug (fixed in 26.0.4, see #10043), the test passes on CI's Mesa 25.2.8, and no lavapipe skip is needed. The rest is left as I first posted it.

Linux run of head 6afa8530c3 on lavapipe, a driver that has VK_EXT_headless_surface, so agc_driver_present_lock_wait doesn't skip on it. The test crashes there every time, and it crashes the same way without this PR's driver change.

Setup: Ubuntu 26.04, GCC 15.2, Release. Lavapipe from Mesa 26.0.3 (LLVM 21.1.8) and an RTX 3070 with NVIDIA 595.99.02, one at a time via VK_DRIVER_FILES. The head is merged --no-ff onto main 809c7fa2df with no conflicts. ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1, ctest -j1.

  • RTX 3070: skips 3/3 (the device has no VK_EXT_headless_surface for a presentation window), as on SleglJan's 3080.
  • Lavapipe: SEGFAULT in every run, about 1.2 s in, right after Surface capabilities drawable=64x64 … minImages=4:
    • this head, VVL 1.4.341: 6/6;
    • this head with APS5_NO_EARLY_DISPLAY_FLUSH=1: 3/3 with VVL 1.4.341, 2/2 with no layer;
    • main plus only PresentLockWait.cpp: 1/1;
    • with MESA_VK_WSI_DEBUG=sw or =linear: still crashes.
  • Where: the fault is a call through a null function pointer (rip=0). The return address is inside libvulkan_lvp.so, at a call site that fills a VkMemoryGetFdInfoKHR (sType 1000074002) just before the call. So it crashes in lavapipe's WSI while the presenter sets up the headless swapchain, before the timing part of the test runs. I have no Mesa debug symbols on this box, so I can't name the function. It may be a Mesa 26.0.3 bug; I haven't tried another Mesa version.
  • The rest of ^agc (minus dcc/flip/lds_atomics64) passes on both devices with the PR: 1133/1133 on the 3070, and 1132/1133 on lavapipe, where the one failure is this crash. agc_driver_flip, agc_driver_present_mode and agc_driver_presentation_pass pass on lavapipe. No AGC test on main calls AgcDriverAttachWindow, so this test is the first one that reaches the presenter with a real surface on lavapipe.

So this run can't give a red/green for the change. The issue is that once a Linux job runs this test on lavapipe, which is what the Linux CI uses, it would probably crash rather than skip. A skip on lavapipe (VK_DRIVER_ID_MESA_LLVMPIPE) next to the headless-surface check would avoid that, unless you want to chase the Mesa side.

GPUs tested: NVIDIA GeForce RTX 3070, 595.99.02, Ubuntu 26.04 (skips); Mesa 26.0.3 lavapipe, Ubuntu 26.04 (crashes)

Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5722499160 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7643#pullrequestreview-5722499160). Originally posted by [jotitadev](https://github.com/jotitadev) on 2026-10-31T11:17:59Z. **Review:** COMMENTED --- **Update:** EagleBearerYS is right. This is the known Mesa 25.3.0–26.0.3 headless WSI bug (fixed in 26.0.4, see #10043), the test passes on CI's Mesa 25.2.8, and no lavapipe skip is needed. The rest is left as I first posted it. Linux run of head `6afa8530c3` on lavapipe, a driver that has `VK_EXT_headless_surface`, so `agc_driver_present_lock_wait` doesn't skip on it. The test crashes there every time, and it crashes the same way without this PR's driver change. Setup: Ubuntu 26.04, GCC 15.2, Release. Lavapipe from Mesa 26.0.3 (LLVM 21.1.8) and an RTX 3070 with NVIDIA 595.99.02, one at a time via `VK_DRIVER_FILES`. The head is merged `--no-ff` onto `main` `809c7fa2df` with no conflicts. `ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1`, `ctest -j1`. - **RTX 3070:** skips 3/3 (`the device has no VK_EXT_headless_surface for a presentation window`), as on SleglJan's 3080. - **Lavapipe:** `SEGFAULT` in every run, about 1.2 s in, right after `Surface capabilities drawable=64x64 … minImages=4`: - this head, VVL 1.4.341: 6/6; - this head with `APS5_NO_EARLY_DISPLAY_FLUSH=1`: 3/3 with VVL 1.4.341, 2/2 with no layer; - `main` plus only `PresentLockWait.cpp`: 1/1; - with `MESA_VK_WSI_DEBUG=sw` or `=linear`: still crashes. - **Where:** the fault is a call through a null function pointer (`rip=0`). The return address is inside `libvulkan_lvp.so`, at a call site that fills a `VkMemoryGetFdInfoKHR` (`sType` 1000074002) just before the call. So it crashes in lavapipe's WSI while the presenter sets up the headless swapchain, before the timing part of the test runs. I have no Mesa debug symbols on this box, so I can't name the function. It may be a Mesa 26.0.3 bug; I haven't tried another Mesa version. - **The rest of `^agc`** (minus dcc/flip/lds_atomics64) passes on both devices with the PR: 1133/1133 on the 3070, and 1132/1133 on lavapipe, where the one failure is this crash. `agc_driver_flip`, `agc_driver_present_mode` and `agc_driver_presentation_pass` pass on lavapipe. No AGC test on `main` calls `AgcDriverAttachWindow`, so this test is the first one that reaches the presenter with a real surface on lavapipe. So this run can't give a red/green for the change. The issue is that once a Linux job runs this test on lavapipe, which is what the Linux CI uses, it would probably crash rather than skip. A skip on lavapipe (`VK_DRIVER_ID_MESA_LLVMPIPE`) next to the headless-surface check would avoid that, unless you want to chase the Mesa side. GPUs tested: NVIDIA GeForce RTX 3070, 595.99.02, Ubuntu 26.04 (skips); Mesa 26.0.3 lavapipe, Ubuntu 26.04 (crashes) Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
MarcZX10 commented 2026-11-23 02:39:22 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-23T02:39:22Z.

Review: APPROVED


Reviewed — looks good

Nothing blocks this change based on the inspected code; the described GPU wait is moved before the presentation lock while the read path retains its flush.

What I ran

Reviewed head 6afa8530c3a356d8967d9513d601f55c2d44097e using the prepared review bundle and repo_read.py. No commands or tests were run by me; the test and platform results below are author supplied.

Results

Check Result Note
Source review passed Core change and new test read
Automated tests not run Reported results are author supplied
Platform behavior not verified Windows test skips on reported drivers

Findings

Blocking

None.

Non-blocking

None.

Not verified

VulkanDevice.cpp was excluded from the review folder because it was too large; I read the changed function at the pinned head through the reader. The changed files reviewed were VulkanDevice.hpp, Presentation.cpp, VulkanDevice.cpp (changed function only), PresentLockWait.cpp, and ENVIRONMENT.md. No files were excluded by the review manifest's file rules. I did not read the remainder of VulkanDevice.cpp or run builds and tests. The supplied description reports Linux lavapipe and RADV test passes, and Windows test skips due to missing headless surface support; I did not independently verify those runs. A title exercising the guest-memory present path was not identified in the description.

To get this to a good state

Nothing is required. The reported Windows run on a driver with VK_EXT_headless_surface and a title using guest-memory presents remain optional validation points.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6015973973 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7643#pullrequestreview-6015973973). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-23T02:39:22Z. **Review:** APPROVED --- # Reviewed — looks good Nothing blocks this change based on the inspected code; the described GPU wait is moved before the presentation lock while the read path retains its flush. ## What I ran Reviewed head `6afa8530c3a356d8967d9513d601f55c2d44097e` using the prepared review bundle and `repo_read.py`. No commands or tests were run by me; the test and platform results below are author supplied. ## Results | Check | Result | Note | |---|---|---| | Source review | passed | Core change and new test read | | Automated tests | not run | Reported results are author supplied | | Platform behavior | not verified | Windows test skips on reported drivers | ## Findings ### Blocking None. ### Non-blocking None. ## Not verified `VulkanDevice.cpp` was excluded from the review folder because it was too large; I read the changed function at the pinned head through the reader. The changed files reviewed were `VulkanDevice.hpp`, `Presentation.cpp`, `VulkanDevice.cpp` (changed function only), `PresentLockWait.cpp`, and `ENVIRONMENT.md`. No files were excluded by the review manifest's file rules. I did not read the remainder of `VulkanDevice.cpp` or run builds and tests. The supplied description reports Linux lavapipe and RADV test passes, and Windows test skips due to missing headless surface support; I did not independently verify those runs. A title exercising the guest-memory present path was not identified in the description. ## To get this to a good state Nothing is required. The reported Windows run on a driver with `VK_EXT_headless_surface` and a title using guest-memory presents remain optional validation points.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/7643:upstream-pr/7643'
git switch 'upstream-pr/7643'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/7643'
git switch 'upstream-pr/7643'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/7643'
git switch 'upstream-pr/7643'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/7643'
git switch 'main'
git merge --squash 'upstream-pr/7643'
git switch 'main'
git merge --ff-only 'upstream-pr/7643'
git switch 'main'
git merge 'upstream-pr/7643'
git push origin 'main'
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!7643
No description provided.