Skip to contentSkip to conversation

ARM Mali Graphics Drivers

RFC New Spenser Gilliland 3 participants 16 messages Jul 14, 2013 – Jul 18, 2013 Arm/Allwinner sunXi SoC support

lore
Share & tools
lore
#0 lore raw

cover ARM Mali Graphics Drivers

This is an RFC for the addition of the ARM Mali graphics driver for Allwinner based systems.

WARNING: This patch series has not been runtime tested.

TODO:
- Fix build bug on test program.
- Runtime testing.

Spenser Gilliland (3):
a10disp: new package
sunxi-mali: new package
opengl: add sunxi-mali as possible egl/gles provider

 package/Config.in                          |  3 ++
 package/a10disp/Config.in                  | 11 +++++
 package/a10disp/a10disp.mk                 | 21 ++++++++
 package/opengl/libegl/libegl.mk            |  4 ++
 package/opengl/libgles/libgles.mk          |  4 ++
 package/sunxi-mali-prop/Config.in          |  2 +
 package/sunxi-mali-prop/sunxi-mali-prop.mk | 10 ++++
 package/sunxi-mali/Config.in               | 65 ++++++++++++++++++++++++
 package/sunxi-mali/S80mali                 | 56 +++++++++++++++++++++
 package/sunxi-mali/egl.pc                  | 12 +++++
 package/sunxi-mali/glesv2.pc               | 12 +++++
 package/sunxi-mali/sunxi-mali.mk           | 79 ++++++++++++++++++++++++++++++
 12 files changed, 279 insertions(+)
 create mode 100644 package/a10disp/Config.in
 create mode 100644 package/a10disp/a10disp.mk
 create mode 100644 package/sunxi-mali-prop/Config.in
 create mode 100644 package/sunxi-mali-prop/sunxi-mali-prop.mk
 create mode 100644 package/sunxi-mali/Config.in
 create mode 100644 package/sunxi-mali/S80mali
 create mode 100644 package/sunxi-mali/egl.pc
 create mode 100644 package/sunxi-mali/glesv2.pc
 create mode 100644 package/sunxi-mali/sunxi-mali.mk
Signature · 1 line
1.8.1.2
#1 lore raw

RFC 1/3 a10disp: new package

---
 package/Config.in          |  1 +
 package/a10disp/Config.in  | 11 +++++++++++
 package/a10disp/a10disp.mk | 21 +++++++++++++++++++++
 3 files changed, 33 insertions(+)
 create mode 100644 package/a10disp/Config.in
 create mode 100644 package/a10disp/a10disp.mk
package/Config.in +1 -0
index 7c24dab..f565dd4 100644
@@ -227,6 +227,7 @@ source "package/ux500-firmware/Config.in"
 source "package/zd1211-firmware/Config.in"
 endmenu
 source "package/freescale-imx/Config.in"
+source "package/a10disp/Config.in"
 source "package/acpid/Config.in"
 source "package/cdrkit/Config.in"
 source "package/dbus/Config.in"
package/a10disp/Config.in new file +11 -0
new file mode 100644
index 0000000..60ba44c
@@ -0,0 +1,11 @@
+config BR2_PACKAGE_A10DISP
+	bool "a10disp"
+	depends on BR2_LINUX_KERNEL && BR2_arm
+	help
+	  Program to change the display mode of Allwinner devices running
+	  linux-sunxi.
+
+	  http://github.com/hglm/a10disp
+
+comment "a10disp requires the linux kernel"
+	depends on !(BR2_LINUX_KERNEL) && BR2_arm
package/a10disp/a10disp.mk new file +21 -0
new file mode 100644
index 0000000..bac515a
@@ -0,0 +1,21 @@
+################################################################################
+#
+# a10disp
+#
+################################################################################
+
+A10DISP_VERSION = a899cc6dcf
+A10DISP_SITE = http://github.com/hglm/a10disp/tarball/$(A10DISP_VERSION)
+
+A10DISP_DEPENDENCIES = linux
+
+define A10DISP_BUILD_CMDS
+   cp -f $(LINUX_DIR)/include/video/sunxi_disp_ioctl.h $(@D)/
+   cd $(@D) && $(TARGET_CC) -Wall -O a10disp.c -o a10disp
+endef
+
+define A10DISP_INSTALL_TARGET_CMDS
+	$(INSTALL) -m 0755 $(@D)/a10disp $(TARGET_DIR)/usr/bin/
+endef
+
+$(eval $(generic-package))
Signature · 1 line
1.8.1.2
#2 lore raw

RFC 1/3 a10disp: new package

Dear Spenser Gilliland,

Great to see the beginning of the work on Allwinner devices!

package/a10disp/Config.in line 6

Quoted 12 lines · Spenser Gilliland
package/a10disp/Config.in new file +6 -0
new file mode 100644
index 0000000..60ba44c
@@ -0,0 +1,11 @@
+config BR2_PACKAGE_A10DISP
+	bool "a10disp"
+	depends on BR2_LINUX_KERNEL && BR2_arm
+	help
+	  Program to change the display mode of Allwinner devices running
+	  linux-sunxi.

I'd make this a little bit more explicit:

Program to change the display mode on Allwinner ARM SOCs running the linux-sunxi kernel (and not the mainline kernel).

package/a10disp/Config.in line 11

Quoted 5 lines
package/a10disp/Config.in new file +5 -0
+
+	  http://github.com/hglm/a10disp
+
+comment "a10disp requires the linux kernel"
+	depends on !(BR2_LINUX_KERNEL) && BR2_arm

Parenthesis not needed.

Quoted 10 lines
package/a10disp/a10disp.mk new file +4 -0
new file mode 100644
index 0000000..bac515a
@@ -0,0 +1,21 @@
+################################################################################
+#
+# a10disp
+#

package/a10disp/a10disp.mk line 14

Quoted 10 lines
package/a10disp/a10disp.mk new file +10 -0
+################################################################################
+
+A10DISP_VERSION = a899cc6dcf
+A10DISP_SITE = http://github.com/hglm/a10disp/tarball/$(A10DISP_VERSION)
+
+A10DISP_DEPENDENCIES = linux
+
+define A10DISP_BUILD_CMDS
+   cp -f $(LINUX_DIR)/include/video/sunxi_disp_ioctl.h $(@D)/
+   cd $(@D) && $(TARGET_CC) -Wall -O a10disp.c -o a10disp

Tabs preferred for indentation here. Also, hardcoding the -Wall and -O flags is not really great. Instead, can we do something like:

	cp -f $(LINUX_DIR)/include/video/sunxi_disp_ioctl.h $(@D)/
	$(TARGET_CC) $(TARGET_CFLAGS) -o $(@D)/a10disp $(@D)/a10disp.c

package/a10disp/a10disp.mk line 18

Quoted 4 lines
package/a10disp/a10disp.mk new file +4 -0
+endef
+
+define A10DISP_INSTALL_TARGET_CMDS
+	$(INSTALL) -m 0755 $(@D)/a10disp $(TARGET_DIR)/usr/bin/
	$(INSTALL) -D -m 0755 $(@D)/a10disp $(TARGET_DIR)/usr/bin/a10disp

Thanks!

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#3 lore raw

RFC 1/3 a10disp: new package

Thomas,

Quoted 8 lines

Dear Spenser Gilliland,

Great to see the beginning of the work on Allwinner devices!

I'd make this a little bit more explicit:

Program to change the display mode on Allwinner ARM SOCs running the linux-sunxi kernel (and not the mainline kernel).

Will fix.

Quoted 7 lines

package/a10disp/Config.in line 11

