diff mbox series

[4/7] package/mali-bifrost-driver: new package

Message ID 20200306071440.30433-5-miquel.raynal@bootlin.com
State Accepted
Headers show
Series [1/7] package/sunxi-mali-utgard: rename from sunxi-mali-mainline | expand

Commit Message

Miquel Raynal March 6, 2020, 7:14 a.m. UTC
Add a new package to build and install a generic ARM Mali Bifrost GPU
Linux kernel module.

This module is compliant with the standard kernel-module
infrastructure.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 package/Config.in                               |  1 +
 package/mali-bifrost-driver/Config.in           | 17 +++++++++++++++++
 .../mali-bifrost-driver.hash                    |  3 +++
 .../mali-bifrost-driver/mali-bifrost-driver.mk  | 15 +++++++++++++++
 4 files changed, 36 insertions(+)
 create mode 100644 package/mali-bifrost-driver/Config.in
 create mode 100644 package/mali-bifrost-driver/mali-bifrost-driver.hash
 create mode 100644 package/mali-bifrost-driver/mali-bifrost-driver.mk

Comments

Thomas Petazzoni Dec. 30, 2021, 2:14 p.m. UTC | #1
Hello Miquèl,

On Fri,  6 Mar 2020 08:14:37 +0100
Miquel Raynal <miquel.raynal@bootlin.com> wrote:

> +MALI_BIFROST_DRIVER_VERSION = v0.1
> +MALI_BIFROST_DRIVER_SITE = $(call github,bootlin,mali-bifrost,$(MALI_BIFROST_DRIVER_VERSION))
> +MALI_BIFROST_DRIVER_DEPENDENCIES = linux
> +MALI_BIFROST_DRIVER_LICENSE = GPL-2.0
> +MALI_BIFROST_DRIVER_LICENSE_FILE = LICENSE
> +MALI_BIFROST_DRIVER_MODULE_SUBDIRS = r8p0/drivers/gpu/arm/midgard

There is something really odd here: why is this package named
mali-bitfrost-driver if the subdirectory you're building is
r8p0/drivers/gpu/arm/midgard ? bitfrost and midgard are two different
generations of the ARM Mali GPU, at least according to
https://en.wikipedia.org/wiki/Mali_(GPU).

Could you clarify (you or somebody else, for that matter) ?

Thanks!

Thomas
Giulio Benetti Dec. 30, 2021, 3:28 p.m. UTC | #2
Hi Thomas, Miquèl,

On 30/12/21 15:14, Thomas Petazzoni wrote:
> Hello Miquèl,
> 
> On Fri,  6 Mar 2020 08:14:37 +0100
> Miquel Raynal <miquel.raynal@bootlin.com> wrote:
> 
>> +MALI_BIFROST_DRIVER_VERSION = v0.1
>> +MALI_BIFROST_DRIVER_SITE = $(call github,bootlin,mali-bifrost,$(MALI_BIFROST_DRIVER_VERSION))
>> +MALI_BIFROST_DRIVER_DEPENDENCIES = linux
>> +MALI_BIFROST_DRIVER_LICENSE = GPL-2.0
>> +MALI_BIFROST_DRIVER_LICENSE_FILE = LICENSE
>> +MALI_BIFROST_DRIVER_MODULE_SUBDIRS = r8p0/drivers/gpu/arm/midgard
> 
> There is something really odd here: why is this package named
> mali-bitfrost-driver if the subdirectory you're building is
> r8p0/drivers/gpu/arm/midgard ? bitfrost and midgard are two different
> generations of the ARM Mali GPU, at least according to
> https://en.wikipedia.org/wiki/Mali_(GPU).
> 
> Could you clarify (you or somebody else, for that matter) ?

I'm interested too to this ^^^

I had no chance to test it on real hardware for lack of time :-/ so I 
don't know if it works, and it should not be expected to work. I've 
compared r8 version of midgard against bifrost and they are pretty 
different.

I'm working on this patchset in spare time[1] with the goal to create a 
single mali-driver package to deal with Utgard, Midgard and Bifrost.
I've already requested to change repository name from 
mali-bifrost-driver to mali-driver and it's been done plus merging 
patches to allow building with up to Linux 5.15[2].

Thomas, do you want me to send the v2 patchset in[1] to Buildroot 
mailing list? It's not complete at all, but it's some step forward.

[1]: https://github.com/giuliobenetti/buildroot/commits/dev/mali-rebase
[2]: https://github.com/bootlin/mali-driver

Best regards
Thomas Petazzoni Dec. 30, 2021, 4:08 p.m. UTC | #3
Hello,

On Thu, 30 Dec 2021 16:28:57 +0100
Giulio Benetti <giulio.benetti@benettiengineering.com> wrote:

> I had no chance to test it on real hardware for lack of time :-/ so I 
> don't know if it works, and it should not be expected to work. I've 
> compared r8 version of midgard against bifrost and they are pretty 
> different.

