Olimex Support Forum

OLinuXino Android / Linux boards and System On Modules => A20 => Topic started by: toxivirus_jon on February 13, 2014, 11:20:49 am

Title: Qt development on A20
Post by: toxivirus_jon on February 13, 2014, 11:20:49 am
Hi,

looking for install Qt Creator on A20, and develop app on my linux laptop, cross compiling and run on A20.
But I have no info,

Any suggest ?

Thanks

John
Title: Re: Qt development on A20
Post by: ikozic on February 20, 2014, 04:48:15 pm
Hi John,

I'm in a similar problem - but it seems that there are no out-of-the-box solutions for A20, so we should configure and compile Qt for it. The closest topic I have found is at:

http://nickguthrie.com/embedd_gui/doc/

However, I haven't managed so far to get it working the same way - something seems to be off with the cLib on the Debian rootfs that we all use. I've also tried compiling it against ArchLinux rootfs and it gets much farther, but still has some issues and doesn't compile completely.

I'm currently doing some other mods to the kernel and I'll start the work on the Qt next week or so, so if you get somewhere with the link I've sent, please post back - as I said, I had very limited success with it.

Also a tip - I'm pretty sure tslib is not really needed, as touchscreen can work with normal Linux input mouse, so you can discard it.
Title: Re: Qt development on A20
Post by: ikozic on February 26, 2014, 11:04:52 am
I've mostly managed to figure out what's wrong. So, basically, we all use arm-linux-gnueabihf- set of compiler/linker. A dependency to this is libc6 armhf package, but since I'm using Ubuntu 12.04, libc6 is set to 2.15. I'm not really sure whether gcc-4.6 has issues with libc6 2.13 or qt somehow pulls the 2.15 libraries from the libc6 package, but this 0.02 offset in libc6 versions on the host and rootfs is making a lot of compiler errors (I dare say untrackable errors).

Either way, it seems that you should either build with Debian on host for Debian rootfs, or build with Ubuntu on host for Ubuntu rootfs. A bit of a drag really, but I cannot find a way to successfully cross compile qt for Debian rootfs by using Ubuntu host, as libc6 is off.

I don't have a PC with a working Debian distro, but when I compile qt (tried 4.7, 4.8 and 5.2) linked against host's cross-compiled armhf libc6 (so 2.15), it compiles normally, but it'll not run on Debian rootfs as it requires libc6 2.15.

If someone finds a way for this to work, I would really like to hear about it.
Title: Re: Qt development on A20
Post by: codifies on February 26, 2014, 05:58:32 pm
just a thought... why not compile on the actual board itself, especially if you install rootfs on sata and put it on a decent display its quite capable little machine...
Title: Re: Qt development on A20
Post by: ikozic on March 03, 2014, 11:46:16 am
Was already doing it when you wrote your post :)

However, even though it compiled, there are setbacks:
1. Compilation takes forever. Especially with my NFS setup - I basically block both my host and my target for a few hours. I guess it would be much faster with a SATA setup.
2. Support libraries and qmake are only on the target. I'm quite new with Qt, but I guess you will not be able to simply use Qt Creator on host, since you don't have cross qmake.

Also good thing to note:
I have a rev. E Olinuxino-A20-Micro. I'm pretty sure that something is off with the uSD-card slot, since SD-card gets garbled every time I don't use poweroff. It sometimes happens that my FAT partition gets messed up before I even start the kernel, just because I'm power-cycling it (or pressing reset). I was also power cycling several other boards in u-boot and this was never happening. It came to the point where I had to rewrite the SD-card every time my target froze (quite often in development ;) ), so I gave up on the SD-card - I only use it for u-boot (which still gets messed-up once or twice in 2 weeks).
Title: Re: Qt development on A20
Post by: codifies on March 03, 2014, 08:15:50 pm
I've found SD cards too be *very* flaky in sudden power loss situations... (at least on other embedded platforms)

Personally I only use a FAT32 boot partition on micro SD - with root on sata, the boot partition is not in fstab and is never auto mounted...
Title: Re: Qt development on A20
Post by: ikozic on March 25, 2014, 11:34:34 am
If anyone is interested, I have successfully compiled both Qt 4.8.5 and Qt 5.2.1 for A20. It's actually not that difficult. Regarding the issues with libc6 - just upgrade libc6 in debian rootfs (via apt-get) - I've used instructions from the following link:

http://stackoverflow.com/questions/10863613/how-to-upgrade-glibc-from-version-2-13-to-2-15-on-debian

Works like a charm - you'll end up with libc6 2.18 (which is excellent, because my Ubuntu 12.04 has it at 2.15).
I used the instructions on how to compile from the above link. The libraries are ALWAYS pulled from the cross compiler that you have installed (hence cross libc6 is the same version as your host's libc6).

Once it's compiled and ready, brace yourself for some real issues :)

I'm currently trying to modify Qt's display driver in order to use layers...
Title: Re: Qt development on A20
Post by: srxa on March 25, 2014, 02:38:32 pm
I have crosscompiled Qt5.2.1 and 5.3.0 alfa,on ubuntu x64, now i am ready for beta. Actually, it is not easy process to do, but when you catch everything it is pretty straight forward afterwards. I need eglfs option, so I did not try it yet with some window server, maybe i will compile QtWayland plugin if i need to, but for now, i am working on EglfsHooks for Qt, because i need dual monitor support and Qt does not provide it out of the box,at least for eglfs, so i must edit Qt source and make it work for my project. Eglfs also need some patches to work on Mali 400, but now it performs very well. QtCinematicExperience demo gives me at least 85 fps in 1280X720. If you have any questions or issues installing it, I am glad to help. maybe i will write some short tutorial here if i can catch some time ;)
Also, i use little modified kernel, because official one supports Mali r3p0 drivers, and performance are doubled with latest r3p2..
Title: Re: Qt development on A20
Post by: junetec on March 25, 2014, 05:44:45 pm
Where I can find a step by step to install qt in the A20?

Title: Re: Qt development on A20
Post by: ikozic on March 26, 2014, 12:19:31 am
Quote from: srxa on March 25, 2014, 02:38:32 pm
I have crosscompiled Qt5.2.1 and 5.3.0 alfa,on ubuntu x64, now i am ready for beta. Actually, it is not easy process to do, but when you catch everything it is pretty straight forward afterwards. I need eglfs option, so I did not try it yet with some window server, maybe i will compile QtWayland plugin if i need to, but for now, i am working on EglfsHooks for Qt, because i need dual monitor support and Qt does not provide it out of the box,at least for eglfs, so i must edit Qt source and make it work for my project. Eglfs also need some patches to work on Mali 400, but now it performs very well. QtCinematicExperience demo gives me at least 85 fps in 1280X720. If you have any questions or issues installing it, I am glad to help. maybe i will write some short tutorial here if i can catch some time ;)
Also, i use little modified kernel, because official one supports Mali r3p0 drivers, and performance are doubled with latest r3p2..


Well nice :) My problem with Qt is that it has a rather slow interface to display when using standard display driver. So now I'm modifying Qt's linux fb driver to use /dev/disp instead of the /dev/fb. Actually, the problem is in Allwinner for doing such a dumb display interface... On a normal display driver there would be a separate /dev/fb for each overlay.

@junetec:
Regarding a step-by-step guide - this is difficult to find. Most of the stuff is in the link I've provided in an earlier post (nick gurthie), but in case you're running anything newer than Debian 7 on host, you'll have issues with the libc6, which are solved if you upgrade it to anything higher than you have on host - you'll find the info on that in the second link I've provided in this thread.
Title: Re: Qt development on A20
Post by: srxa on March 26, 2014, 01:14:11 am
@ikozic

You don't need to do that, actually they use virtual frame buffers, just edit .fex file and under [disp_init] edit fb0_framebuffer_num to 4. Now it is set for double buffering with 2. But consider to use eglfs with Qt instead of linuxfb, because it is much faster and you will have much more options in Qt, including all OpenGL es2 stuff. For now , i am using eglfs for first display, and for other I start another Qt executable with option -platform linuxfb:fb=/dev/fb1, but i would like to use eglfs on both screens, and i can do this by editing EglfsHooks for Mali 400. You did install Qt with -eglfs -opengl es2 option, didn't you?
Title: Re: Qt development on A20
Post by: Welshman on March 28, 2014, 11:18:35 am
I have compiled QT for A10 and A13 Olinuxino boards

The linked guide above works for these

But I would expect the Qmake config file to be slightly different

can somebody post the contents of their Qmake.conf for A20 


Thanks

here is the qmake.conf for A13

A20 is a cortex A7 for the first difference, anything else to take care of

#
# qmake configuration for building with arm-linux-g++
#
include(../../common/gcc-base-unix.conf)
include(../../common/g++-unix.conf)
include(../../common/linux.conf)
include(../../common/qws.conf)

# modifications to g++.conf
QMAKE_CC                = arm-linux-gnueabihf-gcc -mcpu=cortex-a8 -mtune=cortex-a8 -O0 -mfpu=neon -lrt
QMAKE_CXX               = arm-linux-gnueabihf-g++ -mcpu=cortex-a8 -mtune=cortex-a8 -O0 -mfpu=neon -lrt
QMAKE_LINK              = arm-linux-gnueabihf-g++ -mcpu=cortex-a8 -mtune=cortex-a8 -O0 -mfpu=neon -lrt
QMAKE_LINK_SHLIB        = arm-linux-gnueabihf-g++ -mcpu=cortex-a8 -mtune=cortex-a8 -O0 -mfpu=neon -lrt

# modifications to linux.conf
QMAKE_AR                = arm-linux-gnueabihf-ar cqs
QMAKE_OBJCOPY           = arm-linux-gnueabihf-objcopy
QMAKE_STRIP             = arm-linux-gnueabihf-strip
QMAKE_RANLIB            = arm-linux-gnueabihf-ranlib

# tslib
QMAKE_INCDIR  += /usr/local/tslib/include
QMAKE_LIBDIR  += /usr/local/tslib/lib
QMAKE_LFLAGS += -Wl,-rpath-link=/usr/local/tslib/lib

load(qt_config)

Title: Re: Qt development on A20
Post by: ikozic on April 02, 2014, 01:11:18 pm
Quote from: srxa on March 26, 2014, 01:14:11 am
@ikozic

You don't need to do that, actually they use virtual frame buffers, just edit .fex file and under [disp_init] edit fb0_framebuffer_num to 4. Now it is set for double buffering with 2. But consider to use eglfs with Qt instead of linuxfb, because it is much faster and you will have much more options in Qt, including all OpenGL es2 stuff. For now , i am using eglfs for first display, and for other I start another Qt executable with option -platform linuxfb:fb=/dev/fb1, but i would like to use eglfs on both screens, and i can do this by editing EglfsHooks for Mali 400. You did install Qt with -eglfs -opengl es2 option, didn't you?


For some reason, I'm not getting e-mails when someone replies to the topic - I have to check my settings, so sorry for late reply.

Anyway, interesting - I have made Layers work with a modified driver, although now I am quite curious about this virtual fb stuff. Will try it out in an hour or so and post back. Regarding OpenGL - no, I didn't compile it with OpenGL - not even sure what I need for it, as I've never worked with OpenGL before - I'm just guessing that I should probably load Mali drivers before I start the App on the target, and also point to the correct Mali libs when configuring Qt. Will try it out as well, especially since I don't need GUI on second screen (just video stream).

Regarding qmake.conf - I'll post mine, just give me an hour to have something to eat first :)
Title: Re: Qt development on A20
Post by: ikozic on April 02, 2014, 02:00:12 pm
Qmake.conf that I've been using:

Qt5 (5.2.1) - taken from beagleboard and modified a bit:
#-----------------------------------------------------------------------------------------------------
#
# qmake configuration for the BeagleBoard and BeagleBoard xM boards
# http://beagleboard.org/

MAKEFILE_GENERATOR      = UNIX
CONFIG                 += incremental gdb_dwarf_index
QMAKE_INCREMENTAL_STYLE = sublib

include(../../common/linux.conf)
include(../../common/gcc-base-unix.conf)
include(../../common/g++-unix.conf)

load(device_config)

#QMAKE_INCDIR            = $$[QT_SYSROOT]/usr/include
#QMAKE_LIBDIR            = $$[QT_SYSROOT]/usr/lib

QT_QPA_DEFAULT_PLATFORM = eglfs

# modifications to g++.conf
QMAKE_CC                = $${CROSS_COMPILE}gcc
QMAKE_CXX               = $${CROSS_COMPILE}g++
QMAKE_LINK              = $${QMAKE_CXX}
QMAKE_LINK_SHLIB        = $${QMAKE_CXX}

# modifications to linux.conf
QMAKE_AR                = $${CROSS_COMPILE}ar cqs
QMAKE_OBJCOPY           = $${CROSS_COMPILE}objcopy
QMAKE_NM                = $${CROSS_COMPILE}nm -P
QMAKE_STRIP             = $${CROSS_COMPILE}strip

COMPILER_FLAGS          = -march=armv7-a -mtune=cortex-a7 -mfpu=neon

#modifications to gcc-base.conf
QMAKE_CFLAGS           += $${COMPILER_FLAGS}
QMAKE_CXXFLAGS         += $${COMPILER_FLAGS}
QMAKE_CXXFLAGS_RELEASE += -O3

QMAKE_LIBS             += -lrt -lpthread -ldl

# Extra stuff (OpenGL, DirectFB, ...)
QMAKE_INCDIR_EGL        = $$[QT_SYSROOT]/usr/include
QMAKE_LIBDIR_EGL        = $$[QT_SYSROOT]/usr/lib
QMAKE_INCDIR_OPENGL_ES2 = $${QMAKE_INCDIR_EGL}
QMAKE_LIBDIR_OPENGL_ES2 = $${QMAKE_LIBDIR_EGL}
QMAKE_INCDIR_OPENVG     = $${QMAKE_INCDIR_EGL}
QMAKE_LIBDIR_OPENVG     = $${QMAKE_LIBDIR_EGL}

QMAKE_LIBS_EGL          = -lEGL -lIMGegl -lsrv_um
QMAKE_LIBS_OPENGL_ES2   = -lGLESv2 $${QMAKE_LIBS_EGL}
QMAKE_LIBS_OPENVG       = -lOpenVG $${QMAKE_LIBS_EGL}

# Sanity check
#deviceSanityCheckCompiler()

load(qt_config)
#-----------------------------------------------------------------------------------------------------

Qt4 (4.8.5) - modified arm-linux-g++:
#-----------------------------------------------------------------------------------------------------
#
# qmake configuration for building with arm-linux-g++
#

include(../../common/linux.conf)
include(../../common/gcc-base-unix.conf)
include(../../common/g++-unix.conf)
include(../../common/qws.conf)

# modifications to g++.conf
QMAKE_CC                = arm-linux-gnueabihf-gcc -mcpu=cortex-a7 -mtune=cortex-a7 -O0 -mfpu=neon
QMAKE_CXX               = arm-linux-gnueabihf-g++ -mcpu=cortex-a7 -mtune=cortex-a7 -O0 -mfpu=neon
QMAKE_LINK              = arm-linux-gnueabihf-g++ -mcpu=cortex-a7 -mtune=cortex-a7 -O0 -mfpu=neon
QMAKE_LINK_SHLIB        = arm-linux-gnueabihf-g++ -mcpu=cortex-a7 -mtune=cortex-a7 -O0 -mfpu=neon

# modifications to linux.conf
QMAKE_AR                = arm-linux-gnueabihf-ar cqs
QMAKE_OBJCOPY           = arm-linux-gnueabihf-objcopy
QMAKE_STRIP             = arm-linux-gnueabihf-strip
QMAKE_RANLIB            = arm-linux-gnueabihf-ranlib

# modifications to gcc-base.conf
QMAKE_LIBS             += -lrt

load(qt_config)
#-----------------------------------------------------------------------------------------------------

Bare in mind that I have Ubuntu 12.04 LTS with gcc 4.6, which includes its own libc6 (2.15) and all the other necessary libs. This is why I haven't included anything from the actual rootfs. In fact I did try, but it wouldn't compile correctly.
Title: Re: Qt development on A20
Post by: ikozic on April 02, 2014, 05:56:31 pm
Quote from: srxa on March 26, 2014, 01:14:11 am
@ikozic

You don't need to do that, actually they use virtual frame buffers, just edit .fex file and under [disp_init] edit fb0_framebuffer_num to 4. Now it is set for double buffering with 2. But consider to use eglfs with Qt instead of linuxfb, because it is much faster and you will have much more options in Qt, including all OpenGL es2 stuff. For now , i am using eglfs for first display, and for other I start another Qt executable with option -platform linuxfb:fb=/dev/fb1, but i would like to use eglfs on both screens, and i can do this by editing EglfsHooks for Mali 400. You did install Qt with -eglfs -opengl es2 option, didn't you?


Ok, one more reply, since you've put a bug in my head :)

Framebuffer:
Changed fb0_framebuffer_num to 4, but don't really know how to proceed. My solution opens a different layer only by using /dev/disp and only writes to this layer - it's same like normal framebuffer. For your solution, I really don't know where should I write, as I only have /dev/fb0?

Qt:
What is the difference between -opengl es2 and -eglfs? Seems that people are just using it and giving no explanation on what it does - I went through Qt documentation, but couldn't find anything useful...

OpenGL:
I have trouble finding how Mali is using DEBE/DEFE. I'm also not sure about this driver from Mali - don't really know how to use it for Qt. In the end, the whole GUI should also be layered on top of the video (so video goes under GUI). I'm also not sure on how should I include Mali driver in qmake.conf?

Any pointers are welcome!
Title: Re: Qt development on A20
Post by: srxa on April 04, 2014, 12:26:18 pm
@Ikozic
Ok, I am on business trip right now in Czech Republic, so I will have some time this weekend to write some tutorial and explanations in my hotel room. I will try to explain everything I know so far.
Title: Re: Qt development on A20
Post by: ikozic on April 04, 2014, 02:18:35 pm
Quote from: srxa on April 04, 2014, 12:26:18 pm
@Ikozic
Ok, I am on business trip right now in Czech Republic, so I will have some time this weekend to write some tutorial and explanations in my hotel room. I will try to explain everything I know so far.


Ok - as far as I'm concerned just some pointers should be enough. Either way, a huge thanks from me!
Title: Re: Qt development on A20
Post by: srxa on April 06, 2014, 09:47:22 pm
So, let's start. First, little bit of introduction, because this will be loooong post. For my project I need hardware which is capable of independent dual screens, fast graphics interface on medium to high resolutions, lots of GPIO pins and other I/O interfaces. Also, hardware need to be compact, without fans, hard disks etc. After little research on net, i found that Olinuxino A20 is perfect for my project. It has NAND storage, dual screen, 1GB of ram, nice processing power, lots of GPIO and other ports, and it is open source hardware and software. And Olimex company is relatively close to me(I am from Serbia), and I do not have to deal with some Chinese manufacturer, and I am pretty sure that after I finish my product, I will be able to order whatever I need from them, and I hope that they will reenable PCB production in few months, so when A20 SOM hits the market, I will be able to order A20 SOM's with my custom board design, everything produced by Olimex  ;D . Until this board all my products has XP embedded systems, so I am new in linux. Until I receive A20 micro I know only  cd and ls and man from linux, and nano also  :) . After few days I was compiling kernel, then i made Qt work with my platform, and on the end I solved eglfs plugin from Qt for both displays, so my hardware is ready for development now. I must say that many of your need's will not work out of the box with any similar product, but I found that if you know what you need, you will find many communities online which will help you with your problems, and once you get in linux,  you will find that it is pretty intuitive to work with. Just google for everything you need  ;) . So, because I am beginner with linux, do not mind me if in this explanations and tutorial you find that something can be done easier or on better way, please be kind to post your solutions here.

Now few words about hardware on A20. As far as I know (and this phrase is valid for everything that i will write here, so i will not repeat it  :D ), A20 has mali400MP2 GPU for 2D and 3D accelerations, it is dual core, it works with shared memory and you must reserve some for MALI. MALI did not drive displays, MALI only render everything in memory, and other unit display contents then. On A20 there is also separate 2D acceleration unit called G2D, and video acceleration unit, called CedarX. MALI400 is OpenGL ES 2.0 capable, or compatible, so I decided to use OpenGL ES in my project. Everything you are interested about OpenGL ES you can find at www.khronos.org .

And few words about Qt. My previous projects was based on custom engine made with C backend and javascript. When I search for something that I can use with this platform, and has good support, I found about Qt. It has C++ for my backend where I can drive my hardware, it has QML with embedded javascript engine, where I can work with my GUI, and it is absolutely free and opensource! So, it seems that it is perfect for my needs. Qt has many plugins for different types of "driving" applications on platform, like XCB for x server, linuxfb which uses linux frame buffer, minimalegl, DirectFB which I did not explore enough, and eglfs which I choose. Why eglfs? Eglfs stands for EGL full screen. EGL, as wikipedia says, is "EGL is an interface between Khronos rendering APIs (such as OpenGL, OpenGL ES or OpenVG) and the underlying native platform windowing system. EGL handles graphics context management, surface/buffer binding, rendering synchronization, and enables "high-performance, accelerated, mixed-mode 2D and 3D rendering using other Khronos APIs."
So, because I need for my application to be always full screen, and only running application in system, and i don't need any windowing system, i decided for eglfs. Qt is also cross platform, so if in future I need to port my software solution on some other hardware, it should be easy to do.

Some words about preparing your systems. You can compile Qt on your target device, but it is very long process, and i think that it is easier for development when you have cross compiled Qt, because then you have some remote deployment tools and similar stuff which will make your life easier. For host machine, I am using Ubuntu 13.04 x64 in Parallels on my Mac pro, and on target, because i found on net that MALI drivers version r3p2-01rel2 are much faster and better for my project, i use ssvb's kernel with support for those drivers, and you can find it here: https://github.com/ssvb/linux-sunxi/tree/20130913-mali-r3p2-01rel2 . I will not write about compiling kernel, because everything about that is already on Olimex and linux-sunxi wiki.

So, in order to prepare your systems, you must prepare your HOST and your TARGET machine. Host machine is one where you will cross compile Qt, install Qt creator and use it for development, and target is your device where you will deploy your software.

Preparing  Target:

I assume that you already have ssvb's version of kernel. Next step is to disable login manager. Because I am using Debian rootfs from Olimex latest debian image for A20, it has slim manager. To disable it, go to /etc/X11/default-display-manager and replace only line with /usr/bin/true . Next you need to install or recompile MALI binaries, because I found that if you will use frame buffer device, you must compile MALI with that parameters. So, get the latest mali drivers, go to the directory, and use this:

git submodule init
git submodule update
make config ABI=armhf VERSION=r3p2-01rel2 EGL_TYPE=framebuffer
make install
cd test
make


Next, you must load modules, so:

modprobe mali
modprobe drm
modprobe mali_drm


Now you can test everything, by running

./test

and, if everything is ok, you will see triangle on the display, and if you are running ./test via ssh, you will get next information in console:

QuoteEGL Version: "1.4 Linux-r3p2-01rel2"
EGL Vendor: "ARM"
EGL Extensions: "EGL_KHR_image EGL_KHR_image_base EGL_KHR_image_pixmap EGL_KHR_gl_texture_2D_image EGL_KHR_gl_texture_cubemap_image EGL_KHR_gl_renderbuffer_image EGL_KHR_reusable_sync EGL_KHR_fence_sync EGL_KHR_lock_surface EGL_KHR_lock_surface2 EGL_EXT_create_context_robustness "
Surface size: 480x480
GL Vendor: "ARM"
GL Renderer: "Mali-400 MP"
GL Version: "OpenGL ES 2.0"
GL Extensions: "GL_OES_texture_npot GL_OES_compressed_ETC1_RGB8_texture GL_OES_standard_derivatives GL_OES_EGL_image GL_OES_depth24 GL_ARM_rgba8 GL_ARM_mali_shader_binary GL_OES_depth_texture GL_OES_packed_depth_stencil GL_EXT_texture_format_BGRA8888 GL_EXT_blend_minmax GL_OES_EGL_image_external GL_OES_EGL_sync GL_OES_rgb8_rgba8 GL_EXT_multisampled_render_to_texture GL_EXT_discard_framebuffer GL_OES_get_program_binary GL_ARM_mali_program_binary GL_EXT_shader_texture_lod GL_EXT_robustness GL_OES_depth_texture_cube_map"


