RZ-G/Panfrost for RZG2L: Difference between revisions

From Renesas.info
(Created page with "{{DISPLAYTITLE: How to use open source Panfrost GPU Driver on RZ/G2Lx }} ← RZ-G == Note: This article is for experienced users only. == === The Panforst driver is not...")
 
No edit summary
Line 11: Line 11:
=== Requirement ===
=== Requirement ===
SOC: RZ/G2L, RZ/V2L, RZ/G2LC<br>
SOC: RZ/G2L, RZ/V2L, RZ/G2LC<br>
BOARD: RZ/G2L SMARC board<br>
BOARD: RZ/G2L,RZ/V2L based board<br>
Kernel: Linux kernel [https://github.com/renesas-rz/rz_linux-cip/tree/rz-5.10-cip1 v5.10+](v5.16/mainline is also OK but some more patches is needed, let's focus on v5.10 in this article.)<br>
Kernel: Linux kernel v5.10+<br>
Software package: MESA 21.3.x(v21.3.0 and v21.3.7 is tested and worked)<br>
Software package: MESA 21.3.x+<br>


=== Device tree ===
=== Preparation ===
In kernel-source/arch/arm64/boot/dts/renesas/r9a07g044.dtsi, please add the below GPU node in the RZ/G2L device tree.  
1) Please Download and extract the [https://www.renesas.com/us/en/products/microcontrollers-microprocessors/rz-mpus/rzg-linux-platform/rzg-marketplace/verified-linux-package/rzg-verified-linux-package RZ/G2L VLP] or [https://www.renesas.com/us/en/software-tool/rzv-verified-linux-package RZ/V2L VLP] into you build folder<br>
::'''Note: you do not need RZ MPU Graphics Library support package, please do not apply it on your build environment.'''<br>
2) Add [https://github.com/renesas-rz/meta-rz-panfrost meta-rz-panfrost layer] instead '''RZ MPU Graphics Library'''.
<pre>
<pre>
                gpu: gpu@11840000 {
$ cd your_vlp_build_folder/
                        compatible = "renesas,r9a07g044-mali",
$ git clone https://github.com/renesas-rz/meta-rz-panfrost meta-rz-panfrost
                                    "arm,mali-bifrost";
$ vim conf/bblayer.conf // Add meta-rz-panfrost layer into your bblayer.conf
                        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>;
                };
</pre>
</pre>
 
3) Enable kmscube and glmark2 in local.conf
=== Kernel configuration ===
To enable the Panfrost kernel driver support, please make sure the kernel config is included in kernel configuration below.
<pre>
CONFIG_DRM_PANFROST=y
</pre>
 
=== Setup the yocto to re-build the runtime environment ===
In order to not conflict with the official Mali driver, please make sure the following package is not integrated into your yocto build folder.<br>
[https://www.renesas.com/tw/en/document/swe/rz-mpu-graphics-library-evaluation-version-v081-board-support-package-rzg2l-and-rzg2lc?language=en&r=1467981 RZ MPU Graphics Library Evaluation Version V0.81 for Board Support Package of RZ/G2L and RZ/G2LC]
# Use the [https://git.yoctoproject.org/poky/tree/meta/recipes-graphics/mesa?id=3a9e6f8194ad2b275b17fb45c779de864384b70b mesa v21.3.7] to replace the mesa folder in mera-rzg2/recipes-graphics or meta-renesas/recipes-graphics
# Download the [https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14393?commit_id=daf59694aca61ad16e5a23a98e967361105111e4 kmsro support patch] for mesa v21.3.7 and put the patch into the mesa/files folder.
# Modify the mesa_21.3.7.bb file, add the patch file name to the SRC_URI, like below
<pre>
SRC_URI += "file://0001-kmsro-Add-rcar-du-entry-point-for-Renesas-RZ-G2Lx-se.patch \
</pre>
 
=== Add some more configuration in your local.conf ===
In build/conf/local.conf, Please add the following config for your build config.
<pre>
<pre>
PACKAGECONFIG_append_pn-mesa = " egl kmsro panfrost"
IMAGE_INSTALL_append += " kmscube glmark2"
IMAGE_INSTALL_append += " mesa weston kmscube glmark2"
</pre>
</pre>
And build your customized image
4) Build your system
<pre>
<pre>
$ bitbake core-image-weston
$ bitbake core-image-weston
Line 99: Line 65:
* kmscube is also available but stop the weston is needed before run it.
* kmscube is also available but stop the weston is needed before run it.
...
...
'''if you want to test glmark2-es2-wayland above 720p, add cma=384M in bootargs.'''
----
----
Have Fun~~<br>
Have Fun~~<br>
[mailto:show.liu.yj@renesas.com Show Liu]
[mailto:show.liu.yj@renesas.com Show Liu]