I'm pretty sure it works, since I've seen myself the patches from
Miquèl allowing to run Qt5/OpenGL on a Rockchip PX30 platform. I'm
questioning the terminology/choice of naming.

> I'm working on this patchset in spare time[1] with the goal to create a 
> single mali-driver package to deal with Utgard, Midgard and Bifrost.
> I've already requested to change repository name from 
> mali-bifrost-driver to mali-driver and it's been done plus merging 
> patches to allow building with up to Linux 5.15[2].

Ah, we did this rename?

> Thomas, do you want me to send the v2 patchset in[1] to Buildroot 
> mailing list? It's not complete at all, but it's some step forward.

I'm a bit lost with all these renames. We already have
sunxi-mali-mainline-driver in the tree, which points to
https://github.com/mripard/sunxi-mali. I'm not sure which kernel driver
handles which GPU variant.

Best regards,

Thomas
Giulio Benetti Dec. 30, 2021, 4:45 p.m. UTC | #4
On 30/12/21 17:08, Thomas Petazzoni wrote:
> Hello,
> 
> On Thu, 30 Dec 2021 16:28:57 +0100
> Giulio Benetti <giulio.benetti@benettiengineering.com> wrote:
> 
>> I had no chance to test it on real hardware for lack of time :-/ so I
>> don't know if it works, and it should not be expected to work. I've
>> compared r8 version of midgard against bifrost and they are pretty
>> different.
> 
> I'm pretty sure it works, since I've seen myself the patches from
> Miquèl allowing to run Qt5/OpenGL on a Rockchip PX30 platform. I'm
> questioning the terminology/choice of naming.

Ok. Probably Midgard and Bifrost have lot in common on driver side and 
that's why it works. PX30 has a G31-2EE which is a Bifrost:
https://developer.arm.com/ip-products/graphics-and-multimedia/mali-gpus/mali-g31-gpu

So ok, it works but it should be changed. What I can do is providing the 
bifrost driver with the patches for Midgard ported against Bifrost and 
ask the PR. But I don't have time to test and I don't have a working 
PX30 BR defconfig for PX30-Mini-Evb or Engicam PX30 board that I wanted 
to provide.

>> I'm working on this patchset in spare time[1] with the goal to create a
>> single mali-driver package to deal with Utgard, Midgard and Bifrost.
>> I've already requested to change repository name from
>> mali-bifrost-driver to mali-driver and it's been done plus merging
>> patches to allow building with up to Linux 5.15[2].
> 
> Ah, we did this rename?

Yes:
https://github.com/bootlin/mali-driver

> 
>> Thomas, do you want me to send the v2 patchset in[1] to Buildroot
>> mailing list? It's not complete at all, but it's some step forward.
> 
> I'm a bit lost with all these renames. We already have
> sunxi-mali-mainline-driver in the tree, which points to
> https://github.com/mripard/sunxi-mali. I'm not sure which kernel driver
> handles which GPU variant.

mripard/sunxi-mali[1] only deals with Mali Utgard for Sunxi.
The problem is that the mripard/sunxi-mali has a specific platform 
implementation for sunxi:
https://github.com/mripard/sunxi-mali/blob/master/patches/0005-mali-Add-sunxi-platform.patch

While bootlin/mali-driver[2] doesn't have any platform-specific 
implementation. As you've pointed you've tested PX30(Bifrost G31) and it 
works, so that means that G31 doesn't need any specific 
platform-specific implementations. BUT there is 
CONFIG_MALI_PLATFORM_NAME that can be used to point to platform-specific 
implementation(i.e. sunxi):
https://github.com/bootlin/mali-driver/blob/master/r8p0/drivers/gpu/arm/midgard/Kconfig#L72-L79

So what we can do is to add that Sunxi implementation to r6p2 and r8p1 
while adding them to bootlin/mali-driver[2] and remove the actual 
sunxi-mali-mainline-driver BR package.

That way we will end up(for the moment) with these packages:
A1) mali-driver => with all Utgard(Sunxi platform included), Midgard, 
Bifrost versions.
A2) sunxi-mali-mainline => that should change into sunxi-mali-utgard, 
check pending patches[3] for this. And as a second step I would call it 
mali-blobs-sunxi and try to have access from Allwinner to other Blobs 
with license(because I have access to G31 Sunxi blobs but I can't 
publish them) collecting there all Sunxi mali blobs(Utgard, Midgard, 
Bifrost)
A3) mali-blobs-rockchip => with all Rockchip blobs(Utgard, Midgard, 
Bifrost) that we can easily take from rockchip-linux/libmali

This way it becomes easy to add other SoCs drivers and blobs. Steps 
would be:
B1) add platform specific implementation to bootlin/mali-driver(if any)
B2) waiting for PR to be merged
B3) add Buildroot package for the blobs with dependencies on mali-driver 
like mali-blobs-newSoc

