Mali-450 support by lima


(Johnny) #22

Ok - it worked successfully for off-screen rendering - but to render directly to the screen requires modifications to mesa - specifically a DRI shim for the mediatek HDMI output (basically allows rendering on Lima (/dev/dri/card1) but with the final output written to an area of graphics memory using dmabuf.

After discussions on #dri-devel and #lima on freenode IRC - I have successfully written the shim and the R2 can now render directly to the screen :slight_smile:

I’m cleaning up my code now - making sure everything is compliant and any uneeded testing is reverted.

Then I’ll be updating my repositories with both the 4.20 kernel driver and the modified mesa with the Mediatek DRI shim driver - I’ll keep you posted.


(Frank W.) #23

How far are you with code-cleaning? We want to see how lima works :slight_smile:


(Johnny) #25

Should be tomorrow :slight_smile: sorry for the delay - been busy, might have a surprise addition too :wink:


(Frank W.) #26

any news here? can you please upload to your github and make a pull request?


(Frank W.) #27

@JohnnyWednesday can you upload your code for testing?


(Johnny) #28

Hiya - sorry for disappearing - I’ve had health issues but resolved now :slight_smile:

I’m going to port and test my changes for lima to your latest kernel revisions - there’s additions to XOrg as well as the lima kernel driver. It was quite the pain because I needed to submit my additions up the lima project trees on gitlab and to your trees on github - sorting through it all was quite a nightmare given that ultimately only half a dozen files were touched or added.

lima performance wasn’t great - perhaps there were DTS related things / clock related things - perhaps it’s lima being too incomplete.

So my main focus was taking what I’d learned from the lima changes and getting some official mali blobs working on the R2 - for this I was using the sunxi version of the mali kernel driver along with their xorg code.

I’m confident I can get this working given that all the prerequisites have been proven with a working lima setup - and indeed I’ve gotten the kernel part working and detecting the mali450 - there are minor errors, the reported clock frequency was way too low (DTS? same reason lima is slow?) - but the module loaded just fine.

next will be the xorg driver part - there are caveats - given the FB device and the mali device are different nodes, you need to create a kind of stub driver which essentially blits from one part of memory to the FB display memory - the setup for this stub and the functions makes use of are already proven with the lima code.

I need a few days to hack away at this - if I fail I will return to the lima driver and focus on performance.

lima is incomplete of course - BUT there’s enough functionality working that if you take care to only use working features? it’s useful. IE lima is perfectly capable of texture mapping a couple of triangles with filtering - so hardware rescaling for video / emulators is definitely in sight :smiley:

I’ve already written a kind of emulator/media front end called ‘BananaBox’ that brings all the best ARM optimized code that exists into one place, with the fast NEON rescaling code it works great for many things - but for emulating more powerful systems perfectly? I need the GPU to take some load off the CPU.

You start writing a front end then a few months later you’re knee deep in the kernel. Don’t you just love programming? :wink:


#29

did you enable iommu in this case?


(Cioby23) #30

According to this post https://www.phoronix.com/scan.php?page=news_item&px=Lima-DRM-Ready-For-Linux-5.2 it seems that the Lima driver for Arm Mali 400/450 graphics processors will be included in the 5.2 linux kernel.


(Frank W.) #31

it seems to be this commit:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?h=v5.2-rc4&id=a1d2a6339961efc078208dc3b2f006e9e9a8e119

needs to be added to dts too…maybe anyone with more knowledge about lima can try this on base of my 5.2-hdmi tree

https://www.phoronix.com/scan.php?page=news_item&px=Linux-5.2-DRM-Update is maybe also interesting, link to merge for any troubles cause by it