Arch Linux Image for VisionFive 2

In summary:

cwt12 : weston OK
cwt13 : weston OK
package / 3.0.4 : weston not working / PVR_K errors in dmesg

the packaged kernel build script wasnā€™t optimized specifically for U74 core. Iā€™m launching a new build with this flags:

make LLVM=1 CC="clang -mcpu=sifive-u74 -mtune=sifive-7-series"

The new package build be done around my morning, I will let you test it after I wake up.

1 Like

Thanks. Look forward to it.

https://aur.archlinux.org/packages/mesa-pvr-vf2
I tested this last night and made some untested changes before publishing - but hopefully it works :crossed_fingers:

2 Likes

@stronnag and @sajattack Please try this kernel Release cwt13 3.0.4-2 Ā· cwt/pkgbuild-linux-cwt-starfive-visionfive2 Ā· GitHub

1 Like

I wasnā€™t having any kernel issues but weston was sometimes failing to display anything randomly and replugging the hdmi fixed it.

@sajattack, it seems like your package overlaps with this one GitHub - cwt/aur-visionfive2-img-gpu: IMG_GPU driver AUR package for VisionFive2, which Iā€™ve already included in my image. Iā€™d love to know which one is better. However, when I consider the license and openness, I think your package is the way to go.

I thought visionfive2-img-gpu was just the firmware. I set it as a dependency of mine. I might need to have a closer look.

Mine cribs heavily from meta-riscv/recipes-graphics/mesa/mesa-pvr at master Ā· riscv/meta-riscv Ā· GitHub, I thought visionfive2-img-gpu was just the firmware portion - but youā€™re right it looks like there are some Mesa .soā€™s in there so that might cause issues. Or maybe my package just overwrites them. I can have a closer look later tonight or tomorrow.

yeah, the visionfive2-img-gpu contains a lot of blob or precompiled binary files from GitHub - starfive-tech/soft_3rdpart. Both of our packages provide opengl-driver and vulkan-driver.

Yeah Iā€™ll have to fix that I guess. Iā€™ll make an equivalent of meta-riscv/recipes-kernel/firmware/linux-firmware-visionfive2-imggpu.bb at master Ā· riscv/meta-riscv Ā· GitHub (which is what I thought visionfive2-img-gpu was)

Could you check if your package already provides (or overwrites) all binary files and libraries included in visionfive2-img-gpu? If thatā€™s the case, I think I can split just the GPU firmware to a separate package, and then you can make it a dependency in your package. Finally, we can remove the blob from StarFive.

1 Like

Iā€™ll check tomorrow. Btw the vulkan driver seems a bit broken - I mentioned here Vulkan Driver Broken? VK_KHR_SURFACE unsupported

1 Like

My package functions independently of visionfive2-img-gpu looks like. So I removed the dependency. And also I reproduced the weston issue @stronnag saw, but sway is working so :man_shrugging: Maybe an issue with the weston package - unsure.

Edit: Argh I was fooled by llvmpipe. So there is some piece of the firmware we need from the img gpu files. Should I make a new package for those blobs? Sounds like @cwt was up to the task as well. Whoever gets to it first I suppose.

1 Like

Do you just need this part of the visionfive2-img-gpu?

# Firmware files
install -Dm644 lib/firmware/rgx.fw.36.50.54.182 "${pkgdir}/usr/lib/firmware/rgx.fw.36.50.54.182"
install -Dm644 lib/firmware/rgx.sh.36.50.54.182 "${pkgdir}/usr/lib/firmware/rgx.sh.36.50.54.182"
install -Dm644 $srcdir/img-gpu-firmware-mkinitcpio.conf "${pkgdir}/etc/mkinitcpio.conf.d/${pkgname}.conf"

Great news! Thanks for this, even tho it looks like this PKGBUILD isnā€™t quite there yet. I thought those es2gears results were low for having a supposedly working mesa driver. llvmpipe deceives again!

Iā€™ve got the next couple of weeks off work so putting together a PKGBUILD for the PVR mesa driver was near the top of things I was going to be doing but you narrowly beat me to it, which I donā€™t mind at all! I may or may not wait for you to fix up the firmware issue before I give it a go.

Iā€™m pretty shocked by the lack of interest in the GPU and video decoding etc on here. I thought the open source, (potentially when the drivers are more complete) better than the Rpi GPU driver of the VF2 was the long awaited killer feature on a SBC butā€¦ crickets!

HW video decoding next!

1 Like

I think we need a bit more than just the pure firmware. The visionfive2-img-gpu provides hardware OpenCL functionality that is not supplied by mesa, but I am not quite sure which files are needed for that (Havenā€™t tested it).
At the very least we should need:

/etc/OpenCL/vendors/IMG.icd
/usr/lib/libPVROCL.so
/usr/lib/libPVROCL.so.1
/usr/lib/libPVROCL.so.1.17.6210866

Looking at it, we might need some vulkan stuff aswell, but I havenā€™t played with vulkan yet

1 Like

packaged kernel release cwt13 3.0.4-2 fails to initialise the GPU:

[Wed Jun 14 10:27:13 2023] PVR_K:(Error):     1: PVRSRVDeviceFinalise: Failed to set device (____ptrval____) power state to 'on' (PVRSRV_ERROR_TIMEOUT) [2466]
[Wed Jun 14 10:27:13 2023] PVR_K:(Error):     1: PVRSRVDeviceFinalise() failed (PVRSRV_ERROR_TIMEOUT) in PVRSRVCommonDeviceInitialise() [2170]
[Wed Jun 14 10:27:13 2023] [drm:pvr_drm_load] *ERROR* device (____ptrval____) initialisation failed (err=-19)

cwt13 extracted from the SD image initialises the GPU without error.

Did you add the gpu firmware files to the initramfs generated by the kernel?

FILES=(/lib/firmware/rgx.fw.36.50.54.182  /lib/firmware/rgx.sh.36.50.54.182)

Yes. Itā€™s the default. And demonstrated by dmesg and lsinitcpio