Said this, the problem is time for me.

Hope everything is clear.

[1]: https://github.com/mripard/sunxi-mali
[2]: https://github.com/bootlin/mali-driver
[3]: https://patchwork.ozlabs.org/project/buildroot/list/?series=270656

Best regards
Thomas Petazzoni Jan. 8, 2022, 6:07 p.m. UTC | #5
On Fri,  6 Mar 2020 08:14:37 +0100
Miquel Raynal <miquel.raynal@bootlin.com> wrote:

> Add a new package to build and install a generic ARM Mali Bifrost GPU
> Linux kernel module.
> 
> This module is compliant with the standard kernel-module
> infrastructure.
> 
> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> ---
>  package/Config.in                               |  1 +
>  package/mali-bifrost-driver/Config.in           | 17 +++++++++++++++++
>  .../mali-bifrost-driver.hash                    |  3 +++
>  .../mali-bifrost-driver/mali-bifrost-driver.mk  | 15 +++++++++++++++
>  4 files changed, 36 insertions(+)
>  create mode 100644 package/mali-bifrost-driver/Config.in
>  create mode 100644 package/mali-bifrost-driver/mali-bifrost-driver.hash
>  create mode 100644 package/mali-bifrost-driver/mali-bifrost-driver.mk

I finally applied, after renaming to "mali-driver", updating to the
latest version, and doing a few small changes.

Thomas
diff mbox series

Patch

diff --git a/package/Config.in b/package/Config.in
index f2217ee1d5..f9f71fc9eb 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -483,6 +483,7 @@  endmenu
 	source "package/lsuio/Config.in"
 	source "package/luksmeta/Config.in"
 	source "package/lvm2/Config.in"
+	source "package/mali-bifrost-driver/Config.in"
 	source "package/mali-t76x/Config.in"
 	source "package/mdadm/Config.in"
 	source "package/mdevd/Config.in"
diff --git a/package/mali-bifrost-driver/Config.in b/package/mali-bifrost-driver/Config.in
new file mode 100644
index 0000000000..c278048b98
--- /dev/null
+++ b/package/mali-bifrost-driver/Config.in
@@ -0,0 +1,17 @@ 
+comment "Mali Bifrost driver needs a Linux kernel to be built"
+	depends on BR2_PACKAGE_MALI_BIFROST_DRIVER
+	depends on !BR2_LINUX_KERNEL
+
+config BR2_PACKAGE_MALI_BIFROST_DRIVER
+	bool "mali-bifrost-driver"
+	default n
+	depends on BR2_PACKAGE_ROCKCHIP_MALI_BIFROST # runtime
+	depends on BR2_LINUX_KERNEL
+	help
+	  This package builds and installs the Linux kernel driver for
+	  the Mali Bifrost GPU, compatible with recent Linux kernels
+	  (>= 5.4). Note that it should be installed together with the
+	  corresponding userspace OpenGL libraries, which are usually
+	  provided as binaries only by hardware vendors.
+
+	  mali-bifrost-driver requires a Linux kernel >= 5.4.
diff --git a/package/mali-bifrost-driver/mali-bifrost-driver.hash b/package/mali-bifrost-driver/mali-bifrost-driver.hash
new file mode 100644
index 0000000000..40d3b749bf
--- /dev/null
+++ b/package/mali-bifrost-driver/mali-bifrost-driver.hash
@@ -0,0 +1,3 @@ 
+# Locally calculated
+sha256 915873382580ba86518ee0552980ce9726d51a819c90548e31dc4a528d532b1a  mali-bifrost-driver-v0.1.tar.gz
+sha256 8177f97513213526df2cf6184d8ff986c675afb514d4e68a404010521b880643  LICENSE
diff --git a/package/mali-bifrost-driver/mali-bifrost-driver.mk b/package/mali-bifrost-driver/mali-bifrost-driver.mk
new file mode 100644
index 0000000000..5d1990676e
--- /dev/null
+++ b/package/mali-bifrost-driver/mali-bifrost-driver.mk
@@ -0,0 +1,15 @@ 
+################################################################################
+#
+# mali-bifrost-driver
+#
+################################################################################
+
+MALI_BIFROST_DRIVER_VERSION = v0.1
+MALI_BIFROST_DRIVER_SITE = $(call github,bootlin,mali-bifrost,$(MALI_BIFROST_DRIVER_VERSION))
+MALI_BIFROST_DRIVER_DEPENDENCIES = linux
+MALI_BIFROST_DRIVER_LICENSE = GPL-2.0
+MALI_BIFROST_DRIVER_LICENSE_FILE = LICENSE
+MALI_BIFROST_DRIVER_MODULE_SUBDIRS = r8p0/drivers/gpu/arm/midgard
+
+$(eval $(kernel-module))
+$(eval $(generic-package))