[SOLVED] X11 and Mali Binary Drivers

This forum is for supported devices using an ARMv7 Allwinner SoC.

[SOLVED] X11 and Mali Binary Drivers

Postby WebReflection » Thu Aug 08, 2013 7:11 pm

... done some cleanup to this post I was going to publish last evening ... got a few minutes now so here the story:

Coming from this thread, I thought I'd rather open a different step-by-step one not strictly related to the Cubieboard, since apparently this works on other A10 boards too in a basic/generic Arch Linux ARM environment (pcDuino, Marsboard, etc)

This guide is about all you really need in order to make xf86-video-fbturbo driver happen, but:
$this->bbcode_list('1')
  • Mali 400 does not support OpenGL, it supports only OpenGLES. This means mesa-libgl is still needed and Mali will fallback to software rendering regardless when it comes to libGL and your expectations about these drivers should be lower
  • mesa demos such glxgears and others do not measure this driver performance properly, being mostly based on OpenGL capabilities
  • most likely (need to investigate/confirm this) there is no way you can have WebGL since GTK+ libraries (chromium/midori/others) will probably not recognize Mali as HW Acclerated capable
  • I will investigate about latter point with Fedora 19 and Debian Wheezy with binaries support but I am pretty sure it's like that.
    If not please let me know, maybe with libhybris there's extra hope ...

    How To Successfully Install Mali Binaries In Arch Linux From Scratch
    step after step, this is the cleanest way I've tested in order to have a X capable Cubieboard A10 with these drivers. Feel free to skip one or more step if done already ... such ...

    /home
    This is the folder I've used for everything ... feel free to use a different one and remember to change it in each snippet of code, if needed.

    Set Right CPU Frequency
    This is what I do as very first thing in a freshly backed Arch Linux ARM boot as root.
    Feel free to skip this point.
    $this->bbcode_second_pass_code('', '
    pacman -S cpupower
    sync

    # for best performance but
    # max power consumption
    echo '
    governor="performance"
    '>>/etc/default/cpupower

    # enable this service
    systemctl enable cpupower.service
    systemctl start cpupower.service
    ')

    Make /dev/ump And /dev/mali Reachable
    This is necessary to avoid a "modesetting" error in /var/log/Xrog.log.0 after installation but you might not need this.
    In order to verify if you need this:
    $this->bbcode_second_pass_code('', '
    # check loaded modules
    lsmod

    # check permissions
    ls -la /dev/ump
    ls -la /dev/mali
    ')
    If lsmod shows mali, ump, and other things, it's OK ... otherwise we need to do this:
    $this->bbcode_second_pass_code('', '
    # only non builtins modules forced
    echo '
    # needed for xf86-video-fbturbo
    ump
    mali

    # apparently needed too
    drm
    mali_drm

    # wi-fi ... if needed ...
    8192cu
    ' >/usr/lib/modules-load.d/modules.conf
    ')
    This will force those modules to load next reboot ... we don't need to reboot though:
    $this->bbcode_second_pass_code('', '
    # load modules for current session
    modprobe ump
    modprobe mali
    modprobe drm
    modprobe mali_drm
    ')
    We can double check via lsmod again and see those modules loaded. However, permissions are still not good:
    $this->bbcode_second_pass_code('', '
    # enabling mali.service via systemctl
    echo '[Unit]
    Description=reachable /dev/ump and /dev/mali

    [Service]
    Type=oneshot
    ExecStart=/usr/bin/chmod 666 /dev/ump
    ExecStart=/usr/bin/chmod 666 /dev/mali
    RemainAfterExit=yes

    [Install]
    WantedBy=multi-user.target'>/etc/systemd/system/mali.service
    systemctl enable mali.service
    systemctl start mali.service
    ')
    We can double check again via ls -la /dev/mali and see permissions should be OK.

    Update And Install Required Modules
    The classic update first:
    $this->bbcode_second_pass_code('', '
    pacman -Syu --noconfirm
    ')
    Now we need some development package such:
    $this->bbcode_second_pass_code('', '
    pacman -S make gcc git-core automake autoconf pkg-config libtool
    ')
    Now we need some xorg related package plus libGL.so via mesa
    $this->bbcode_second_pass_code('', '
    pacman -S xorg-server-devel xorg-server mesa-libgl
    ')
    Now, to be sure we do things in X we might want to install the basics
    $this->bbcode_second_pass_code('', '
    pacman -S xorg-xinit xterm xf86-video-fbdev
    ')
    xterm is not really needed if not to just xinit and find ourself inside a white console where we'll do the rest.

    Bear in mind at this point we have already everything we need to use a X11 desktop environment.
    Keep reading only if you think you really might need these drivers in such env.

    Build Drivers Using Binaries
    first of all, repositories:
    $this->bbcode_second_pass_code('', '
    # inside xterm, after launching xinit or startx
    cd /home
    git clone https://github.com/robclark/libdri2.git
    git clone https://github.com/linux-sunxi/sunxi-mali.git
    git clone https://github.com/ssvb/xf86-video-fbturbo
    ')

    We can build libdri2 now but we need to specify the right prefix.
    At least in my case this library could not be used/installed/recognized properly otherwise.
    $this->bbcode_second_pass_code('', '
    cd /home/libdri2
    ./autogen.sh --prefix=/usr
    make install
    ')

    Now we can build sunxi-mali:
    $this->bbcode_second_pass_code('', '
    cd /home/sunxi-mali
    git submodule init
    git submodule update
    make config ABI=armhf VERSION=r3p0
    make install
    ')
    Above build should take care of libUMP too.

    [edit]
    In some case /dev/mali and /dev/ump cannot be reached regardless ... we can use VERSION so it will work in any case.
    What I've written before was:
    $this->bbcode_second_pass_quote('', '
    ')If the config fails it's because it did not find/read/recognize the /dev/mali path.
    Be sure about privileges and availability instead of simply forcing the VERSION since you might have problems later on regardless.

    This is still true for Cubieboard A10 at least.

    If built without problems, we could even test it later on, once everything has been done:
    $this->bbcode_second_pass_code('', '
    cd /home/sunxi-mali/test
    # vi Makefile before building
    # append -lX11 to the list of make arguments
    make
    # see the triangle
    ./test
    ')

    Now we can build and install xf86-video-fbturbo too:
    $this->bbcode_second_pass_code('', '
    cd /home/xf86-video-fbturbo
    autoreconf -vi
    ./configure --prefix=/usr
    make
    make install
    ')

    Almost there ... but we need to tell X11 to use this driver each time it starts.
    $this->bbcode_second_pass_code('', '
    echo 'Section "Device"
    Identifier "Allwinner A10/A13 FBDEV""
    Driver "fbturbo"
    Option "fbdev" "/dev/fb0"
    Option "SwapbuffersWait" "true"
    # `man fbturbo` to know more options
    Option "AccelMethod" "G2D"
    EndSection
    '>/etc/X11/xorg.conf.d/99-fbturbo.conf
    ')

    Verify If Works
    Time to get out of xterm via exit and restart it (startx or xinit).
    Once you've done and you are again in xterm you can
    $this->bbcode_second_pass_code('', '
    cat /var/log/Xorg.log.0 | grep \(EE\) | less
    ')
    Use the down arrow to reach the bottom of the list.
    You are actually reading all errors in there but these should be just a repeated one:
    $this->bbcode_second_pass_code('', '
    (EE) SUNXIFB(0): FBIOPUTCMAP: Invalid argument
    ')
    And that should be it, except for the following error which is expected:
    $this->bbcode_second_pass_code('', '
    [ 10743.691] (EE) AIGLX error: dlopen of /usr/lib/arm-linux-gnueabihf/dri/Mali DRI2_dri.so failed (/usr/lib/arm-linux-gnueabihf/dri/Mali DRI2_dri.so: cannot open shared object file: No such file or directory)
    [ 10743.691] (EE) AIGLX: reverting to software rendering
    ')
    Unfortunately, above error is most likely the reason many OpenGL based software will still be slow, no matter how good we tune this driver, it won't support GLX.

    If you find anything to optimize, a way to install libhybris too or a way to have a browser with WebGL in it please share, thanks!

    External References
    ssvb Wiki with installation instructions
    cubieboard and mali
    sunxi wiki
    These contain also some troubleshooting info in case you did not follow this guide from a freshly installed raw/base Arch Linux.

    The End
    Last edited by WebReflection on Thu Oct 17, 2013 1:55 am, edited 1 time in total.
    WebReflection
     
    Posts: 99
    Joined: Tue Apr 02, 2013 6:49 pm

    Re: [SOLVED] X11 and Mali Binary Drivers

    Postby WebReflection » Wed Aug 14, 2013 5:15 pm

    as quick note: above walk-through works only via SD card since there's no way to reach /dev/mali and others when booting from NAND.

    I am trying to investigate about this issue (and why this is happening) but so far no clues at all so if you have a solution to modprobe.d and modules when booting from NAND please share, thanks
    WebReflection
     
    Posts: 99
    Joined: Tue Apr 02, 2013 6:49 pm

    Re: [SOLVED] X11 and Mali Binary Drivers

    Postby WebReflection » Sun Aug 18, 2013 6:44 pm

    quick update ... looks like if you follow this procedure (scroll down a bit) after having a working mali via the procedure I've described here, you'll have mali driver via nand too.

    If you try to do the procedure I've described from a freshly new ArchLinux installation over the nand, it won't work for some reason I have no idea about ^_^
    WebReflection
     
    Posts: 99
    Joined: Tue Apr 02, 2013 6:49 pm

    Re: [SOLVED] X11 and Mali Binary Drivers

    Postby motroxx » Sat Oct 05, 2013 12:52 pm

    Hello,

    I stuck in
    $this->bbcode_second_pass_code('', 'cd /home/sunxi-mali/test
    # vi Makefile before building
    # append -lX11 to the list of make arguments
    make
    # see the triangle
    ./test')

    with this error message:
    $this->bbcode_second_pass_code('', '[root@olimex test]# make
    cc -Wall -o test test.c -lEGL -lGLESv2
    /usr/bin/ld: /tmp/ccj0hR76.o: undefined reference to symbol 'XNextEvent'
    /usr/bin/ld: note: 'XNextEvent' is defined in DSO /usr/lib/libX11.so.6 so try adding it to the linker command line
    /usr/lib/libX11.so.6: could not read symbols: Invalid operation
    collect2: Fehler: ld gab 1 als Ende-Status zurück
    ')
    >> EDIT:
    I solved it...just read the message :/


    do you know what could cause the error and how to solve it?
    I tried to complete the HowTo without building the test, but when I start X11, i get this message in Xorg.0.log:
    $this->bbcode_second_pass_code('', '[ 1677.185] (EE) AIGLX error: dlopen of /usr/lib/xorg/modules/dri/sunxi-mali_dri.so failed (/usr/lib/xorg/modules/dri/sunxi-mali_dri.so: cannot open shared object file: No such file or directory)
    [ 1677.185] (EE) AIGLX: reverting to software rendering
    ')


    Thanks a lot!
    motroxx
     
    Posts: 5
    Joined: Sun Oct 14, 2012 10:52 am

    Re: [SOLVED] X11 and Mali Binary Drivers

    Postby goofy03 » Mon Oct 07, 2013 12:26 pm

    Hi !
    i can't get it to work i try two method with package i get too complicated dependency loop and with git way i get :

    $this->bbcode_second_pass_code('', '
    [ 956.868] (II) LoadModule: "fbturbo"
    [ 956.868] (II) Loading /usr/lib/xorg/modules/drivers/fbturbo_drv.so
    [ 956.873] (II) Module fbturbo: vendor="X.Org Foundation"
    [ 956.873] compiled for 1.14.3, module version = 0.3.1
    [ 956.873] Module class: X.Org Video Driver
    [ 956.873] ABI class: X.Org Video Driver, version 14.1
    [ 956.873] (II) FBTURBO: driver for framebuffer: fbturbo
    [ 956.873] (--) using VT number 2

    [ 956.874] (WW) Falling back to old probe method for fbturbo
    [ 956.874] (II) Loading sub module "fbdevhw"
    [ 956.874] (II) LoadModule: "fbdevhw"
    [ 956.875] (II) Loading /usr/lib/xorg/modules/libfbdevhw.so
    [ 956.875] (II) Module fbdevhw: vendor="X.Org Foundation"
    [ 956.875] compiled for 1.14.3, module version = 0.0.2
    [ 956.875] ABI class: X.Org Video Driver, version 14.1
    [ 956.875] (EE) open /dev/fb: No such file or directory
    [ 956.876] (EE) No devices detected.
    ')

    all my module are loaded without error and have good right on path but i cant get /dev/fbX thing …

    I can't get console at bootime on my screen too, i have follow the official installation for pcduino on arch linux ARM website.
    Everything is ok with official lxubuntu nand image for pcduino.

    I come from arch for x86 but uboot is not Grub ;-) If good soul could help me please … :)
    goofy03
     
    Posts: 1
    Joined: Mon Oct 07, 2013 12:13 pm

    Re: [SOLVED] X11 and Mali Binary Drivers

    Postby motroxx » Tue Oct 08, 2013 12:58 pm

    Hey Goofy,
    I'm not really sure, but I think there is a problem with your Kernel. Try to activate FB/Framebuffer in your config-File..
    I don't know what a board you have, but here is a sample kernel config of the Olimex A20-Olinuxino (extracted from the Debian Image): http://pastebin.com/4tFiVrTf
    motroxx
     
    Posts: 5
    Joined: Sun Oct 14, 2012 10:52 am

    Re: [SOLVED] X11 and Mali Binary Drivers

    Postby WebReflection » Wed Oct 16, 2013 11:17 pm

    dear all, this guide is still valid except the repository and the driver changed name so xf86-video-sunxifb is wrong and it is called xf86-video-fbturbo now.

    This part needs some change such:
    $this->bbcode_second_pass_code('', '
    # instead of
    # git clone https://github.com/ssvb/xf86-video-sunxifb

    git clone https://github.com/ssvb/xf86-video-fbturbo

    # then
    cd /home/xf86-video-fbturbo
    autoreconf -vi
    ./configure --prefix=/usr
    make
    make install
    ')

    The driver name must be changed accordingly
    $this->bbcode_second_pass_code('', '
    echo 'Section "Device"
    Identifier "Allwinner A10/A13 FBDEV"
    Driver "fbturbo"
    Option "fbdev" "/dev/fb0"
    Option "SwapbuffersWait" "true"
    # `man fbturbo ` to know more options
    Option "AccelMethod" "G2D"
    EndSection
    '>/etc/X11/xorg.conf.d/99-fbturbo.conf
    ')

    I hope this helps.

    Update
    I've updated the guide too with these info.
    WebReflection
     
    Posts: 99
    Joined: Tue Apr 02, 2013 6:49 pm

    Re: [SOLVED] X11 and Mali Binary Drivers

    Postby cgo » Sat Nov 30, 2013 1:54 pm

    Hi,

    thanks for your guide, it proved very helpful. I run arch on a cubieboard 1.0.

    I have some questions:

    There are libdri2-git, xf86-video-fbturbo-git and mali-firmware (not sure this last one is related) PKGBUILDs in aur. Why not use them ? Just asking, there may be a good reason.

    Also, in the end I got everything working, (the test shows a triangle and uses Mali GPU) but xorg log shows:

    $this->bbcode_second_pass_code('', '(II) FBTURBO(0): [DRI2] DRI driver: lima
    (II) FBTURBO(0): using DRI2 integration for Mali GPU (UMP buffers)
    (II) FBTURBO(0): Mali binary drivers can only accelerate EGL/GLES
    (II) FBTURBO(0): so AIGLX/GLX is expected to fail or fallback to software
    (==) RandR enabled
    (EE) AIGLX error: dlopen of /usr/lib/xorg/modules/dri/lima_dri.so failed (/usr/lib/xorg/modules/dri/lima_dri.so: cannot open shared object file: No such file or directory)')

    instead of complaining about Mali_DRI2_dri.so. Is that normal because something changed meanwhile, or did I do something wrong ? This message can be a hint: xbmc says: libGL error: failed to load driver: lima

    Thanks,

    --
    Charles
    cgo
     
    Posts: 1
    Joined: Sat Nov 30, 2013 1:37 pm

    Re: [SOLVED] X11 and Mali Binary Drivers

    Postby WebReflection » Wed Dec 04, 2013 6:40 pm

    the only wrong thing you did was to use that aur package that unfortunately is not as reliable as the manual build I've described in these steps.

    I wish it was that easy, unfortunately it's not :(
    WebReflection
     
    Posts: 99
    Joined: Tue Apr 02, 2013 6:49 pm


    Return to Allwinner

    Who is online

    Users browsing this forum: No registered users and 3 guests

    cron