fix(agc): turn off dma-buf import on the NVIDIA proprietary driver #1380

Closed
overlordxrz-source wants to merge 1 commit from upstream-pr/1380 into main
overlordxrz-source commented 2026-10-08 01:14:24 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by overlordxrz-source on 2026-10-08T01:14:24Z.


What

Fixes #1289. Since #943, no Vulkan device can be created on the NVIDIA proprietary driver on Linux: the dma-buf write-protection probe that decideImportWatch runs at device setup fails at vkAllocateMemory with VK_ERROR_OUT_OF_DEVICE_MEMORY, and every later allocation on that device fails the same way (first visible as vkAllocateDescriptorSets color transfer: Vulkan result -2). The GPU tests then return 77 and are counted as skipped.

dma-buf import is now chosen by DmaBufImportUsable (GuestBufferMemory.cpp): it needs VK_KHR_external_memory_fd and VK_EXT_external_memory_dma_buf as before, and is off when VkPhysicalDeviceDriverProperties::driverID is VK_DRIVER_ID_NVIDIA_PROPRIETARY. The driver is read through VK_KHR_driver_properties (the instance is Vulkan 1.1, so the 1.2 core struct cannot be used without the extension); a driver without that extension is not checked. VulkanDevice and the recorder test device both use it, so neither the probe nor the shared direct memory imports from 815d2747 run on that driver. Host-pointer imports are unchanged. This is the first fix proposed in the issue.

The cause on the driver side is not known, so the gap is recorded in TechnicalDebt. NVK (VK_DRIVER_ID_MESA_NVK) and every other driver keep dma-buf import.

Tested

Not tested on an NVIDIA GPU or any GPU: I have no NVIDIA/Linux machine. The host is aarch64 Debian 13, where the project cannot be built.

  • GuestBufferMemory.cpp, VulkanDevice.cpp and tests/Recorder.cpp compile for x86_64-linux-gnu (Zig 0.16 clang, libstdc++ 14 headers, -Wall -Wextra); the only warnings on changed lines are the -Wmissing-field-initializers ones the surrounding Vulkan struct initialisers already produce.
  • DmaBufImportUsable was run on its own against a fake vkGetPhysicalDeviceProperties2: NVIDIA proprietary gives false; RADV, NVK and lavapipe give true; without VK_KHR_driver_properties it gives true and does not query; without VK_EXT_external_memory_dma_buf it gives false.
  • python3 tools/check_conventions.py --base origin/main passes.

It would help if someone with an NVIDIA GPU on Linux could confirm that the agc GPU tests run again (the issue reports 407/407 with APS5_WRITE_WATCH_IMPORTS=watch, which skips the same probe).

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4780441428 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1380). Originally posted by [overlordxrz-source](https://github.com/overlordxrz-source) on 2026-10-08T01:14:24Z. --- ### What Fixes #1289. Since #943, no Vulkan device can be created on the NVIDIA proprietary driver on Linux: the dma-buf write-protection probe that `decideImportWatch` runs at device setup fails at `vkAllocateMemory` with `VK_ERROR_OUT_OF_DEVICE_MEMORY`, and every later allocation on that device fails the same way (first visible as `vkAllocateDescriptorSets color transfer: Vulkan result -2`). The GPU tests then return 77 and are counted as skipped. dma-buf import is now chosen by `DmaBufImportUsable` (`GuestBufferMemory.cpp`): it needs `VK_KHR_external_memory_fd` and `VK_EXT_external_memory_dma_buf` as before, and is off when `VkPhysicalDeviceDriverProperties::driverID` is `VK_DRIVER_ID_NVIDIA_PROPRIETARY`. The driver is read through `VK_KHR_driver_properties` (the instance is Vulkan 1.1, so the 1.2 core struct cannot be used without the extension); a driver without that extension is not checked. `VulkanDevice` and the recorder test device both use it, so neither the probe nor the shared direct memory imports from 815d2747 run on that driver. Host-pointer imports are unchanged. This is the first fix proposed in the issue. The cause on the driver side is not known, so the gap is recorded in TechnicalDebt. NVK (`VK_DRIVER_ID_MESA_NVK`) and every other driver keep dma-buf import. ### Tested Not tested on an NVIDIA GPU or any GPU: I have no NVIDIA/Linux machine. The host is aarch64 Debian 13, where the project cannot be built. - `GuestBufferMemory.cpp`, `VulkanDevice.cpp` and `tests/Recorder.cpp` compile for x86_64-linux-gnu (Zig 0.16 clang, libstdc++ 14 headers, `-Wall -Wextra`); the only warnings on changed lines are the `-Wmissing-field-initializers` ones the surrounding Vulkan struct initialisers already produce. - `DmaBufImportUsable` was run on its own against a fake `vkGetPhysicalDeviceProperties2`: NVIDIA proprietary gives false; RADV, NVK and lavapipe give true; without `VK_KHR_driver_properties` it gives true and does not query; without `VK_EXT_external_memory_dma_buf` it gives false. - `python3 tools/check_conventions.py --base origin/main` passes. It would help if someone with an NVIDIA GPU on Linux could confirm that the agc GPU tests run again (the issue reports 407/407 with `APS5_WRITE_WATCH_IMPORTS=watch`, which skips the same probe). ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] AI-assisted: yes
hashaam1217 commented 2026-10-08 02:25:18 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by hashaam1217 on 2026-10-08T02:25:18Z.


Partial check on NVIDIA Linux: RTX 3060 Laptop, driver 595.91.07, merged onto df16c4c2.

  • DmaBufImportUsable returns false on the proprietary driver: the dma-buf probe no longer runs.
  • On Intel (Mesa ANV) the probe still runs.
  • The full suite passes 408/408 with nothing skipped.

This machine cannot reproduce #1289 itself: main also passes, because /dev/udmabuf is not accessible to this user and the probe fails at open. Details: https://github.com/boykopovar/AnyPS5/issues/1289#issuecomment-6050898411

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6050898727 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1380#issuecomment-6050898727). Originally posted by [hashaam1217](https://github.com/hashaam1217) on 2026-10-08T02:25:18Z. --- Partial check on NVIDIA Linux: RTX 3060 Laptop, driver 595.91.07, merged onto df16c4c2. - `DmaBufImportUsable` returns false on the proprietary driver: the dma-buf probe no longer runs. - On Intel (Mesa ANV) the probe still runs. - The full suite passes 408/408 with nothing skipped. This machine cannot reproduce #1289 itself: main also passes, because `/dev/udmabuf` is not accessible to this user and the probe fails at `open`. Details: https://github.com/boykopovar/AnyPS5/issues/1289#issuecomment-6050898411
oneandonlydean commented 2026-10-08 02:45:10 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-08T02:45:10Z.


Closing: #1329 makes the same change for #1289 (dma-buf import off for VK_DRIVER_ID_NVIDIA_PROPRIETARY, recorder device included), was opened first and was run on an NVIDIA GPU. If this one handles something #1329 doesn't, please comment on #1329 with what it misses.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6051112061 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1380#issuecomment-6051112061). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-08T02:45:10Z. --- Closing: #1329 makes the same change for #1289 (dma-buf import off for `VK_DRIVER_ID_NVIDIA_PROPRIETARY`, recorder device included), was opened first and was run on an NVIDIA GPU. If this one handles something #1329 doesn't, please comment on #1329 with what it misses.

Pull request closed

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!1380
No description provided.