diff --git a/README.md b/README.md index 4fb1335..9f05d0e 100644 --- a/README.md +++ b/README.md @@ -19,8 +19,12 @@ Maintainers: Kernel / U-Boot Version =========== Most Allwinner devices and hardware are supported in mainline kernel and U-Boot, so this layer builds mainline by default. + +Legacy sunxi Kernel / U-Boot +----------- + There is a custom U-Boot and Kernel version for sunxi devices which includes some special drivers not mainlined. -These versions are rather old (3.4 for kernel and 2014.04 for U-Boot), but may support more functions and devices than current mainline +These versions are rather old (3.4 for kernel and 2014.04 for U-Boot), but may support more functions and devices than current mainline. If you want to switch back to sunxi versions for some reasons (no device tree available, unsupported hardware), either: - change the file conf/machine/include/sunxi.inc to include the following block @@ -35,9 +39,16 @@ If you already have built the mainline versions it might be necessary to reset t bitbake -c clean virtual/kernel virtual/bootloader -For mainline kernel we have now support for latest LTS, stable and bleeding edge (latest possible rc). +Mainline Kernel / U-Boot +----------- + +For mainline kernel we have now support for latest LTS and stable. By default we use latest LTS. If you would like to change version please update ```PREFERRED_VERSION_linux-mainline``` in: -* [conf/machine/include/sunxi.inc](https://github.com/linux-sunxi/meta-sunxi/blob/4921234ed77f9df77c65c88637ce50468f65bde7/conf/machine/include/sunxi.inc#L16) +* [conf/machine/include/sunxi.inc](https://github.com/linux-sunxi/meta-sunxi/blob/fa0846c0eb23e3424b89acb4d5a327e921f73497/conf/machine/include/sunxi.inc#L16) + +When using mainline kernel ≥ 5.2 it is now possible to use the mainline graphics drivers *lima* and *panfrost*, instead of the *mali* driver provided by ARM. To enable open source mainline graphics support add the following line in your `local.conf`: + + MACHINEOVERRIDES .= ":use-mailine-graphics" Performance =========== diff --git a/conf/machine/include/sunxi-mali-driver.inc b/conf/machine/include/sunxi-mali-driver.inc new file mode 100644 index 0000000..829f366 --- /dev/null +++ b/conf/machine/include/sunxi-mali-driver.inc @@ -0,0 +1,15 @@ +PREFERRED_PROVIDER_virtual/mesa ?= "mesa-gl" +PREFERRED_PROVIDER_virtual/libgl ?= "mesa-gl" +PREFERRED_PROVIDER_virtual/libgles1 ?= "sunxi-mali" +PREFERRED_PROVIDER_virtual/libgles2 ?= "sunxi-mali" +PREFERRED_PROVIDER_virtual/egl ?= "sunxi-mali" + +PACKAGECONFIG_remove_pn-xserver-xorg = "${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'glamor', '', d)}" + +XSERVER += "sunxi-mali \ + sunxi-mali-dev" + +MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS += "\ + kernel-module-mali \ + kernel-module-mali-drm \ + " diff --git a/conf/machine/include/sunxi-mali.inc b/conf/machine/include/sunxi-mali.inc index 829f366..c260133 100644 --- a/conf/machine/include/sunxi-mali.inc +++ b/conf/machine/include/sunxi-mali.inc @@ -1,15 +1,5 @@ -PREFERRED_PROVIDER_virtual/mesa ?= "mesa-gl" -PREFERRED_PROVIDER_virtual/libgl ?= "mesa-gl" -PREFERRED_PROVIDER_virtual/libgles1 ?= "sunxi-mali" -PREFERRED_PROVIDER_virtual/libgles2 ?= "sunxi-mali" -PREFERRED_PROVIDER_virtual/egl ?= "sunxi-mali" - -PACKAGECONFIG_remove_pn-xserver-xorg = "${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'glamor', '', d)}" - -XSERVER += "sunxi-mali \ - sunxi-mali-dev" - -MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS += "\ - kernel-module-mali \ - kernel-module-mali-drm \ - " +# The "sunxi-mailine-graphics-drivers.inc" doesn't exist, but it can be created +# in the future if needed. Using include directive ensures build doesn't fail +# if .inc file doesn't exist: +# https://www.yoctoproject.org/pipermail/yocto/2019-August/046484.html +include ${@'sunxi-mali-driver.inc' if 'use-mailine-graphics' not in d.getVar("MACHINEOVERRIDES").split(":") else 'sunxi-mailine-graphics-drivers.inc' } diff --git a/recipes-graphics/mesa/mesa_%.bbappend b/recipes-graphics/mesa/mesa_%.bbappend new file mode 100644 index 0000000..44281d4 --- /dev/null +++ b/recipes-graphics/mesa/mesa_%.bbappend @@ -0,0 +1,5 @@ +# Enable lima and panfrost Mesa drivers +PACKAGECONFIG_append_use-mailine-graphics = " lima panfrost" +# Enable KMS renderonly Mesa support +# See https://cgit.freedesktop.org/mesa/mesa/commit/?id=2b780fe89300199f2334539aa1678e9b68f0434f +GALLIUMDRIVERS_append_use-mailine-graphics = ",kmsro" diff --git a/recipes-kernel/linux/linux-mainline.inc b/recipes-kernel/linux/linux-mainline.inc index 84234e4..b36a4fa 100644 --- a/recipes-kernel/linux/linux-mainline.inc +++ b/recipes-kernel/linux/linux-mainline.inc @@ -26,4 +26,6 @@ SRC_URI = "https://www.kernel.org/pub/linux/kernel/v5.x/linux-${PV}.tar.xz \ file://defconfig \ " +SRC_URI_append_use-mailine-graphics = " file://drm.cfg" + FILES_${KERNEL_PACKAGE_NAME}-base_append = " ${nonarch_base_libdir}/modules/${KERNEL_VERSION}/modules.builtin.modinfo" diff --git a/recipes-kernel/linux/linux-mainline/drm.cfg b/recipes-kernel/linux/linux-mainline/drm.cfg new file mode 100644 index 0000000..cb1834e --- /dev/null +++ b/recipes-kernel/linux/linux-mainline/drm.cfg @@ -0,0 +1,8 @@ +CONFIG_DRM=y +CONFIG_DRM_SUN4I=y +CONFIG_DRM_SUN8I_DW_HDMI=y +CONFIG_DRM_SUN8I_MIXER=y +CONFIG_DRM_LIMA=y +CONFIG_DRM_PANFROST=y +CONFIG_CMA=y +CONFIG_DMA_CMA=y