Quoted 5 lines
package/a10disp/Config.in new file +5 -0
+
+       http://github.com/hglm/a10disp
+
+comment "a10disp requires the linux kernel"
+     depends on !(BR2_LINUX_KERNEL) && BR2_arm

Parenthesis not needed.

Will fix.

Quoted 15 lines
Quoted 15 lines
package/a10disp/a10disp.mk new file +9 -0
new file mode 100644
index 0000000..bac515a
@@ -0,0 +1,21 @@
+################################################################################
+#
+# a10disp
+#
+################################################################################
+
+A10DISP_VERSION = a899cc6dcf
+A10DISP_SITE = http://github.com/hglm/a10disp/tarball/$(A10DISP_VERSION)
+
Quoted 8 lines

package/a10disp/a10disp.mk line 14

Quoted 5 lines
package/a10disp/a10disp.mk new file +5 -0
+A10DISP_DEPENDENCIES = linux
+
+define A10DISP_BUILD_CMDS
+   cp -f $(LINUX_DIR)/include/video/sunxi_disp_ioctl.h $(@D)/
+   cd $(@D) && $(TARGET_CC) -Wall -O a10disp.c -o a10disp

Tabs preferred for indentation here. Also, hardcoding the -Wall and -O flags is not really great. Instead, can we do something like:

Sometimes I think vim is randomly choosing indentation for me. Will fix.

Quoted 9 lines
        cp -f $(LINUX_DIR)/include/video/sunxi_disp_ioctl.h $(@D)/
        $(TARGET_CC) $(TARGET_CFLAGS) -o $(@D)/a10disp $(@D)/a10disp.c

package/a10disp/a10disp.mk line 18

Quoted 4 lines
package/a10disp/a10disp.mk new file +4 -0
+endef
+
+define A10DISP_INSTALL_TARGET_CMDS
+     $(INSTALL) -m 0755 $(@D)/a10disp $(TARGET_DIR)/usr/bin/
        $(INSTALL) -D -m 0755 $(@D)/a10disp $(TARGET_DIR)/usr/bin/a10disp

Will fix.

Thanks,
Spenser

#4 lore raw

RFC 2/3 sunxi-mali: new package

In reply to Spenser Gilliland
---
 package/Config.in                          |  2 +
 package/sunxi-mali-prop/Config.in          |  2 +
 package/sunxi-mali-prop/sunxi-mali-prop.mk | 10 ++++
 package/sunxi-mali/Config.in               | 65 ++++++++++++++++++++++++
 package/sunxi-mali/S80mali                 | 56 +++++++++++++++++++++
 package/sunxi-mali/egl.pc                  | 12 +++++
 package/sunxi-mali/glesv2.pc               | 12 +++++
 package/sunxi-mali/sunxi-mali.mk           | 79 ++++++++++++++++++++++++++++++
 8 files changed, 238 insertions(+)
 create mode 100644 package/sunxi-mali-prop/Config.in
 create mode 100644 package/sunxi-mali-prop/sunxi-mali-prop.mk
 create mode 100644 package/sunxi-mali/Config.in
 create mode 100644 package/sunxi-mali/S80mali
 create mode 100644 package/sunxi-mali/egl.pc
 create mode 100644 package/sunxi-mali/glesv2.pc
 create mode 100644 package/sunxi-mali/sunxi-mali.mk
package/Config.in +2 -0
index f565dd4..9ee7c90 100644
@@ -292,6 +292,8 @@ source "package/smartmontools/Config.in"
 source "package/snowball-hdmiservice/Config.in"
 source "package/sredird/Config.in"
 source "package/statserial/Config.in"
+source "package/sunxi-mali/Config.in"
+source "package/sunxi-mali-prop/Config.in"
 source "package/sysstat/Config.in"
 source "package/ti-utils/Config.in"
 source "package/uboot-tools/Config.in"
package/sunxi-mali-prop/Config.in new file +2 -0
new file mode 100644
index 0000000..26511a7
@@ -0,0 +1,2 @@
+config BR2_PACKAGE_SUNXI_MALI_PROP
+	bool
package/sunxi-mali-prop/sunxi-mali-prop.mk new file +10 -0
new file mode 100644
index 0000000..f745731
@@ -0,0 +1,10 @@
+################################################################################
+#
+# sunxi-mali
+#
+################################################################################
+
+SUNXI_MALI_PROP_VERSION = e4ced47
+SUNXI_MALI_PROP_SITE = http://github.com/linux-sunxi/sunxi-mali-proprietary/tarball/$(SUNXI_MALI_PROP_VERSION)
+
+$(eval $(generic-package))
package/sunxi-mali/Config.in new file +65 -0

65 lines not on this page · raw message

package/sunxi-mali/S80mali new file +56 -0

56 lines not on this page · raw message

package/sunxi-mali/egl.pc new file +12 -0
new file mode 100644
index 0000000..56e3990
@@ -0,0 +1,12 @@
+prefix=/usr/
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+
+Name: egl
+Description: ARM Mali implementation of EGL
+Version: 1.4
+Requires:
+Libs: -L${libdir} -lEGL -lGLESv2 -lUMP
+Cflags: -I{includedir}/EGL/ -I${includedir}
+
package/sunxi-mali/glesv2.pc new file +12 -0
new file mode 100644
index 0000000..4e112ee
@@ -0,0 +1,12 @@
+prefix=/usr
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+
+Name: glesv2
+Description: ARM Mali implementation of OpenGL ESv2
+Version: 2.0
+Requires:
+Libs: -L${libdir} -lGLESv2 -lGLES_CM -lUMP
+Cflags: -I${includedir}/GLES2
+
package/sunxi-mali/sunxi-mali.mk new file +79 -0

79 lines not on this page · raw message

Signature · 1 line
1.8.1.2
#5 lore raw

RFC 2/3 sunxi-mali: new package

Dear Spenser Gilliland,

Quoted 6 lines · Spenser Gilliland
---
 package/Config.in                          |  2 +
 package/sunxi-mali-prop/Config.in          |  2 +
 package/sunxi-mali-prop/sunxi-mali-prop.mk | 10 ++++

It'd be great to have some explanations about what is this sunxi-mali-prop compared to sunxi-mali. At least in the commit log, maybe even somewhere in the source code (but I'm not sure where).

Quoted 33 lines
 package/sunxi-mali/Config.in               | 65 ++++++++++++++++++++++++
 package/sunxi-mali/S80mali                 | 56 +++++++++++++++++++++
 package/sunxi-mali/egl.pc                  | 12 +++++
 package/sunxi-mali/glesv2.pc               | 12 +++++
 package/sunxi-mali/sunxi-mali.mk           | 79 ++++++++++++++++++++++++++++++
 8 files changed, 238 insertions(+)
 create mode 100644 package/sunxi-mali-prop/Config.in
 create mode 100644 package/sunxi-mali-prop/sunxi-mali-prop.mk
 create mode 100644 package/sunxi-mali/Config.in
 create mode 100644 package/sunxi-mali/S80mali
 create mode 100644 package/sunxi-mali/egl.pc
 create mode 100644 package/sunxi-mali/glesv2.pc
 create mode 100644 package/sunxi-mali/sunxi-mali.mk
package/Config.in +2 -0
index f565dd4..9ee7c90 100644
@@ -292,6 +292,8 @@ source "package/smartmontools/Config.in"
 source "package/snowball-hdmiservice/Config.in"
 source "package/sredird/Config.in"
 source "package/statserial/Config.in"
+source "package/sunxi-mali/Config.in"
+source "package/sunxi-mali-prop/Config.in"
 source "package/sysstat/Config.in"
 source "package/ti-utils/Config.in"
 source "package/uboot-tools/Config.in"
package/sunxi-mali-prop/Config.in new file +0 -0
new file mode 100644
index 0000000..26511a7

package/sunxi-mali-prop/Config.in line 2

Quoted 2 lines
package/sunxi-mali-prop/Config.in new file +2 -0
@@ -0,0 +1,2 @@
+config BR2_PACKAGE_SUNXI_MALI_PROP
+	bool

Maybe you need to select this from sunxi-mali/Config.in ?

package/sunxi-mali-prop/sunxi-mali-prop.mk line 3

Quoted 9 lines
package/sunxi-mali-prop/sunxi-mali-prop.mk new file +3 -0
new file mode 100644
index 0000000..f745731
@@ -0,0 +1,10 @@
+################################################################################
+#
+# sunxi-mali

sunxi-mali-prop

Quoted 13 lines
package/sunxi-mali-prop/sunxi-mali-prop.mk new file +7 -0
+#
+################################################################################
+
+SUNXI_MALI_PROP_VERSION = e4ced47
+SUNXI_MALI_PROP_SITE = http://github.com/linux-sunxi/sunxi-mali-proprietary/tarball/$(SUNXI_MALI_PROP_VERSION)
+
+$(eval $(generic-package))
package/sunxi-mali/Config.in new file +0 -0
new file mode 100644
index 0000000..d1ad173

package/sunxi-mali/Config.in line 5

Quoted 5 lines
package/sunxi-mali/Config.in new file +5 -0
@@ -0,0 +1,65 @@
+config BR2_PACKAGE_SUNXI_MALI
+	bool "sunxi-mali"
+	select BR2_PACKAGE_HAS_OPENGL_EGL
+	select BR2_PACKAGE_HAS_OPENGL_ES
+	depends on BR2_TOOLCHAIN_USES_GLIBC && BR2_arm

As suggested above: select BR2_PACKAGE_SUNXI_MALI_PROP.

Just curious: there is no kernel modules?

Quoted 7 lines
package/sunxi-mali/Config.in new file +7 -0
+	help
+	  Install the ARM Mali drivers for sunxi based systems.
+
+	  http://github.com/linux-sunxi/sunxi-mali
+
+if BR2_PACKAGE_SUNXI_MALI
+

package/sunxi-mali/Config.in line 22

Quoted 10 lines
package/sunxi-mali/Config.in new file +10 -0
+config BR2_PACKAGE_SUNXI_MALI_DBG
+	bool "install malitest and maliver tools"
+	help
+	  Install 3D triangle demo malitest application and the maliver application
+	  which describes the kernel module version.
+
+config BR2_PACKAGE_SUNXI_MALI_HARDFP
+	bool "use hard float binaries"
+	help
+	  Install hard float binaries (required if using a hard float toolchain)

Hopefully with my EABIhf series this can be refactored, but ok for now.

Quoted 7 lines
package/sunxi-mali/Config.in new file +7 -0
+
+choice
+	prompt "type of EGL binaries to install"
+	default BR2_PACKAGE_SUNXI_FB
+	help
+	  Which EGL_TYPE binaries should be installed?
+

package/sunxi-mali/Config.in line 39

Quoted 10 lines
package/sunxi-mali/Config.in new file +10 -0
+config BR2_PACKAGE_SUNXI_MALI_FB
+	bool "framebuffer"
+	help
+	  Install framebuffer compatible binaries
+
+# TODO: Add X11 support
+#config BR2_PACKAGE_SUNXI_MALI_X11
+#	bool "X11"
+#	help
+#	  Install X11 compatible binaries

Does this requires a specific Mali X11 driver? Is it something you intend to package in this first version of sunxi-mali, or something you intend to do later (in which case you could remove this choice for now).

Quoted 7 lines
package/sunxi-mali/Config.in new file +7 -0
+endchoice
+
+choice
+	prompt "Version"
+	default BR2_PACKAGE_SUNXI_MALI_R3P1
+	help
+	  Select the version of the Sunxi Mali binaries to install.

package/sunxi-mali/Config.in line 57

Quoted 10 lines
package/sunxi-mali/Config.in new file +10 -0
+
+config BR2_PACKAGE_SUNXI_MALI_R2P4
+	bool "r2p4"
+
+config BR2_PACKAGE_SUNXI_MALI_R3P0
+	bool "r3p0"
+
+config BR2_PACKAGE_SUNXI_MALI_R3P1
+	depends on BR2_PACKAGE_SUNXI_MALI_HARDFP
+	bool "r3p1"

I wouldn't know how to chose between the three possibilities here, some more help would be nice. Also, maybe add a comment for the r3p1 being not available on !EABIhf systems.

package/sunxi-mali/Config.in line 64

Quoted 6 lines
package/sunxi-mali/Config.in new file +6 -0
+endchoice
+
+endif
+
+comment "sunxi-mali requires an eglibc/glibc based toolchain"
+	depends on !(BR2_TOOLCHAIN_USES_GLIBC) && BR2_arm

Parenthesis unneeded.

Quoted 11 lines
package/sunxi-mali/S80mali new file +5 -0
new file mode 100644
index 0000000..22976b6
@@ -0,0 +1,56 @@
+#!/bin/sh -e
+
+install_driver() {
+	DRIVER=$1
+	OPTS=$2

package/sunxi-mali/S80mali line 15

Quoted 10 lines
package/sunxi-mali/S80mali new file +10 -0
+
+	modprobe $DRIVER $OPTS
+	maj=$(awk "$$2==\"${DRIVER}\" { print $$1; }" /proc/devices)
+
+	if [ -e /dev/${DRIVER} ]; then
+		rm -f /dev/${DRIVER}
+	fi
+
+	mknod /dev/${DRIVER} c $maj 0
+	chmod 666 /dev/${DRIVER}

600.

Quoted 88 lines
package/sunxi-mali/S80mali new file +41 -0
+}
+
+start() {
+	echo "mali: starting driver"
+
+	BITSPERPIXEL="$(fbset | awk '/geom/ {print $6}')"
+	YRES="$(fbset | awk '/geom/ {print $3}')"
+	# Set RGBA ordering to something the drivers like
+	if [ "$BITSPERPIXEL" = "32" ] ; then
+		fbset -rgba 8/16,8/8,8/0,8/24
+	fi
+	# Try to enable triple buffering when there's enough VRAM
+	fbset -vyres $(( YRES*3 ))
+
+	install_driver mali
+	install_driver ump
+}	
+
+stop() {
+	echo "mali: stopping driver"
+
+	rmmod ump
+	rmmod mali
+}
+
+case "$1" in 
+start)
+	start
+;;
+stop)
+	stop
+;;
+restart)
+	stop
+	start
+;;
+*)
+	echo "mali: Please use start, stop, or restart."
+	exit 1
+;;
+esac
package/sunxi-mali/egl.pc new file +12 -0
new file mode 100644
index 0000000..56e3990
@@ -0,0 +1,12 @@
+prefix=/usr/
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+
+Name: egl
+Description: ARM Mali implementation of EGL
+Version: 1.4
+Requires:
+Libs: -L${libdir} -lEGL -lGLESv2 -lUMP
+Cflags: -I{includedir}/EGL/ -I${includedir}
+
package/sunxi-mali/glesv2.pc new file +12 -0
new file mode 100644
index 0000000..4e112ee
@@ -0,0 +1,12 @@
+prefix=/usr
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+
+Name: glesv2
+Description: ARM Mali implementation of OpenGL ESv2
+Version: 2.0
+Requires:
+Libs: -L${libdir} -lGLESv2 -lGLES_CM -lUMP
+Cflags: -I${includedir}/GLES2
+
package/sunxi-mali/sunxi-mali.mk new file +5 -0
new file mode 100644
index 0000000..693e454
@@ -0,0 +1,79 @@
+################################################################################
+#
+# sunxi-mali
+#
+################################################################################

package/sunxi-mali/sunxi-mali.mk line 15

Quoted 10 lines
package/sunxi-mali/sunxi-mali.mk new file +10 -0
+
+SUNXI_MALI_VERSION = c2491fe952
+SUNXI_MALI_SITE = http://github.com/linux-sunxi/sunxi-mali/tarball/$(SUNXI_MALI_VERSION)
+
+SUNXI_MALI_DEPENDENCIES = sunxi-mali-prop
+SUNXI_MALI_INSTALL_STAGING = YES
+
+define SUNXI_MALI_CONFIGURE_CMDS
+	rm -rf $(@D)/lib/mali
+	cp -rf $(SUNXI_MALI_PROP_DIR) $(@D)/lib/mali

So you're replacing the original lib/mali directory with the data from the sunxi-mali-prop package. This is probably the good place to explain why this is needed.

Also, I would put this in a post-extract hook rather than in the configure commands.

package/sunxi-mali/sunxi-mali.mk line 20

Quoted 5 lines
package/sunxi-mali/sunxi-mali.mk new file +5 -0
+endef
+
+SUNXI_MALI_MAKE_ENV = \
+	CC=$(TARGET_CC) \
+	CFLAGS="$(TARGET_CFLAGS)" \

These are generally passed as arguments of make rather than in the environment. It doesn't work in your case?

Quoted 20 lines
package/sunxi-mali/sunxi-mali.mk new file +20 -0
+	$(TARGET_MAKE_ENV)
+
+
+ifeq ($(BR2_PACKAGE_SUNXI_MALI_HARDFP),y)
+SUNXI_MALI_MAKE_OPTS += ABI=armhf
+else
+SUNXI_MALI_MAKE_OPTS += ABI=armel
+endif
+
+ifeq ($(BR2_PACKAGE_SUNXI_MALI_FB),y)
+SUNXI_MALI_MAKE_OPTS += EGL_TYPE=framebuffer
+else
+SUNXI_MALI_MAKE_OPTS += EGL_TYPE=x11
+endif
+
+ifeq ($(BR2_PACKAGE_SUNXI_MALI_R2P4),y)
+SUNXI_MALI_MAKE_OPTS += VERSION=r2p4
+endif
+ifeq ($(BR2_PACKAGE_SUNXI_MALI_R3P0),y)
+SUNXI_MALI_MAKE_OPTS += VERISON=r3p0

package/sunxi-mali/sunxi-mali.mk line 50

Quoted 10 lines
package/sunxi-mali/sunxi-mali.mk new file +10 -0
+endif
+ifeq ($(BR2_PACKAGE_SUNXI_MALI_R3P1),y)
+SUNXI_MALI_MAKE_OPTS += VERSION=r3p1
+endif
+
+define SUNXI_MALI_BUILD_CMDS
+	$(SUNXI_MALI_MAKE_ENV) $(MAKE) -C $(@D) $(SUNXI_MALI_MAKE_OPTS) all
+	$(if $(BR2_PACKAGE_SUNXI_MALI_DBG), 
+		cd $(@D)/version && \
+			$(TARGET_CC) $(SUNXI_MALI_CFLAGS) -o version version.c; \

SUNXI_MALI_CFLAGS isn't defined anywhere from what I can see. Also, I believe that you could build this C file unconditionally, it's not going to take a huge amount of time:

	$(TARGET_CC) $(TARGET_CFLAGS) -o $(@D)/version/version $(@D)/version/version.c

package/sunxi-mali/sunxi-mali.mk line 59

Quoted 9 lines
package/sunxi-mali/sunxi-mali.mk new file +9 -0
+	)
+endef
+
+define SUNXI_MALI_INSTALL_STAGING_CMDS
+	$(SUNXI_MALI_MAKE_ENV) $(MAKE) -C $(@D) \
+		$(SUNXI_MALI_MAKE_OPTS) DESTDIR=$(STAGING_DIR) install
+	$(if $(BR2_PACKAGE_SUNXI_MALI_DBG),
+		# test must be built after install because it depends on headers that are
+		# generated during the install above.

Yurk :-(

package/sunxi-mali/sunxi-mali.mk line 63

Quoted 4 lines
package/sunxi-mali/sunxi-mali.mk new file +4 -0
+		$(SUNXI_MALI_MAKE_ENV) $(MAKE) -C $(@D) $(SUNXI_MALI_MAKE_OPTS) test
+	)
+	$(INSTALL) -D -m 0644 package/sunxi-mali/egl.pc $(STAGING_DIR)/usr/lib/pkgconfig/
+	$(INSTALL) -D -m 0644 package/sunxi-mali/glesv2.pc $(STAGING_DIR)/usr/lib/pkgconfig/

The destination path must indicate the complete filename when using -D.

Quoted 6 lines
package/sunxi-mali/sunxi-mali.mk new file +6 -0
+endef
+
+define SUNXI_MALI_INSTALL_TARGET_CMDS
+	$(SUNXI_MALI_MAKE_ENV) $(MAKE) -C $(@D)/lib \
+		$(SUNXI_MALI_MAKE_OPTS) DESTDIR=$(TARGET_DIR) install
+	$(if $(BR2_PACKAGE_SUNXI_MALI_DBG),

package/sunxi-mali/sunxi-mali.mk line 79

Quoted 10 lines
package/sunxi-mali/sunxi-mali.mk new file +10 -0
+		$(INSTALL) -m 755 $(@D)/version/version $(TARGET_DIR)/usr/bin/maliver; \
+		$(INSTALL) -m 755 $(@D)/test/test       $(TARGET_DIR)/usr/bin/malitest
+	)
+endef
+
+define SUNXI_MALI_INSTALL_INIT_SYSV
+	$(INSTALL) -D -m 0755 package/sunxi-mali/S80mali $(TARGET_DIR)/etc/init.d/
+endef
+
+$(eval $(generic-package))

Otherwise looks good. Seems like the sunxi-mali stuff is a little bit less horrible than the ti-gfx thing :-)

Best regards,

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#6 lore raw

RFC 2/3 sunxi-mali: new package

Thomas,

Quoted 3 lines

It'd be great to have some explanations about what is this sunxi-mali-prop compared to sunxi-mali. At least in the commit log, maybe even somewhere in the source code (but I'm not sure where).

Basically, sunxi-mali-prop is a git submodule of sunxi-mali. It is copied into the lib/mali directory to emulate this configuration. (doesn't work as a symlink unfortunately)

Quoted 4 lines

package/sunxi-mali-prop/Config.in line 2

Quoted 2 lines
package/sunxi-mali-prop/Config.in new file +2 -0
+config BR2_PACKAGE_SUNXI_MALI_PROP
+     bool

Maybe you need to select this from sunxi-mali/Config.in ?

Will fix.

Quoted 11 lines

package/sunxi-mali-prop/sunxi-mali-prop.mk line 3

Quoted 9 lines
package/sunxi-mali-prop/sunxi-mali-prop.mk new file +3 -0
new file mode 100644
index 0000000..f745731
@@ -0,0 +1,10 @@
+################################################################################
+#
+# sunxi-mali

sunxi-mali-prop

Will fix.

Quoted 12 lines
Quoted 12 lines
package/sunxi-mali-prop/sunxi-mali-prop.mk new file +7 -0
+#
+################################################################################
+
+SUNXI_MALI_PROP_VERSION = e4ced47
+SUNXI_MALI_PROP_SITE = http://github.com/linux-sunxi/sunxi-mali-proprietary/tarball/$(SUNXI_MALI_PROP_VERSION)
+
+$(eval $(generic-package))
package/sunxi-mali/Config.in new file +0 -0
new file mode 100644
index 0000000..d1ad173
Quoted 8 lines

package/sunxi-mali/Config.in line 5

Quoted 6 lines
package/sunxi-mali/Config.in new file +5 -0
@@ -0,0 +1,65 @@
+config BR2_PACKAGE_SUNXI_MALI
+     bool "sunxi-mali"
+     select BR2_PACKAGE_HAS_OPENGL_EGL
+     select BR2_PACKAGE_HAS_OPENGL_ES
+     depends on BR2_TOOLCHAIN_USES_GLIBC && BR2_arm

As suggested above: select BR2_PACKAGE_SUNXI_MALI_PROP.

Will fix.

Quoted 1 line

Just curious: there is no kernel modules?

Well, yes and no. There is the possibility to build the external module. However, it is included by default in the sunxi-linux kernel.
See https://github.com/linux-sunxi/mali-400-kernel-drivers for the
external module.

Quoted 11 lines
Quoted 11 lines
package/sunxi-mali/Config.in new file +11 -0
+     help
+       Install the ARM Mali drivers for sunxi based systems.
+
+       http://github.com/linux-sunxi/sunxi-mali
+
+if BR2_PACKAGE_SUNXI_MALI
+
+config BR2_PACKAGE_SUNXI_MALI_DBG
+     bool "install malitest and maliver tools"
+     help
+       Install 3D triangle demo malitest application and the maliver application
Quoted 8 lines

package/sunxi-mali/Config.in line 22

Quoted 6 lines
package/sunxi-mali/Config.in new file +6 -0
+       which describes the kernel module version.
+
+config BR2_PACKAGE_SUNXI_MALI_HARDFP
+     bool "use hard float binaries"
+     help
+       Install hard float binaries (required if using a hard float toolchain)

Hopefully with my EABIhf series this can be refactored, but ok for now.

Will fix.

Quoted 13 lines
Quoted 13 lines
package/sunxi-mali/Config.in new file +13 -0
+
+choice
+     prompt "type of EGL binaries to install"
+     default BR2_PACKAGE_SUNXI_FB
+     help
+       Which EGL_TYPE binaries should be installed?
+
+config BR2_PACKAGE_SUNXI_MALI_FB
+     bool "framebuffer"
+     help
+       Install framebuffer compatible binaries
+
+# TODO: Add X11 support
Quoted 8 lines

package/sunxi-mali/Config.in line 39

Quoted 4 lines
package/sunxi-mali/Config.in new file +4 -0
+#config BR2_PACKAGE_SUNXI_MALI_X11
+#    bool "X11"
+#    help
+#      Install X11 compatible binaries

Does this requires a specific Mali X11 driver? Is it something you intend to package in this first version of sunxi-mali, or something you intend to do later (in which case you could remove this choice for now).

There is an x11 driver here
https://github.com/linux-sunxi/xf86-video-mali . However, I was planning to add this in a later patch series. So, I'll just delete it for now.

Quoted 13 lines
Quoted 13 lines
package/sunxi-mali/Config.in new file +13 -0
+endchoice
+
+choice
+     prompt "Version"
+     default BR2_PACKAGE_SUNXI_MALI_R3P1
+     help
+       Select the version of the Sunxi Mali binaries to install.
+
+config BR2_PACKAGE_SUNXI_MALI_R2P4
+     bool "r2p4"
+
+config BR2_PACKAGE_SUNXI_MALI_R3P0
+     bool "r3p0"
Quoted 8 lines

package/sunxi-mali/Config.in line 57

Quoted 4 lines
package/sunxi-mali/Config.in new file +4 -0
+
+config BR2_PACKAGE_SUNXI_MALI_R3P1
+     depends on BR2_PACKAGE_SUNXI_MALI_HARDFP
+     bool "r3p1"

I wouldn't know how to chose between the three possibilities here, some more help would be nice. Also, maybe add a comment for the r3p1 being not available on !EABIhf systems.

I'm having trouble finding a description of what cores use which version of the libs. The best method is to install and use the maliver application to determine the appropriate version. I'll add info about this to the help text. Also, I will add the !EABIHF comment.

Quoted 9 lines

package/sunxi-mali/Config.in line 64

Quoted 7 lines
package/sunxi-mali/Config.in new file +6 -0
+endchoice
+
+endif
+
+comment "sunxi-mali requires an eglibc/glibc based toolchain"
+     depends on !(BR2_TOOLCHAIN_USES_GLIBC) && BR2_arm

Parenthesis unneeded.

Will fix.

Quoted 16 lines
Quoted 16 lines
package/sunxi-mali/S80mali new file +9 -0
new file mode 100644
index 0000000..22976b6
@@ -0,0 +1,56 @@
+#!/bin/sh -e
+
+install_driver() {
+     DRIVER=$1
+     OPTS=$2
+
+     modprobe $DRIVER $OPTS
+     maj=$(awk "$$2==\"${DRIVER}\" { print $$1; }" /proc/devices)
+
Quoted 8 lines

package/sunxi-mali/S80mali line 15

Quoted 6 lines
package/sunxi-mali/S80mali new file +6 -0
+     if [ -e /dev/${DRIVER} ]; then
+             rm -f /dev/${DRIVER}
+     fi
+
+     mknod /dev/${DRIVER} c $maj 0
+     chmod 666 /dev/${DRIVER}

600.

Will fix.

Quoted 104 lines
Quoted 89 lines
package/sunxi-mali/S80mali new file +41 -0
+}
+
+start() {
+     echo "mali: starting driver"
+
+     BITSPERPIXEL="$(fbset | awk '/geom/ {print $6}')"
+     YRES="$(fbset | awk '/geom/ {print $3}')"
+     # Set RGBA ordering to something the drivers like
+     if [ "$BITSPERPIXEL" = "32" ] ; then
+             fbset -rgba 8/16,8/8,8/0,8/24
+     fi
+     # Try to enable triple buffering when there's enough VRAM
+     fbset -vyres $(( YRES*3 ))
+
+     install_driver mali
+     install_driver ump
+}
+
+stop() {
+     echo "mali: stopping driver"
+
+     rmmod ump
+     rmmod mali
+}
+
+case "$1" in
+start)
+     start
+;;
+stop)
+     stop
+;;
+restart)
+     stop
+     start
+;;
+*)
+     echo "mali: Please use start, stop, or restart."
+     exit 1
+;;
+esac
package/sunxi-mali/egl.pc new file +12 -0
new file mode 100644
index 0000000..56e3990
@@ -0,0 +1,12 @@
+prefix=/usr/
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+
+Name: egl
+Description: ARM Mali implementation of EGL
+Version: 1.4
+Requires:
+Libs: -L${libdir} -lEGL -lGLESv2 -lUMP
+Cflags: -I{includedir}/EGL/ -I${includedir}
+
package/sunxi-mali/glesv2.pc new file +12 -0
new file mode 100644
index 0000000..4e112ee
@@ -0,0 +1,12 @@
+prefix=/usr
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+
+Name: glesv2
+Description: ARM Mali implementation of OpenGL ESv2
+Version: 2.0
+Requires:
+Libs: -L${libdir} -lGLESv2 -lGLES_CM -lUMP
+Cflags: -I${includedir}/GLES2
+
package/sunxi-mali/sunxi-mali.mk new file +5 -0
new file mode 100644
index 0000000..693e454
@@ -0,0 +1,79 @@
+################################################################################
+#
+# sunxi-mali
+#
+################################################################################

package/sunxi-mali/sunxi-mali.mk line 15

Quoted 10 lines
package/sunxi-mali/sunxi-mali.mk new file +10 -0
+
+SUNXI_MALI_VERSION = c2491fe952
+SUNXI_MALI_SITE = http://github.com/linux-sunxi/sunxi-mali/tarball/$(SUNXI_MALI_VERSION)
+
+SUNXI_MALI_DEPENDENCIES = sunxi-mali-prop
+SUNXI_MALI_INSTALL_STAGING = YES
+
+define SUNXI_MALI_CONFIGURE_CMDS
+     rm -rf $(@D)/lib/mali
+     cp -rf $(SUNXI_MALI_PROP_DIR) $(@D)/lib/mali

So you're replacing the original lib/mali directory with the data from the sunxi-mali-prop package. This is probably the good place to explain why this is needed.

Quoted 2 lines

Also, I would put this in a post-extract hook rather than in the configure commands.

Will fix.

Quoted 8 lines

package/sunxi-mali/sunxi-mali.mk line 20

Quoted 5 lines
package/sunxi-mali/sunxi-mali.mk new file +5 -0
+endef
+
+SUNXI_MALI_MAKE_ENV = \
+     CC=$(TARGET_CC) \
+     CFLAGS="$(TARGET_CFLAGS)" \

These are generally passed as arguments of make rather than in the environment. It doesn't work in your case?

No it doesn't. The makefiles use the CFLAGS variable to add various options and setting them as arguments overrides all of this. When placed in the environment, the CFLAGS variable is able to be appended.

Quoted 26 lines
Quoted 26 lines
package/sunxi-mali/sunxi-mali.mk new file +26 -0
+     $(TARGET_MAKE_ENV)
+
+
+ifeq ($(BR2_PACKAGE_SUNXI_MALI_HARDFP),y)
+SUNXI_MALI_MAKE_OPTS += ABI=armhf
+else
+SUNXI_MALI_MAKE_OPTS += ABI=armel
+endif
+
+ifeq ($(BR2_PACKAGE_SUNXI_MALI_FB),y)
+SUNXI_MALI_MAKE_OPTS += EGL_TYPE=framebuffer
+else
+SUNXI_MALI_MAKE_OPTS += EGL_TYPE=x11
+endif
+
+ifeq ($(BR2_PACKAGE_SUNXI_MALI_R2P4),y)
+SUNXI_MALI_MAKE_OPTS += VERSION=r2p4
+endif
+ifeq ($(BR2_PACKAGE_SUNXI_MALI_R3P0),y)
+SUNXI_MALI_MAKE_OPTS += VERISON=r3p0
+endif
+ifeq ($(BR2_PACKAGE_SUNXI_MALI_R3P1),y)
+SUNXI_MALI_MAKE_OPTS += VERSION=r3p1
+endif
+
+define SUNXI_MALI_BUILD_CMDS
Quoted 8 lines

package/sunxi-mali/sunxi-mali.mk line 50

Quoted 4 lines
package/sunxi-mali/sunxi-mali.mk new file +4 -0
+     $(SUNXI_MALI_MAKE_ENV) $(MAKE) -C $(@D) $(SUNXI_MALI_MAKE_OPTS) all
+     $(if $(BR2_PACKAGE_SUNXI_MALI_DBG),
+             cd $(@D)/version && \
+                     $(TARGET_CC) $(SUNXI_MALI_CFLAGS) -o version version.c; \

SUNXI_MALI_CFLAGS isn't defined anywhere from what I can see. Also, I believe that you could build this C file unconditionally, it's not going to take a huge amount of time:

Will fix.

Quoted 13 lines
        $(TARGET_CC) $(TARGET_CFLAGS) -o $(@D)/version/version $(@D)/version/version.c

package/sunxi-mali/sunxi-mali.mk line 59

Quoted 9 lines
package/sunxi-mali/sunxi-mali.mk new file +9 -0
+     )
+endef
+
+define SUNXI_MALI_INSTALL_STAGING_CMDS
+     $(SUNXI_MALI_MAKE_ENV) $(MAKE) -C $(@D) \
+             $(SUNXI_MALI_MAKE_OPTS) DESTDIR=$(STAGING_DIR) install
+     $(if $(BR2_PACKAGE_SUNXI_MALI_DBG),
+             # test must be built after install because it depends on headers that are
+             # generated during the install above.

Yurk :-(

Agreed!

Quoted 7 lines

package/sunxi-mali/sunxi-mali.mk line 63

Quoted 5 lines
package/sunxi-mali/sunxi-mali.mk new file +4 -0
+             $(SUNXI_MALI_MAKE_ENV) $(MAKE) -C $(@D) $(SUNXI_MALI_MAKE_OPTS) test
+     )
+     $(INSTALL) -D -m 0644 package/sunxi-mali/egl.pc $(STAGING_DIR)/usr/lib/pkgconfig/
+     $(INSTALL) -D -m 0644 package/sunxi-mali/glesv2.pc $(STAGING_DIR)/usr/lib/pkgconfig/

The destination path must indicate the complete filename when using -D.

Will fix.

Quoted 11 lines
Quoted 11 lines
package/sunxi-mali/sunxi-mali.mk new file +11 -0
+endef
+
+define SUNXI_MALI_INSTALL_TARGET_CMDS
+     $(SUNXI_MALI_MAKE_ENV) $(MAKE) -C $(@D)/lib \
+             $(SUNXI_MALI_MAKE_OPTS) DESTDIR=$(TARGET_DIR) install
+     $(if $(BR2_PACKAGE_SUNXI_MALI_DBG),
+             $(INSTALL) -m 755 $(@D)/version/version $(TARGET_DIR)/usr/bin/maliver; \
+             $(INSTALL) -m 755 $(@D)/test/test       $(TARGET_DIR)/usr/bin/malitest
+     )
+endef
+
Quoted 8 lines

package/sunxi-mali/sunxi-mali.mk line 79

Quoted 5 lines
package/sunxi-mali/sunxi-mali.mk new file +5 -0
+define SUNXI_MALI_INSTALL_INIT_SYSV
+     $(INSTALL) -D -m 0755 package/sunxi-mali/S80mali $(TARGET_DIR)/etc/init.d/
+endef
+
+$(eval $(generic-package))

Otherwise looks good. Seems like the sunxi-mali stuff is a little bit less horrible than the ti-gfx thing :-)

A lot less horrible.

Thanks,
Spenser

#7 lore raw

RFC 2/3 sunxi-mali: new package

Dear Spenser Gilliland,

Quoted 7 lines · Spenser Gilliland
Quoted 3 lines

It'd be great to have some explanations about what is this sunxi-mali-prop compared to sunxi-mali. At least in the commit log, maybe even somewhere in the source code (but I'm not sure where).

Basically, sunxi-mali-prop is a git submodule of sunxi-mali. It is copied into the lib/mali directory to emulate this configuration. (doesn't work as a symlink unfortunately)

Ok. As discussed on IRC, one option would be to extend the download infrastructure to be able to pass the --recursive option to Git. Not sure it's worth the effort for one package though. Maybe what you did with sunxi-mali + sunxi-mali-prop is the simplest option for now. As I noted, it should however be documented.

Quoted 7 lines
Quoted 5 lines

package/sunxi-mali-prop/Config.in line 2

Quoted 3 lines
package/sunxi-mali-prop/Config.in new file +2 -0
+config BR2_PACKAGE_SUNXI_MALI_PROP
+     bool

Maybe you need to select this from sunxi-mali/Config.in ?

Will fix.

Maybe you can put a small comment above this hidden option, like:

# This option is hidden because this package is merely used as a way of

# downloading a git submodule needed by sunxi-mali. The real package to
# enable is therefore sunxi-mali.

or something along those lines (as a native speaker, I trust you to find a better english wording than my proposal!).

Quoted 6 lines
Quoted 1 line

Just curious: there is no kernel modules?

Well, yes and no. There is the possibility to build the external module. However, it is included by default in the sunxi-linux kernel.
See https://github.com/linux-sunxi/mali-400-kernel-drivers for the
external module.

Ok. Since those advanced graphics features are anyway only usable with the sunxi specific kernel at the moment, it doesn't make much sense to package the external kernel modules.

However, a short comment in the Config.in help text about the need for those special drivers would be useful.

Quoted 8 lines
Quoted 3 lines

Does this requires a specific Mali X11 driver? Is it something you intend to package in this first version of sunxi-mali, or something you intend to do later (in which case you could remove this choice for now).

There is an x11 driver here
https://github.com/linux-sunxi/xf86-video-mali . However, I was planning to add this in a later patch series. So, I'll just delete it for now.

Yes, sounds good.

Quoted 20 lines
Quoted 11 lines
Quoted 11 lines
package/sunxi-mali/Config.in new file +11 -0
+choice
+     prompt "Version"
+     default BR2_PACKAGE_SUNXI_MALI_R3P1
+     help
+       Select the version of the Sunxi Mali binaries to install.
+
+config BR2_PACKAGE_SUNXI_MALI_R2P4
+     bool "r2p4"
+
+config BR2_PACKAGE_SUNXI_MALI_R3P0
+     bool "r3p0"
Quoted 8 lines

package/sunxi-mali/Config.in line 57

Quoted 4 lines
package/sunxi-mali/Config.in new file +4 -0
+
+config BR2_PACKAGE_SUNXI_MALI_R3P1
+     depends on BR2_PACKAGE_SUNXI_MALI_HARDFP
+     bool "r3p1"

I wouldn't know how to chose between the three possibilities here, some more help would be nice. Also, maybe add a comment for the r3p1 being not available on !EABIhf systems.

Quoted 5 lines

I'm having trouble finding a description of what cores use which version of the libs. The best method is to install and use the maliver application to determine the appropriate version. I'll add info about this to the help text. Also, I will add the !EABIHF comment.

Have you tried asking on the sunxi IRC channel? I'm not on the channel but I know my colleague Maxime Ripard is there, and it seems to be a fairly active channel.

Quoted 9 lines
Quoted 8 lines

package/sunxi-mali/sunxi-mali.mk line 20

Quoted 5 lines
package/sunxi-mali/sunxi-mali.mk new file +5 -0
+endef
+
+SUNXI_MALI_MAKE_ENV = \
+     CC=$(TARGET_CC) \
+     CFLAGS="$(TARGET_CFLAGS)" \

These are generally passed as arguments of make rather than in the environment. It doesn't work in your case?

Quoted 3 lines

No it doesn't. The makefiles use the CFLAGS variable to add various options and setting them as arguments overrides all of this. When placed in the environment, the CFLAGS variable is able to be appended.

Ok. Maybe a short comment above then.

Quoted 4 lines
Quoted 2 lines

Otherwise looks good. Seems like the sunxi-mali stuff is a little bit less horrible than the ti-gfx thing :-)

A lot less horrible.

Great :)

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#8 lore raw

RFC 2/3 sunxi-mali: new package

Thomas,

Quoted 5 lines

Ok. As discussed on IRC, one option would be to extend the download infrastructure to be able to pass the --recursive option to Git. Not sure it's worth the effort for one package though. Maybe what you did with sunxi-mali + sunxi-mali-prop is the simplest option for now. As I noted, it should however be documented.

Because git-archive does not easily support creating tarballs of git submodule based projects, I've decided to keep the current structure.

Quoted 8 lines
Quoted 7 lines
Quoted 5 lines

package/sunxi-mali-prop/Config.in line 2

Quoted 3 lines
package/sunxi-mali-prop/Config.in new file +2 -0
+config BR2_PACKAGE_SUNXI_MALI_PROP
+     bool

Maybe you need to select this from sunxi-mali/Config.in ?

Will fix.

Quoted 8 lines

Maybe you can put a small comment above this hidden option, like:

# This option is hidden because this package is merely used as a way of

# downloading a git submodule needed by sunxi-mali. The real package to
# enable is therefore sunxi-mali.

or something along those lines (as a native speaker, I trust you to find a better english wording than my proposal!).

Will fix.

Quoted 7 lines
Quoted 6 lines
Quoted 1 line

Just curious: there is no kernel modules?

Well, yes and no. There is the possibility to build the external module. However, it is included by default in the sunxi-linux kernel.
See https://github.com/linux-sunxi/mali-400-kernel-drivers for the
external module.

Quoted 6 lines

Ok. Since those advanced graphics features are anyway only usable with the sunxi specific kernel at the moment, it doesn't make much sense to package the external kernel modules.

However, a short comment in the Config.in help text about the need for those special drivers would be useful.

Will fix.

Quoted 37 lines
Quoted 8 lines
Quoted 3 lines

Does this requires a specific Mali X11 driver? Is it something you intend to package in this first version of sunxi-mali, or something you intend to do later (in which case you could remove this choice for now).

There is an x11 driver here
https://github.com/linux-sunxi/xf86-video-mali . However, I was planning to add this in a later patch series. So, I'll just delete it for now.

Yes, sounds good.

Quoted 20 lines
Quoted 11 lines
Quoted 11 lines
package/sunxi-mali/Config.in new file +11 -0
+choice
+     prompt "Version"
+     default BR2_PACKAGE_SUNXI_MALI_R3P1
+     help
+       Select the version of the Sunxi Mali binaries to install.
+
+config BR2_PACKAGE_SUNXI_MALI_R2P4
+     bool "r2p4"
+
+config BR2_PACKAGE_SUNXI_MALI_R3P0
+     bool "r3p0"
Quoted 8 lines

package/sunxi-mali/Config.in line 57

Quoted 4 lines
package/sunxi-mali/Config.in new file +4 -0
+
+config BR2_PACKAGE_SUNXI_MALI_R3P1
+     depends on BR2_PACKAGE_SUNXI_MALI_HARDFP
+     bool "r3p1"

I wouldn't know how to chose between the three possibilities here, some more help would be nice. Also, maybe add a comment for the r3p1 being not available on !EABIhf systems.

Quoted 5 lines

I'm having trouble finding a description of what cores use which version of the libs. The best method is to install and use the maliver application to determine the appropriate version. I'll add info about this to the help text. Also, I will add the !EABIHF comment.

Quoted 3 lines

Have you tried asking on the sunxi IRC channel? I'm not on the channel but I know my colleague Maxime Ripard is there, and it seems to be a fairly active channel.

I asked tonight and received the response: the sunxi-kernel repo uses the r3p0 version of the Mali libraries and that the version number corresponds to the version of the kernel module. Therefore, I have set the default to r3p0 and have updated the information in the Config.in.

Quoted 10 lines
Quoted 10 lines
Quoted 9 lines

package/sunxi-mali/sunxi-mali.mk line 20

Quoted 6 lines
package/sunxi-mali/sunxi-mali.mk new file +5 -0
+endef
+
+SUNXI_MALI_MAKE_ENV = \
+     CC=$(TARGET_CC) \
+     CFLAGS="$(TARGET_CFLAGS)" \

These are generally passed as arguments of make rather than in the environment. It doesn't work in your case?

Quoted 5 lines
Quoted 3 lines

No it doesn't. The makefiles use the CFLAGS variable to add various options and setting them as arguments overrides all of this. When placed in the environment, the CFLAGS variable is able to be appended.

Ok. Maybe a short comment above then.

Will do.

Quoted 6 lines
Quoted 5 lines
Quoted 3 lines

Otherwise looks good. Seems like the sunxi-mali stuff is a little bit less horrible than the ti-gfx thing :-)

A lot less horrible.

Quoted 8 lines

Great :)

Thomas
--
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

Just as further discussion, I went down the path of transforming the CONFIGURE step into a post extract hook. However, I'm concerned that this may cause a race condition if the post-extract-hook occurs before sunxi-mali-prop is extracted. Perhaps, this needs to be a post configure hook so that the dependency is satisfied.

Thanks,
Spenser

--
Spenser Gilliland
Computer Engineer
Doctoral Candidate

#9 lore raw

RFC 2/3 sunxi-mali: new package

Dear Spenser Gilliland,

Quoted 8 lines · Spenser Gilliland
Quoted 5 lines

Ok. As discussed on IRC, one option would be to extend the download infrastructure to be able to pass the --recursive option to Git. Not sure it's worth the effort for one package though. Maybe what you did with sunxi-mali + sunxi-mali-prop is the simplest option for now. As I noted, it should however be documented.

Because git-archive does not easily support creating tarballs of git submodule based projects, I've decided to keep the current structure.

Right, sounds good to me.

Quoted 5 lines

Just as further discussion, I went down the path of transforming the CONFIGURE step into a post extract hook. However, I'm concerned that this may cause a race condition if the post-extract-hook occurs before sunxi-mali-prop is extracted. Perhaps, this needs to be a post configure hook so that the dependency is satisfied.

You are absolutely correct. By the time sunxi-mali is extracted, there is no guarantee at all that sunxi-mali-prop will be extracted, so my suggestion of moving the copying of sunxi-mali-prop stuff into sunxi-mali sources at the extract step clearly doesn't work. Doing it at the configure stage as you did is the only solution, so you were right.

Thanks!

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#10 lore raw

RFC 2/3 sunxi-mali: new package

In reply to Spenser Gilliland

Spenser, All,

On 2013-07-14 00:10 -0500, Spenser Gilliland spake thusly:

package/sunxi-mali/Config.in line 2

Quoted 2 lines
package/sunxi-mali/Config.in new file +2 -0
+config BR2_PACKAGE_SUNXI_MALI
+	bool "sunxi-mali"

Do you plan on looking to the open source driver, lima, as an alternative to mali?

http://limadriver.org/

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#11 lore raw

RFC 2/3 sunxi-mali: new package

Yann,

Quoted 6 lines

On 2013-07-14 00:10 -0500, Spenser Gilliland spake thusly:

package/sunxi-mali/Config.in line 2

Quoted 2 lines
package/sunxi-mali/Config.in new file +2 -0
+config BR2_PACKAGE_SUNXI_MALI
+     bool "sunxi-mali"

Do you plan on looking to the open source driver, lima, as an alternative to mali?

Yes, I've been looking at it but I'm not sure we should package it just yet. I'm going to work on the ODroidU2 first and come back to this.

Spenser

--
Spenser Gilliland
Computer Engineer
Doctoral Candidate

#12 lore raw

RFC 2/3 sunxi-mali: new package

Dear Spenser Gilliland,

Quoted 10 lines · Spenser Gilliland
Quoted 6 lines

On 2013-07-14 00:10 -0500, Spenser Gilliland spake thusly:

package/sunxi-mali/Config.in line 2

Quoted 2 lines
package/sunxi-mali/Config.in new file +2 -0
+config BR2_PACKAGE_SUNXI_MALI
+     bool "sunxi-mali"

Do you plan on looking to the open source driver, lima, as an alternative to mali?

Yes, I've been looking at it but I'm not sure we should package it just yet. I'm going to work on the ODroidU2 first and come back to this.

Is lima actually usable today as a drop-in replacement for libOpenGLES, libEGL and so on? Last time I had some infos, my understanding was that it was still some experimental code that isn't yet available in a form of a drop-in OpenGL ES implementation. I've been looking around yesterday for more details on the Lima website, but things aren't really clear, even by having a quick look at the source code.

Best regards,

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#13 lore raw

RFC 2/3 sunxi-mali: new package

In reply to Spenser Gilliland

Spenser, All,

On 2013-07-18 01:12 -0500, Spenser Gilliland spake thusly:

Quoted 10 lines
Quoted 6 lines

On 2013-07-14 00:10 -0500, Spenser Gilliland spake thusly:

package/sunxi-mali/Config.in line 2

Quoted 2 lines
package/sunxi-mali/Config.in new file +2 -0
+config BR2_PACKAGE_SUNXI_MALI
+     bool "sunxi-mali"

Do you plan on looking to the open source driver, lima, as an alternative to mali?

Yes, I've been looking at it but I'm not sure we should package it just yet. I'm going to work on the ODroidU2 first and come back to this.

OK, I just wanted to know if you had looked at it. You have, good! :-)

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#14 lore raw

RFC 3/3 opengl: add sunxi-mali as possible egl/gles provider

In reply to Spenser Gilliland
---
 package/opengl/libegl/libegl.mk   | 4 ++++
 package/opengl/libgles/libgles.mk | 4 ++++
 2 files changed, 8 insertions(+)
package/opengl/libegl/libegl.mk +4 -0
index bd8040d..f00f6d1 100644
@@ -10,6 +10,10 @@ ifeq ($(BR2_PACKAGE_RPI_USERLAND),y)
 LIBEGL_DEPENDENCIES += rpi-userland
 endif
 
+ifeq ($(BR2_PACKAGE_SUNXI_MALI),y)
+LIBEGL_DEPENDENCIES += sunxi-mali
+endif
+
 ifeq ($(LIBEGL_DEPENDENCIES),)
 define LIBEGL_CONFIGURE_CMDS
 	echo "No libEGL implementation selected. Configuration error."
package/opengl/libgles/libgles.mk +4 -0
index a0048a7..ec06d57 100644
@@ -10,6 +10,10 @@ ifeq ($(BR2_PACKAGE_RPI_USERLAND),y)
 LIBGLES_DEPENDENCIES += rpi-userland
 endif
 
+ifeq ($(BR2_PACKAGE_SUNXI_MALI),y)
+LIBGLES_DEPENDENCIES += sunxi-mali
+endif
+
 ifeq ($(LIBGLES_DEPENDENCIES),)
 define LIBGLES_CONFIGURE_CMDS
 	echo "No libGLES implementation selected. Configuration error."
Signature · 1 line
1.8.1.2
#15 lore raw

RFC 3/3 opengl: add sunxi-mali as possible egl/gles provider

Dear Spenser Gilliland,

Quoted 6 lines · Spenser Gilliland
---
 package/opengl/libegl/libegl.mk   | 4 ++++
 package/opengl/libgles/libgles.mk | 4 ++++
 2 files changed, 8 insertions(+)

This one obviously looks good. Just rebase on top of master now that ti-gfx has been merged, in order to avoid merge conflicts.

Best regards,

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com