From 826040fcedfcd54cbc592ae87d4a20b1f7c379e3 2020-11-19 17:11:31 From: g-vidal Date: 2020-11-19 17:11:31 Subject: [PATCH] Added choice to enable v3d graphics accelerator for Pi4 if true excludes fbturbo for pi4 fbturbo is faulty --- diff --git a/README.md b/README.md index c0a0e69..77d4f91 100644 --- a/README.md +++ b/README.md @@ -207,6 +207,7 @@ The following static networking parameters are only supported if `ENABLE_WIFI_DH |ENABLE_UBOOT|boolean|false|`true`\|`false`|Replace the default RPi 0/1/2/3 second stage bootloader (bootcode.bin) with [U-Boot bootloader](https://git.denx.de/?p=u-boot.git;a=summary). U-Boot can boot images via the network using the BOOTP/TFTP protocol. RPI4 needs tbd| |UBOOTSRC_DIR|string||`FullPathToUBootFolder`|Full path to a directory named `u-boot` of [U-Boot bootloader sources](https://git.denx.de/?p=u-boot.git;a=summary) that will be copied, configured, build and installed inside the chroot| |ENABLE_FBTURBO|boolean|false|`true`\|`false`|Install and enable the [hardware accelerated Xorg video driver](https://github.com/ssvb/xf86-video-fbturbo) `fbturbo`. Please note that this driver is currently limited to hardware accelerated window moving and scrolling| +|ENABLE_GR_ACCEL|boolean|false|`true`\|`false`|Install and enable [one of the 3D graphics accelerators for Raspi4](https://www.raspberrypi.org/documentation/configuration/config-txt/video.md) `vc4-fkms-v3d`. Not compatible with `fbturbo` mutually excluded and installed for Raspberry4 only| |FBTURBOSRC_DIR|string||`FullPathToFbTurboFolder`|Full path to a directory named `xf86-video-fbturbo` of [hardware accelerated Xorg video driver sources](https://github.com/ssvb/xf86-video-fbturbo) that will be copied, configured, build and installed inside the chroot| |ENABLE_VIDEOCORE|boolean|false|`true`\|`false`|Install and enable the [ARM side libraries for interfacing to Raspberry Pi GPU](https://github.com/raspberrypi/userland) `vcgencmd`. Please note that this driver is currently limited to hardware accelerated window moving and scrolling| |VIDEOCORESRC_DIR|string||`FullPathToVideoSrcFolder`|Full path to a directory named `userland` of [ARM side libraries for interfacing to Raspberry Pi GPU](https://github.com/raspberrypi/userland) that will be copied, configured, build and installed inside the chroot| diff --git a/bootstrap.d/15-rpi-config.sh b/bootstrap.d/15-rpi-config.sh index 63f556c..5f0a4b9 100644 --- a/bootstrap.d/15-rpi-config.sh +++ b/bootstrap.d/15-rpi-config.sh @@ -266,7 +266,12 @@ echo "${CMDLINE}" > "${BOOT_DIR}/cmdline.txt" # Setup minimal GPU memory allocation size: 16MB (no X) if [ "$ENABLE_MINGPU" = true ] ; then - echo "gpu_mem=16" >> "${BOOT_DIR}/config.txt" + if [ "$ENABLE_GR_ACCEL" = false ] ; then + echo "gpu_mem=16" >> "${BOOT_DIR}/config.txt" + else + ### Cannot reduce memory if graphics acceleration is requested + echo "gpu_mem=128" >> "${BOOT_DIR}/config.txt" + fi fi # Setup boot with initramfs @@ -315,6 +320,19 @@ if [ -n "$DISABLE_UNDERVOLT_WARNINGS" ] ; then echo "avoid_warnings=${DISABLE_UNDERVOLT_WARNINGS}" >> "${BOOT_DIR}/config.txt" fi +#Enable graphics acceleration for Model 4 +if [ "$RPI_MODEL" = 4 ] && [ "$ENABLE_GR_ACCEL" = true ] ; then + echo "max_framebuffers=2" >> "${BOOT_DIR}/config.txt" + echo "arm_64bit=1" >> "${BOOT_DIR}/config.txt" + echo "cmdline=cmdline.txt" >> "${BOOT_DIR}/config.txt" + echo "dtparam=audio=on" >> "${BOOT_DIR}/config.txt" + if [ "$ENABLE_MINGPU" = false ] ; then + echo "gpu_mem=128" >> "${BOOT_DIR}/config.txt" + fi + echo "dtoverlay=vc4-fkms-v3d, cma-128" >> "${BOOT_DIR}/config.txt" +fi + + # Install kernel modules blacklist mkdir -p "${ETC_DIR}/modprobe.d/" install_readonly files/modules/raspi-blacklist.conf "${ETC_DIR}/modprobe.d/raspi-blacklist.conf" diff --git a/bootstrap.d/42-fbturbo.sh b/bootstrap.d/42-fbturbo.sh index 0835552..828dbfc 100644 --- a/bootstrap.d/42-fbturbo.sh +++ b/bootstrap.d/42-fbturbo.sh @@ -5,7 +5,7 @@ # Load utility functions . ./functions.sh -if [ "$ENABLE_FBTURBO" = true ] ; then +if [ "$ENABLE_FBTURBO" = true ] && [ "$ENABLE_GR_ACCEL" = false ] ; then # Install c/c++ build environment inside the chroot chroot_install_cc diff --git a/rpi23-gen-image.sh b/rpi23-gen-image.sh index 9d6733b..1c64656 100755 --- a/rpi23-gen-image.sh +++ b/rpi23-gen-image.sh @@ -191,6 +191,7 @@ CHROOT_SCRIPTS=${CHROOT_SCRIPTS:=""} ENABLE_UBOOT=${ENABLE_UBOOT:=false} UBOOTSRC_DIR=${UBOOTSRC_DIR:=""} ENABLE_FBTURBO=${ENABLE_FBTURBO:=false} +ENABLE_GR_ACCEL=${ENABLE_GR_ACCEL:=true} FBTURBOSRC_DIR=${FBTURBOSRC_DIR:=""} ENABLE_VIDEOCORE=${ENABLE_VIDEOCORE:=false} VIDEOCORESRC_DIR=${VIDEOCORESRC_DIR:=""}