The purpose of this page is to describe how the ARM MALI driver is integrated into Zynq™ UltraScale+™ MPSoC
Table of Contents
Table of Contents |
---|
Overview
Zynq™ UltraScale+™ MPSoC has the MALI 400MP GPU from ARM. The ARM MALI 400MP is an OpenGLES 2.0 capable GPU.Driver access and license
The driver for MALI 400MP consists of Linux kernel driver and user library. The user space library is proprietary licensed and will have to be distributed as binaries. The user space library will be provided through AMD's PetaLinux release. The Linux kernel driver is GPL licensed, and downloadable from http://malideveloper.arm.com/. Until 2016.4, the kernel driver was hosted on github. From 2017.1, the kernel driver hosted on github is deprecated. This will now be downloaded from ARM website and packaged into the PetaLinux BSP....
The driver is released periodically by ARM. Thus there can be multiple versions available. The default version in Kconfig points to the latest working release.
Device tree binding
The DT binding documentation is included in the driver release. Download the kernel driver tarball from http://malideveloper.arm.com/., unzip it and the DT binding documentation is available at the folder path."driver/documentation/devicetree/bindings/arm/mali-utgard.txt"
Runtime power management
The MALI driver supports fine grained runtime power management based on Linux runtime PM APIs, with its own scheduler. This section describes the flow of specific driver version, r7p0-00rel0, to give an overview.First the driver implements the Linux runtime PM callbacks (in mali_kernel_linux.c), and the runtime pm is enabled in device initialization (arm.c)
Code Block | ||
---|---|---|
| ||
static const struct dev_pm_ops mali_dev_pm_ops = { #ifdef CONFIG_PM_RUNTIME .runtime_suspend = mali_driver_runtime_suspend, .runtime_resume = mali_driver_runtime_resume, .runtime_idle = mali_driver_runtime_idle, #endif .suspend = mali_driver_suspend_scheduler, .resume = mali_driver_resume_scheduler, .freeze = mali_driver_suspend_scheduler, .thaw = mali_driver_resume_scheduler, .poweroff = mali_driver_suspend_scheduler, }; #endif |
Code Block | ||
---|---|---|
| ||
mali_platform_device_register() { ... pm_runtime_set_autosuspend_delay(&&(mali_gpu_device.dev), 1000); pm_runtime_use_autosuspend(&&(mali_gpu_device.dev)); #endif pm_runtime_enable(&&(mali_gpu_device.dev)); ... } |
Then, the driver has its own scheduler (mali_scheduler.c) that tracks any activities of all GPU processors (GP: geometry processor, PP: pixel processor). All activities on those processors are created as a job (ex, gp job / pp job) and scheduled through this scheduler. The scheduler tracks the completion of the job as well. Based on the status, the scheduler sets the runtime pm reference count accordingly (mali_scheduler.c). Below is an example for GP. Equivalent functions exist for PP.
Code Block | ||
---|---|---|
| ||
mali_scheduler_queue_gp_job() { ... _mali_osk_pm_dev_ref_get_async() ... } mali_scheduler_complete_gp_job() { ... _mali_osk_pm_dev_ref_pet_async() ... } |
When the reference count reaches to 0, the runtime_suspend callback will be triggered: runtime_suspend callback -> mali_driver_runtime_suspend() -> mali_pm_runtime_suspend() -> mali_pm_common_suspend(). mali_pm_common_suspend() performs a series of operations to put all relevant modules, ex, l2 cache and mmu, in idle state. Reverse operations is performed when resuming.
Code Block | ||
---|---|---|
| ||
mali_pm_common_suspend() { ... if (0 < num_groups_down) { mali_executor_group_power_down(groups_down, num_groups_down); } for (i = 0; i < num_l2_down; i++) { mali_l2_cache_power_down(l2_down[i]); } ... } |
GPU software stack
Changelog
- 2023.1
- Fix for compatibility with 6.1 Linux kernel
- Updated clock name to match LIMA driver
- Added attribute support for weston
- Performance Issues with Weston 10+ in 2023.1. So below is AR for downgrading weston to 9.0.0
- 2021.1
- Update EGL headers
- Fix for compatibility with 5.10 Linux kernel
...
Selecting particular backends:
You can select particular backend while configuring rootfs
File: project-spec/config/rootfs_config
Code Block | ||
---|---|---|
| ||
petalinux-config -c rootfs |
- Wayland/GBM backend:
By default, plnx build system will try to package all the backends in the rootfs and depending upon the rootfs config, we create a link to the correct backend. Fbdev, X11, wayland and headless are the choices we have.
For example: Once you have selected libmali through 'petalinux-config -c rootfs', select backend to wayland and unselect 'packagegroup-petalinux-matchbox' and 'packagegroup-petalinux-x11' and select 'packagegroup-petalinux-weston'. After selection your rootfs_config will look as below.
Code Block theme Midnight CONFIG_libmali-xlnx=y CONFIG_mali-backend-wayland=y
This packagegroup ensures all the essential wayland/weston packages are packaged into the rootfs for having a wayland/weston application work out of the box. On boot, export following parameter in your terminal console.
Code Block theme Midnight export XDG_RUNTIME_DIR=/run/
Now, you can run sample benchmarking application glmark2-es2-wayland.
- X11 backend:
By default, Mali supports X11 backend. Just select libmali-xlnx package from 'petalinux-config -c rootfs'. The root filesystem should now have libmali with X11 support. Also, please select at least one window manager. For example: packagegroup-petalinux-matchbox.
Once you have selected libmali through 'petalinux-config -c rootfs', and selected backend to x11, your rootfs_config will look as below.
Code Block theme Midnight CONFIG_libmali-xlnx=y CONFIG_mali-backend-x11=y
- Fbdev backend:
Just select libmali-xlnx package from 'petalinux-config -c rootfs' and select fbdev backend.
Once you have selected libmali through 'petalinux-config -c rootfs' unselect 'packagegroup-petalinux-matchbox' and 'packagegroup-petalinux-x11'. Your rootfs_config will look as below.
Code Block theme Midnight CONFIG_libmali-xlnx=y CONFIG_mali-backend-fbdev=y
- Headless-EGL backend:
Just select libmali-xlnx package from 'petalinux-config -c rootfs' and select headless backend. Unselect 'packagegroup-petalinux-matchbox' and 'packagegroup-petalinux-x11'.
Once you have selected libmali through 'petalinux-config -c rootfs', and selected backend to headless, your rootfs_config will look as below.
Code Block theme Midnight CONFIG_libmali-xlnx=y CONFIG_mali-backend-headless=y
Please find more details for Headless rendering on below page.
Mali 400 Headless rendering
Benchmark:
To run a benchmark example for x11 and wayland backend, please add below lines to build/conf/local.conf
Code Block | ||
---|---|---|
| ||
IMAGE_INSTALL:append = "glmark2" |
...