Now you are ready to install dependencies for Qt. Different Qt modules requires different packages. I will list only few, but if you need some other dependencies for some module, you will need to install them. First, run:

sudo apt-get update
sudo apt-get upgrade


Then, install packages. This will be from Ubuntu, but surely there is similar package names for any distro.

Basic Qt dependencies:


Dependencies for multimedia:


QtWebKit dependencies:

For QtWebKit you must install flex, bison, gperf, and ruby also.

Install gdbserver because you will need it for debugging purpose.

sudo apt-get install gdbserver

Now your target device is ready, let's move to the host.

Preparing Host:

If you are using 64bit linux as I am, you will need to install some libraries to support it, because toolchain is created for 32bit systems. So, on Ubuntu, you will use:

sudo apt-get install ia32-libs

Somewhere I use apt-get, but i recommend you to use aptitude instead, because i found that it is pretty good package manager.
Next, you will need toolchain for cross compiling. I recommend you that you use latest linaro toolchain, because everything below version 4.7 is not good for Qt, because Qt has support for C++11, and if you will use C++11 you need to use gcc which is 4.7 or above. Also, newer version of compiler produce faster code, believe it or not :) . You can use toolchain from here: http://www.linaro.org/downloads/

Then, you need to mount rootfs from your device to host machine. Rootfs must be mounted whenever you use Qt. You can do it in two different ways. First, you can dd your SDcard to image on your host and mount it, but you will need to put it back when you are finished with Qt cross compiling. You can mount your image using command similar to this:

mount -o loop,offset=17825792 /home/parallels/a20qt.img /mnt/a20/

To calculate offset, you can use something like:

fdisk -lu /home/parallels/a20qt.img

Then you can use start sector from second partition, which is your rootfs partition, and multiply it by sector size. In my case, start sector is at 34816 and there is 512 bytes per sector, so 34816 * 512 =  17825792

Better way is to mount your rootfs via sshfs. Sshfs is fast and reliable, and you don't need to dd your SDcard whenever you change something. Install sshfs on your device, and run something like this:

sudo sshfs -o allow_other root@192.168.0.100:/ /mnt/a20/


Next it is time to download some tools and Qt sources. First download some cross compiling tools.

git clone git://gitorious.org/cross-compile-tools/cross-compile-tools.git
cd cross-compile-tools


Then apply the fixQualifiedLibraryPaths script. This fixes the symlinks in the mounted image to be relative instead of absolute. The command is: fixQualifiedLibraryPaths target-rootfs path-to-target-toolchain-compiler
In my case it is:
./fixQualifiedLibraryPaths /mnt/a20/ /home/parallels/toolchain/gcc-linaro-arm-linux-gnueabihf-4.8-2013.09_linux/bin/arm-linux-gnueabihf-gcc

Download Qt source files from http://qt-project.org/downloads . You can download stable 5.2.1 or 5.3.0 beta versions for now (and all older versions, of course).
Unpack files to some folder. In my case it is /home/parallels/Qt5.2.1/qt-everywhere-opensource-src-5.2.1.
Go to the /qtbase/mkspecs/devices and create new directory called linux-a20olimex-g++
Copy qmake.conf and qplatformdefs.h from /qtbase/mkspecs/devices/linux-beagleboard-g++/ to /qtbase/mkspecs/devices/linux-a20olimex-g++/
Open qmake.conf , delete everything, and replace with:
#
# qmake configuration for the A20_OlinuxinO boards
# http://www.olimex.com/

MAKEFILE_GENERATOR      = UNIX
CONFIG                 += incremental gdb_dwarf_index
QMAKE_INCREMENTAL_STYLE = sublib

include(../../common/linux.conf)
include(../../common/gcc-base-unix.conf)
include(../../common/g++-unix.conf)

load(device_config)

QT_QPA_DEFAULT_PLATFORM = eglfs
#EGLFS_PLATFORM_HOOKS_SOURCES = $$PWD/qeglfshooks_a20.cpp
# modifications to g++.conf
QMAKE_CC                = $${CROSS_COMPILE}gcc
QMAKE_CXX               = $${CROSS_COMPILE}g++
QMAKE_LINK              = $${QMAKE_CXX}
QMAKE_LINK_SHLIB        = $${QMAKE_CXX}

# modifications to linux.conf
QMAKE_AR                = $${CROSS_COMPILE}ar cqs
QMAKE_OBJCOPY           = $${CROSS_COMPILE}objcopy
QMAKE_NM                = $${CROSS_COMPILE}nm -P
QMAKE_STRIP             = $${CROSS_COMPILE}strip

COMPILER_FLAGS          = -march=armv7-a -mtune=cortex-a7 -mfpu=neon -DLINUX=1 -DEGL_API_FB=1 -mfloat-abi=hard

#modifications to gcc-base.conf
QMAKE_CFLAGS           += $${COMPILER_FLAGS}
QMAKE_CXXFLAGS         += $${COMPILER_FLAGS}
QMAKE_CXXFLAGS_RELEASE += -O3

QMAKE_LIBS             += -lrt -lpthread -ldl

# Extra stuff (OpenGL, DirectFB, ...)
QMAKE_INCDIR_EGL        = /mnt/a20/usr/include/EGL
QMAKE_LIBDIR_EGL        = /mnt/a20/usr/lib
QMAKE_INCDIR_OPENGL_ES2 = /mnt/a20/usr/include/GLES2
QMAKE_LIBDIR_OPENGL_ES2 = /mnt/a20/usr/lib
#QMAKE_INCDIR_OPENVG     = $${QMAKE_INCDIR_EGL}
#QMAKE_LIBDIR_OPENVG     = $${QMAKE_LIBDIR_EGL}

QMAKE_LIBS_EGL          = -lEGL
QMAKE_LIBS_OPENGL_ES2   = -lGLESv2 $${QMAKE_LIBS_EGL}
#QMAKE_LIBS_OPENVG       = -lOpenVG $${QMAKE_LIBS_EGL}

# Sanity check
deviceSanityCheckCompiler()

load(qt_config)
 

Then you need to modify paths for your system, because i did not use variables but fixed path for OpenGL ES driver. Save file and close.

Then we need to patch mali native window which we will use. I did not make qeglfshooks_a20.cpp, instead I directly edit qeglfshooks_stub.cpp. So, go to /qtbase/src/plugins/platforms/eglfs/ , open qeglfshooks_stub.cpp , and change native window function with this code:

EGLNativeWindowType QEglFSHooks::createNativeWindow(QPlatformWindow *platformWindow,const QSize &size,const QSurfaceFormat &format)
{
    Q_UNUSED(platformWindow);
    Q_UNUSED(size);
    Q_UNUSED(format);
    //return 0;
    static struct mali_native_window native_window = {
        .width = (short unsigned int)size.width(),
        .height = (short unsigned int)size.height(),
    };
    return &native_window;
}


Finally, we are at configuring Qt before compiling. Important thing is to define sysroot and prefix parameter, because it will make your life easier :) . Sysroot is rootfs of your target device, and prefix is folder where Qt will be installed. My configure goes like this:

./configure -opengl es2 -device linux-a20olimex-g++ -device-option CROSS_COMPILE=/home/parallels/toolchain/gcc-linaro-arm-linux-gnueabihf-4.8-2013.09_linux/bin/arm-linux-gnueabihf- -sysroot /mnt/a20 -opensource -confirm-license -optimized-qmake -release -make libs -prefix /usr/local/qt5olim2 -no-pch -nomake examples -nomake tests -no-xcb -eglfs -v

If everything is ok, check your config.summary.
cat qtbase/config.summary

Check for options you need. If something is not all right, change your configuration. You will get something like this:
Quote
   Configure summary

Building on:   linux-g++ (x86_64, CPU features: mmx sse sse2)
Building for:  devices/linux-a20olimex-g++ (arm, CPU features: neon)
Platform notes:

            - Also available for Linux: linux-kcc linux-icc linux-cxx
       
qmake vars .......... styles += mac fusion windows DEFINES += QT_NO_MTDEV QT_CFLAGS_DBUS = -I/mnt/a20/usr/include/dbus-1.0 -I/mnt/a20/usr/lib/arm-linux-gnueabihf/dbus-1.0/include   QT_LIBS_DBUS = -L/mnt/a20/usr/lib/arm-linux-gnueabihf -ldbus-1   QT_CFLAGS_GLIB = -pthread -I/mnt/a20/usr/include/glib-2.0 -I/mnt/a20/usr/lib/arm-linux-gnueabihf/glib-2.0/include   QT_LIBS_GLIB = -pthread -L/mnt/a20/usr/lib/arm-linux-gnueabihf -lgthread-2.0 -lrt -lglib-2.0   QMAKE_CFLAGS_FONTCONFIG = -I/mnt/a20/usr/include/freetype2   QMAKE_LIBS_FONTCONFIG = -L/mnt/a20/usr/lib/arm-linux-gnueabihf -lfontconfig -lfreetype   QMAKE_INCDIR_LIBUDEV =   QMAKE_LIBS_LIBUDEV = -ludev   DEFINES += QT_NO_XCB DEFINES += QT_NO_XKBCOMMON sql-drivers =  sql-plugins =  sqlite qmake switches .........

Build options:
  Configuration .......... accessibility alsa audio-backend c++11 clock-gettime clock-monotonic compile_examples concurrent cross_compile dbus egl eglfs evdev eventfd fontconfig full-config getaddrinfo getifaddrs glib iconv icu inotify ipv6ifname large-config largefile libudev linuxfb medium-config minimal-config mremap nis no-harfbuzz opengl opengles2 openssl pcre png posix_fallocate qpa qpa reduce_exports reduce_relocations release rpath shared small-config system-freetype system-png system-zlib xinput2 xlib xrender
  Build parts ............  libs
  Mode ................... release
  Using C++11 ............ yes
  Using PCH .............. no
  Target compiler supports:
    iWMMXt/Neon .......... no/auto

Qt modules and options:
  Qt D-Bus ............... yes (loading dbus-1 at runtime)
  Qt Concurrent .......... yes
  Qt GUI ................. yes
  Qt Widgets ............. yes
  Large File ............. yes
  JavaScriptCore JIT ..... yes (To be decided by JavaScriptCore)
  QML debugging .......... yes
  Use system proxies ..... no

Support enabled for:
  Accessibility .......... yes
  ALSA ................... yes
  CUPS ................... no
  FontConfig ............. yes
  FreeType ............... yes (system library)
  Glib ................... yes
  GTK theme .............. no
  HarfBuzz ............... no
  Iconv .................. yes
  ICU .................... yes
  Image formats:
    GIF .................. yes (plugin, using bundled copy)
    JPEG ................. yes (plugin, using bundled copy)
    PNG .................. yes (in QtGui, using system library)
  journald ............... no
  mtdev .................. no
  Networking:
    getaddrinfo .......... yes
    getifaddrs ........... yes
    IPv6 ifname .......... yes
    OpenSSL .............. yes (loading libraries at run-time)
  NIS .................... yes
  OpenGL / OpenVG:
    EGL .................. yes
    OpenGL ............... yes (OpenGL ES 2.x)
    OpenVG ............... no
  PCRE ................... yes (bundled copy)
  pkg-config ............. yes
  PulseAudio ............. no
  QPA backends:
    DirectFB ............. no
    EGLFS ................ yes
    KMS .................. no
    LinuxFB .............. yes
    XCB .................. no
  Session management ..... yes
  SQL drivers:
    DB2 .................. no
    InterBase ............ no
    MySQL ................ no
    OCI .................. no
    ODBC ................. no
    PostgreSQL ........... no
    SQLite 2 ............. no
    SQLite ............... yes (plugin, using bundled copy)
    TDS .................. no
  udev ................... yes
  xkbcommon .............. no
  zlib ................... yes (system library)

NOTE: Qt is using double for qreal on this system. This is binary incompatible against Qt 5.1.
Configure with '-qreal float' to create a build that is binary compatible with 5.1.


AND FINALLY:

sudo make -j5 && sudo make install

Configuring Qt Creator and running some tests, i will describe in my next post, I am writing this whole afternoon, at least 8 hours, so it is time to get some coffee  :D .
Title: Re: Qt development on A20
Post by: ikozic on April 07, 2014, 11:14:15 am
Quote from: srxa on April 06, 2014, 09:47:22 pm
So, let's start. First, little bit of introduction, because this will be loooong post.


Long and detailed. I bet that many people will praise you now, as this probably deserves a sticky. Hear that admins? Also very structured. Posts like this one actually define a good open-source community.

Quote from: srxa on April 06, 2014, 09:47:22 pm
(I am from Serbia),


You don't say... Probably many of us here are, but we somehow do not even try to figure that out - dunno why though :) Certainly a nice surprise for me :)

If I may interrupt with my problems, as it seems that we are more-less in the same state, although I'm without 3D acceleration.
1. You've mentioned this virtual fb. So currently I have modified Qt linuxfb driver to work with layers (video under, GUI over, alpha blended) and this works quite well - it's still a bit buggy, but I will fix it in a week or so. Anyway, this mod includes opening /dev/disp and using Allwinner ioctls to properly work with layers - it's not too complex, but since the driver is quite buggy and there's no docu, I needed quite a while until it worked as expected. If I understood correctly, you said that you did something similar only by increasing framebuffer_num to 4 and using virtual fb. Could you tell me how, provided that I've understood it right of course?
2. Mali is basically mem-to-mem unit, so no output to the screen, I'm familiar with that. In order to actually output something, it would have to go to DEFE->DEBE or directly to DEBE (depending whether you need scaler layer or not). So what I'm not really understanding here is how are DEFE/DEBE initialized in such a case - what initializes them? Because it seems to me that Mali gets some sort of special access to the screen when you modprobe the driver, so it looks as if Mali driver itself is accessing /dev/disp...
3. This eglfs option is quite interesting, but I guess it's not for me, as most of my GUI layer is transparent, because video is underneath. Although what is fullscreen when there is alpha blending? - it can render the whole screen, no problem, but if 90% of the pixels have 0x00 for alpha, then only some objects would be visible, which could in fact be good for my application. Do you know if Mali driver supports working with RGB8888 - 32bit color?
4. Is there any benefit to using -opengl es2 when not using eglfs? Maybe smoother GUI or something similar?

I have a small addition, if you're not using it already - I find it much easier to use TFTP/NFS boot for development phase. SD card gets garbled easily when power-cycling (often when debugging kernel) and it's quite slow to always update it. If you don't need extreme speeds when accessing rootfs, I'd opt for TFTP/NFS - both kernel and rootfs are on your host and when I compile new kernel, I just restart the system and it boots from network. The same for rootfs and Qt - I cross compile everything on host and it's already on target, since rootfs is actually on my host... The only thing on SD is uboot that manages this network boot.
Also quite easy to set up, so if anyone needs any pointers, I'll be happy to help.
Title: Re: Qt development on A20
Post by: srxa on April 07, 2014, 12:58:54 pm
@ikozic

You are going too deep to hardware layers, and everything is handled for you if you are using OpenGL ES2... EGL will handle buffers and everything, you don't need to deal with it. Of course that you can use GUI over video with OpenGL ES2, and you will get hardware accelerated GUI with many OpenGL functions , shaders, lights, etc. And in Qt, I think in versions above 5.0, i am not sure, many things are already accelerated and using OpenGL, so if you don't have proper drivers installed, you will not be able to use many of that functions in Qt. Eglfs is only platform for running OpenGL ES2, you can use XCB for x server, you can use QtWayland plugin which is also window manager(but it uses eglfs as a base), and you will get OpenGL ES2 acceleration. But if you are using LinuxFB, there is no acceleration at all...

Here is some example what you can do with OpenGL ES2 with your video in Qt using QML... http://youtu.be/P4kv-AoAJ-Q or this http://youtu.be/Ew114XH7-xc

And for TFTP/NFS .. I did not have ANY problems yet with my SDcard image  :o ... but i will certainly use it when it comes to fine tuning of kernel, one day when i finish developing my software. Final product must run from NAND, it must be read only with ramfs, and i will have battery backup for safe shutdown, and probably STM32F4 on my daughter board for some critical data, protection of product, i also need true random generator which is embedded to STM32F4 etc...
Title: Re: Qt development on A20
Post by: ikozic on April 07, 2014, 02:02:11 pm
Quote from: srxa on April 07, 2014, 12:58:54 pm
@ikozic

You are going too deep to hardware layers, and everything is handled for you if you are using OpenGL ES2... EGL will handle buffers and everything, you don't need to deal with it. Of course that you can use GUI over video with OpenGL ES2, and you will get hardware accelerated GUI with many OpenGL functions , shaders, lights, etc. And in Qt, I think in versions above 5.0, i am not sure, many things are already accelerated and using OpenGL, so if you don't have proper drivers installed, you will not be able to use many of that functions in Qt. Eglfs is only platform for running OpenGL ES2, you can use XCB for x server, you can use QtWayland plugin which is also window manager(but it uses eglfs as a base), and you will get OpenGL ES2 acceleration. But if you are using LinuxFB, there is no acceleration at all...

Here is some example what you can do with OpenGL ES2 with your video in Qt using QML... http://youtu.be/P4kv-AoAJ-Q or this http://youtu.be/Ew114XH7-xc


Well, I am a HW engineer :)
True, but correct me if I'm wrong - Mali will then use its own layering mechanism instead of DEBE/DEFE, since I hardly doubt it uses Allwinner's display driver (it's really that terrible) - it probably just bypasses it by using one single layer or similar. So, the usual V4L2 flow is to have its buffers exchanged with display framebuffer (in reality this is all done with DMAs in HW). If we use EGLFS, there should be some mechanism to interface it with V4L2 - most of the references from Google go to some sort of GLUT library which is used to handle it. This is however a very different approach to the whole project - instead of using dedicated HW for all the image operations, Mali is used for everything.

It's maybe a better approach, maybe not, either way not really needed for my app. Effects would be nice of course, and I would try it out if I had more time which unfortunately I don't. However, I did mark it as low priority in my roadmap, so I may try it out if I get some time for it. The fact that you're sticking to one platform (GPU+OpenGL) makes it a better candidate on the long run, since DEBE/DEFE and other display drivers will change from generation to generation.

Quote from: srxa on April 07, 2014, 12:58:54 pm
And for TFTP/NFS .. I did not have ANY problems yet with my SDcard image  :o ... but i will certainly use it when it comes to fine tuning of kernel, one day when i finish developing my software. Final product must run from NAND, it must be read only with ramfs, and i will have battery backup for safe shutdown, and probably STM32F4 on my daughter board for some critical data, protection of product, i also need true random generator which is embedded to STM32F4 etc...


For kernel it's quite useful, but also for rootfs and testing apps - with i.MX6, I had most of the "util" apps source files in my rootfs, edited them on host and build them on host - it was just the matter of typing ./my_app in target's UART console to start it. The same with libs. Basically maybe one step off Qt in automation for normal C files. I also had a lot of dump files which I needed to inspect, so since they were on host it was easy.
But yeah, for kernel development it's a must. Otherwise you'll go crazy with all the copying - developing kernel usually includes a lot of seg faults which effectively block the system. In such situation, when you restart without reboot or poweroff it's quite likely that your SD will corrupt...
How far did you get with NAND? - this week I've reserved for that - you'll also need firmware update with NAND I guess...
Title: Re: Qt development on A20
Post by: ikozic on April 07, 2014, 02:25:50 pm
Ahh sorry, just saw how it's done - you're configuring Mali driver for framebuffer (EGL_TYPE=framebuffer), so technically, it goes directly to /dev/fb. /dev/fb has its own layer and it's easy to get a handle for it.

Ok, there actually could be a sort of hybrid solution - V4L2 could run underneath (as I have it like a c library), while Qt could use Mali for regular framebuffer - I could just get a handle on the framebuffer and pull its layer to top (I also have a disp library which runs underneath). Simples.

Still no time for it now. I'll post back as soon as I try this thing out.
Title: Re: Qt development on A20
Post by: ikozic on April 14, 2014, 04:41:08 pm
@srxa:

I think I've found a bug with Qt 5.2.1. Let me explain:
- I've compiled Mali drivers in a similar way you did, but with regular kernel (linux-sunxi).
- ./test works as it should.
- when compiling Qt 5.2.1, I've used your qmake.conf, but it had issues with configure script (could not find includes), so I changed your lines:

QMAKE_INCDIR_EGL        = /mnt/a20/usr/include/EGL
QMAKE_INCDIR_OPENGL_ES2 = /mnt/a20/usr/include/GLES2

to:

QMAKE_INCDIR_EGL        = /mnt/a20/usr/include
QMAKE_INCDIR_OPENGL_ES2 = /mnt/a20/usr/include

as Qt EGL files are like:

#include <GLES2/gl2.h>
...

However, as Qt config script is rather buggy, it seems that Qt is pulling all the other libs from this place - stdlib.h for one (as if I've set QMAKE_INCDIR instead of QMAKE_INCDIR_EGL). This introduces A LOT of other issues, so it might be the best to either manually edit these files and clean them from these stupid includes or just copy them to another place and use them from there.

Either way, I dunno how you got past this - it's either different with newer Mali drivers (I'm using r3p0, as they come with the original 3.4 kernel) or you've fixed this somehow but forgot to write it out.
Title: Re: Qt development on A20
Post by: ikozic on April 15, 2014, 02:59:21 pm
@srxa:

One more minor correction regarding your hooks implementation:

static struct mali_native_window native_window = {
        .width = (short unsigned int)size.width(),
        .height = (short unsigned int)size.height(),
    };

This cannot be written like this, as it's C++ and we're compiling with g++, if it was gcc it could have been as this syntax is valid in C only:

http://publib.boulder.ibm.com/infocenter/lnxpcomp/v8v101/index.jsp?topic=%2Fcom.ibm.xlcpp8l.doc%2Flanguage%2Fref%2Fstrin.htm (http://publib.boulder.ibm.com/infocenter/lnxpcomp/v8v101/index.jsp?topic=%2Fcom.ibm.xlcpp8l.doc%2Flanguage%2Fref%2Fstrin.htm)

Just change to:

static struct mali_native_window native_window = {
        (short unsigned int)size.width(),
        (short unsigned int)size.height(),
    };

And it'll work as it should.
Title: Re: Qt development on A20
Post by: srxa on April 15, 2014, 08:11:27 pm
Yes, I am aware that this is not correct c++ syntax, but it will compile and work  ;D . Otherwise, you will get 0x300 error when you try to start your application, and that error means bad native window. And for MALI drivers, i will check, but i know that there is some difference with ssvb's kernel, because when i was solving the dual screen eglfs option, i found that driver is split in more smaller libraries,  and in your version i think that everything is in libMALI.so . And more about this and some bugs in Qt, and how to work around them, (with distance field and text, for example) I will write in few days, because it will be also time consuming post again  :D.
Title: Re: Qt development on A20
Post by: ikozic on April 16, 2014, 11:50:42 am
Quote from: srxa on April 15, 2014, 08:11:27 pm
Yes, I am aware that this is not correct c++ syntax, but it will compile and work  ;D .


Hmm... for me it doesn't for some reason - this is why I had to change it in the first place, as it won't compile. Maybe my GCC is too old (I'm still using 4.6).

Quote from: srxa on April 15, 2014, 08:11:27 pm
Otherwise, you will get 0x300 error when you try to start your application, and that error means bad native window.


True :) This is why I had to make your code compilable on my GCC, hence my post :)

Quote from: srxa on April 15, 2014, 08:11:27 pm
And for MALI drivers, i will check, but i know that there is some difference with ssvb's kernel, because when i was solving the dual screen eglfs option, i found that driver is split in more smaller libraries,  and in your version i think that everything is in libMALI.so . And more about this and some bugs in Qt, and how to work around them, (with distance field and text, for example) I will write in few days, because it will be also time consuming post again  :D.


Ok, I need some help here, because currently I'm stuck. I've compiled a new QML project and now thanks to your post I could finally use Quick 2.0 (since it requires OpenGL). However, I don't know how to make Mali render in 32 bits, that is, with transparency. A bit difficult to describe, but I'll try:

I've noticed that, at least in SW, it seems that Mali is using /dev/fb0 for render. I've found this out by playing around with layers and saw that when I move the framebuffer layer to the top, my QML app is displayed. As I said before, video is running under with Alpha value set to 0xff in DEBE.

I've also set a simple rectangle that covers the whole screen in QML and I've set the color to white (0xFFFFFFFF). Once I enable the transparency this is what happens:
1. 0x80FFFFFF (or opacity 0.5, so 50% transparency) - the rectangle gets gray,
2. 0x00FFFFFF (opacity 0, full transparency) - the whole screen is black.
If I move the fb layer with my display support lib down, I can see my video only - this is how I saw that Mali is using default layer.
If on the other hand, I use DEBE's Alpha blender to set the global alpha of the Qt layer to 0.5, I can finally see the video underneath, but it's very black or grey depending on what I set as transparency in Qt layer. However, global alpha is not really usable in Qt, so this is only for debug - I need "pixel-wise" transparency to correctly construct GUI over video.

Ideally, Mali should render in 32 bits, so that when I set transparency in QML to full, that I can see the video underneath without any color distortions. This is what I've tried yesterday, but I have no idea what is wrong - I think I've almost ruled out QML and playing around with Quickview and I'm more and more certain that this is an issue with ELGFS driver in Qt. It could also be something in the kernel driver for Mali, but I think I would be wasting time playing around with the kernel driver since most of the source is closed anyway. I've also disabled FBCON in kernel, thinking it might be this (FBCON uses this default display layer of /dev/fb0 to display console), but other than losing cursor blinking and console, nothing changed. I had a similar problem with SW render in Quick 1.0, so it might be that Qt is painting this black color in the background for some reason, but I couldn't really find out where.

If you have any info on this, it'd be great if you share - I've already posted a similar post to sunxi google group, hoping if someone could help. If I get to the solution first, I'll post back as always.



Title: Re: Qt development on A20
Post by: srxa on April 16, 2014, 07:25:50 pm
I think you should use gstreamer and QtMultimedia for your project, and everything will be OK. Gstreamer libs allow you to stream almost every input i think. About other issues in your post, i will write in few days, time is problem for me right now.
Title: Re: Qt development on A20
Post by: ikozic on April 16, 2014, 11:41:06 pm
@srxa:

Got it, working great now. Mali is in fact using default framebuffer layer for this (as if it's writing to /dev/fb0). What happens in fact is that it writes to the framebuffer allocated memory (there's references to framebuffer memory in Mali driver (called SUNXI_RESERVED_FB_MEM or something similar)).

Anyway, I've got exactly what I need - video running under, OpenGL accelerated Qt/QML running over it with transparency as needed and directed by Qt/QML.

What needs to be done? Video is pretty straightforward and I already explained it, so for Qt/Mali, in rough steps:
1. Get the framebuffer layer handle by calling FBIOGET_LAYER_HDL_0 (for fb0). This is all we need from kernel to do the changes.
2. Using this handle, call DISP_LAYER_GET_PARA ioctl to get the layer parameters.
3. Modify the parameters for Mali/Qt. This is very important - you need to set the mode to NORMAL, not SCALER (especially if already using scaler for video), alpha_en to 0 and alpha_val to 0. Do not touch the layer_para.fb.addr(x). Set the pipe to the opposite of the video layer (if video layer is 0, set to 1 and the other way around). Scaler for fb layer could also be accidentally set in the fex file, so take care of this.
4. Call DISP_LAYER_SET_PARA ioctl to set the new parameters.
5. Naturally if video is under, you should move its layer, using video layer handle and DISP_LAYER_BOTTOM ioctl, to the bottom, while Qt layer (framebuffer) should be moved to the top (DISP_LAYER_TOP ioctl). If there are some other crazy layers active, move first the video layer to the top, then Qt layer to the top - this will ensure that you have Qt layer on the top, while video just under it.

That's it - works perfectly.
Title: Re: Qt development on A20
Post by: Polto on April 19, 2014, 09:47:25 am
Hi
I make an image (linux shell + qt 4.8 ) work on framebuffer
I tested it on marsboard a20.
If any one could test it on olimex a20 and a10 board and tell me if it works or not.
http://www.remnum.com/myimage+qt.img
Title: Re: Qt development on A20
Post by: ikozic on April 21, 2014, 04:15:33 pm
Quote from: srxa on April 06, 2014, 09:47:22 pm
modprobe mali
modprobe drm
modprobe mali_drm



Quite strange, but my Mali works without DRM - do you know if there is maybe a downside to this? Basically, I just do:


modprobe mali


And it works...
Title: Re: Qt development on A20
Post by: srxa on April 22, 2014, 04:53:51 am
@ikozic
It is not strange, DRM or Direct Rendering Manager Device , together with DRI2 is for X11 server, and for XCB plugin, for eglfs only MALI device driver is enough. I think you need also UMP device driver for eglfs, but it is already loaded by kernel, or it is called in some script in my and yours image.
Title: Re: Qt development on A20
Post by: ikozic on April 22, 2014, 10:52:40 am
@srxa
Aha, got it. Great, thanks for clearing that out.

Yeah, UMP is automatically loaded with Mali. So far (knock on wood :) ), almost everything is functional for my project - quite buggy though, so I'll need a week or two to get everything polished.

I'll just repeat one more time, since I can't seem to learn myself - BEWARE of /dev/disp - too much dysfunctional crappy code there, and it's extremely buggy.
Title: Re: Qt development on A20
Post by: Cosik on September 28, 2014, 11:47:16 am
Hi,

@srxa
I tried to cross compile qtbase in Qt5.2.1 with your description, but I always get failed. Maybe from beging.

I don't compile new drivers for my A20-LIME, I've just download last debian image and there is no problem with loading drivers:
modprobe mali
modprobe drm
modprobe mali_drm


Also I have downloaded gcc-linaro-arm-linux-gnueabihf-4.8-2013.09_linux from https://releases.linaro.org/13.09/components/toolchain/binaries (https://releases.linaro.org/13.09/components/toolchain/binaries).

Configuration past without any problem with command:
..everywhere-opensource-src-5.2.1/qtbase # ./configure -device linux-a20olimex-g++ -device-option CROSS_COMPILE=/home/cosik/r_and_d/A20-lime/gcc-linaro-arm-linux-gnueabihf-4.8-2013.09_linux/bin/arm-linux-gnueabihf- -sysroot /mnt/a20 -opensource -confirm-license -optimized-qmake -release -make libs -prefix /usr/local/qt5olim2 -no-pch -nomake examples -nomake tests -no-xcb -eglfs -v

And after then, when I call make command, I get something like this at the end:
/mnt/a20/usr/lib/arm-linux-gnueabihf/libm.a: could not read symbols: Bad value
collect2: error: ld returned 1 exit status
Makefile:853: polecenia dla obiektu '../../lib/libQt5Core.so.5.2.1' nie powiodły się
make[2]: *** [../../lib/libQt5Core.so.5.2.1] Błąd 1
make[2]: Opuszczenie katalogu '/home/cosik/r_and_d/A20-lime/qt-everywhere-opensource-src-5.2.1/qtbase/src/corelib'
Makefile:135: polecenia dla obiektu 'sub-corelib-make_first' nie powiodły się
make[1]: *** [sub-corelib-make_first] Błąd 2
make[1]: Opuszczenie katalogu '/home/cosik/r_and_d/A20-lime/qt-everywhere-opensource-src-5.2.1/qtbase/src'
Makefile:41: polecenia dla obiektu 'sub-src-make_first' nie powiodły się
make: *** [sub-src-make_first] Błąd 2


Any suggestions and tips?
Title: Re: Qt development on A20
Post by: Cosik on October 11, 2014, 07:08:06 pm
Hi,

I noticed that I have problems with compile Qt with option -eglfs.

Any one have any idea what to do?

[Edit]
Problem solved, I found solution in this instruction:
http://wickwire2099.blogspot.pt/2014/02/qt5-on-cubieboard-a10a20.html
Title: Re: Qt development on A20
Post by: claudio on October 23, 2014, 07:06:25 pm
Hi all!  ;)
I have an Olinuxino-micro a20 with the last Debian image by Olimex, ssvb kernel and Mali libraries installed.

Now i'm trying to install QT5 on my Olinuxino-micro a20.
I installed "ia32-libs" on my host (Ubuntu 12.04 64bit), mounted my sd card (rootfs partition) in /mnt/a20/, cloned "cross-compile-tools" repo and ran the fixQualifiedLibraryPaths script. As toolchain i'm using "gcc-linaro-arm-linux-gnueabihf-4.8-2013.09_linux" (but i tryed also with 4.9 version). Then i downloaded qtsource 5.3.1, created the "linux-a20olimex-g++" folder and changed the qmake.conf and qeglfshooks_stub.cpp files, that are the same as the guide coz i have the same paths.

Now i have some problems with the ./configure, this is my command:
./configure -opengl es2 -device linux-a20olimex-g++ -device-option CROSS_COMPILE=/home/claudio/TirocinioSort/Toolchain/gcc-linaro-arm-linux-gnueabihf-4.8-2013.09_linux/bin/arm-linux-gnueabihf- -sysroot /mnt/a20/ -opensource -confirm-license -optimized-qmake -release -make libs -prefix /usr/local/qt5olim2 -no-pch -nomake examples -nomake tests -no-xcb -eglfs -v


Result:

This is the Qt Open Source Edition.

You are licensed to use this software under the terms of
the Lesser GNU General Public License (LGPL) versions 2.1.
You are also licensed to use this software under the terms of
the GNU General Public License (GPL) versions 3.

You have already accepted the terms of the Open Source license.

/home/claudio/TirocinioSort/Toolchain/gcc-linaro-arm-linux-gnueabihf-4.8-2013.09_linux/bin/arm-linux-gnueabihf-g++ -c -fvisibility=hidden fvisibility.c
Symbol visibility control enabled.
/home/claudio/TirocinioSort/Toolchain/gcc-linaro-arm-linux-gnueabihf-4.8-2013.09_linux/bin/arm-linux-gnueabihf-g++ --sysroot=/mnt/a20/ -o libtest.so -shared -Wl,-Bsymbolic-functions -fPIC bsymbolic_functions.c
bsymbolic_functions.c:2:2: error: #error "Symbolic function binding on this architecture may be broken, disabling it (see QTBUG-36129)."
#error "Symbolic function binding on this architecture may be broken, disabling it (see QTBUG-36129)."
  ^
Symbolic function binding disabled.
DEFAULT_INCDIRS="/home/claudio/TirocinioSort/Toolchain/gcc-linaro-arm-linux-gnueabihf-4.8-2013.09_linux/arm-linux-gnueabihf/include/c++/4.8.2
/home/claudio/TirocinioSort/Toolchain/gcc-linaro-arm-linux-gnueabihf-4.8-2013.09_linux/arm-linux-gnueabihf/include/c++/4.8.2/arm-linux-gnueabihf
/home/claudio/TirocinioSort/Toolchain/gcc-linaro-arm-linux-gnueabihf-4.8-2013.09_linux/arm-linux-gnueabihf/include/c++/4.8.2/backward
/home/claudio/TirocinioSort/Toolchain/gcc-linaro-arm-linux-gnueabihf-4.8-2013.09_linux/lib/gcc/arm-linux-gnueabihf/4.8.2/include
/home/claudio/TirocinioSort/Toolchain/gcc-linaro-arm-linux-gnueabihf-4.8-2013.09_linux/lib/gcc/arm-linux-gnueabihf/4.8.2/include-fixed
/home/claudio/TirocinioSort/Toolchain/gcc-linaro-arm-linux-gnueabihf-4.8-2013.09_linux/arm-linux-gnueabihf/include
/mnt/a20/usr/include
/mnt/a20/usr/include/arm-linux-gnueabihf
"
DEFAULT_LIBDIRS="/mnt/a20/usr/lib
/mnt/a20/usr/lib/arm-linux-gnueabihf
/home/claudio/TirocinioSort/Toolchain/gcc-linaro-arm-linux-gnueabihf-4.8-2013.09_linux/lib/gcc/arm-linux-gnueabihf/4.8.2
/home/claudio/TirocinioSort/Toolchain/gcc-linaro-arm-linux-gnueabihf-4.8-2013.09_linux/lib/gcc/arm-linux-gnueabihf
/home/claudio/TirocinioSort/Toolchain/gcc-linaro-arm-linux-gnueabihf-4.8-2013.09_linux/lib/gcc
/home/claudio/TirocinioSort/Toolchain/gcc-linaro-arm-linux-gnueabihf-4.8-2013.09_linux/arm-linux-gnueabihf/lib
/mnt/a20/lib/arm-linux-gnueabihf
/mnt/a20/lib
"
Creating qmake...
g++ -c -o qlibraryinfo.o -pipe -ffunction-sections -O2 -g  -I/home/claudio/TirocinioSort/QTSource/qt-everywhere-opensource-src-5.3.2/qtbase/qmake -I/home/claudio/TirocinioSort/QTSource/qt-everywhere-opensource-src-5.3.2/qtbase/qmake/library -I/home/claudio/TirocinioSort/QTSource/qt-everywhere-opensource-src-5.3.2/qtbase/qmake/generators -I/home/claudio/TirocinioSort/QTSource/qt-everywhere-opensource-src-5.3.2/qtbase/qmake/generators/unix -I/home/claudio/TirocinioSort/QTSource/qt-everywhere-opensource-src-5.3.2/qtbase/qmake/generators/win32 -I/home/claudio/TirocinioSort/QTSource/qt-everywhere-opensource-src-5.3.2/qtbase/qmake/generators/mac -I/home/claudio/TirocinioSort/QTSource/qt-everywhere-opensource-src-5.3.2/qtbase/qmake/generators/integrity -I/home/claudio/TirocinioSort/QTSource/qt-everywhere-opensource-src-5.3.2/qtbase/include -I/home/claudio/TirocinioSort/QTSource/qt-everywhere-opensource-src-5.3.2/qtbase/include/QtCore -I/home/claudio/TirocinioSort/QTSource/qt-everywhere-opensource-src-5.3.2/qtbase/include/QtCore/5.3.2 -I/home/claudio/TirocinioSort/QTSource/qt-everywhere-opensource-src-5.3.2/qtbase/include/QtCore/5.3.2/QtCore -I/home/claudio/TirocinioSort/QTSource/qt-everywhere-opensource-src-5.3.2/qtbase/src/corelib/global -DHAVE_QCONFIG_CPP -I/home/claudio/TirocinioSort/QTSource/qt-everywhere-opensource-src-5.3.2/qtbase/mkspecs/linux-g++ -I/home/claudio/TirocinioSort/QTSource/qt-everywhere-opensource-src-5.3.2/qtbase/tools/shared -DQT_BUILD_QMAKE -DQT_BOOTSTRAPPED -DPROEVALUATOR_FULL -DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES -DQT_NO_COMPONENT -DQT_NO_COMPRESS -DQT_NO_THREAD -DQT_NO_QOBJECT -DQT_NO_GEOM_VARIANT -DQT_NO_DATASTREAM -DQT_CRYPTOGRAPHICHASH_ONLY_SHA1 -DQT_JSON_READONLY /home/claudio/TirocinioSort/QTSource/qt-everywhere-opensource-src-5.3.2/qtbase/src/corelib/global/qlibraryinfo.cpp
g++ -o "/home/claudio/TirocinioSort/QTSource/qt-everywhere-opensource-src-5.3.2/qtbase/bin/qmake" project.o option.o property.o main.o ioutils.o proitems.o qmakevfs.o qmakeglobals.o qmakeparser.o qmakeevaluator.o qmakebuiltins.o makefile.o unixmake2.o unixmake.o mingw_make.o winmakefile.o projectgenerator.o meta.o makefiledeps.o metamakefile.o xmloutput.o pbuilder_pbx.o msvc_vcproj.o msvc_vcxproj.o msvc_nmake.o msvc_objectmodel.o msbuild_objectmodel.o gbuild.o cesdkhandler.o qtextcodec.o qutfcodec.o qstring.o qstring_compat.o qstringbuilder.o qtextstream.o qiodevice.o qmalloc.o qglobal.o qarraydata.o qbytearray.o qbytearraymatcher.o qdatastream.o qbuffer.o qlist.o qfiledevice.o qfile.o qfilesystementry.o qfilesystemengine.o qfsfileengine.o qfsfileengine_iterator.o qregexp.o qvector.o qbitarray.o qdir.o qdiriterator.o quuid.o qhash.o qfileinfo.o qdatetime.o qstringlist.o qabstractfileengine.o qtemporaryfile.o qmap.o qmetatype.o qsettings.o qsystemerror.o qlibraryinfo.o qvariant.o qvsnprintf.o qlocale.o qlocale_tools.o qlinkedlist.o qnumeric.o qcryptographichash.o qxmlstream.o qxmlutils.o qlogging.o qjson.o qjsondocument.o qjsonparser.o qjsonarray.o qjsonobject.o qjsonvalue.o qfilesystemengine_unix.o qfilesystemiterator_unix.o qfsfileengine_unix.o qlocale_unix.o  -Wl,--gc-sections
Running configuration tests...
Note: PKG_CONFIG_LIBDIR automatically set to /mnt/a20//usr/lib/pkgconfig:/mnt/a20//usr/share/pkgconfig:/mnt/a20//usr/lib/arm-linux-gnueabihf/pkgconfig
Note: PKG_CONFIG_SYSROOT_DIR automatically set to /mnt/a20/
Determining architecture... ()
/home/claudio/TirocinioSort/Toolchain/gcc-linaro-arm-linux-gnueabihf-4.8-2013.09_linux/bin/arm-linux-gnueabihf-g++ -c -pipe -march=armv7-a -mtune=cortex-a7 -mfpu=neon -DLINUX=1 -DEGL_API_FB=1 -mfloat-abi=hard --sysroot=/mnt/a20/ -g -Wall -W -fPIE  -I../../mkspecs/devices/linux-a20olimex-g++ -I. -o arch.o arch.cpp
/home/claudio/TirocinioSort/Toolchain/gcc-linaro-arm-linux-gnueabihf-4.8-2013.09_linux/bin/arm-linux-gnueabihf-g++  -o arch arch.o   -lrt -lpthread -ldl --sysroot=/mnt/a20/
    Found architecture in binary
CFG_ARCH="arm"
CFG_CPUFEATURES=" neon"
Determining architecture... ()
g++ -c -pipe -g -Wall -W -fPIE  -I../../mkspecs/linux-g++ -I. -o arch.o arch.cpp
g++  -o arch arch.o   
    Found architecture in binary
CFG_HOST_ARCH="x86_64"
CFG_HOST_CPUFEATURES=" mmx sse sse2"
System architecture: 'arm'
Host architecture: 'x86_64'
C++11 auto-detection... ()
/home/claudio/TirocinioSort/Toolchain/gcc-linaro-arm-linux-gnueabihf-4.8-2013.09_linux/bin/arm-linux-gnueabihf-g++ -c -pipe -march=armv7-a -mtune=cortex-a7 -mfpu=neon -DLINUX=1 -DEGL_API_FB=1 -mfloat-abi=hard --sysroot=/mnt/a20/ -O2 -O3 -std=c++0x -Wall -W -fPIE  -I../../../mkspecs/devices/linux-a20olimex-g++ -I. -o c++11.o c++11.cpp
/home/claudio/TirocinioSort/Toolchain/gcc-linaro-arm-linux-gnueabihf-4.8-2013.09_linux/bin/arm-linux-gnueabihf-g++ -Wl,-O1 -o c++11 c++11.o   -lrt -lpthread -ldl --sysroot=/mnt/a20/
C++11 enabled.
floatmath auto-detection... ()
/home/claudio/TirocinioSort/Toolchain/gcc-linaro-arm-linux-gnueabihf-4.8-2013.09_linux/bin/arm-linux-gnueabihf-g++ -c -pipe -march=armv7-a -mtune=cortex-a7 -mfpu=neon -DLINUX=1 -DEGL_API_FB=1 -mfloat-abi=hard --sysroot=/mnt/a20/ -O2 -O3 -Wall -W -fPIE  -I../../../mkspecs/devices/linux-a20olimex-g++ -I. -o floatmath.o floatmath.cpp
floatmath.cpp:44:5: warning: unused parameter 'argc' [-Wunused-parameter]
int main(int argc, char **argv)
     ^
floatmath.cpp:44:5: warning: unused parameter 'argv' [-Wunused-parameter]
/home/claudio/TirocinioSort/Toolchain/gcc-linaro-arm-linux-gnueabihf-4.8-2013.09_linux/bin/arm-linux-gnueabihf-g++ -Wl,-O1 -o floatmath floatmath.o   -lrt -lpthread -ldl --sysroot=/mnt/a20/
floatmath enabled.
sse2 auto-detection... ()
/home/claudio/TirocinioSort/Toolchain/gcc-linaro-arm-linux-gnueabihf-4.8-2013.09_linux/bin/arm-linux-gnueabihf-g++ -c -pipe -march=armv7-a -mtune=cortex-a7 -mfpu=neon -DLINUX=1 -DEGL_API_FB=1 -mfloat-abi=hard --sysroot=/mnt/a20/ -msse2 -g -Wall -W -fPIE  -I../../../mkspecs/devices/linux-a20olimex-g++ -I. -o sse2.o sse2.cpp
arm-linux-gnueabihf-g++: error: unrecognized command line option '-msse2'
make: *** [sse2.o] Errore 1
sse2 disabled.
zlib auto-detection... ()
/home/claudio/TirocinioSort/Toolchain/gcc-linaro-arm-linux-gnueabihf-4.8-2013.09_linux/bin/arm-linux-gnueabihf-g++ -c -pipe -march=armv7-a -mtune=cortex-a7 -mfpu=neon -DLINUX=1 -DEGL_API_FB=1 -mfloat-abi=hard --sysroot=/mnt/a20/ -O2 -O3 -Wall -W -fPIE  -I../../../mkspecs/devices/linux-a20olimex-g++ -I. -o zlib.o zlib.cpp
zlib.cpp: In function 'int main(int, char**)':
zlib.cpp:46:15: warning: variable 'stream' set but not used [-Wunused-but-set-variable]
     z_streamp stream;
               ^
zlib.cpp:48:17: warning: variable 'ver' set but not used [-Wunused-but-set-variable]
     const char *ver = zlibVersion();
                 ^
zlib.cpp:51:9: warning: variable 'res' set but not used [-Wunused-but-set-variable]
     int res = compress2(0, 0, 0, 0, 1);
         ^
/home/claudio/TirocinioSort/Toolchain/gcc-linaro-arm-linux-gnueabihf-4.8-2013.09_linux/bin/arm-linux-gnueabihf-g++ -Wl,-O1 -o zlib zlib.o   -lrt -lpthread -ldl --sysroot=/mnt/a20/ -lz
zlib enabled.
mtdev auto-detection... ()
Project ERROR: mtdev development package not found
mtdev disabled.
libjpeg auto-detection... ()
/home/claudio/TirocinioSort/Toolchain/gcc-linaro-arm-linux-gnueabihf-4.8-2013.09_linux/bin/arm-linux-gnueabihf-g++ -c -pipe -march=armv7-a -mtune=cortex-a7 -mfpu=neon -DLINUX=1 -DEGL_API_FB=1 -mfloat-abi=hard --sysroot=/mnt/a20/ -O2 -O3 -Wall -W -fPIE  -I../../../mkspecs/devices/linux-a20olimex-g++ -I. -o libjpeg.o libjpeg.cpp
libjpeg.cpp:45:21: fatal error: jpeglib.h: File o directory non esistente
#include <jpeglib.h>
                     ^
...
...

compilation terminated.
make: *** [glib.o] Errore 1
Glib disabled.
ICU auto-detection... ()
/home/claudio/TirocinioSort/Toolchain/gcc-linaro-arm-linux-gnueabihf-4.8-2013.09_linux/bin/arm-linux-gnueabihf-g++ -c -pipe -march=armv7-a -mtune=cortex-a7 -mfpu=neon -DLINUX=1 -DEGL_API_FB=1 -mfloat-abi=hard --sysroot=/mnt/a20/ -O2 -O3 -Wall -W -fPIE  -I../../../mkspecs/devices/linux-a20olimex-g++ -I. -o icu.o icu.cpp
/home/claudio/TirocinioSort/Toolchain/gcc-linaro-arm-linux-gnueabihf-4.8-2013.09_linux/bin/arm-linux-gnueabihf-g++ -Wl,-O1 -o icu icu.o   -lrt -lpthread -ldl --sysroot=/mnt/a20/ -licui18n -licuuc -licudata
ICU enabled.
PulseAudio auto-detection... ()
/home/claudio/TirocinioSort/Toolchain/gcc-linaro-arm-linux-gnueabihf-4.8-2013.09_linux/bin/arm-linux-gnueabihf-g++ -c -pipe -march=armv7-a -mtune=cortex-a7 -mfpu=neon -DLINUX=1 -DEGL_API_FB=1 -mfloat-abi=hard --sysroot=/mnt/a20/ -O2 -O3 -Wall -W -fPIE  -I../../../mkspecs/devices/linux-a20olimex-g++ -I. -o pulseaudio.o pulseaudio.cpp
pulseaudio.cpp:42:30: fatal error: pulse/pulseaudio.h: File o directory non esistente
#include <pulse/pulseaudio.h>
                              ^
compilation terminated.
make: *** [pulseaudio.o] Errore 1
PulseAudio disabled.
OpenGL ES 2.x auto-detection... ()
/home/claudio/TirocinioSort/Toolchain/gcc-linaro-arm-linux-gnueabihf-4.8-2013.09_linux/bin/arm-linux-gnueabihf-g++ -c -pipe -march=armv7-a -mtune=cortex-a7 -mfpu=neon -DLINUX=1 -DEGL_API_FB=1 -mfloat-abi=hard --sysroot=/mnt/a20/ -O2 -O3 -Wall -W -fPIE  -I../../../mkspecs/devices/linux-a20olimex-g++ -I. -I/mnt/a20/usr/include/GLES2 -o opengles2.o opengles2.cpp
/home/claudio/TirocinioSort/Toolchain/gcc-linaro-arm-linux-gnueabihf-4.8-2013.09_linux/bin/arm-linux-gnueabihf-g++ -Wl,-O1 -o opengles2 opengles2.o   -lrt -lpthread -ldl --sysroot=/mnt/a20/ -L/mnt/a20/usr/lib -lGLESv2 -lEGL
OpenGL ES 2.x enabled.
FontConfig auto-detection... ()
/home/claudio/TirocinioSort/Toolchain/gcc-linaro-arm-linux-gnueabihf-4.8-2013.09_linux/bin/arm-linux-gnueabihf-g++ -c -pipe -march=armv7-a -mtune=cortex-a7 -mfpu=neon -DLINUX=1 -DEGL_API_FB=1 -mfloat-abi=hard --sysroot=/mnt/a20/ -O2 -O3 -Wall -W -fPIE  -I../../../mkspecs/devices/linux-a20olimex-g++ -I. -o fontconfig.o fontconfig.cpp
fontconfig.cpp:42:22: fatal error: ft2build.h: File o directory non esistente
#include <ft2build.h>
                      ^
compilation terminated.
make: *** [fontconfig.o] Errore 1
FontConfig disabled.
libudev auto-detection... ()
/home/claudio/TirocinioSort/Toolchain/gcc-linaro-arm-linux-gnueabihf-4.8-2013.09_linux/bin/arm-linux-gnueabihf-g++ -c -pipe -march=armv7-a -mtune=cortex-a7 -mfpu=neon -DLINUX=1 -DEGL_API_FB=1 -mfloat-abi=hard --sysroot=/mnt/a20/ -O2 -O3 -Wall -W -fPIE  -I../../../mkspecs/devices/linux-a20olimex-g++ -I. -o libudev.o libudev.cpp
libudev.cpp:42:21: fatal error: libudev.h: File o directory non esistente
#include <libudev.h>
                     ^
compilation terminated.
make: *** [libudev.o] Errore 1
libudev disabled.
evdev auto-detection... ()
/home/claudio/TirocinioSort/Toolchain/gcc-linaro-arm-linux-gnueabihf-4.8-2013.09_linux/bin/arm-linux-gnueabihf-g++ -c -pipe -march=armv7-a -mtune=cortex-a7 -mfpu=neon -DLINUX=1 -DEGL_API_FB=1 -mfloat-abi=hard --sysroot=/mnt/a20/ -O2 -O3 -Wall -W -fPIE  -I../../../mkspecs/devices/linux-a20olimex-g++ -I. -o evdev.o evdev.cpp
/home/claudio/TirocinioSort/Toolchain/gcc-linaro-arm-linux-gnueabihf-4.8-2013.09_linux/bin/arm-linux-gnueabihf-g++ -Wl,-O1 -o evdev evdev.o   -lrt -lpthread -ldl --sysroot=/mnt/a20/
evdev enabled.
XLib auto-detection... ()
/home/claudio/TirocinioSort/Toolchain/gcc-linaro-arm-linux-gnueabihf-4.8-2013.09_linux/bin/arm-linux-gnueabihf-g++ -c -pipe -march=armv7-a -mtune=cortex-a7 -mfpu=neon -DLINUX=1 -DEGL_API_FB=1 -mfloat-abi=hard --sysroot=/mnt/a20/ -O2 -O3 -Wall -W -fPIE  -I../../../mkspecs/devices/linux-a20olimex-g++ -I. -o xlib.o xlib.cpp
/home/claudio/TirocinioSort/Toolchain/gcc-linaro-arm-linux-gnueabihf-4.8-2013.09_linux/bin/arm-linux-gnueabihf-g++ -Wl,-O1 -o xlib xlib.o   -lrt -lpthread -ldl --sysroot=/mnt/a20/ -lXext -lX11 -lm
/home/claudio/TirocinioSort/Toolchain/gcc-linaro-arm-linux-gnueabihf-4.8-2013.09_linux/bin/../lib/gcc/arm-linux-gnueabihf/4.8.2/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lXext
collect2: error: ld returned 1 exit status
make: *** [xlib] Errore 1
XLib disabled.
Xrender auto-detection... ()
/home/claudio/TirocinioSort/Toolchain/gcc-linaro-arm-linux-gnueabihf-4.8-2013.09_linux/bin/arm-linux-gnueabihf-g++ -c -pipe -march=armv7-a -mtune=cortex-a7 -mfpu=neon -DLINUX=1 -DEGL_API_FB=1 -mfloat-abi=hard --sysroot=/mnt/a20/ -O2 -O3 -Wall -W -fPIE  -I../../../mkspecs/devices/linux-a20olimex-g++ -I. -o xrender.o xrender.cpp
xrender.cpp:43:36: fatal error: X11/extensions/Xrender.h: File o directory non esistente
#include <X11/extensions/Xrender.h>
                                    ^
compilation terminated.
make: *** [xrender.o] Errore 1
Xrender disabled.
XInput2 auto-detection... ()
/home/claudio/TirocinioSort/Toolchain/gcc-linaro-arm-linux-gnueabihf-4.8-2013.09_linux/bin/arm-linux-gnueabihf-g++ -c -pipe -march=armv7-a -mtune=cortex-a7 -mfpu=neon -DLINUX=1 -DEGL_API_FB=1 -mfloat-abi=hard --sysroot=/mnt/a20/ -O2 -O3 -Wall -W -fPIE  -I../../../mkspecs/devices/linux-a20olimex-g++ -I. -o xinput2.o xinput2.cpp
xinput2.cpp:43:36: fatal error: X11/extensions/XInput2.h: File o directory non esistente
#include <X11/extensions/XInput2.h>
                                    ^
compilation terminated.
make: *** [xinput2.o] Errore 1
XInput2 disabled.
LinuxFB auto-detection... ()
/home/claudio/TirocinioSort/Toolchain/gcc-linaro-arm-linux-gnueabihf-4.8-2013.09_linux/bin/arm-linux-gnueabihf-g++ -c -pipe -march=armv7-a -mtune=cortex-a7 -mfpu=neon -DLINUX=1 -DEGL_API_FB=1 -mfloat-abi=hard --sysroot=/mnt/a20/ -O2 -O3 -Wall -W -fPIE  -I../../../mkspecs/devices/linux-a20olimex-g++ -I. -o linuxfb.o linuxfb.cpp
/home/claudio/TirocinioSort/Toolchain/gcc-linaro-arm-linux-gnueabihf-4.8-2013.09_linux/bin/arm-linux-gnueabihf-g++ -Wl,-O1 -o linuxfb linuxfb.o   -lrt -lpthread -ldl --sysroot=/mnt/a20/
LinuxFB enabled.
KMS auto-detection... ()
Project ERROR: libudev development package not found
KMS disabled.
EGL auto-detection... ()
/home/claudio/TirocinioSort/Toolchain/gcc-linaro-arm-linux-gnueabihf-4.8-2013.09_linux/bin/arm-linux-gnueabihf-g++ -c -pipe -march=armv7-a -mtune=cortex-a7 -mfpu=neon -DLINUX=1 -DEGL_API_FB=1 -mfloat-abi=hard --sysroot=/mnt/a20/ -O2 -O3 -Wall -W -fPIE  -I../../../mkspecs/devices/linux-a20olimex-g++ -I. -I/mnt/a20/usr/include/EGL -o egl.o egl.cpp
egl.cpp: In function 'int main(int, char**)':
egl.cpp:46:12: warning: unused variable 'x' [-Wunused-variable]
     EGLint x = 0;
            ^
/home/claudio/TirocinioSort/Toolchain/gcc-linaro-arm-linux-gnueabihf-4.8-2013.09_linux/bin/arm-linux-gnueabihf-g++ -Wl,-O1 -o egl egl.o   -lrt -lpthread -ldl --sysroot=/mnt/a20/ -L/mnt/a20/usr/lib -lEGL
/mnt/a20/usr/lib/libEGL.so: undefined reference to `_mali_clz_lut'
collect2: error: ld returned 1 exit status
make: *** [egl] Errore 1
EGL disabled.
The EGL functionality test failed; EGL is required by some QPA plugins to manage contexts & surfaces.
You might need to modify the include and library search paths by editing
QMAKE_INCDIR_EGL, QMAKE_LIBDIR_EGL and QMAKE_LIBS_EGL in /home/claudio/TirocinioSort/QTSource/qt-everywhere-opensource-src-5.3.2/qtbase/mkspecs/devices/linux-a20olimex-g++.



I deleted some text above because of the 20000 chars limitation.
Can you give me some hints?

One last thing: following another guide (for cubieboard) when i had to prepare my board with libraries i've only installed these:
sudo apt-get install flex bison gperf libicu-dev libxslt-dev ruby
can be this the problem?

Thank you in advance, Claudio.

Title: Re: Qt development on A20
Post by: JohnS on October 23, 2014, 07:48:04 pm
As it complains about jpeglib.h you look to need some tool(s)/etc for jpeg

John
Title: Re: Qt development on A20
Post by: claudio on October 23, 2014, 08:00:25 pm
Quote from: JohnS on October 23, 2014, 07:48:04 pm
As it complains about jpeglib.h you look to need some tool(s)/etc for jpeg

John


Thank you for your tip  ;), btw i don't think that's the main problem. I'll wait for new hints.
Title: Re: Qt development on A20
Post by: Cosik on October 26, 2014, 09:15:16 pm
Hi claudio,

Did you correctly compiled mali binaries? I had some similar problems to yours.

I also writing some tutorial how to compile Qt5 step by step from beginning, but status of this is pending.
Title: Re: Qt development on A20
Post by: claudio on October 27, 2014, 03:25:32 pm
Quote from: Cosik on October 26, 2014, 09:15:16 pm
Hi claudio,

Did you correctly compiled mali binaries? I had some similar problems to yours.

I also writing some tutorial how to compile Qt5 step by step from beginning, but status of this is pending.


Hi, ye i correctly compiled mali libraries and the test runs with no errors. Also ./configure works now, but i still have problems running the make command. Everytime i try to compile there is a new error, then i fix the error and when i try there is a new one. 
Title: Re: Qt development on A20
Post by: Cosik on October 27, 2014, 05:47:17 pm
But what kind of errors? It's necessary to know what errors you get.
Title: Re: Qt development on A20
Post by: claudio on October 27, 2014, 06:11:40 pm
My last error was this:
make[3]: uscita dalla directory "/home/claudio/TirocinioSort/QTSource/qt-everywhere-opensource-src-5.3.2/qtbase/src/widgets"
cd opengl/ && ( test -e Makefile || /home/claudio/TirocinioSort/QTSource/qt-everywhere-opensource-src-5.3.2/qtbase/bin/qmake /home/claudio/TirocinioSort/QTSource/qt-everywhere-opensource-src-5.3.2/qtbase/src/opengl/opengl.pro -o Makefile ) && make -f Makefile
make[3]: ingresso nella directory "/home/claudio/TirocinioSort/QTSource/qt-everywhere-opensource-src-5.3.2/qtbase/src/opengl"
/home/claudio/TirocinioSort/Toolchain/gcc-linaro-arm-linux-gnueabihf-4.8-2013.09_linux/bin/arm-linux-gnueabihf-g++ -c -pipe -march=armv7-a -mtune=cortex-a7 -mfpu=neon -DLINUX=1 -DEGL_API_FB=1 -mfloat-abi=hard --sysroot=/mnt/a20/ -O2 -O3 -fvisibility=hidden -fvisibility-inlines-hidden -std=c++0x -fno-exceptions -Wall -W -D_REENTRANT -fPIC -DQT_NO_MTDEV -DQT_NO_USING_NAMESPACE -DQT_BUILD_OPENGL_LIB -DQT_BUILDING_QT -DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS -DQT_MOC_COMPAT -DQT_USE_QSTRINGBUILDER -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x050000 -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../../mkspecs/devices/linux-a20olimex-g++ -I. -I../../include -I../../include/QtOpenGL -I../../include/QtOpenGL/5.3.2 -I../../include/QtOpenGL/5.3.2/QtOpenGL -isystem /mnt/a20/usr/include/EGL -isystem /mnt/a20/usr/include/GLES2 -I../../include/QtWidgets/5.3.2 -I../../include/QtWidgets/5.3.2/QtWidgets -I../../include/QtWidgets -I../../include/QtGui/5.3.2 -I../../include/QtGui/5.3.2/QtGui -I../../include/QtGui -I../../include/QtCore/5.3.2 -I../../include/QtCore/5.3.2/QtCore -I../../include/QtCore -I.moc -o .obj/qgl.o qgl.cpp
In file included from /mnt/a20/usr/include/EGL/eglplatform.h:89:0,
                 from /mnt/a20/usr/include/EGL/egl.h:36,
                 from eglconvenience/qeglplatformcontext_p.h:47,
                 from eglconvenience/qeglplatformcontext.cpp:42:
../../include/QtCore/../../src/corelib/kernel/qvariant.h:132:9: error: expected identifier before 'int'
         Bool = QMetaType::Bool,
         ^
../../include/QtCore/../../src/corelib/kernel/qvariant.h:132:9: error: expected '}' before 'int'
In file included from ../../include/QtCore/qvariant.h:1:0,
                 from ../../include/QtCore/../../src/corelib/tools/qlocale.h:45,
                 from ../../include/QtCore/qlocale.h:1,
                 from ../../include/QtCore/../../src/corelib/io/qtextstream.h:48,
                 from ../../include/QtCore/qtextstream.h:1,
                 from ../../include/QtCore/../../src/corelib/io/qdebug.h:50,
                 from ../../include/QtCore/qdebug.h:1,
                 from ../../include/QtCore/QDebug:1,
                 from eglconvenience/qeglplatformcontext.cpp:47:
../../include/QtCore/../../src/corelib/kernel/qvariant.h:132:14: error: expected unqualified-id before '=' token
         Bool = QMetaType::Bool,
              ^
../../include/QtCore/../../src/corelib/kernel/qvariant.h:197:21: error: expected unqualified-id before ')' token
     inline QVariant();
                     ^
../../include/QtCore/../../src/corelib/kernel/qvariant.h:198:16: error: expected constructor, destructor, or type conversion before ';' token
     ~QVariant();
                ^


I found a workaround that says to put "#undef Bool" after includes into "qvariant.h" so now i'm trying again with make. But everytime i "fix" an error there is one new.
Title: Re: Qt development on A20
Post by: Cosik on October 27, 2014, 06:30:33 pm
Ok, I probably know where is problem. You configure Qt with frame buffer or X11?

How did you build mali binary drivers?

I had similar problems when I configure wrong mali drivers.
Title: Re: Qt development on A20
Post by: claudio on October 27, 2014, 06:41:12 pm
For Mali i did:

git clone https://github.com/linux-sunxi/sunxi-mali.git
cd sunxi-mali
git submodule init
git submodule update
make config ABI=armhf VERSION=r3p2-01rel2 EGL_TYPE=framebuffer
make install


Then i tested them:
cd test
make
modprobe mali
modprobe drm
modprobe mali_drm
./test


And it was all ok, with the triangle and all parameters good.

Then qt: i ran this configure:
./configure \
-opengl es2 \
-device linux-a20olimex-g++ \
-device-option CROSS_COMPILE=/home/claudio/TirocinioSort/Toolchain/gcc-linaro-arm-linux-gnueabihf-4.8-2013.09_linux/bin/arm-linux-gnueabihf- \
-sysroot /mnt/a20/ \
-opensource \
-confirm-license \
-optimized-qmake \
-release \
-make libs \
-prefix /opt/qt5.3.2olim2 \
-no-pch \
-nomake examples \
-nomake tests \
-no-xcb \
-eglfs \
-v


My Qmake is:
#
# qmake configuration for the A20_OlinuxinO boards
# http://www.olimex.com/

MAKEFILE_GENERATOR      = UNIX
CONFIG                 += incremental gdb_dwarf_index
QMAKE_INCREMENTAL_STYLE = sublib

include(../../common/linux.conf)
include(../../common/gcc-base-unix.conf)
include(../../common/g++-unix.conf)

load(device_config)

QT_QPA_DEFAULT_PLATFORM = eglfs
#EGLFS_PLATFORM_HOOKS_SOURCES = $$PWD/qeglfshooks_a20.cpp
# modifications to g++.conf
QMAKE_CC                = $${CROSS_COMPILE}gcc
QMAKE_CXX               = $${CROSS_COMPILE}g++
QMAKE_LINK              = $${QMAKE_CXX}
QMAKE_LINK_SHLIB        = $${QMAKE_CXX}

# modifications to linux.conf
QMAKE_AR                = $${CROSS_COMPILE}ar cqs
QMAKE_OBJCOPY           = $${CROSS_COMPILE}objcopy
QMAKE_NM                = $${CROSS_COMPILE}nm -P
QMAKE_STRIP             = $${CROSS_COMPILE}strip

COMPILER_FLAGS          = -march=armv7-a -mtune=cortex-a7 -mfpu=neon -DLINUX=1 -DEGL_API_FB=1 -mfloat-abi=hard

#modifications to gcc-base.conf
QMAKE_CFLAGS           += $${COMPILER_FLAGS}
QMAKE_CXXFLAGS         += $${COMPILER_FLAGS}
QMAKE_CXXFLAGS_RELEASE += -O3

QMAKE_LIBS             += -lrt -lpthread -ldl

# Extra stuff (OpenGL, DirectFB, ...)
QMAKE_INCDIR_EGL        = /mnt/a20/usr/include/EGL
QMAKE_LIBDIR_EGL        = /mnt/a20/usr/lib
QMAKE_INCDIR_OPENGL_ES2 = /mnt/a20/usr/include/GLES2
QMAKE_LIBDIR_OPENGL_ES2 = /mnt/a20/usr/lib
#QMAKE_INCDIR_OPENVG     = $${QMAKE_INCDIR_EGL}
#QMAKE_LIBDIR_OPENVG     = $${QMAKE_LIBDIR_EGL}

QMAKE_LIBS_EGL          = -lEGL -lGLESv2
QMAKE_LIBS_OPENGL_ES2   = -lGLESv2 $${QMAKE_LIBS_EGL}
#QMAKE_LIBS_OPENVG       = -lOpenVG $${QMAKE_LIBS_EGL}

# Sanity check
deviceSanityCheckCompiler()

load(qt_config)


I used "QMAKE_LIBS_EGL = -lEGL -lGLESv2" because the first time i ran "configure" it gave me this error: "undefined reference to `_mali_clz_lut' " and i found this discussion: "http://talk.radxa.com/topic/139/libegl-so-undefined-reference-to-_mali_clz_lut/10"


Title: Re: Qt development on A20
Post by: Cosik on October 27, 2014, 06:54:34 pm
Ok, some more stupid question:

1. Did you link libraries with cross-compile-tools and arm-linux-gnueabihf-g++?

2. Did you clean directory before each build/configuration?

3. Did you install mali drivers as root?
Title: Re: Qt development on A20
Post by: claudio on October 27, 2014, 07:02:44 pm
1) yes
git clone git://gitorious.org/cross-compile-tools/cross-compile-tools.git
cd cross-compile-tools
sudo ./fixQualifiedLibraryPaths /mnt/a20/ /home/claudio/TirocinioSort/Toolchain/gcc-linaro-arm-linux-gnueabihf-4.8-2013.09_linux/bin/arm-linux-gnueabihf-g++


2)i think no

3)yes, btw i think tomorrow i'll try to re-do my Debian image from beginning.

I ask you one thing, i'm using official Debian image from Olimex (the release 7 that you can find here: https://www.olimex.com/wiki/A20-OLinuXino-MICRO#Linux)
Next i need ssvb kernel for mali support:

git clone -b 20140116-mali-r3p2-01rel2 https://github.com/ssvb/linux-sunxi.git linux-sunxi
cd linux-sunxi
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- sun7i_defconfig
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- menuconfig
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j5 uImage modules
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- INSTALL_MOD_PATH=output modules_install


is this right? i'm really desperate coz i tried so many things...
Thank you for your help
Title: Re: Qt development on A20
Post by: Cosik on October 27, 2014, 08:17:13 pm
If you are interest, I was fighting with Qt over two weeks.

You should use latest release for this. This release should contain all necessary libraries.

Also pleas try one more time on fresh image, and on clean Qt source directory. Easiest way is to remove qt source and recompile it again.

Also if you will still have problems and will be desperate, we can set remote session or something like that.
Title: Re: Qt development on A20
Post by: claudio on October 27, 2014, 08:45:06 pm
Ye, tomorrow i'll try with a new setup, release 7 is the last one, there is a release 8 torrent but i can't download it because there are no seeds/peers.
So:


Finger crossed.
One more thing: what about dependencies? in my last try i've installed all the same dependencies as you show on your guide, do you think there are some other to be installed? i've read somewhere on internet something about Mesa libraries..
Title: Re: Qt development on A20
Post by: Cosik on October 28, 2014, 09:18:26 am
It's hard to say about mesa, because I have all dependencies already installed on my image.

I will check it when I will back home.

I have one proposal from my side, please try to cross compile Qt with default kernel. If it will passed then you could try to do it with yours own compiled kernel.