Skip to content

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

Closed
overlordxrz-source wants to merge 1 commit into
boykopovar:mainfrom
overlordxrz-source:fix/agc-nvidia-dma-buf-import
Closed

overlordxrz-source wants to merge 1 commit into
boykopovar:mainfrom
overlordxrz-source:fix/agc-nvidia-dma-buf-import

Conversation

@overlordxrz-source

Copy link
Copy Markdown
Contributor

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 815d274 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

On the NVIDIA proprietary driver a dma-buf import of a udmabuf fails with VK_ERROR_OUT_OF_DEVICE_MEMORY and every later allocation on the device fails too, so since the import probe ran at device setup no device could be created there. Import dma-bufs only on drivers that are not VK_DRIVER_ID_NVIDIA_PROPRIETARY, in the device and in the recorder test device.

Fixes boykopovar#1289
@hashaam1217

Copy link
Copy Markdown
Contributor

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

  • 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: #1289 (comment)

@oneandonlydean

Copy link
Copy Markdown
Collaborator

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.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AGC: Vulkan device creation fails on the NVIDIA proprietary driver since #943 (dma-buf import probe)

3 participants