Jump to content

Lima on Rock64 / RK3328


human

Recommended Posts

Armbianmonitor:

Hi,

 

Around the forums, I've seen that some people have been successful in running the lima driver on Amlogic or Allwinner hardware:

https://forum.armbian.com/topic/14180-bananapro-lima-driver-problems/

https://forum.armbian.com/topic/11424-playing-with-limamesa-mali-drivers/

 

However, I couldn't seem to find any posts with Rockchip hardware, specifically the ROCK64. I tried to enable it myself by doing the following, but was unsuccessful so far.

 

  • enable kernel module lima via "sudo modprobe lima"
  • update /etc/X11/xorg.conf.d/01-armbian-defaults.conf as below per the lima wiki instructions (also tried w/o the "Device" section)
    Section "Monitor"
            Identifier              "Monitor0"
            Option                  "DPMS" "false"
    EndSection
    Section "ServerFlags"
            Option                  "BlankTime" "0"
            Option                  "StandbyTime" "0"
            Option                  "SuspendTime" "0"
            Option                  "OffTime" "0"
    EndSection
    Section "ServerFlags"
            Option  "AutoAddGPU" "off"
            Option "Debug" "dmabuf_capable"
    EndSection
    Section "Device"
             Identifier "Lima"
             Driver "modesetting"
             Option "AccelMethod" "glamor"
    EndSection
    Section "OutputClass"
            Identifier "Lima"
            MatchDriver "rockchip"
            Driver "modesetting"
            Option "PrimaryGPU" "true"
    EndSection
  • Install kodi from the standard repo
  • install updated graphics drivers from Oibaf's PPA
  • start kodi, Armbian desktop (XFCE), or weston (can't confirm if weston was running lima actually)

 

However, no matter what I do,  I always get output via llvmpipe as opposed to lima, as also seen in my Xorg.0.log.

 

A couple things I also noticed:

  • other boards also have an armsoc video driver like xserver-xorg-video-armsoc-sun4i, but there isn't one for Rockchip. However, I'm also not sure if this is for the proprietary blobs as opposed to lima.
  • there is a rockchipdrm module loaded in my kernel. I tried to blacklist it and load lima in /etc/modules-load.d, but it seems that it didn't work (rockchipdrm still loaded, lima not) when I booted. I guess it's baked into the kernel?

 

So, can anyone point me in the right direction of where to go from here? My goal is to run kodi via lima so that I can use mainline kernels + mesa with minimum/no patches (vpu might still be tricky).

Link to comment
Share on other sites

Can't see anything about lima in the kernel dmesg log you posted.

Are you sure you got the right device node in the device tree? It is essential, otherwise the hardware will never be detected by the kernel.

Note that when the node is present and enabled (look for status="okay") in the device tree, the lima module is automatically loaded by the kernel.

 

As a side note, you don't need armsoc X.org driver, everything should be handled by default modesetting X.org driver.

You should also not blacklist any other module.

 

X.org configuration bits instead are important: I get black screen if I miss things there.

 

Little note: my experience is based upon rockchip rk322x and amlogic s905, but it should be the same on rk3328.

Link to comment
Share on other sites

your Xorg.conf can only applied to mainline kernel, but it looks like you are using vendor kernel. so you need to use modesetting+mali binary driver.

 

and mali binary driver only supports glse2, thus only gles2 application can use it, desktop rendering still software.

 

meanwhile if you use mainline kernel, you will get desktop be rendered by lima, but don't expect fast than software, due to mali450 is weak, and maybe RK33 is faster.

Link to comment
Share on other sites

Hi jock and ning, many thanks for the assistance.

 

On 6/27/2020 at 12:42 AM, jock said:

Are you sure you got the right device node in the device tree?

 

I'm not sure about this, I'm using the stock device tree/kernel 5.4 from the Armbian Focal here. Here's my rk3328-rock64.dts from /boot/dtb/rockchip.

Do you have any pointers on how I might enable these nodes or examples from other boards? I'm not very experienced here.

 

18 hours ago, ning said:

your Xorg.conf can only applied to mainline kernel, but it looks like you are using vendor kernel.

 

As I understand it, the rockchip vendor kernel is only 4.4 or is this incorrect?

"uname -r" gives me "5.4.45-rockchip64" which I suppose is mainline with some patches from Armbian devs, but maybe I'm mistaken. I could also try the rockchip-dev branch which is 5.6.x if necessary.

 

With regards to performance, I'm only looking to run kodi or maybe some emulation frontends in the future, no desktop - can I expect decent performance with these? I could also try running it via GBM if I get some pointers on how to do that.

Link to comment
Share on other sites

11 minutes ago, human said:

Hi jock and ning, many thanks for the assistance.

 

 

I'm not sure about this, I'm using the stock device tree/kernel 5.4 from the Armbian Focal here. Here's my rk3328-rock64.dts from /boot/dtb/rockchip.

Do you have any pointers on how I might enable these nodes or examples from other boards? I'm not very experienced here.

 

 

As I understand it, the rockchip vendor kernel is only 4.4 or is this incorrect?

"uname -r" gives me "5.4.45-rockchip64" which I suppose is mainline with some patches from Armbian devs, but maybe I'm mistaken. I could also try the rockchip-dev branch which is 5.6.x if necessary.

 

With regards to performance, I'm only looking to run kodi or maybe some emulation frontends in the future, no desktop - can I expect decent performance with these? I could also try running it via GBM if I get some pointers on how to do that.

Hmm, it seems like you did not link the dts file.

 

Yes, the vendor kernel is only 4.4, and actually you're on 5.4 which is mainline.

 

Here, on my rk322x targets, I managed to get lima working fine with mali 400, which is fundamentally the same as Mali 450 but much slower.

 

X.org desktop is really slow with Lima enabled, and some games I tried also did not render perfectly, but Kodi instead was plenty usable. Wasn't able though to get hardware video acceleration yet, but I guess it's just a matter of consolidation from Kodi, ffmpeg and kernel developers, in fact LibreElec already has Mainline Kernel + Lima + hardware video acceleration in Kodi for h.264.

 

 

Link to comment
Share on other sites

2 minutes ago, human said:

Oops, here's the dts:

http://ix.io/2qp0

 

And great, then it sounds like this effort will be worth if only running kodi.

Ok, for start the gpu@ff300000 node is clearly missing the status = "okay" property.

It looks like it is missing some other things, for example I don't see an operating points table for the GPU.

 

You may try to compile the dts back to dtb and see what happens, but honestly I think you may have more luck trying a nightly armbian image with latest kernel and updates or even compile Armbian yourself.

Link to comment
Share on other sites

Quote

194.093] (II) Initializing extension GLX

[ 194.094] (II) AIGLX: Screen 0 is not DRI2 capable

[ 194.114] (II) IGLX: Loaded and initialized swrast

[ 194.114] (II) GLX: Initialized DRISWRAST GL provider for screen 0

 

Lima is not enabled.

for you Xorg.conf please remove "device" section, and install xserver-xorg-video-fbdev

 

Link to comment
Share on other sites

Great news - I was able to get lima running by following your advice jock! I ended up upgrading to the 5.6 kernels (probably not critical), and then updated the gpu section for the dts per your advice using the vendor dtsi as a baseline:

Spoiler

	gpu@ff300000 {
		compatible = "rockchip,rk3328-mali\0arm,mali-450";
		reg = <0x00 0xff300000 0x00 0x40000>;
		interrupts = <0x00 0x5a 0x04 0x00 0x57 0x04 0x00 0x5d 0x04 0x00 0x58 0x04 0x00 0x59 0x04 0x00 0x5b 0x04 0x00 0x5c 0x04>;
		interrupt-names = "gp\0gpmmu\0pp\0pp0\0ppmmu0\0pp1\0ppmmu1";
		clocks = <0x02 0x87 0x02 0x87>;
		clock-names = "bus\0core";
		power-domains = <0x3c 0x01>;
		resets = <0x02 0x66>;
		phandle = <0x8b>;
		status = "okay";
	};

	gpu_opp_table: gpu-opp-table {
		compatible = "operating-points-v2";

		opp-200000000 {
			opp-hz = /bits/ 64 <200000000>;
			opp-microvolt = <950000>;
		};
		opp-300000000 {
			opp-hz = /bits/ 64 <300000000>;
			opp-microvolt = <975000>;
		};
		opp-400000000 {
			opp-hz = /bits/ 64 <400000000>;
			opp-microvolt = <1050000>;
		};
		opp-500000000 {
			opp-hz = /bits/ 64 <500000000>;
			opp-microvolt = <1150000>;
		};
	};

 

Kodi worked with my existing X11 config, and also works via gbm from the tty (which appears to be much smoother for the interface).

 

There are a few things popping up in dmesg, but I'm not sure if anything is too concerning (the i2s message came up repeatedly, but I'm not using it):

Spoiler

[ 3260.048173] rockchip-i2s ff000000.i2s: Fail to set mclk -22

and


[   87.654879] lima ff300000.gpu: IRQ pmu not found
[   87.655577] lima ff300000.gpu: IRQ ppmmu2 not found
[   87.656029] lima ff300000.gpu: IRQ ppmmu3 not found
[   87.656476] lima ff300000.gpu: IRQ ppmmu4 not found
[   87.656918] lima ff300000.gpu: IRQ ppmmu5 not found
[   87.657358] lima ff300000.gpu: IRQ ppmmu6 not found
[   87.657799] lima ff300000.gpu: IRQ ppmmu7 not found
[   87.658380] lima ff300000.gpu: gp - mali450 version major 0 minor 0
[   87.658498] lima ff300000.gpu: pp0 - mali450 version major 0 minor 0
[   87.658583] lima ff300000.gpu: pp1 - mali450 version major 0 minor 0
[   87.658648] lima ff300000.gpu: IRQ pp2 not found
[   87.659073] lima ff300000.gpu: IRQ pp3 not found
[   87.659493] lima ff300000.gpu: IRQ pp4 not found
[   87.659911] lima ff300000.gpu: IRQ pp5 not found
[   87.660330] lima ff300000.gpu: IRQ pp6 not found
[   87.660749] lima ff300000.gpu: IRQ pp7 not found
[   87.661169] lima ff300000.gpu: l2 cache 8K, 4-way, 64byte cache line, 128bit external bus
[   87.661183] lima ff300000.gpu: l2 cache 64K, 4-way, 64byte cache line, 128bit external bus
[   87.662438] lima ff300000.gpu: bus rate = 491520000
[   87.662457] lima ff300000.gpu: mod rate = 491520000
[   87.663230] [drm] Initialized lima 1.0.0 20190217 for ff300000.gpu on minor 1

 

 

 

Now all I need to do is figure out how to get the VPU running for accel and should be good to go. As you mentioned LibreElec seems to be progressing nicely,  this thread on the RK3399 forum looks promising.

 

 

 

Edited by human
spoiler tags to clean things up
Link to comment
Share on other sites

For any of those following this thread, I'm happy to report that none of the above workarounds are now necessary to run kodi on mainline!

I was simply able to install the latest mainline image (linux 5.8.6 as of this post) along with kodi-gbm and everything just works. 

 

Of course, there are performance caveats at this time - refresh rates are limited to 50/60Hz, only h.264 video is accelerated, no 4k output, and the general video quality (sharpness, motion blur, colors) appears to be degraded compared to the legacy kernel.

However, I'm sure these issues will be fixed moving forward, and at this point, I would say that the system is usable.

 

Many thanks to all the developers whose hard work made this possible - I look forward to the improved performance moving forward!

Link to comment
Share on other sites

14 minutes ago, human said:

For any of those following this thread, I'm happy to report that none of the above workarounds are now necessary to run kodi on mainline!

I was simply able to install the latest mainline image (linux 5.8.6 as of this post) along with kodi-gbm and everything just works. 

 

Of course, there are performance caveats at this time - refresh rates are limited to 50/60Hz, only h.264 video is accelerated, no 4k output, and the general video quality (sharpness, motion blur, colors) appears to be degraded compared to the legacy kernel.

However, I'm sure these issues will be fixed moving forward, and at this point, I would say that the system is usable.

 

Many thanks to all the developers whose hard work made this possible - I look forward to the improved performance moving forward!

That's good news!

kodi-gbm is the debian/ubuntu packaged one or you built it from sources?

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines