Star64: GPU firmware loading on Armbian
(06-08-2023, 10:30 PM)Fishwaldo Wrote: if you want a practical proof of the GPU "working" do this:
Load my desktop image (or kernel on armbian etc) and execute in a terminal window
"cat /sys/kernel/debug/pvr/status" and then do move some windows or play a video:
"Every 2.0s: cat /sys/kernel/debug/pvr/status                                                                                                                                                          star64: Fri Jun  9 04:49:23 2023

Driver Status:  OK

Device ID: 0:128
Firmware Status: OK
Server Errors:  0
HWR Event Count: 0
CRR Event Count: 0
SLR Event Count: 0
WGP Error Count: 0
TRP Error Count: 0
FWF Event Count: 0
APM Event Count: 243
GPU Utilisation: 93%

Now do the same with your Framebuffer app, and not that the GPU utilization does not go above 0%.

I've written both framebuffer apps and X apps, so these details are already familiar.

However when I was running X and seeing it run slow and with artifacts, I was using xterm, xconsole, and the Motif window manager, none of which use any part of Mesa,
and X claimed in its log to be using the "fb" device, so it shouldn't have been trying to use an 3D objects and textures to place windows. In fact, it didn't so any such thing because if you watch what happens when I moved a window, it didn't slide like a 3D object would.

Here is the evidence again in case you missed it:

And of course, the fbdev test program that I ran, if it wasn't using any part of the GPU, should not have displayed any out-of-order drawing, but it did.
Therefore it seems it is the GPU driver which is providing /dev/fb0 functionality but that driver is buggy.
It's not that bad, with the right setup, even the soft mode works well enough and can use Star64 as a mini PC with DE without HW GPU. For example, can even watch videos in windowed mode. In any case, there are no strong brakes when using DE XFCE\Icewm normally. can try these images and make sure that DE works.

p.s. Even on the first variant of VF1 (jh7100) without GPU at all, I can work with DE acceptably. Smile
(06-03-2023, 01:01 PM)Der Geist der Maschine Wrote: GPU firmware loading fails on armbian:

[    0.698528] PVR_K:(Fatal):    1: All RGX Firmware image loads failed for 'rgx.fw.' (PVRSRV_ERROR_NOT_FOUND) [1599]
[    0.698565] PVR_K:(Error):    1: RGXInit: InitFirmware failed (275) [1556]
[    0.698592] PVR_K:(Error):    1: RGXInit() failed (PVRSRV_ERROR_NOT_FOUND) in PVRSRVCommonDeviceInitialise() [2156]
[    0.698626] PVR_K:(Error):    1: PVRSRVDeviceFinalise() failed (PVRSRV_ERROR_NOT_INITIALISED) in PVRSRVCommonDeviceInitialise() [2170]
[    0.698664] [drm:pvr_drm_load] *ERROR* device (____ptrval____) initialisation failed (err=-19)

This is probably a first step in having GPU support in Xorg and Wayland.

Apply this kernel patch

schaecsn@pc:~/risc/linux# git diff drivers/gpu/drm/img/img-rogue/Kconfig
diff --git a/drivers/gpu/drm/img/img-rogue/Kconfig b/drivers/gpu/drm/img/img-rogue/Kconfig
index 5b793bb9da0e..6f84a2643e02 100644
--- a/drivers/gpu/drm/img/img-rogue/Kconfig
+++ b/drivers/gpu/drm/img/img-rogue/Kconfig
@@ -1,5 +1,5 @@
-      bool "DRM support for PowerVR GPU"
+      tristate "DRM support for PowerVR GPU"
        select DRM_IMG
        default n

Configure the gpu driver as a module

schaecsn@pc:~/riscv/linux$ scripts/config -m CONFIG_DRM_IMG_ROGUE

Rebuild the kernel and modules and install them.

The driver needs to be compiled as a kernel module. Unsophisticated guess: that moves out the initialization of the gpu from initrd into systemd-land. That is why the firmware does not need to be in initrd but can reside on the /-filesystem.

The two firmware blobs rgx.fw. need to be moved into /lib/firmware/ directory. They come from starfive-'s github repro

