felixdoerre / primus_vk

Vulkan GPU-offloading layer
BSD 2-Clause "Simplified" License
229 stars 17 forks source link

No device for the display GPU found. Are the intel-mesa drivers installed? #34

Closed frank777777777 closed 5 years ago

frank777777777 commented 5 years ago

Hi, I am trying to set up DXVK in Lutris, but bumblebee does not support vulkan. I am excited to see this hack, but I can't get my head around the configuration.

I have hybrid nvidia laptop.

OS: Manjaro
DE: KDE Plasma
Graphic Card: 970m
CPU: 4710mq
Nvidia Driver: 418.56.0
Vulkan: 1.1.95
Intel Mesa Driver: 19.0.2

I have bumblebee installed through Manjaro mhwd.


My setup:

  1. Installed primus_vk through AUR.
  2. Installed Lutris 0.5.2.1, wine version tkg-protonified-4.6 + DXVK 1.0.3.
  3. Lutris wine runner system options:
    • Optimus Launcher: primus vk
    • Vulkan ICD loader: primus_vk_wrapper.json

Json files:

/usr/share/vulkan/icd.d/primus_vk_wrapper.json

{
    "file_format_version" : "1.0.0",
    "ICD": {
        "library_path": "libnv_vulkan_wrapper.so",
        "api_version" : "1.1.84"
    }
}

/usr/share/vulkan/implicit_layer.d/primus_vk.json

{
  "file_format_version" : "1.0.0",
  "layer" : {
    "name": "VK_LAYER_PRIMUS_PrimusVK",
    "type": "GLOBAL",
    "library_path": "libprimus_vk.so",
    "api_version": "1.1.0",
    "implementation_version": "1",
    "description": "Primus-vk - https://github.com/felixdoerre/primus_vk",
    "functions": {
      "vkGetInstanceProcAddr": "PrimusVK_GetInstanceProcAddr",
      "vkGetDeviceProcAddr": "PrimusVK_GetDeviceProcAddr"
    },
    "enable_environment": {
      "ENABLE_PRIMUS_LAYER": "1"
    },
    "disable_environment": {
      "DISABLE_PRIMUS_LAYER": "1"
    }
  }
}

What I got from launching Assassin's Creed Unity logs:

Running pvkrun /home/yyy/.local/share/lutris/runners/wine/tkg-4.6-x86_64/bin/wine /run/media/yyy/Games/games/Assassins Creed Unity/ACU.exe
info:  Game: ACU.exe
info:  DXVK: v1.0.3
warn:  OpenVR: Failed to locate module
info:  Enabled instance extensions:
info:    VK_KHR_get_physical_device_properties2
info:    VK_KHR_surface
info:    VK_KHR_win32_surface
PrimusVK: CreateInstance
PrimusVK: Getting devices
PrimusVK: Searching for display GPU:
PrimusVK: 0x7dba84c0: 
PrimusVK: Searching for render GPU:
PrimusVK: 0x7dba84c0: 
PrimusVK: Got discrete gpu!
PrimusVK: Device: GeForce GTX 970M
PrimusVK:   Type: 2
PrimusVK: No device for the display GPU found. Are the intel-mesa drivers installed?
err:   DxvkInstance::createInstance: Failed to create Vulkan instance
Waiting on children
All children gone
Exit with returncode 5

Am I missing anything? No device for the display GPU found? If I change Vulkan ICD loader to intel_icd.x86_64.json, then

No device for the rendering GPU found.


Running pvkrun /home/yyy/.local/share/lutris/runners/wine/tkg-4.6-x86_64/bin/wine /run/media/yyy/Games/games/Assassins Creed Unity/ACU.exe
info:  Game: ACU.exe
info:  DXVK: v1.0.3
warn:  OpenVR: Failed to locate module
info:  Enabled instance extensions:
info:    VK_KHR_get_physical_device_properties2
info:    VK_KHR_surface
info:    VK_KHR_win32_surface
PrimusVK: CreateInstance
PrimusVK: Getting devices
INTEL-MESA: warning: Haswell Vulkan support is incomplete
PrimusVK: Searching for display GPU:
PrimusVK: 0x7db73f10: 
PrimusVK: Got integrated gpu!
PrimusVK: Device: Intel(R) Haswell Mobile
PrimusVK:   Type: 1
PrimusVK: Searching for render GPU:
PrimusVK: 0x7db73f10: 
PrimusVK: No device for the rendering GPU found. Is the correct driver installed?
err:   DxvkInstance::createInstance: Failed to create Vulkan instance
Waiting on children
All children gone
Exit with returncode 5
frank777777777 commented 5 years ago

I found a temporary fix.

The important thing is that intel icd's are listed in VK_ICD_FILENAME and that primus-vk-wrapper.json comes before nvidia_icd.json in the list.

felixdoerre commented 5 years ago

The alternative is to remove nvidia.json completely from /usr/share/vulkan/icd.d. The diver will not start without the wrapper so it is of no use. But that's difficult to do in a regular package.

I would not recommend selecting the device drivers manually and setting VK_ICD_FILENAMES, as I already discussed here: https://github.com/felixdoerre/primus_vk/issues/33#issuecomment-484139009

