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

From Renesas.info

RZ-G

Introduction

Notice: 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.
  • 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.

Requirements

Note: Please apply [HACK DO NOT APPLY] patches in the patch set to enable display on 5.10.y-cip.

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 of RZ MPU Graphics Library.
Note: All test verified with VLP 3.0.5update1.

$ 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

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

4) Build your system

$ bitbake core-image-minimal

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.
# systemctl stop weston@root
# kmscube

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


Have Fun~~
Show Liu