Code Monkey home page Code Monkey logo

sunxi-mali's Introduction

Mali support for Allwinner / sunXi platform for mainline Linux

Here is the driver needed in order to support ARM's Mali GPU found on the Allwinner SoC, using a mainline (ie. Torvalds') kernel.

Adding the Mali to your Device Tree

If that isn't already the case, you'll need to edit your Device Tree file to add a node following the Device Tree binding

Don't forget to submit your change afterward to the Linux kernel mailing list..

Building the kernel module

In order to build the kernel module, you'll need a functional DRM driver. If you have that already, you'll need the options CONFIG_CMA and CONFIG_DMA_CMA enabled in your kernel configuration.

Then, you can compile the module using the following commands:

git clone https://github.com/mripard/sunxi-mali.git
cd sunxi-mali
export CROSS_COMPILE=$TOOLCHAIN_PREFIX
export KDIR=$KERNEL_BUILD_DIR
export INSTALL_MOD_PATH=$TARGET_DIR
./build.sh -r r6p2 -b
./build.sh -r r6p2 -i

It should install the mali.ko Linux kernel module into the target filesystem, and the module should be loaded automatically. If it isn't, modprobe will help.

To compile for arm64(aarch64) platform, before issuing ./build.sh :

export ARCH=arm64

Module is compiled using parallel build by default. To override jobs number, use -j option as follows:

./build.sh -r r6p2 -j 8 -b

Where 8 is the number of simultaneous jobs.

Installing the user-space components

Once the driver is compiled and loaded, you'll need to integrate the OpenGL ES implementation.

In order to do that, you'll need to do the following commands (assuming you want the r6p2 fbdev version over the X11-dma-buf one).

git clone https://github.com/bootlin/mali-blobs.git
cd mali-blobs
cp -a r6p2/arm/fbdev/lib* $TARGET_DIR/usr/lib

fbdev quirks

The fbdev variants are meant to deal with applications using the legacy fbdev interface. The most widely used example would be Qt. In such a case, you'll need to do a few more things in order to have a working setup.

The Mali blob uses framebuffer panning to implement multiple buffering. Therefore, the kernel needs to allocate buffers at least twice the size (for double buffering) of the actual resolution, which it doesn't by default. For you to change that, you'll need to change either the CONFIG_DRM_FBDEV_OVERALLOC option or the drm_kms_helper.drm_fbdev_overalloc parameter to 100 times the number of simultaneous buffers you want to use (so 200 for double buffering, 300 for triple buffering, etc.).

Linux also introduced with the 4.20 some memory protection mechanisms that breaks the user-space components. You'll need to enable CONFIG_DRM_FBDEV_LEAK_PHYS_SMEM, and pass `drm_kms_helper.drm_leak_fbdev_smem=1' on the kernel command-line.

To avoid screen tearing, set the FRONTBUFFER_LOCKING environment variable to 1. This environment variable is used only by the Mali fbdev blob.

sunxi-mali's People

Contributors

giuliobenetti avatar honjek avatar mripard avatar net147 avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.