[Letux-kernel] PVR/SGX driver integrated into kernel tree

H. Nikolaus Schaller hns at goldelico.com
Tue Dec 19 21:37:09 CET 2017


Hi,

> Am 19.12.2017 um 16:58 schrieb aTc <atc at k-n-p.org>:
> 
> This probably doesn't work with pyra yet anyway,

not yet - so far it is OMAP3/AM33xx only. OMAP5 is on my wish-list...

> but I did run into a problem where make clean doesn't work properly :
> 
>  CLEAN   drivers/gpu/pvr
> rm: cannot remove 'drivers/gpu/pvr/omap3/': Is a directory
> rm: cannot remove 'drivers/gpu/pvr/omap5/': Is a directory
> scripts/Makefile.clean:72: recipe for target '__clean' failed
> make[3]: *** [__clean] Error 1
> scripts/Makefile.clean:89: recipe for target 'drivers/gpu/pvr' failed

Ok, that is interesting! I'll try to find out and learn how Kconfig and kernel Makefiles work...

> We did have working gpu drivers on pyra on an earlier kernel (more the uevm, never tried it on a real pyra, kernel was too old to have dtbs for the current prototypes) ,

Yes, I remember the demos at Gamescom.

> but they couldn't be run at the same time as tiler.

Ok.

Well, SGX driver by IMG needs a "backend" by TI so that the SGX can be told where the framebuffer is located and properly memory-mapped.
If we can not provide a "standard" framebuffer this ends in trouble.

Anyways, the TILER isn't working with 4.15 any more... So we have a chance to get SGX working :)

> 
> This has some info on that, which you should already have.
> https://dev.pyra-handheld.com/snippets/1

I wasn't aware of this good description! TNX!
It certainly helps to add OMAP5 to the kernel.

> 
> This is also what our current omap5-sgx-ddk-um-linux package is based on. So it's probably a few versions behind more recent drivers.

The most difficult thing is to track driver versions...
Basically they are all the same code except some tiny changes here and there.

Some changes come from IMG versions, some come from TI versions. And some are needed if the kernel API is modernized compared to the baseline TI had used.

Nevertheless the driver is quite well structured - except thousands of #if to adapt to kernel API changes.
And, that the Errata are hard-coded into #ifs. So at the moment it is not possible to compile one driver
for all SGX and OMAP versions, although the basic principles are very similar. Yu have to CONFIG SGX530/540/544 and a certain revision. And which SoC to support.

It looks as if it was simpler for IMG and TI to copy the source tree and modify it instead of adding some
dynamic version detection.

Anyways, this is a future dream. I would be happy at the moment if it would work for the most common combinations.


This leads to a big question where someone may be able to help...

I would like to define the Makefile in a way that multiple kernel modules are built from the same source tree but different CONFIG or -D.

This seems almost impossible with Kbuild. But I had found some hints - for older kernels. Like this:

https://stackoverflow.com/questions/18386182/out-of-tree-kernel-modules-multiple-module-single-makefile-same-source-file

The basic idea is to copy the whole tree of the multi-variant-module into separate directories and build them separately.
Perhaps by modifying the Makefile on the fly.

What I could not yet solve is to formulate the Makefile in a way that this copy process is included.
And that it works with in-tree-modules!

It seems not to be possible to tell the Makefile:

some-rule:
	cp this that

obj-pvrsrvkm := ...run some-rule first ...

So a first hint towards a solution would be how to add arbitrary Makefile rules.

BR and thanks,
Nikolaus

> 
> 
> On 12/18/2017 02:32 PM, H. Nikolaus Schaller wrote:
>> Hi all,
>> I spent some time to work on the PVR/SGX driver and with
>> 4.15-rc4 there is now something available for further study.
>> What works:
>> * integration with SoC drivers for OMP3630 and AM335x in
>>   drivers/gpu/pvr/omap*
>> * fixes for kernel driver to compile and work against 4.15 API
>> * a gpu-demo script that installs the (closed) firmware and drivers,
>>   then starts the µKernel on the SGX and finally tries to
>>   run a demo - tested on GTA04 and Letux Cortex 8
>> Well, we do yet not see anything on the display :(
>> There is one missing piece: the interface of the SGX to the
>> framebuffer base address.
>> Unfortunately neither the omaplfb nor the omapdrm backends
>> of the kernel driver work (although they can be compiled).
>> If you want to try, SGX is not configured into the latest
>> 4.15-rc4 but it is easy to enable:
>> 1. download sources of 4.15-rc4
>>    (http://projects.goldelico.com/p/gta04-kernel/)
>> 2. edit letux_defconfig to set
>>    CONFIG_SGX=y
>>    CONFIG_SGX_OMAP=m
>>    optionally CONFIG_SGX_DRM=y
>> 3. build & boot
>> 4. run /root/gpu-demo script
>> For AM33xx (BeagleBone/PocketBone/LC8) there is one more change:
>> edit drivers/gpu/pvr/omap3/Makefile for SOC=ti335x.
>> There is still a lot of things to do:
>> * fix the framebuffer access issue
>> * make a variant for omap3430 (OpenPandora 600MHz)
>>   this needs a different flavour of the user-space package
>> * make variants for OMAP4 and OMAP5 (driver code is
>>   already included in source tree)
>> * for AM33xx there is some tiny bit missing to fully
>>   automatically enable all clocks. Currently there is
>>   a devmem2 hack in the gpu-demo script
>> * I have some ideas to streamline the driver so that
>>   a single driver binary could support *all* OMAP variants
>>   and generations but that is a big project which needs
>>   funding
>> Please test and report your experiences.
>> It would be great if we could provide a full set
>> of tested and maintained (as good as possible)
>> drivers for *all* omap boards.
>> And an (optional) 3D acceleration for Replicant.
>> BR,
>> Nikolaus
>> _______________________________________________
>> Kernel mailing list
>> Kernel at pyra-handheld.com
>> http://pyra-handheld.com/cgi-bin/mailman/listinfo/kernel
> 



More information about the Letux-kernel mailing list