How to use open source Panfrost GPU Driver on RZ/G2Lx

From Renesas.info
Revision as of 09:02, 11 April 2022 by ShowL (talk | contribs) (Created page with "== Note: This article is for experienced users only. == === The Panforst driver is not part of official BSP, So some hacking/modification on BSP package is needed. === == In...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Note: This article is for experienced users only.

The Panforst driver is not part of official BSP, So some hacking/modification on BSP package is needed.

Introduction

The Panfrost driver stack is open source GPU driver for Midgard and Bifrost microarchitectures based Mali GPU. The RZ/G2Lx series included Mali G31 GPU inside is on the Panfrost support list as well.
This article is a tutorial to enable Panfrost driver support for RZ/G2Lx series Mali GPU based MPU.

Requirement

SOC: RZ/G2L, RZ/V2L, RZ/G2LC BOARD: RZ/G2L SMARC board Kernel: Linux kernel v5.10+(v5.16/mainline is also OK but some more patches is needed, let's focus on v5.10 in this article.) Software package: MESA 21.3.x(v21.3.0 and v21.3.7 is tested and worked)

Device tree

In kernel-source/arch/arm64/boot/dts/renesas/r9a07g044.dtsi, please add the below GPU node in the RZ/G2L device tree.

                gpu: gpu@11840000 {
                        compatible = "renesas,r9a07g044-mali",
                                     "arm,mali-bifrost";
                        reg = <0x0 0x11840000 0x0 0x10000>;
                        interrupts = <GIC_SPI 154 IRQ_TYPE_LEVEL_HIGH>,
                                     <GIC_SPI 155 IRQ_TYPE_LEVEL_HIGH>,
                                     <GIC_SPI 153 IRQ_TYPE_LEVEL_HIGH>,
                                     <GIC_SPI 156 IRQ_TYPE_LEVEL_HIGH>;
                        interrupt-names = "job", "mmu", "gpu", "event";
                        clocks = <&cpg CPG_MOD R9A07G044_GPU_CLK>,
                                 <&cpg CPG_MOD R9A07G044_GPU_AXI_CLK>,
                                 <&cpg CPG_MOD R9A07G044_GPU_ACE_CLK>;
                        clock-names = "gpu", "bus", "bus_ace";
                        power-domains = <&cpg>;
                        resets = <&cpg R9A07G044_GPU_RESETN>,
                                 <&cpg R9A07G044_GPU_AXI_RESETN>,
                                 <&cpg R9A07G044_GPU_ACE_RESETN>;
                        reset-names = "rst", "axi_rst", "ace_rst";
                        operating-points-v2 = <&gpu_opp_table>;
                };

Kernel configuration

To enable the Panfrost kernel driver support, please make sure the kernel config is included in kernel configuration below.

CONFIG_DRM_PANFROST=y

Setup the yocto to re-build the runtime environment

In order to not conflict the official Mali driver, please make sure the following package is not integrated in you yocto build folder. RZ MPU Graphics Library Evaluation Version V0.81 for Board Support Package of RZ/G2L and RZ/G2LC

Add some more configuration in your local.conf

In build/conf/local.conf, Please add the following config for your build config.

PACKAGECONFIG_append_pn-mesa = " egl kmsro panfrost"
IMAGE_INSTALL_append += " mesa weston kmscube glmark2"

How to test the Panfrost