Yours3lf / rpi-vk-driver

VK driver for the Raspberry Pi (Broadcom Videocore IV)
MIT License
1.23k stars 70 forks source link

How to install on 64-bit #6

Open Joseph-Azzam opened 4 years ago

Joseph-Azzam commented 4 years ago

Hi, I'm a bit stuck and would appreciate your help. I don't have experience installing drivers for Linux, not sure if I'm missing something. I followed the steps in Build.MD:

How to compile on a Raspberry Pi Clone RPi VK Driver git clone https://github.com/Yours3lf/rpi-vk-driver.git cd rpi-vk-driver mkdir build cd build

Run CMake cmake .. -DCMAKE_BUILD_TYPE=Release

Build project cmake --build . --target all

I executed them successfully, except for "_cmake --build . --target all" had a couple of error compiling armv6. I get stuck on run Install.sh install.sh is missing the "librpi-vk-driver.so" not sure if it's important but either way the driver does not install.

I am using Raspberi Pi OS Beta to run a AArch64 Vulkan app. Thank you in advance

Yours3lf commented 4 years ago

Hey,

the master branch is very much in development, it might not always build. I fixed it now, so please try again. You need the cmake build step to finish successfully so you can install the driver SO file (librpi-vk-driver.so) to the right place.

cheers

darkdragon-001 commented 4 years ago

For the release v1.0, use

git clone -b v1.0 https://github.com/Yours3lf/rpi-vk-driver.git
Joseph-Azzam commented 4 years ago

I am working on a raspberry pi 3b+, with raspberry pi OS 64bit Arch64 beta. I downloaded the latest master and release v1 versions, and still encountered compile errors. I commented in makelist.txt the armv6 architecture line, and uncommented armv8a. I also added set(CMAKE_CXX_FLAGS "=fpermissive"). Compile required .so libraries that are included in the project but where skipped because they are incompatible, so I manually downloaded the equivalent one using apt-get "missing-library-name-dev". I included math.h in a certain library that complained about using log2. That fixed most of the errors, but the main error I could not fix was, which came up in multiple files: error: cannot convert ‘VkImageView’ {aka ‘VkImageView_T’} to ‘VkImage’ {aka ‘VkImage_T’} in assignment imageMemoryBarrier.image = depthImageView;

Am I missing something?

Yours3lf commented 4 years ago

It compiles fine on the latest release of raspberry pi os, have you tried that?

Joseph-Azzam commented 4 years ago

I need it to work on the 64-bit raspberry OS to make use of the AArch64 support.

Yours3lf commented 4 years ago

Reopening for testing on 64bit Raspberry Pi OS. Since it's still beta I can't guarantee it's going to work. Just use the 32 bit version for now.

Yours3lf commented 4 years ago

so to build on arm64 1) set arch to armv8-a in CMakeLists.txt 2) add compile option -fpermissive in CMakeLists.txt 3) install libdrm-dev, libx11-dev, libxrandr-dev, libmtdev-dev, libevdev-dev, libudev-dev, libinput-dev 3) build and install https://github.com/KhronosGroup/Vulkan-Headers 4) set VULKAN_HEADERS_INSTALL_DIR=/usr/local 5) build and install Vulkan-Loader with -DBUILD_WSI_WAYLAND_SUPPORT=OFF 6) change depthImageView to depthImage when it complains (or just don't build that test)

Yours3lf commented 4 years ago

Then if you test blending for example you get: Thread 1 "blending" received signal SIGSEGV, Segmentation fault. 0x0000007ff7a6b3d8 in rpi_vkCreateShaderModule (device=0x55555a2b50, pCreateInfo=0x7fffffdf58, pAllocator=0x0, pShaderModule=0x55555a2cb0) at /home/pi/rpi-vk-driver/driver/shader.c:34 34 assert(ci->instructions); (gdb) bt

0 0x0000007ff7a6b3d8 in rpi_vkCreateShaderModule (device=0x55555a2b50, pCreateInfo=0x7fffffdf58, pAllocator=0x0, pShaderModule=0x55555a2cb0) at /home/pi/rpi-vk-driver/driver/shader.c:34

1 0x0000007ff7a53658 in createBufferToTextureShaderModule (device=0x55555a2b50, blitShaderModule=0x55555a2cb0) at /home/pi/rpi-vk-driver/driver/copy.c:647

2 0x0000007ff7a53a68 in setupEmulationResources (device=0x55555a2b50) at /home/pi/rpi-vk-driver/driver/copy.c:962

3 0x0000007ff7a57ca8 in rpi_vkCreateDevice (physicalDevice=0x55555a2898, pCreateInfo=0x7ffffff090, pAllocator=0x0, pDevice=0x5555665538) at /home/pi/rpi-vk-driver/driver/device.c:364

4 0x0000007ff7f6a6f4 in ?? () from /usr/lib/aarch64-linux-gnu/libvulkan.so.1

5 0x0000007ff7f72090 in ?? () from /usr/lib/aarch64-linux-gnu/libvulkan.so.1

6 0x0000007ff7f75244 in vkCreateDevice () from /usr/lib/aarch64-linux-gnu/libvulkan.so.1

7 0x0000005555565cc4 in createLogicalDevice () at /home/pi/rpi-vk-driver/test/blending/blending.cpp:411

8 0x0000005555564d80 in setupVulkan () at /home/pi/rpi-vk-driver/test/blending/blending.cpp:140

9 0x0000005555568104 in main () at /home/pi/rpi-vk-driver/test/blending/blending.cpp:1360

which probably happens because I never tested the driver on 64bit, so you'll run into issues with that (pointers being 8 bytes long etc.)

Joseph-Azzam commented 4 years ago

Thank you, I will try those changes over the weekend

paulwratt commented 4 years ago

can someone change the topic title to say "How to build for 64bit?" (easier to find later)

thanx for this info and the whole project @Yours3lf - OpenArena just does not cut it

Joseph-Azzam commented 4 years ago

Hi Yours3lf, Thank you a ton for taking the time to look into this, it's appreciated. I can confirm the installation worked by following these steps.

paulwratt commented 4 years ago

Unless these 64bit build instructions are posted in a doc within the project, can I ask this issue stays open as an "instructional" issue, which should come up in searches

vanfanel commented 4 years ago

@Yours3lf: In the first place, congratulations for this massive archivement: Vulkan on Pi3 is something I couldn't even imagine!! :-O

I am also trying to build for Raspbian OS 64bit, instead of Raspbian OS. I found the instructions in this thread by pure chance, so I think @paulwratt is right: This thread should be re-opened or the 64bit building instructions should be added to README.md or BUILD.md