Skip to content

fix(agc): keep presenting after a SUBOPTIMAL present - #9881

Merged
oneandonlydean merged 2 commits into
boykopovar:mainfrom
mazen320:fix/present-suboptimal-keep-extent
Nov 2, 2026
Merged

oneandonlydean merged 2 commits into
boykopovar:mainfrom
mazen320:fix/present-suboptimal-keep-extent

Conversation

@mazen320

@mazen320 mazen320 commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

What

Keep presenting when vkQueuePresentKHR returns VK_SUBOPTIMAL_KHR instead of zeroing the swapchain extent. Window drag often reports suboptimal without a size change; clearing the extent made Presentable() false until Resize and dropped frames (flicker). OUT_OF_DATE still clears the extent, matching AcquireImage.

Tested

  • python tools/check_conventions.py --base upstream/main
  • Rebased onto current main; tip 5517fc49a5. Manual window-drag/resize evidence withdrawn by review (source review + short gate suffice).
  • Additional: @babyhuey Windows selected suite on tip 5517fc49a5 merged onto main 710cf9c0352 (RTX 3080): 798 pass / 3 fail / 689 skip; the 3 fails also fail on that main tip alone (pr_overlap_encoding, agc_host_import_cut_lifetime agc_host_import_cut_lifetime fails on Windows since the merge of #9159 #10746, windows_trace_imports Defender FP). No failures from this PR.

Checklist

  • Depends on: none
  • Fixes: window-drag present flicker from SUBOPTIMAL zeroing extent
  • Unblocks: none
  • Silent stubs: none
  • GPUs tested: NVIDIA GeForce RTX 3080 (babyhuey Windows selected suite on tip 5517fc4)
  • AI-assisted: yes

@MarcZX10

Copy link
Copy Markdown
Contributor

The two-line change matches the distinction between VK_SUBOPTIMAL_KHR (presentation succeeded with a suboptimal swapchain) and VK_ERROR_OUT_OF_DATE_KHR (extent must be rebuilt). The code path now leaves the existing extent intact for SUBOPTIMAL and still clears it for OUT_OF_DATE. Hosted conventions, eligibility, intake, labels, and report pass; all product jobs are skipped. The manual window-drag check is explicitly still pending, and I did not run it locally. Please add that result when available, including whether repeated drag/resize transitions recover without flicker.

@github-actions

github-actions Bot commented Oct 22, 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 1395 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 4040 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 4472 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 5021 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 5925 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 6188 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 6977 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 7275 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 7369 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 7449 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 7464 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 7642 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 8004 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 9356 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 9387 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 9432 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 9489 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 10069 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 10442 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 10547 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 11351 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 11483 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 12120 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 12828 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 13148 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp

@mazen320

Copy link
Copy Markdown
Contributor Author

Overlap with #9670 is the same QueuePresent hunk, not the same fix: that PR still zeroes the extent on VK_SUBOPTIMAL_KHR while moving present onto a separate queue. This PR only keeps presenting on SUBOPTIMAL (OUT_OF_DATE still clears). Whichever merges second will need a trivial rebase of that hunk; Depends on does not apply.

@mazen320
mazen320 force-pushed the fix/present-suboptimal-keep-extent branch from 92acab7 to 254b3d3 Compare October 23, 2026 20:05
@oneandonlydean oneandonlydean self-assigned this Oct 23, 2026
@oneandonlydean

Copy link
Copy Markdown
Collaborator

@mazen320 Could you add the requested repeated window-drag/resize results for the VulkanDevice.cpp:3748–3750 change? Please include OS, GPU, driver, exact head, and matched baseline/change observations showing presentation retained on SUBOPTIMAL and recovery after OUT_OF_DATE. The description still says manual validation is pending.

@mazen320
mazen320 force-pushed the fix/present-suboptimal-keep-extent branch from 254b3d3 to e6c9022 Compare October 25, 2026 09:35
@mazen320
mazen320 force-pushed the fix/present-suboptimal-keep-extent branch from d295ac3 to 5517fc4 Compare October 25, 2026 19:55
@mazen320

Copy link
Copy Markdown
Contributor Author

@oneandonlydean Rebased onto current main; tip 5517fc49a5. Gathering the matched baseline/change window-drag/resize results next (OS/GPU/driver/head) and will update ### Tested + reply here.

@oneandonlydean

Copy link
Copy Markdown
Collaborator

@mazen320 Thanks for the rebase. You don't need to gather the window-drag/resize results: we've withdrawn that request. The change is two lines, it already has source review and our short gate passed, so it goes ahead on CI for the rebased head 5517fc4. Sorry we didn't say so sooner.

@mazen320

Copy link
Copy Markdown
Contributor Author

@oneandonlydean Understood — stopping the local drag/resize run. Updated ### Tested to drop the pending manual check; tip remains 5517fc49a5 for CI.

@babyhuey

Copy link
Copy Markdown
Contributor

Windows run of this head 5517fc49a5e, merged onto main 710cf9c0352 (clean merge, local only), with the selection CI's skipped Windows product job uses: Windows 11, Ryzen 7 5800X, RTX 3080, WinLibs GCC 15.2, Release, BUILD_TESTING=ON. The tree was configured fresh after the merge, then select_tests.py select / ninja -f select.ninja selected / --target libs / select_tests.py ctest --parallel 4 --timeout 120, with check_skips.py --job windows.

AI-assisted: yes (Claude Code)

@mazen320

Copy link
Copy Markdown
Contributor Author

@babyhuey Thanks for the Windows selected-suite run on tip 5517fc49a5 (merged onto 710cf9c0352). Noted the three fails are pre-existing on that main tip / Defender FP, with no failures from this change. Updated ### Tested and GPUs tested.

@mazen320
mazen320 force-pushed the fix/present-suboptimal-keep-extent branch from 5517fc4 to a4fd179 Compare October 27, 2026 08:19
@mazen320

Copy link
Copy Markdown
Contributor Author

Rebased onto current upstream/main (2ab073a1e7) after main moved; conventions pass.

@mazen320

Copy link
Copy Markdown
Contributor Author

Rebased onto current upstream/main (f52d0373ea).

@mazen320
mazen320 force-pushed the fix/present-suboptimal-keep-extent branch from a4fd179 to 5a65acc Compare October 27, 2026 08:27
@mazen320

Copy link
Copy Markdown
Contributor Author

Rebased onto current upstream/main (3fea2a937b) after a VulkanDevice.cpp conflict with main.

@mazen320
mazen320 force-pushed the fix/present-suboptimal-keep-extent branch from 5a65acc to 662b6e9 Compare October 27, 2026 10:05
Dragging the window often returns VK_SUBOPTIMAL_KHR without a size
change. Zeroing the swapchain extent made Presentable() false until a
real Resize, which dropped frames and looked like flicker. Match
AcquireImage: only OUT_OF_DATE clears the extent.
@mazen320
mazen320 force-pushed the fix/present-suboptimal-keep-extent branch from 662b6e9 to 7fbe493 Compare October 27, 2026 11:07
@TechLevelZero

TechLevelZero commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

✅ NVIDIA GPU test: passed

PR head 7fbe493 merged onto main 828ac0b · tested 2026-10-31 12:13 UTC · 26 min

GPU NVIDIA RTX 2000 Ada Generation, driver 595.99.02, Vulkan 1.4.329
Host Ubuntu 26.04.1 LTS, kernel 7.0.0-38-generic, container ubuntu:24.04
Logs build and test logs for this run
Build ✅ passed (Release, -DANYPS5_ENABLE_SPIRV_TOOLS=ON)
Tests ✅ 2,321 passed · 4 failed (0 new, 2 also fail on main, 2 unstable on main) · 41 skipped (ANYPS5_REQUIRE_VULKAN=1)
Test setup CPU-only tests without a GPU; GPU tests (and any CPU-only test that failed or skipped without one) once on the GPU with VK_LAYER_KHRONOS_validation and ANYPS5_NO_SHADER_CACHE=1; main ran the same way
Test selection 2,366 of 3,048 tests run: the ones this change can reach, chosen by tools/select_tests.py from main's build graph
Vulkan validation ✅ no new validation IDs vs main (866 tests run on the GPU)
Slow tests (>30 s, GPU tests timed with validation layers) ⚠️ agc_driver_graphics 31.2 s, ⚠️ agc_driver_graphics_maps_fallback 31.0 s
Unstable on main (2, these also failed in recent main runs on this machine; not counted against this PR)
agc_submit_progress: failed in 6 of the last 10 main runs
agc_submit_progress_no_timeline: failed in 8 of the last 10 main runs
Failing on main too (2, not counted against this PR)
guest_mmap_executable
guest_socket_options_multicast
Passed on retry (1, failed in the parallel run, passed when re-run with a 360 s timeout; not counted against this PR)
agc_driver_job_manager_compute_capacity: Failed in the parallel run; also passed only on retry in 171 other runs in the last 7 days
Validation IDs already present on main (3 IDs in 384 tests)
VUID-VkDeviceCreateInfo-pNext-pNext (384 tests): agc_compute_pipeline_replay, agc_driver, agc_driver_address_passes, agc_driver_address_passes_draw_transitions, agc_driver_address_passes_targets_split, agc_driver_alias_copy_label, agc_driver_alpha_to_coverage, agc_driver_array_layer_target, and 376 more
VUID-vkCmdCopyImage-srcImage-01548 (12 tests): agc_driver_depth_clear_hle, agc_driver_depth_plane_buffer_memory, agc_driver_depth_plane_cpu_write_after_memo, agc_driver_depth_plane_cpu_write_after_page_unwatch, agc_driver_depth_plane_cpu_write_after_partial_unwatch, agc_driver_depth_plane_partial_store, agc_driver_depth_plane_partial_store_unimported, agc_driver_depth_plane_sampling, and 4 more
VUID-vkCmdCopyImage-srcImage-01551 (12 tests): agc_driver_depth_clear_hle, agc_driver_depth_plane_buffer_memory, agc_driver_depth_plane_cpu_write_after_memo, agc_driver_depth_plane_cpu_write_after_page_unwatch, agc_driver_depth_plane_cpu_write_after_partial_unwatch, agc_driver_depth_plane_partial_store, agc_driver_depth_plane_partial_store_unimported, agc_driver_depth_plane_sampling, and 4 more
Skipped (41)
agc_driver_bda_reads_shadowed_results: skipped, the device reports watched host memory written when it imports or reads it
agc_driver_bda_reads_shadowed_results_per_build: skipped, the device reports watched host memory written when it imports or reads it
agc_driver_msaa_dcc_compared_import_2: skipped, the device reports host imports that keep write protection, so the write-watch probe compares none of them
agc_driver_msaa_dcc_compared_import_4: skipped, the device reports host imports that keep write protection, so the write-watch probe compares none of them
agc_driver_msaa_dcc_compared_import_8: skipped, the device reports host imports that keep write protection, so the write-watch probe compares none of them
agc_driver_sample_order_grid_reference: skipped, the device does not keep depth drawn at custom sample locations at those locations, even after a transition that names them: the composite of uniform renders holds the guest's depth in 0 of 3005 sloped samples, so no path can be compared with it bit for bit
agc_driver_stencil_ref_export: skipped, the device lacks VK_EXT_shader_stencil_export
agc_driver_vertex_elected_atomic_max: skipped, the device runs vertex programs in subgroups, so they keep their cross-lane reductions
agc_host_import_sparse: skipped, host imports are unavailable: /dev/udmabuf is not accessible
agc_import_settle_initial_dcc: skipped, the device has no deferred settle of host imports: imports under 1 MiB wait for one only on Windows
agc_unit_shadow_completion_store: skipped, the device reports watched host memory written when it imports or reads it
guest_http_uri_locale: 
guest_net_ctl: skipped, the host has no IPv4 address
guest_video_out_color_space: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_hdr: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_high_frame_rate: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_output_mode: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_resolution_status: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_wqhd_detection: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
video_out_flip_controls: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_cpuflip: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_cpuflip_in_order: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_eop: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_eop_aftergpu: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_eop_main: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_fresh: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_labels: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is eithe
Reproduce
git fetch origin 7fbe493b5320389b155ddc68175ed3c5bc882ecb 828ac0b2ae74aac181ba128fb59b08a1534f2041
git checkout 828ac0b2ae74aac181ba128fb59b08a1534f2041 && git merge --no-ff 7fbe493b5320389b155ddc68175ed3c5bc882ecb
git submodule update --init --recursive
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -DANYPS5_ENABLE_SPIRV_TOOLS=ON
cmake --build build && cmake --build build --target libs
VK_DRIVER_FILES=/nonexistent/icd.json ctest --test-dir build -E '^(agc|shader|recompiler|videoout|video_out|guest_video_out|vulkan)|gpu' --timeout 120 --parallel 32 --output-on-failure
ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation \
  ctest --test-dir build -R '^(agc|shader|recompiler|videoout|video_out|guest_video_out|vulkan)|gpu' --timeout 120 --parallel 4 --output-on-failure
# failures are then re-run alone: --timeout 360 --parallel 2; new validation IDs: the test alone, twice, --parallel 1

Automated build and test on a contributor's NVIDIA machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs.

@oneandonlydean
oneandonlydean merged commit 55b0e90 into boykopovar:main Nov 2, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants