Mali-450 support by lima

Section "Device" 
   Identifier   "My Graphics Card"
   Driver       "lima"
   BusID "AXI" 
EndSection

does not work…

[   131.874] (EE) Failed to load module "lima" (module does not exist, 0)       
[   131.874] (EE) No drivers available.                                         
[   131.874] (EE)                                                               
Fatal server error:                                                             
[   131.875] (EE) no screens found(EE)                                          
[   131.875] (EE)                                                               

i guess driver needs to be a xorg-device driver…

btw. it seems that mali takes not too much current…i had only 9w because i had powered my display over r2…tried booting with blacklisted lima module from powered off state shows also 9.xW. without display i have ~5w i remember board takes…there is no much change in power consumption (maybe 0.1w) if lima is loaded afterwards or unloaded

Yep you need to get lima driver in your X. Maybe recompilation if it is not packed yet… (try apt-cache search lima)

My board just compiles clang:9 and it may take time because it started to swap… After it clanged mesa, X etc…

MiB Mem :   2009.6 total,     55.8 free,   1907.1 used,     46.7 buff/cache
MiB Swap:   4096.0 total,   3320.2 free,    775.8 used.     35.6 avail Mem 

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND                                                           
18882 portage   39  19  406636 386952  13532 R  99.7  18.8   1:38.36 cc1plus                                                           
18870 portage   39  19  703648 512116  10516 R  97.1  24.9   6:01.41 cc1plus                                                           
18843 portage   39  19 1081136 934472   9860 R  96.1  45.4  10:44.21 cc1plus                                                           

cat /sys/class/thermal/thermal_zone0/temp
60686

It is in default acrylic box. No ventilation holes.

OK, so not yet need to ask from Mediatek? Btw I noticed that 5.4.12 runs hotter than 4.19. Maybe test diffrent kernels?

GPU may need some load to increase consumption??

had not looked while testing lima, but 5.4-main-tree had about ~40°C similar to 4.19

i expected that only powering the chip without load will be visible on wattmeter…

maybe you both can measure too before…

for lima x driver i guess this is the mesa-driver johnny talked about

edit: actually i have 46.5°C with loaded lima module

root@bpi-r2:~# cat /sys/class/thermal/thermal_zone0/temp                        
46499

btw. i have moved your code in separate function in my 5.4-lima-tree

Maybe lima in driver section is wrong. I found someone used (need to be modified to mt7623)

Section "Device"
	Option "kmsdev" "/dev/dri/card1
	Identifier	"Sunxi DRM driver"
EndSection

Section "ServerFlags"
        Option  "AutoAddGPU" "off"
        Option "Debug" "dmabuf_capable"
EndSection

Section "OutputClass"
        Identifier "Sunxi"
        MatchDriver "sun4i-drm"
        Driver "modesetting"
        Option "PrimaryGPU" "true"
EndSection

Found also:
Section "ServerFlags"
        Option  "AutoAddGPU" "off"
        Option "Debug" "dmabuf_capable"
EndSection

Section "OutputClass"
        Identifier "Lima"
        MatchDriver "<display DRM driver>"
        Driver "modesetting"
        Option "PrimaryGPU" "true"
EndSection

Where <display DRM driver> posible lima-drm, need to match mesa *so libs..

Its ok. Some more cpu tic’s + memory usage but not much. Looks much better (have not checked yet). Maybe you send it to lima postlist when ok…?

Btw. back to boar overcloking. How much you think it is posible to increase Mhz’s? Modifying .dtsi?

I don’t think we get it upstream…it is still device specific…and not with this condition :slight_smile: but its now easier to port over kernelversions

your examples using alex’ options too…without they do not work…

i do not know how much you can overclock…maybe you can do it from userspace while take a look on temperature of soc/power-converter

It’s unactive because this videocard is probably masked by using profile, also mesa required libdrm with lima support(by portage logic). libdrm has no lima support (VIDEO_CARDS=“lima”) but as i remember lima was switched for using amdgpu scheduler (which is definetly masked in arm profile see /usr/portage/profiles/arch/arm/use.mask).

I want to try create repo with correct flags etc, for now - without succes (reading manuals :slight_smile: )

P.S. @frank-w, @eros I’ve started net thread for userspace drivers etc. Lima userspace drivers: Xorg/mesa/tools/etc for BPI-R2 I suggest to leave this thread for kernel/dts-related questions for easier search

After reboot i got

