test(agc): present the FSR test only on a driver with its own headless surface #17179

Merged
GiannisG1 merged 1 commit from upstream-pr/17179 into main 2026-11-12 23:23:22 +00:00
GiannisG1 commented 2026-11-08 14:05:15 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by GiannisG1 on 2026-11-08T14:05:15Z.


What

agc_driver_present_upscale presents through a VK_EXT_headless_surface window, and it skips when the Vulkan instance doesn't offer that extension (#17065 worded that skip as a device limitation). The extension is an instance extension, though: when Mesa's drivers are installed next to NVIDIA's, the instance offers it, while NVIDIA's driver doesn't implement it. VulkanDevice then asks every candidate for surface support, and the NVIDIA device is asked about a surface its driver never created. Here (GTX 1050 Ti, 580.178.04, with Mesa 25.2.8 ANV and llvmpipe), on main 105c9e4d91:

  • With Ubuntu 24.04's loader (1.3.275), the test segfaults inside the first vkGetPhysicalDeviceSurfaceSupportKHR call, in libnvidia-glcore.so.580.178.04 (gdb). That happens with ANYPS5_GPU naming the GTX and also with it unset. Loaders before Vulkan-Loader 322d6340a2 ("Lazily allocate ICD surface objects") pass the loader's own surface object to a driver that has no vkCreateHeadlessSurfaceEXT.
  • With Vulkan-Loader 1.4.313 built from source, the call returns VK_ERROR_EXTENSION_NOT_PRESENT, and the constructor throws vkGetPhysicalDeviceSurfaceSupportKHR: Vulkan result -7.

This PR follows EagleBearerYS' suggestion in https://github.com/boykopovar/AnyPS5/pull/17065#issuecomment-6722281817 (my analysis: https://github.com/boykopovar/AnyPS5/pull/17065#issuecomment-6721542332). Before the first VulkanDevice, the test reads each Vulkan 1.2 device's driver ID:

  • With ANYPS5_GPU unset, it sets ANYPS5_GPU to the name of the best-ranked device whose driver implements the extension, ranked the way VulkanDevice ranks candidates. VulkanDevice drops a candidate whose name doesn't match ANYPS5_GPU before it asks for surface support, so no other driver is asked.
  • It skips with the existing line (skipped, the device lacks VK_EXT_headless_surface) when no device qualifies, or when ANYPS5_GPU names a device whose driver isn't on the list.

The list covers drivers that report the extension by themselves. Here I called vkEnumerateInstanceExtensionProperties with VK_DRIVER_FILES set to one ICD at a time: Mesa 25.2.8's intel and intel_hasvk (INTEL_OPEN_SOURCE_MESA), radeon (MESA_RADV), lvp (MESA_LLVMPIPE), nouveau (MESA_NVK), virtio (MESA_VENUS) and asahi (MESA_HONEYKRISP) report it; nvidia and gfxstream don't. MoltenVK's runtime user guide lists it among its extensions, so MOLTENVK is on the list too. A driver that isn't on the list gets the skip instead of the crash, and adding one is one case line. Only the test changes.

Tested

Linux Mint 22.3, kernel 7.0.0-38, GCC 13.3.0, Release, BUILD_TESTING=ON, on main 105c9e4d91 (it merges cleanly with main 1086833f9a; nothing since touches the file). The PR changes only this test's source, so every other test binary is the same as main's.

ctest -R '^agc_driver_present_upscale$' -V under Xvfb, 3 runs per device, tools/check_skips.py on each JUnit file:

ANYPS5_GPU main this PR
GTX 1050 (NVIDIA 580.178.04) SegFault 3/3 skipped 3/3 with the line above; check_skips.py exit 0
HD Graphics 630 (Mesa 25.2.8 ANV) passed passed 3/3
llvmpipe (Mesa 25.2.8) passed passed 3/3

The test binary run directly in other setups:

Setup main this PR
ANYPS5_GPU unset, all ICDs segfault (exit 139) passed on the HD 630 (Physical device selected is the HD 630)
ANYPS5_GPU=NVIDIA segfault (exit 139) skipped
ANYPS5_GPU=intel passed passed on the HD 630
ANYPS5_GPU unset, Vulkan-Loader 1.4.313 exit 1: vkGetPhysicalDeviceSurfaceSupportKHR: Vulkan result -7 passed on the HD 630
ANYPS5_GPU=GTX 1050, Vulkan-Loader 1.4.313 exit 1, the same skipped
VK_DRIVER_FILES = NVIDIA's ICD only, ANYPS5_GPU unset or the GTX skipped (no extension in the instance) skipped, same line
VK_DRIVER_FILES = llvmpipe's ICD only, ANYPS5_GPU unset passed passed on llvmpipe
VK_LOADER_DRIVERS_DISABLE=*nvidia*, ANYPS5_GPU unset passed passed on the HD 630

With VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation (layers 1.3.275), ANYPS5_REQUIRE_VULKAN=1, ctest -V, on the HD 630 and llvmpipe: no was not found but was requested by env var VK_INSTANCE_LAYERS. VUIDs are the same on main and this PR: none on the HD 630, and on llvmpipe 21 mentions of VUID-VkDeviceCreateInfo-pNext-pNext.

The 264 source-scanning tests (conventions_*, public_headers*, check_*, tools_*) pass. check_conventions.py, check_test_registration.py, check_main_sync.py (merges cleanly) and check_compile.py --build build (1 translation unit) are clean. tools/pr_overlap.py --branch: no overlap with open pull requests.

Doorriiaann ran it on an NVIDIA RTX 3070 (610.57.04, Debian 13, loader 1.4.309, Mesa 25.0.7 llvmpipe installed beside it), 5 runs per row. With ANYPS5_GPU=NVIDIA and with it unset, main segfaults and this PR skips or passes (selecting llvmpipe); there are no VUIDs on either side: https://github.com/boykopovar/AnyPS5/pull/17179#issuecomment-6727066506

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: none
  • GPUs tested: Intel HD Graphics 630 (Mesa 25.2.8 ANV), NVIDIA GeForce GTX 1050 Ti (580.178.04), llvmpipe (Mesa 25.2.8); Linux Mint 22.3, kernel 7.0.0-38
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5211964438 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/17179). Originally posted by [GiannisG1](https://github.com/GiannisG1) on 2026-11-08T14:05:15Z. --- ### What `agc_driver_present_upscale` presents through a `VK_EXT_headless_surface` window, and it skips when the Vulkan instance doesn't offer that extension (#17065 worded that skip as a device limitation). The extension is an instance extension, though: when Mesa's drivers are installed next to NVIDIA's, the instance offers it, while NVIDIA's driver doesn't implement it. `VulkanDevice` then asks every candidate for surface support, and the NVIDIA device is asked about a surface its driver never created. Here (GTX 1050 Ti, 580.178.04, with Mesa 25.2.8 ANV and llvmpipe), on `main` `105c9e4d91`: - With Ubuntu 24.04's loader (1.3.275), the test segfaults inside the first `vkGetPhysicalDeviceSurfaceSupportKHR` call, in `libnvidia-glcore.so.580.178.04` (gdb). That happens with `ANYPS5_GPU` naming the GTX and also with it unset. Loaders before Vulkan-Loader 322d6340a2 ("Lazily allocate ICD surface objects") pass the loader's own surface object to a driver that has no `vkCreateHeadlessSurfaceEXT`. - With Vulkan-Loader 1.4.313 built from source, the call returns `VK_ERROR_EXTENSION_NOT_PRESENT`, and the constructor throws `vkGetPhysicalDeviceSurfaceSupportKHR: Vulkan result -7`. This PR follows EagleBearerYS' suggestion in https://github.com/boykopovar/AnyPS5/pull/17065#issuecomment-6722281817 (my analysis: https://github.com/boykopovar/AnyPS5/pull/17065#issuecomment-6721542332). Before the first `VulkanDevice`, the test reads each Vulkan 1.2 device's driver ID: - With `ANYPS5_GPU` unset, it sets `ANYPS5_GPU` to the name of the best-ranked device whose driver implements the extension, ranked the way `VulkanDevice` ranks candidates. `VulkanDevice` drops a candidate whose name doesn't match `ANYPS5_GPU` before it asks for surface support, so no other driver is asked. - It skips with the existing line (`skipped, the device lacks VK_EXT_headless_surface`) when no device qualifies, or when `ANYPS5_GPU` names a device whose driver isn't on the list. The list covers drivers that report the extension by themselves. Here I called `vkEnumerateInstanceExtensionProperties` with `VK_DRIVER_FILES` set to one ICD at a time: Mesa 25.2.8's `intel` and `intel_hasvk` (`INTEL_OPEN_SOURCE_MESA`), `radeon` (`MESA_RADV`), `lvp` (`MESA_LLVMPIPE`), `nouveau` (`MESA_NVK`), `virtio` (`MESA_VENUS`) and `asahi` (`MESA_HONEYKRISP`) report it; `nvidia` and `gfxstream` don't. MoltenVK's runtime user guide lists it among its extensions, so `MOLTENVK` is on the list too. A driver that isn't on the list gets the skip instead of the crash, and adding one is one `case` line. Only the test changes. ### Tested Linux Mint 22.3, kernel 7.0.0-38, GCC 13.3.0, Release, `BUILD_TESTING=ON`, on `main` `105c9e4d91` (it merges cleanly with `main` `1086833f9a`; nothing since touches the file). The PR changes only this test's source, so every other test binary is the same as `main`'s. `ctest -R '^agc_driver_present_upscale$' -V` under Xvfb, 3 runs per device, `tools/check_skips.py` on each JUnit file: | `ANYPS5_GPU` | `main` | this PR | |---|---|---| | `GTX 1050` (NVIDIA 580.178.04) | `SegFault` 3/3 | skipped 3/3 with the line above; `check_skips.py` exit 0 | | `HD Graphics 630` (Mesa 25.2.8 ANV) | passed | passed 3/3 | | `llvmpipe` (Mesa 25.2.8) | passed | passed 3/3 | The test binary run directly in other setups: | Setup | `main` | this PR | |---|---|---| | `ANYPS5_GPU` unset, all ICDs | segfault (exit 139) | passed on the HD 630 (`Physical device selected` is the HD 630) | | `ANYPS5_GPU=NVIDIA` | segfault (exit 139) | skipped | | `ANYPS5_GPU=intel` | passed | passed on the HD 630 | | `ANYPS5_GPU` unset, Vulkan-Loader 1.4.313 | exit 1: `vkGetPhysicalDeviceSurfaceSupportKHR: Vulkan result -7` | passed on the HD 630 | | `ANYPS5_GPU=GTX 1050`, Vulkan-Loader 1.4.313 | exit 1, the same | skipped | | `VK_DRIVER_FILES` = NVIDIA's ICD only, `ANYPS5_GPU` unset or the GTX | skipped (no extension in the instance) | skipped, same line | | `VK_DRIVER_FILES` = llvmpipe's ICD only, `ANYPS5_GPU` unset | passed | passed on llvmpipe | | `VK_LOADER_DRIVERS_DISABLE=*nvidia*`, `ANYPS5_GPU` unset | passed | passed on the HD 630 | With `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation` (layers 1.3.275), `ANYPS5_REQUIRE_VULKAN=1`, `ctest -V`, on the HD 630 and llvmpipe: no `was not found but was requested by env var VK_INSTANCE_LAYERS`. VUIDs are the same on `main` and this PR: none on the HD 630, and on llvmpipe 21 mentions of `VUID-VkDeviceCreateInfo-pNext-pNext`. The 264 source-scanning tests (`conventions_*`, `public_headers*`, `check_*`, `tools_*`) pass. `check_conventions.py`, `check_test_registration.py`, `check_main_sync.py` (merges cleanly) and `check_compile.py --build build` (1 translation unit) are clean. `tools/pr_overlap.py --branch`: no overlap with open pull requests. Doorriiaann ran it on an NVIDIA RTX 3070 (610.57.04, Debian 13, loader 1.4.309, Mesa 25.0.7 llvmpipe installed beside it), 5 runs per row. With `ANYPS5_GPU=NVIDIA` and with it unset, `main` segfaults and this PR skips or passes (selecting llvmpipe); there are no VUIDs on either side: https://github.com/boykopovar/AnyPS5/pull/17179#issuecomment-6727066506 ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [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 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 - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: Intel HD Graphics 630 (Mesa 25.2.8 ANV), NVIDIA GeForce GTX 1050 Ti (580.178.04), llvmpipe (Mesa 25.2.8); Linux Mint 22.3, kernel 7.0.0-38 - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
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!17179
No description provided.