felixdoerre / primus_vk

Vulkan GPU-offloading layer
BSD 2-Clause "Simplified" License
230 stars 18 forks source link

Problems with understanding the installation instructions. #82

Closed adamryczkowski closed 3 years ago

adamryczkowski commented 3 years ago

The installation instructions seem to assume too much knowledge of the inner workings of how Vulkan is implemented. I managed to find the dependencies and build both files, but I had problems with how to install them. In particular,

Copy primus_vk.json to /usr/share/vulkan/implicit_layer.d and adjust the path.

Do you mean to make sure, that the /usr/share/vulkan/implicit_layer.d/ exists? (Fortunately, it does on Ubuntu 20.04). Or do you mean to set the "library_path": entry inside the json to point to the libprimus_vk.so? If so, why does the entry defaults to the libprimus_vk.so.1, and not to the libprimus_vk.so, which was built by the make?

1 Install the correct vulkan icds (i.e. intel/mesa, nvidia, amd, depending on your hardware).

After a fair bit of Googling I identified, that ICD stands for "Installable Client Driver", but that did not help me in understanding how does it relate to the installation of Intel/NVidia/Radeon GPU drivers. I also thought, that Mesa is just an implementation of OpenGL, and it applies to all graphic cards equally, not only to Intel's. How exactly should I understand the phrase "intel/mesa"? What exactly a user of e.g. NVidia discrete GPU should do to satisfy this point? Just install ubuntu-drivers --install/apt install nvidia-driver-455? Should I also install mesa-utils?

3 Ensure that the (unwrapped) nvidia driver is not registered (e.g. in /usr/share/vulkan/icd.d/nvidia_icd.json)

Do you mean by unregistering simply deleting that file? Or is there any special way to unregister it?

...and create a similar file nv_vulkan_wrapper.json where the path to the driver points to the compiled libnv_vulkan_wrapper.so.

The similar, I understand "using it as a template". Here are the contents of that file on Ubuntu 20.04:

{
    "file_format_version" : "1.0.0",
    "ICD": {
        "library_path": "libGLX_nvidia.so.0",
        "api_version" : "1.2.142"
    }
}

How to adjust the library_path entry is obvious. The question remains on how to adjust the api_version and possibly file_format_version. I simply left it unchanged, but it may not be what I ought to do.

Install primus_vk.json and adjust the path.

How do I install .json files? Do you mean, moving it to /usr/share/vulkan/implicit_layer.d/~/.local/share/vulkan/implicit_layer.d? I understand you refer to the same process as in the preamble to the "Installation" section.

Run ENABLE_PRIMUS_LAYER=1 optirun vulkan-smoketest. vulkan-smoketest is gone now, and I read it is unlikely it is comming back.

felixdoerre commented 3 years ago

Let's start with this issue and debug the concrete problems in #83 later. First of all: from ubuntu 20.10 on you should have a package primus-vk-nvidia which already brings everything preconfigured and should work out of the box.

Now to the concrete questions:

and adjust the path.

I believe I meant that you should adjust the library_path in the file. Having the json file point to libprimus_vk.so.1 is correct. This can be seen if you look at the install target. It installs primus_vk as libprimus_vk.so.1. Those shared-object versioning things are complicated.

1 Install the correct vulkan icds (i.e. intel/mesa, nvidia, amd, depending on your hardware).

You need to install vulkan drivers for both graphics devices. The "internal" and the "dedicated".

I also thought, that Mesa is just an implementation of OpenGL, and it applies to all graphic cards equally, not only to Intel's

No that's wrong. Mesa is an implementation of an OpenGL Interface and a Vulkan Interface. Mesa brings a software renderer, but also specific renderers/drivers for Intel integrated graphics and newer AMD graphics cards. Intel and AMD contributed changes to mesa for it to support their graphics devices better.

What exactly a user of e.g. NVidia discrete GPU should do to satisfy this point?

I guess this means that you have a "Intel integrated graphics" device to display on, and an Nvidia gpu to render on. This means you need to install the correct nvidia driver for your hardware (I assume that is the nvidia-driver-455 you suggested), and the mesa driver for the intel integrated graphics mesa-vulkan-drivers.

Do you mean by unregistering simply deleting that file? Or is there any special way to unregister it?

You can delete the file, however it might come back with updates and you would need to make sure it stays away. You could use "dpkg diversions" to move the file to a different location. Vulkan ignores files when the name does not end in .json. So you could simply rename it to nvidia_icd.json.disable or use dpkg-diversions to do so.

The question remains on how to adjust the api_version and possibly file_format_version. I simply left it unchanged, but it may not be what I ought to do.

That's exactly what you should do. The nv_vulkan_wrapper is a thin wrapper around the nvidia driver and exposes the same api version as the wrapped driver.

How do I install .json files? Do you mean, moving it to /usr/share/vulkan/implicit_layer.d/~/.local/share/vulkan/implicit_layer.d? I understand you refer to the same process as in the preamble to the "Installation" section.

Yes that's what I meant with "install".

vulkan-smoketest is gone now, and I read it is unlikely it is comming back.

That was just a dummy vulkan application at the time I wrote the readme. This was subsequently replaced with vkcube. I could adjust the readme, however there are also people trying to install primus_vk on older systems where there is only vulkan-smoketest. But yes, it would be good to mention vkcube.

adamryczkowski commented 3 years ago

If you allow, once I make the primus_vk run on my Dell 9500, I may send you PR with a "noob-friendly" instructions on how to install primus_vk which may benefit a whole lot of others, like me. At least until the primus_vk is backported to LTS Ubuntus.

felixdoerre commented 3 years ago

Of course, any improvement of the installation instructions is welcome, as long as it does not contain steps which are false for people on different operating systems.

adamryczkowski commented 3 years ago

Cool.