[   99.905585] LIMA_INIT: lima_clk_init
[   99.905666] LIMA_INIT: lima_clk_init_err:0
[   99.905720] LIMA_INIT: lima_regulator_init_err:0
[   99.906618] LIMA_INIT: lima_dlbu_cpu no err:0
[   99.906675] lima 13040000.gpu: IRQ pmu not found
[   99.906683] lima 13040000.gpu: Lima_init_ip: ip:0, err:0
[   99.906725] lima 13040000.gpu: mmu gpmmu dte write: ADDR:0,val:cafebabe
[   99.906733] lima 13040000.gpu: mmu gpmmu dte read: ADDR:0,val:0
[   99.906740] lima 13040000.gpu: mmu gpmmu dte write test fail
[   99.906746] lima 13040000.gpu: Lima_init_ip: ip:1, err:-5
[   99.980447] lima: probe of 13040000.gpu failed with error -5

Again… devmem 0x10003014 w 0x00000001 didn’t helped.

Same kernel.

UPD: looks like successful initialization may depend on HDMI connection. After reboot with hdmi connected - lima has initialized successfully.

UPD2: Did more tests, result: to init lima hdmi port must be connected. without it

lima: probe of 13040000.gpu failed with error -5

Helli frank

Currently 4.14 support gpu mali ?

Thanks

No only 5.4-main…it uses mali driver from linux. Before 5.3 you need to add lima manually, change it (at least changes i did) and include it or build separately

If dont have gpu mali, Can we run qt5 application ?

I don’t know but i guess it will be software rendered

I’ve succesfully uset Qt apps without lima, works as well as other Xorg apps, atleast unless you need OpenGL

Do you use x11 ? And you build qt5 by using yocto ?

Yep, i use Qt over X11. (i use LXQt DE)

No, i use Gentoo - source based distro, so it was built by package manager.

Can somebody please message me with details on how I can get my configurations to you? I already solved all of this, including X11. Driver works perfectly - it’s just slower than it should be. Both GL under fbcon and GL under X11 work with the lima driver - you can even get things like MythTV working.

I have build scripts, research, config files - somebody send me their email address.

the R2 Mali450 does not have a PMU and it does have 8 units, each PP is a dual unit on a mali - hence pp0 through pp3.

All you had to do was look at the DTSI for another board that ALSO has a Mali-450 MP4 and this all would of been obvious.

Why not posting it here? If you have patches for kernel, attach them here and i will apply them to my repo

Hi! I see you have a github account, it would be nice to publish your code there, and provide links.

I’ve not exactly maintained a GIT tree :wink: I’ve just pulled all I needed, modified all I needed and then compiled it all. I can send you all the scripts I wrote to help? but you’ve already solved most if not all of the issues. I’ve got meson build scripts, the modifications to mesa (you basically find every instance of exynos (which is another similar board) and duplicate it as ‘mediatek’ in order to get your mediatek shim.

Let’s see - build Lima as a module (adding the dtsi extensions as provided by ryder lee?) - didn’t have a single issue with the detection and setup of the Mali, I sent my DTSI to frank at some point I’m sure - again it was just changes pertaining to an entry entitled ‘g3d’ or something along those lines.

I was having issues with performance but I believe you’ve solved that with optimization flags as well as disabling the debug logging for the driver?

I posted this all working in this thread aaaaages ago but if there’s anything I have that’s still useful? just message me an address to send it to.

I’m going to be integrating all the changes into franks latest version and then building lima with the optimizations and without logging - the figures you reported were much better than the performance I was getting - as long as it can spit out a frame in less than 16ms? that’ll suit me. I think the lima guys have video being hardware scaled already but for simple bi-linear scaling for emulators? Lima is capable - just need the speed!

Hey @frank-w, what is the current status of lima patches for your repos? Which branches are up to date to use if I would have a chance to give this a test?

What’s about the DTB regulator vs. board specific function in drm driver story conclusion? Am I correct that neither you nor other people in this thread were able to find how to power on/off GPU using DTB-only approach?

Also I’ve seen report from @DeadMeat that module initialization depends on the HDMI port being connected to some powered on device. Is it really the case? Had it been reproduced by other users? I’m thinking about trying to move from serial console to netconsole in u-boot and EFI grub2 plus normal HDMI console in linux - it will be easier to maintain boards in production with setup like this.

Ah, and yet another question: am I correct that to get text console working I need to have fbcon enabled, kmsconsole fb emulation enabled and working drm driver (lima in our case)? I’m wondering if it possible to have linux console working for BPi-R2 with some other driver than lima.

And while we’re at it - have anyone had any luck with using proprietary driver from ARM for utgard GPUs?