Revision as of 17:44, 28 April 2023

RZ-G

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,RZ/V2L based board
Kernel: Linux kernel v5.10+
Software package: MESA 21.3.x+

Preparation

1) Please Download and extract the RZ/G2L VLP or RZ/V2L VLP into you build folder

Note: you do not need RZ MPU Graphics Library support package, please do not apply it on your build environment.

2) Add meta-rz-panfrost layer instead RZ MPU Graphics Library.

$ cd your_vlp_build_folder/
$ git clone https://github.com/renesas-rz/meta-rz-panfrost meta-rz-panfrost
$ vim conf/bblayer.conf // Add meta-rz-panfrost layer into your bblayer.conf

3) Enable kmscube and glmark2 in local.conf

IMAGE_INSTALL_append += " kmscube glmark2"

4) Build your system

$ bitbake core-image-weston

Test the Panfrost driver with glmark2

  • Make sure the Panfrost kernel driver is ready

Kernel boot up log:

...
[    0.140409] panfrost 11840000.gpu: clock rate = 500000000
[    0.140456] panfrost 11840000.gpu: bus_clock rate = 200000000
[    0.141269] panfrost 11840000.gpu: [drm:panfrost_devfreq_init] Failed to register cooling device
[    0.141371] panfrost 11840000.gpu: mali-g31 id 0x7093 major 0x0 minor 0x0 status 0x0
[    0.141390] panfrost 11840000.gpu: features: 00000000,3fde77ff, issues: 00000000,00000400
[    0.141408] panfrost 11840000.gpu: Features: L2:0x070d0206 Shader:0x00000000 Tiler:0x00000209 Mem:0x1 MMU:0x00002821 AS:0xff JS:0x7
[    0.141425] panfrost 11840000.gpu: shader_present=0x1 l2_present=0x1
[    0.142475] [drm] Initialized panfrost 1.1.0 20180908 for 11840000.gpu on minor 0
...
  • add PAN_MESA_DEBUG="noafbc" in /etc/environment for your RZ/G2Lx runtime or export PAN_MESA_DEBUG="noafbc" before your run the glmark2-es2-wayland.(kernel v5.10 MUST required.)

Run glmark2-es2-wayland, you should see the Panfrost information like below and the glmark2 testing screen in the monitor.

root@smarc-rzg2l:~# glmark2-es2-wayland
=======================================================
    glm[10215.517141] panfrost 11840000.gpu: js fault, js=0, status=DATA_INVALID_FAULT, head=0x63c8140, tail=0x63c8140
ark2 2017.07
==[10215.528535] panfrost 11840000.gpu: gpu sched timeout, js=0, config=0x7300, status=0x58, head=0x63c8140, tail=0x63c8140, sched_job=0000000035c763e7
=====================================================
    OpenGL Information
    GL_VENDOR:     Panfrost
    GL_RENDERER:   Mali-G31 (Panfrost)
    GL_VERSION:    OpenGL ES 3.1 Mesa 21.3.7
=======================================================
  • kmscube is also available but stop the weston is needed before run it.

... if you want to test glmark2-es2-wayland above 720p, add cma=384M in bootargs.


Have Fun~~
Show Liu