The Problem is, if the "old" nvidia.json loads before the "wrapped", then the nvidia-driver library detects that there is no nvidia GPU available, as DISPLAY does not point to the secondary bumblebee X server, but to :0. And as the driver has now decided it won't start at all, the wrapper cant trick it into loading properly.

Just out of interest, how did you get PrimusVK: No device for the display GPU found. Are the intel-mesa drivers installed?? Did you configure Lutris to set VK_ICD_FILENAMES to the wrapped icd? https://github.com/lutris/lutris/blob/121a735341bcf94dc719f17663961096f7a5a787/lutris/game.py#L413 Theoretically, you would need to have both the "wrapped nvidia" and intel_icd.x86_64.json configured in vk_icd (separated by :, order should not matter), however Lutris checks that this file exists and will no apply such a setting. So here are my 2 recommendation:

So my recommendation would be to chose one of these: a) Configure Lutris to not mess with VK_ICD_FILENAMES (and if that does not work additionally delete nvidia.json, which I have done on my system) b) Patch Lutris to not validate vk_icd is a file here: https://github.com/lutris/lutris/blob/121a735341bcf94dc719f17663961096f7a5a787/lutris/game.py#L412 (or check that all or at least one path in the :-separated list point to existing files). Configure Lutris' vk_icd to be /usr/share/vulkan/icd.d/primus_vk_wrapper.json:/usr/share/vulkan/icd.d/intel_icd.x86_64.json.

frank777777777 commented 5 years ago

Just out of interest, how did you get PrimusVK: No device for the display GPU found. Are the intel-mesa drivers installed??

Yes, intel-mesa driver is installed, I guess if lutris loads nvidia.json so it does not detect intel driver.

Than you for recommendation. Finally I got it working. To be able to let Lutris to launch it with the correct ICD loader, here is what I did.

  1. I backed up /usr/share/vulkan/icd.d/nvidia_icd.json, and pointed nvidia_icd.json to libGLX_nvidia.so.0. I think remove it would do the trick too.
  2. In Lutris, I set Vulkan ICD loader to None, Optimus launcher to primus vk.
cosmincrihan commented 5 years ago

Solution for this, on Debian-based systems though: sudo apt install mesa-vulkan-drivers:amd64

Arucard1983 commented 5 years ago

On my system (Debian 9) with NVidia drivers installed from backports repositiry (418), I just needed to copy the json files to the system directories. The libnv_vulkan_wrapper.so are placed on /usr/lib/x86_64-linux-gnu/nvidia/ and libprimus_vk.so on /usr/lib/x86_64-linux-gnu/ ? Without changing other ICD's, this wrapper works perfectly. Also the pvkrun binary makes more easy on Steam, since it will only need to use such command to use Vulkan games with NVidia.

felixdoerre commented 5 years ago

I've added a print in master to display VK_ICD_FILENAME when the devices cannot be found to finde this configuration problem more easily in the future. As everything seems to work now, I close this issue.

wushangwei commented 4 years ago

The alternative is to remove nvidia.json completely from /usr/share/vulkan/icd.d. The diver will not start without the wrapper so it is of no use. But that's difficult to do in a regular package.

I would not recommend selecting the device drivers manually and setting VK_ICD_FILENAMES, as I already discussed here: #33 (comment)

The Problem is, if the "old" nvidia.json loads before the "wrapped", then the nvidia-driver library detects that there is no nvidia GPU available, as DISPLAY does not point to the secondary bumblebee X server, but to :0. And as the driver has now decided it won't start at all, the wrapper cant trick it into loading properly.

Just out of interest, how did you get PrimusVK: No device for the display GPU found. Are the intel-mesa drivers installed?? Did you configure Lutris to set VK_ICD_FILENAMES to the wrapped icd? https://github.com/lutris/lutris/blob/121a735341bcf94dc719f17663961096f7a5a787/lutris/game.py#L413 Theoretically, you would need to have both the "wrapped nvidia" and intel_icd.x86_64.json configured in vk_icd (separated by :, order should not matter), however Lutris checks that this file exists and will no apply such a setting. So here are my 2 recommendation:

So my recommendation would be to chose one of these: a) Configure Lutris to not mess with VK_ICD_FILENAMES (and if that does not work additionally delete nvidia.json, which I have done on my system) b) Patch Lutris to not validate vk_icd is a file here: https://github.com/lutris/lutris/blob/121a735341bcf94dc719f17663961096f7a5a787/lutris/game.py#L412 (or check that all or at least one path in the :-separated list point to existing files). Configure Lutris' vk_icd to be /usr/share/vulkan/icd.d/primus_vk_wrapper.json:/usr/share/vulkan/icd.d/intel_icd.x86_64.json.

Thanks for you solution and it saved my day! Now it's 2020 and the primus_vk_wrapper.json has now been renamed to nv_vulkan_wrapper.json in my nvidia setup. In my situation, the nvidia_icd.json shows before nv_vulkan_wrapper.json in lutris. So I manually edited "vk_icd" in the corresponding config file (.yml) at ~/.config/lutris/games/ as @felixdoerre suggested:

/usr/share/vulkan/icd.d/nv_vulkan_wrapper.json:/usr/share/vulkan/icd.d/intel_icd.x86_64.json

And the game runs successfully.