schaecsn@star64:~$ sudo mv img-gpu-powervr-bin-1.17.6210866/target/lib/firmware/* /lib/firmware/

A reboot shows successful firmware load

[  26.414834] PVR_K:  362: Read BVNC from HW device registers
[  26.414879] PVR_K:  362: RGX Device registered BVNC with 1 core in the system
[  26.422574] PVR_K:  362: RGX Firmware image 'rgx.fw.' loaded
[  26.442903] PVR_K:  362: Shader binary image '' loaded

Th next step in having GPU support in Xorg and Wayland is probably installing the libs, bin, and headers from said img-gpu-powervr-bin-1.17.6210866.tar.gz "[this] is a GPU library packages from Imagination and provide GPU firmware, libOpenCL, vulkan, gles2, gles3. This library is not open source, only provide with binary library." I have not tried that.

(06-06-2023, 12:12 AM)Fishwaldo Wrote: This is where you are going to have lots of "fun" - GPU support requires tons of patches to various userland apps, including mesa, wayland, apps etc to correctly use the GPU. The challenge is the patches starfive distribute are for older versions of userspace, namely mesa, that don't apply to current mainline (same issue for VPU as well). I tried to build GPU acceleration initially on debian, but ran in version dependency nightmares... newer apps wont compile against older mesa versions etc etc etc. I gave up and went with yocto as its not as "fussy" about version dependencies and is easier to overcome

Xorg is going to be very "challenging", and i've not started on it yet, as wayland is easier go get running with GPU.

The setup in the form of a firmware module is loaded, but there is no output to the monitor, even to the console

[   38.232439] mailbox_test mailbox_client: Successfully registered
[   41.669558] @@ dev ptr:ffffffe0bfedac00/1500/1
[   41.669717] PVR_K:  272: Read BVNC from HW device registers
[   41.669766] PVR_K:  272: RGX Device registered BVNC with 1 core in the system
[   41.705177] PVR_K:  272: RGX Firmware image 'rgx.fw.' loaded
[   41.728503] PVR_K:  272: Shader binary image '' loaded
[   41.730429] [drm] Initialized pvr 1.19.6345021 20170530 for 18000000.gpu on minor 1
[   42.423200] device-mapper: ioctl: 4.45.0-ioctl (2021-03-22) initialised: dm-devel@redhat.
donation   slarm64

(09-11-2023, 11:09 AM)mara Wrote:
[   38.232439] mailbox_test mailbox_client: Successfully registered
[   41.669558] @@ dev ptr:ffffffe0bfedac00/1500/1
[   41.669717] PVR_K:  272: Read BVNC from HW device registers
[   41.669766] PVR_K:  272: RGX Device registered BVNC with 1 core in the system
[   41.705177] PVR_K:  272: RGX Firmware image 'rgx.fw.' loaded
[   41.728503] PVR_K:  272: Shader binary image '' loaded
[   41.730429] [drm] Initialized pvr 1.19.6345021 20170530 for 18000000.gpu on minor 1
[   42.423200] device-mapper: ioctl: 4.45.0-ioctl (2021-03-22) initialised: dm-devel@redhat.

donation   slarm64


Possibly Related Threads…
Thread Author Replies Views Last Post
  [Star64] Help needed in understanding Yocto and U-boot build process InterestedinFOSS 0 319 04-23-2024, 10:58 AM
Last Post: InterestedinFOSS
  Star64 JH7110 (slarm64, riscv64) mara 2 1,340 10-09-2023, 03:43 AM
Last Post: mara
  Star64: jtag debugging? bluepill 1 1,169 09-20-2023, 08:26 AM
Last Post: bwooster0
  Star64: 4GB on 8GB boards Der Geist der Maschine 4 2,337 07-27-2023, 12:32 AM
Last Post: balbes150
  Star64: SATA Der Geist der Maschine 1 1,215 07-26-2023, 12:35 PM
Last Post: Gladox114
Information Star64: Armbian Installation Der Geist der Maschine 5 4,934 06-03-2023, 01:26 PM
Last Post: Der Geist der Maschine
  Star64: a first benchmark Der Geist der Maschine 0 1,197 05-29-2023, 01:00 PM
Last Post: Der Geist der Maschine
  Star64 first boot (and success) bortzmeyer 1 1,822 05-24-2023, 02:45 AM
Last Post: draintroup

Forum Jump:

Users browsing this thread: 1 Guest(s)