Project

General

Profile

Recent updates on Mesa Lima driver

Added by Özcan Oğuz 9 days ago

Hello everyone,

I just checked the yuq's mesa-lima driver on the link below and I saw a commit that pushed 12 hours ago. Also there is a new wiki entry which shows the instructions to build the driver.

[[https://github.com/yuq/mesa-lima]]

I dump the content to here:

Status

Be able to run the following OGL application:

    off-screen rendering
        simple triangle: https://github.com/yuq/gfx/tree/master/gbm-surface
        vertex shader uniform: https://github.com/yuq/gfx/tree/master/gbm-surface-move
        multi varying: https://github.com/yuq/gfx/tree/master/gbm-surface-color
        multi draw: https://github.com/yuq/gfx/tree/master/gbm-surface-draw
        FBO: https://github.com/yuq/gfx/tree/master/gbm-surface-fbo
        kmscube: https://github.com/yuq/kmscube
            ./kmscube -d -D /dev/dri/renderD128
            ./kmscube -d -D /dev/dri/renderD128 -M rgba
    on-screen rendering
        PRIME export/import: https://github.com/enunes/mesa-test-programs/blob/master/gbm-bo-test.c
        renderonly lib: https://github.com/enunes/mesa-test-programs/blob/master/eglkms.c
        kmscube: https://cgit.freedesktop.org/mesa/kmscube/
            ./kmscube
            ./kmscube -M rgba
            ./kmscube -A
        glmark2: https://github.com/glmark2/glmark2
            glmark2-drm -b build
            glmark2-es2-drm -b build

Tested on

    Mali400
        Allwinner A20/H3
        Rockchip RK3188
        Exynos 4412
    Mali450
        Allwinner H5
        Rockchip RK3328
        Amlogic S905X

Build and install
common process

    build Linux kernel with lima driver from: https://github.com/yuq/linux-lima
    build mesa with lima driver by:

./configure --with-gallium-drivers=exynos,sun4i,meson,rockchip,lima --with-dri-drivers= \
  --with-platforms=drm,x11 --disable-xvmc --disable-vdpau --enable-debug

buildroot

For those who want to use buildroot: https://github.com/enunes/buildroot-external-lima
OpenEmbedded

meson metadata with lima driver and test apps: https://github.com/superna9999/meta-meson/tree/topic/mesa-lima
Tool

    dump the runtime close source mali driver memory for reverse engineering
        https://github.com/yuq/mali-syscall-tracker

TODO
mesa

    Newly refined GP compiler needs optimization, code size can be ~40% smaller compared to close source driver output, main problem should be creating too many moves but too few reg load/store
    PP compiler optimization, add post scheduler instruction combination which combine multi instructions into one instruction
    both GP and PP compiler need control flow and other un-implemented instruction support
    texture mipmap support
    Build a piglit test result list so that we can start clear them one by one.
    New mesa NIR changes will always lower io/alu to scalar which is not expected by PP, need merge scalar back to vector or create a PIPE_CAP to disable it, see
        https://www.mail-archive.com/mesa-dev@lists.freedesktop.org/msg189216.html
    Tiled texture format support
    optimization
        thread rendering that has dedicated render thread to submit command

kernel

    Power management
    TTM buffer eviction/swap support, need to investigate if GP/PP support MMU fault recovery
    Dump buffer support

Done
mesa

    GP compiler needs re-fine so that we can guarantee the vertex shader compilation succeed, Connor Abbott think out a new algorithm which should work
    Mesa renderonly lib support
    multi varying support, current implementation assumes we only have a single varying (gl_Position), command stream setup need be implemented for multi varying support
    command stream setup for multi draw, flush at once
    Mali450 initial support
    PP uniform support, command stream need be setup for PP uniform
    fix render fail when buffer is 800x600, maybe due to buffer alignment or command stream setup
    break the ABI come from libdrm_lima which is integrated into mesa for more efficiency especially the command submit interface
    texture support, both PP compiler and command stream need be changed
    command stream setup refine for multi FBO and dynamic buffer size
    Mali450 fully support
    EGL_ANDROID_native_fence_sync support

kernel

    PRIME export support
    Mali450 initial support
    New task scheduler which can create a per OGL context fence context. We can use the new drm_sched which is from amdgpu and will be adopted by etnaviv too. drm_sched should be in Linux kernel 4.16.
    New memory management for non-continuous buffer object
    Different GPU mCLK frequency setup, current GPU mCLK frequency is the default frequency when system boot, but GPU should be able to run on a higher frequency.
    Mali450 fully support, include multi group GP/PP, DLBU
    submit support syn fd dep
    use TTM as MM

Reference

    Lima offical site: http://web.archive.org/web/20180106112822/http://limadriver.org/
    compiler: https://gitorious.org/open-gpu-tools/cwabbotts-open-gpu-tools/

Donation

https://paypal.me/yuq825

I think we can use it experimentally on our Replicant devices. I've started to build the kernel and driver, but it seems to take very long.

What do you think?