Discussion

Mali GPU driver

131 97863
nnn2  
Post Last Edited by tony_zhang at 2014-7-22 01:57
  1. EGL Version: "1.4 Linux-r3p0-04rel0"
  2. EGL Vendor: "ARM"
  3. EGL Extensions: "EGL_KHR_image EGL_KHR_image_base EGL_KHR_image_pixmap EGL_KHR_g
  4. l_texture_2D_image EGL_KHR_gl_texture_cubemap_image EGL_KHR_gl_renderbuffer_imag
  5. e EGL_KHR_reusable_sync EGL_KHR_fence_sUMP<2>: ync EGL_KHR_lock_surface EGL_KHRS
  6. ession closed
  7. _lock_surface2 "
  8. Surface size: 480x480
  9. GL Vendor: "ARM"
  10. GL Renderer: "Mali-400 MP"
  11. GL Version: "OpenGL ES 2.0"
  12. GL Extensions: "GL_OES_texture_npot GL_OES_compressed_ETC1_RGB8_texture GL_OES_s
  13. tandard_derivatives GL_OES_EGL_image GL_OES_depth24 GL_ARM_rgba8 GL_ARM_mali_sha
  14. der_binary GL_OES_depth_texture GL_OES_packed_depth_stencil GL_EXT_texture_forma
  15. t_BGRA8888 GL_EXT_blend_minmax GL_OES_EGL_image_external GL_OES_EGL_sync GL_EXT_
  16. multisampled_render_to_texture GL_EXT_discard_framebuffer GL_OES_get_program_bin
  17. ary GL_EXT_shader_texture_lod "
Copy the Code


Success! This looks very nice, a step forward for having accelerated video decoding.
Did it build by you? The source code for Banana Pi has been publiuc. https://github.com/LeMaker

nnn2  
Post Last Edited by nnn2 at 2014-7-22 02:07

Reply 2# tony_zhang


   Thank you! I just saw that, now cloning the repo to test, fingers crossed!
My test was from linux-sunxi and using http://linux-sunxi.org/Mali_binary_driver

if I can get the network to boot on open source kernel I'll test everything properly
After that ... time for open source gpu drivers from limadrivers ;)

The mali driver can be load in the default kernel config from Lemaker Github. (If I don't remember wrong)

The mali driver can be load in the default kernel config from Lemaker Github. (If I don't remember wrong)

nnn2  
Post Last Edited by nnn2 at 2014-7-23 09:24

Ok, I finally found a way to play fullhd video without any stuttering or tearing or anything.

First, you need to load kernel modules mali, ump and sunxi_cedar_mod. If you don't have any of those, grab the kernel source and compile yourself. (http://wiki.lemaker.org/index.php?title=Building_u-boot,_script.bin_and_linux-kernel)
Then you need https://github.com/linux-sunxi/libvdpau-sunxi
Then you need https://github.com/linux-sunxi/sunxi-mali and Xorg running on it (see: http://linux-sunxi.org/Mali_binary_driver)

Then you can start mplayer as:

  1. export VDPAU_DRIVER=sunxi
  2. mplayer -vo vdpau -vc ffmpeg12vdpau,ffh264vdpau, [filename]
Copy the Code
and it works!

CPU usage when playing full hd movie: 12% Xorg, 8% mplayer. Plays absolutely perfectly.

Troubleshooting:
- you need to run as root or allow write to /dev/g2d to your user.
- make sure /dev/mali /dev/g2d and /dev/cedar_dev exist (this tells you whenever you have needed kernel modules)

Problems:
- still wasn't able to use hdmi audio with banana ...
- subtitles don't show up

nnn2  
Post Last Edited by nnn2 at 2014-7-23 19:33

- Subtitles fixed
- hdmi audio works

Anyone would be interested in a system i made? Custom kernel, custom script.bin, clean debian wheezy (debootstraped), has simple desktop (lxde) perfectly runs all videos by double clicking them - h264 is hardware decoded, other are software (with two threads) and so far all my movies and tv series worked fine. 1080p, 720p, 480p all fine!

I need to add a few more things, like basic browser and audio player, but I want to keep the whole thing below 1GB. So far so good. If anyone is interested I can upload it early stage.

muf  
i am interesting by your custom kernel, and i want to adapt it to mu archlinux image.
Can you explain me how have you compile your kernel ?

First, you need to load kernel modules mali, ump and sunxi_cedar_mod. If you don't have any of those, grab the kernel source and compile yourself. (http://wiki.lemaker.org/index.php?title=Building_u-boot,_script.bin_and_linux-kernel)
Then you need https://github.com/linux-sunxi/libvdpau-sunxi
Then you need https://github.com/linux-sunxi/sunxi-mali and Xorg running on it (see: http://linux-sunxi.org/Mali_binary_driver)


I don't understand this. I have compiled my kernel from " https://github.com/LeMaker" too but how have you add "libvdpau-sunxi" and  "sunxi-mali" ?

Juni  
Nice work, could you explain a little more detailed what you have done? I mean in steps, etc... You dont have to explain every step in detailed.

nnn2  
Post Last Edited by tony_zhang at 2014-7-24 09:20

My custom kernel doesn't have any important changes for playing videos, I just enabled async crypto. However building your own kernel is needed to get a working mali.

OK, a little more detailed process:

0. You need to modify script.bin. You can find in link below how to do that, important bits:
  1. fb0_framebuffer_num = 3
  2. sunxi_fb_mem_reserve = 32
Copy the Code


in [disp_init] section. One of them exists but is lower num, second you need to add.

1. you need mali driver running in the kernel. This means that eg. raspbian images won't work, they don't have it compiled. THANK YOU Tony for finally releasing the sources so that we can compile our own kernel, and this will include mali.

Build kernel normally, as per here. When you built uImage and modules, make sure it has mali.ko, for example:


  1. $ make INSTALL_MOD_PATH=output modules_install
  2. $ find output -name mali.ko
  3. output/lib/modules/3.4.90+/kernel/drivers/gpu/mali/mali/mali.ko
Copy the Code


^ Here we can see it finds it. We copy the output/lib/* to our sdcard /lib/.

In /etc/modules you have to add:

  1. ump
  2. mali
  3. mali_drmsunxi_cedar_mod
Copy the Code


After reboot (or just modprobe them) type `lsmod` and make sure it lists them.

That's step 1: making sure our kernel supports mali. Again, default raspbian image doesn't have them, you have to compile your own and copy modules dir from output.

2. We need Xorg running on mali driver. There is a great, step-by-step guide here: http://linux-sunxi.org/Xorg#fbturbo_driver
3. We need libvdpau. First:

  1. $ apt-get install libvdpau-dev vdpauinfo
  2. $ git clone https://github.com/linux-sunxi/libvdpau-sunxi
  3. $ cd libvdpau-sunxi
  4. $ make && make install
Copy the Code


Then check if it works. Make sure you have /dev/disp /dev/g2d /dev/mali /dev/fb* present and X is started
  1. $ export DISPLAY=:0
  2. $ export VDPAU_DRIVER=sunxi
  3. $ vdpauinfo
Copy the Code


The last one should display a meaningful info. If you get error try to trace back all steps and make sure you're running as root (or otherwise can WRITE to /dev/disp /dev/g2d /dev/mali /dev/fb*)

Once that works, you need mplayer. apt-get install mplayer

And in the ~/.mplayer/config write:

  1. vo=vdpau
  2. vc=ffmpeg12vdpau,ffh264vdpau
  3. fullscreen=yes
  4. quiet=yes
  5. ao=pulse
  6. framedrop=yes
  7. cache=8192
  8. lavdopts=threads=2
  9. ass=no
  10. ass-font-scale=1.4
  11. ass-color=FFFFFF00
  12. ass-border-color=00000000
  13. ass-use-margins=yes
  14. ass-bottom-margin=50
  15. spualign=2
  16. subalign=2
  17. subfont=/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf
  18. subcp=cp1250
Copy the Code


Now try playing video & enjoy :^


edit: wtf forum, breaks code tags and then removes whole post lol

You have to log in before you can reply Login | Sign Up

Points Rules