Greg Posted September 9, 2017 Posted September 9, 2017 On 16 June 2016 at 9:18 AM, dimag0g said: Hello, I wish to share my research on getting OpenGL to work on Mali GPU. I realize Armbian focuses on server images, but I suppose many people would be interested nevertheless. I have a Banana Pi Pro and an Orange Pi PC, which both have a compatible GPU. Perhaps it will work on other boards as well. Here are the commands I used to get OpenGL to work. 1. Install: # install GLX Gears, mesa GL and GLU libraries apt-get -y install mesa-utils # install development tools apt-get -y install build-essential automake pkg-config libtool ca-certificates git cmake subversion # install required libraries apt-get install libx11-dev libxext-dev xutils-dev libdrm-dev x11proto-xf86dri-dev libxfixes-dev # get source code git clone https://github.com/robclark/libdri2 git clone https://github.com/linux-sunxi/libump git clone https://github.com/linux-sunxi/sunxi-mali git clone https://github.com/ssvb/xf86-video-fbturbo git clone https://github.com/ptitSeb/glshim # install mali driver cd sunxi-mali git submodule init git submodule update git pull wget http://pastebin.com/raw.php?i=hHKVQfrh -O ./include/GLES2/gl2.h wget http://pastebin.com/raw.php?i=ShQXc6jy -O ./include/GLES2/gl2ext.h make config ABI=armhf VERSION=r3p0 mkdir /usr/lib/mali echo "/usr/lib/mali" > /etc/ld.so.conf.d/1-mali.conf make -C include install make -C lib/mali prefix=/usr libdir='$(prefix)/lib/mali/' install cd .. 2. Build # Step 1: build and install helper libraries cd libdri2 autoreconf -i ./configure --prefix=/usr make make install cd .. cd libump autoreconf -i ./configure --prefix=/usr make make install cd .. # Step 2: build video driver cd xf86-video-fbturbo autoreconf -i ./configure --prefix=/usr make make install cd .. # Step 3: build GL wrapper cd glshim cmake . make cp lib/libGL.so.1 /usr/lib/ # replace the software GL library with the wrapper cd .. 3. Configure your system - configure your kernel to allocate memory for the GPU - make sure mali and mali_drm kernel modules are loaded - give your user permissions to access /dev/ump and /dev/mali - configure Xorg to use fbturbo driver 4. Test: # run a basic test glxgears # install and run a GL benchmark apt-get -y install globs /usr/lib/globs/benchmarks/GL_pointz/gl_pointz # try to run a real game apt-get -y install billard-gl billard-gl This all worked out for me rather nicely. The only issue I have encountered is a segfault that many GL programs get when they shut down. I'm currently debugging this issue, but it would be helpful to know others experience it as well, and perhaps get some advice from people experienced in GLX or SDL. Edit: I know glxgears is not a real benchmark, but let me give you some numbers to make it clear what I'm talking about. Results are from Orange Pi PC clocked at 1296000 Hz (and are CPU-bound): user@bananapi:~$ glxgears LIBGL: Initialising glshim libGL: built on Jun 12 2016 06:12:01 LIBGL: Current folder is:/home/user libGL:loaded: libGLESv1_CM.so libGL:loaded: libEGL.so 2074 frames in 5.0 seconds = 414.688 FPS 2071 frames in 5.0 seconds = 414.085 FPS 2070 frames in 5.0 seconds = 413.915 FPS ^C Hi there, I followed this for my pcDuino3 and it worked well except that graphics run slow, but better then they did before I followed this. In step 3 you say to configure your kernel to allocate memory for the GPU. I am a bit unsure on what to do here and realise it is platform specific. However, could you provide any further instruction on why to do. I am booting of an SD card and have tried updating a file called uEnv.txt to add commands shown on the configure page to this but they don't seem to have any effect. Ultimately I am trying to run emulation station and tetrarch ala retropie on my pcDuino3. It has been challenging to say the least! Any help or pointers you could give would be appreciated. Thanks, Greg 1
sans-ltd Posted March 10, 2018 Posted March 10, 2018 Hello finally it turns out that the package libglshim is missing alternative information. But this package is needed to use the Mali EGL driver as GL driver. To work around this we manually added the alternative information: echo /usr/lib/arm-linux-gnueabihf/glshim > /usr/lib/arm-linux-gnueabihf/glshim/ld.so.conf export DEB_HOST_MULTIARCH=arm-linux-gnueabihf sudo update-alternatives --force --install /etc/ld.so.conf.d/${DEB_HOST_MULTIARCH}_GL.conf ${DEB_HOST_MULTIARCH}_gl_conf /usr/lib/${DEB_HOST_MULTIARCH}/glshim/ld.so.conf 500 Then we switched to glshim instead of Mesa for GL: sudo update-alternatives --config arm-linux-gnueabihf_gl_conf There are 2 choices for the alternative arm-linux-gnueabihf_gl_conf (providing /etc/ld.so.conf.d/arm-linux-gnueabihf_GL.conf). Selection Path Priority Status ------------------------------------------------------------ * 0 /usr/lib/arm-linux-gnueabihf/mesa/ld.so.conf 500 auto mode 1 /usr/lib/arm-linux-gnueabihf/glshim/ld.so.conf 500 manual mode 2 /usr/lib/arm-linux-gnueabihf/mesa/ld.so.conf 500 manual mode Choose 1 here In addition we checked if Mali-EGL is used instead of Mesa-EGL: sudo update-alternatives --config arm-linux-gnueabihf_egl_conf There are 2 choices for the alternative arm-linux-gnueabihf_egl_conf (providing /etc/ld.so.conf.d/arm-linux-gnueabihf_EGL.conf). Selection Path Priority Status ------------------------------------------------------------ * 0 /usr/lib/arm-linux-gnueabihf/mali-egl/ld.so.conf 600 auto mode 1 /usr/lib/arm-linux-gnueabihf/mali-egl/ld.so.conf 600 manual mode 2 /usr/lib/arm-linux-gnueabihf/mesa-egl/ld.so.conf 500 manual mode And finally sudo ldconfig Now glxgears runs with 140FPS and 60% CPU on a Allwinner A20. @Armbian Maintainers: It would be great if you could fix the libglshim package in the future and add the alternatives information. Greetings Florian
zador.blood.stained Posted March 10, 2018 Posted March 10, 2018 10 minutes ago, sans-ltd said: @Armbian Maintainers: It would be great if you could fix the libglshim package in the future and add the alternatives information. glshim doesn't work well with some applications (i.e. web browsers) so it does not replace Mesa by default. It should be used only with individual applications via changing LD_LIBRARY_PATH or using LD_PRELOAD with a special library.
sans-ltd Posted March 11, 2018 Posted March 11, 2018 Ahh OK I see. What solution can you suggest in conjuction with Electron / Chromium / (Firefox)? Is there a way to get them working directly on EGL instead of GL? We want to run a HTML 5 application on the Allwinner A20. If all fails, we would port it to Qt/QML which hopefully has better EGL support. But the alternatives information would still be great, maybe with a lower priority than Mesa, so it could be activated easily if needed. I fully agree that it cannot be a default solution when it has issues with browsers. Regards Florian
Oleg Oleg Posted December 26, 2018 Posted December 26, 2018 Hi, @dimag0g. First of all, thanks for the tutorial: quite extensive. I've got a couple of problems implementing it to make OpenGL work on my BananaPi M2U. After me performing first two steps of this howto, the kernel is still unable to locate the mali module: # modprobe mali modprobe: FATAL: Module mali not found in directory /lib/modules/4.18.18-sunxi Neither are there /dev/ump or /dev/mali in my system. The second problem is that the changes I made in /boot/armbianEnv.txt do not seem to have any effect. The parameters added are: disp_mem_reserves=on cma=256M Is there a special step that I am missing to make kernel respect the changes? (I did reboot the system of course) The content of my /etc/armbian-release is as follows: BOARD=bananapim2ultra BOARD_NAME="Banana Pi M2U" BOARDFAMILY=sun8i VERSION=5.66 LINUXFAMILY=sunxi BRANCH=dev ARCH=arm IMAGE_TYPE=user-built BOARD_TYPE=csc INITRD_ARCH=arm KERNEL_IMAGE_TYPE=zImage Any advise is appreciated, I'm sort of stuck.
tommy Posted January 1, 2019 Posted January 1, 2019 On 12/26/2018 at 10:26 PM, Oleg Oleg said: Hi, @dimag0g. First of all, thanks for the tutorial: quite extensive. I've got a couple of problems implementing it to make OpenGL work on my BananaPi M2U. After me performing first two steps of this howto, the kernel is still unable to locate the mali module: # modprobe mali modprobe: FATAL: Module mali not found in directory /lib/modules/4.18.18-sunxi Neither are there /dev/ump or /dev/mali in my system. The second problem is that the changes I made in /boot/armbianEnv.txt do not seem to have any effect. The parameters added are: disp_mem_reserves=on cma=256M Is there a special step that I am missing to make kernel respect the changes? (I did reboot the system of course) The content of my /etc/armbian-release is as follows: BOARD=bananapim2ultra BOARD_NAME="Banana Pi M2U" BOARDFAMILY=sun8i VERSION=5.66 LINUXFAMILY=sunxi BRANCH=dev ARCH=arm IMAGE_TYPE=user-built BOARD_TYPE=csc INITRD_ARCH=arm KERNEL_IMAGE_TYPE=zImage Any advise is appreciated, I'm sort of stuck. This tutorial is not for mainline kernel.
Kiko Posted May 24, 2019 Posted May 24, 2019 On 2/5/2017 at 7:41 PM, copytco said: Ok, so I started this tutorial again on legacy desktop. I have issues when trying to compile xf86-video-fbturbo. It says: ./configure: line 18655: syntax error near unexpected token `RANDR,' ./configure: line 18655: `XORG_DRIVER_CHECK_EXT(RANDR, randrproto)' Also, before mali driver did not want to compile before I compiled and installed libdri2 and libump, because it was recognized as its dependencies. Any thoughts? That happened to me also, I ran apt-get install xorg-dev and it went away
appz Posted July 23, 2019 Posted July 23, 2019 http://ix.io/1Ph7 It is work $ sudo modinfo lima filename: /lib/modules/4.19.57-sunxi/kernel/drivers/gpu/drm/lima/lima.ko license: GPL v2 description: Lima DRM Driver author: Lima Project Developers alias: of:N*T*Carm,mali-450C* alias: of:N*T*Carm,mali-450 alias: of:N*T*Carm,mali-400C* alias: of:N*T*Carm,mali-400 depends: ttm,gpu-sched intree: Y name: lima vermagic: 4.19.57-sunxi SMP mod_unload ARMv7 thumb2 p2v8 parm: sched_timeout_ms:task run timeout in ms (0 = no timeout (default)) (int) parm: sched_max_tasks:max queued task num in a context (default 32) (int) parm: max_mem:Max memory size in MB can be used (<0 = auto) (int) But billard is slow sudo apt-get -y install billard-gl simple@orangepiplus2e:~ $ /usr/lib/globs/benchmarks/GL_pointz/gl_pointz fps = 3.2 Why it is so slow?
Igor Posted July 23, 2019 Posted July 23, 2019 11 minutes ago, appz said: Why it is so slow? Because functionality is in an early development stage. Closed source variant, which should work much faster/normal, is also in the works - help is needed to get that working that we can merge https://github.com/armbian/build/pull/1409
AnonymousPi Posted December 18, 2019 Posted December 18, 2019 Hi Igor. Is there any update on mali integration in the mainline kernel? It does not look like there has been any movement on that pull request, so I assume hardware accelerated 3D graphics is still out of the question?
Igor Posted December 18, 2019 Posted December 18, 2019 6 hours ago, AnonymousPi said: Is there any update on mali integration in the mainline kernel? Nothing is developed in secrecy. You see what I see - we don't cover explaining where development is - it just adds to the bill we have to pay in 99%. There is a lot of work to move thing forward from the state where it got stuck. Armbian have zero R&D budget and no employees. Its amazing to get this far without ... and its not enough? 6 hours ago, AnonymousPi said: so I assume hardware accelerated 3D graphics is still out of the question? Open source driver is present in the kernel for about a year now. Its not very fast, but it works.
OOKAMI Posted December 18, 2019 Posted December 18, 2019 On 6/16/2016 at 1:18 AM, dimag0g said: Hello, I wish to share my research on getting OpenGL to work on Mali GPU. I realize Armbian focuses on server images, but I suppose many people would be interested nevertheless. I have a Banana Pi Pro and an Orange Pi PC, which both have a compatible GPU. Perhaps it will work on other boards as well. Here are the commands I used to get OpenGL to work. 1. Install: # install GLX Gears, mesa GL and GLU libraries apt-get -y install mesa-utils # install development tools apt-get -y install build-essential automake pkg-config libtool ca-certificates git cmake subversion # install required libraries apt-get install libx11-dev libxext-dev xutils-dev libdrm-dev x11proto-xf86dri-dev libxfixes-dev # get source code git clone https://github.com/robclark/libdri2 git clone https://github.com/linux-sunxi/libump git clone https://github.com/linux-sunxi/sunxi-mali git clone https://github.com/ssvb/xf86-video-fbturbo git clone https://github.com/ptitSeb/glshim # install mali driver cd sunxi-mali git submodule init git submodule update git pull wget http://pastebin.com/raw.php?i=hHKVQfrh -O ./include/GLES2/gl2.h wget http://pastebin.com/raw.php?i=ShQXc6jy -O ./include/GLES2/gl2ext.h make config ABI=armhf VERSION=r3p0 mkdir /usr/lib/mali echo "/usr/lib/mali" > /etc/ld.so.conf.d/1-mali.conf make -C include install make -C lib/mali prefix=/usr libdir='$(prefix)/lib/mali/' install cd .. 2. Build # Step 1: build and install helper libraries cd libdri2 autoreconf -i ./configure --prefix=/usr make make install cd .. cd libump autoreconf -i ./configure --prefix=/usr make make install cd .. # Step 2: build video driver cd xf86-video-fbturbo autoreconf -i ./configure --prefix=/usr make make install cd .. # Step 3: build GL wrapper cd glshim cmake . make cp lib/libGL.so.1 /usr/lib/ # replace the software GL library with the wrapper cd .. 3. Configure your system - configure your kernel to allocate memory for the GPU - make sure mali and mali_drm kernel modules are loaded - give your user permissions to access /dev/ump and /dev/mali - configure Xorg to use fbturbo driver 4. Test: # run a basic test glxgears # install and run a GL benchmark apt-get -y install globs /usr/lib/globs/benchmarks/GL_pointz/gl_pointz # try to run a real game apt-get -y install billard-gl billard-gl This all worked out for me rather nicely. The only issue I have encountered is a segfault that many GL programs get when they shut down. I'm currently debugging this issue, but it would be helpful to know others experience it as well, and perhaps get some advice from people experienced in GLX or SDL. Edit: I know glxgears is not a real benchmark, but let me give you some numbers to make it clear what I'm talking about. Results are from Orange Pi PC clocked at 1296000 Hz (and are CPU-bound): user@bananapi:~$ glxgears LIBGL: Initialising glshim libGL: built on Jun 12 2016 06:12:01 LIBGL: Current folder is:/home/user libGL:loaded: libGLESv1_CM.so libGL:loaded: libEGL.so 2074 frames in 5.0 seconds = 414.688 FPS 2071 frames in 5.0 seconds = 414.085 FPS 2070 frames in 5.0 seconds = 413.915 FPS ^C Thanks for your precious tutorial :) i have an issue on the first step for the command make config ABI=armhf VERSION=r3p0 r3p0 => i think i have to replace by the last version in the git clone folder correct ? when launching make config ABI=armhf VERSION=r9p0 i have this result root@DietPi:~/sunxi-mali# make config ABI=armhf VERSION=r9p0 make: *** No rule to make target 'config'. Stop. for this section 3. Configure your system - configure your kernel to allocate memory for the GPU - make sure mali and mali_drm kernel modules are loaded - give your user permissions to access /dev/ump and /dev/mali - configure Xorg to use fbturbo driver I don't know how to perform kernel configuration (this is my first time sorry :) ) and would like how with your help :) all others sections has been done without any issue :) Thanks for the help :)
Igor Posted December 18, 2019 Posted December 18, 2019 6 hours ago, OOKAMI said: 6/16/2016 Have you noticed the year of this tutorial? All Armbian desktop images for A10/A20/H3/A64 with kernel 3.4.y / 3.10.y (you can find them on each download pages, scroll down and look for OLD) comes with 3D and video acceleration out of the box. You don't need to do anything while this method will 100% not work on modern kernel (4.19.y / 5.3.y) or some diedized justice / Dietpi. Perhaps it can be done with extensive fixing and adjustment but its already too expensive to help in a known non broken environment.
OOKAMI Posted December 18, 2019 Posted December 18, 2019 1 hour ago, Igor said: Have you noticed the year of this tutorial? All Armbian desktop images for A10/A20/H3/A64 with kernel 3.4.y / 3.10.y (you can find them on each download pages, scroll down and look for OLD) comes with 3D and video acceleration out of the box. You don't need to do anything while this method will 100% not work on modern kernel (4.19.y / 5.3.y) or some diedized justice / Dietpi. Perhaps it can be done with extensive fixing and adjustment but its already too expensive to help in a known non broken environment. thanks for your reply didn't know this will only work for 3.x I am on 4.14 I would like to use armbian for nanopim1 but it always stop for temp critical cpu sensor is wrong and i don't find any info to disable cpu sensor monitor Thanks for your time and help
Igor Posted December 18, 2019 Posted December 18, 2019 On 4.14 will not work. If there is a problem with supported boards we try to fix them. I didn't know there is such problem you are mentioning. Which board, which kernel?Wrote on mobile
OOKAMI Posted December 18, 2019 Posted December 18, 2019 5 minutes ago, Igor said: On 4.14 will not work. If there is a problem with supported boards we try to fix them. I didn't know there is such problem you are mentioning. Which board, which kernel? Wrote on mobile board model is NANOPI M1 any version and any kernel tried many version and alway stop with and error "critical temp" i tried to disable hardware monitor services in order to overide sensor monitor but no effect i can take a picture if you need more precision i can try with Armbian_5.84_Nanopim1_Ubuntu_xenial_default_3.4.113_desktop image and if error occure, i can make a picture
Igor Posted December 18, 2019 Posted December 18, 2019 34 minutes ago, OOKAMI said: 3.4.113 We officially drop support for this prehistoric kernel months ago, others did this years ago. We (used to) support only last images from the download section. (last image with this kernel was 5.90) Try last images with modern kernel from: https://www.armbian.com/nanopi-m1/ They should work.
AnonymousPi Posted December 18, 2019 Posted December 18, 2019 12 hours ago, Igor said: Nothing is developed in secrecy. You see what I see - we don't cover explaining where development is - it just adds to the bill we have to pay in 99%. There is a lot of work to move thing forward from the state where it got stuck. Armbian have zero R&D budget and no employees. Its amazing to get this far without ... and its not enough? OK. I'll refer to the Git going forward. My question was more out of curiosity, not a demand. Armbian on an Orange Pi PC does everything one could want now thanks to the work sunxi have done and your tireless unpaid hard work. It's amazing how far things have come. Merry Christmas!
OOKAMI Posted December 18, 2019 Posted December 18, 2019 1 hour ago, Igor said: We officially drop support for this prehistoric kernel months ago, others did this years ago. We (used to) support only last images from the download section. (last image with this kernel was 5.90) Try last images with modern kernel from: https://www.armbian.com/nanopi-m1/ They should work. thanks for your precision about the correct image really appreciate i will prepare it and show error if it occure
Igor Posted December 18, 2019 Posted December 18, 2019 25 minutes ago, AnonymousPi said: I'll refer to the Git going forward. Good. It there is nothing going on, there is nothing to add by me. Why should I do anything regarding MALI anyway? 31 minutes ago, AnonymousPi said: not a demand. No, it was not a demand but can be understand as a pressure. Which is not acceptable. 25 minutes ago, AnonymousPi said: It's amazing how far things have come. Indeed.
OOKAMI Posted December 18, 2019 Posted December 18, 2019 Hello first of all, I would like to thank you for your big help i downloaded image and made boot This, time, this version looks working (green led blinking, a good sign ) but screen show red my screen show 1280x720 60p resolution I think this can be resolved by changing to a lower resolution from image but don't know where exactly Thanks for your help and your time UPDATE finally had first connection by SSH ARMBIAN purposed to change resolution (great ) i just need to set the correct value for my board just need to know how to
johnsmith101 Posted December 26, 2019 Posted December 26, 2019 Hello, i have a problem to allocate memory of GPU, I do not know if I should just change a file boot.cmd tubemate get-mobdro.com authorityapk.com
cxm Posted March 11, 2020 Posted March 11, 2020 What about set cpu overclock in moment? sudo apt-get install cpufrequtils sudo cpufreq-set -g performance glxgears
Recommended Posts