April 03, 2020, 06:59:11 pm

News:

Have you visited the Allwinner Chipset wiki? - http://linux-sunxi.org/


Qt5 build for cubieboard

Started by wickwire, March 09, 2013, 04:06:39 pm

Previous topic - Next topic

wickwire

October 14, 2013, 07:29:03 am #45 Last Edit: October 14, 2013, 07:32:18 am by wickwire
Hi guys,

I've decided to move on to ssvb's optimizations and based on mattli's efforts, I'm currently one step shy of Qt5 on Cubie2, framebuffer mali r3p2-01rel2

Slightly different / maybe simpler than mattli's steps,

I took the sunxi-bsp approach from the FirstSteps guide and build a custom SD card:

- The easy option: sunxi-bsp
- linaro rootfs (linaro-precise-alip-20121124-519.tar.gz)
- linaro gcc (gcc-linaro-arm-linux-gnueabihf-4.8-2013.09_linux.tar.bz2)

- Once I had the SD card working (it's just a couple of commands, supply the SD card, wait, and the card is produced), I tested it on Cubie2 and it worked fine

- then I pulled ssvb's modified 3.4 kernel from git and built it:

- First Steps Guide -> The flexible option: manual build and installation -> Building the kernel (just this bit)


make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- sun7i_defconfig
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


- then I inserted the SD card on my laptop again and copied the uImage built on ssvb's modified kernel sources AND the /lib/modules/ and /lib/firmware dirs that were generated

SD card back on Cubie, fired it up, it booted normally, stopped lightdm/X and removed the service from boot and then the mali libs:

- cloned the sunxi-mali git on Cubie
- make config VERSION=r3p2-01rel1 ABI=armhf EGL_TYPE=framebuffer
- manually corrected the lib/mali/Makefile.split (replace 8 spaces with TAB space) - otherwise, the make install step fails
- make
- sudo make install
- cd test
- make
- ./test

linaro@linaro-alip:~/sunxi-mali/test$ ./test
EGL 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 "
linaro@linaro-alip:~/sunxi-mali/test$


And a nice gradient coloured triangle on the framebuffer. I think it still has the 10min blank screen issue, I'll have to fix that next.

And afterwards, going with Qt5 - I've been trying to cross-compile Qt5 instead of native building... if anyone has had any success with it, please write here as well!

wickwire

Disabling lightdm/X on boot seems to be accomplished by removing/renaming /etc/init/lightdm.conf

For the 10min issue, I'm using the uEnv.txt parameters from the link derekdhaas posted http://www.cubieforums.com/index.php/topic,838.msg4910.html#msg4910

extraargs=disp.screen0_output_mode=1280x720p60 consoleblank=0

patwood

Quote from: wickwire on October 14, 2013, 07:55:20 am
Disabling lightdm/X on boot seems to be accomplished by removing/renaming /etc/init/lightdm.conf


You can disable any init script by appending the line

manual

to the .conf file.  Then if you want to run it manually, just do

start lightdm

as root.

mattli

Quote from: wickwire on October 14, 2013, 07:29:03 am
...
And afterwards, going with Qt5 - I've been trying to cross-compile Qt5 instead of native building... if anyone has had any success with it, please write here as well!


Hi, wickwire:

     Do you success run with Qt5_CinematicExperience and saw tearing when "sun" image moving?
When the "sun" moving to bottom of movie picture, It will tearing.

Source code -
http://quitcoding.com/download/Qt5_CinematicExperience_rpi_1.0.tgz

Matt.

wickwire

Hi mattli,

Haven't managed to build Qt 5.1.1 yet, I've been trying to cross-compile it and save us some time, but I'm currently stuck at

/opt/qt5.cubieboard2A20.workbench/cubie2-rootfs/usr/lib/arm-linux-gnueabihf/libz.a: could not read symbols: Bad value

wickwire

I've managed to successfully build Qt 5.1.1 using cross compile, and then running the QtCinematic Demo I got to my old error:

EGL Error : Could not create the egl surface: error = 0x300b

I'm going to check mattli's notes now - probably the EGLFS patches or something

wickwire

mattli, are you still working with the  qt5base-eglfs-native-window.patch?

which platform on the framebuffer are you using with Qt: eglfs? Can you share your Qt5 configure line?

wickwire

Finally, Qt5 cross compiled and the Cinematic Demo running on framebuffer @~85fps

mattli: I'm not experiencing the tearing of the sun orb at the bottom I don't think, but on the other hand, the mouse cursor is drawn but doesn't work.

wickwire

Ok, so on my side, at this point I have ~85FPS on either 720p or 1080p, by ajusting the script.bin file (convert to fex, edit, generate new bin)

The system locks up after a few minutes in, running the QtCinematic Demo (720p/1080p)

I think I did manage to notice the tearing you were talking about mattli, although very slightly

In spite of having the high FPS, I sense that the particles animations (the sunny orb) aren't fluid, the animation seems to stutter a bit

I don't have mouse - I have the cursor being drawn on screen but can't use it in the app

Once I have the chance, I'll post the steps I used.

ssvb

Quote from: mattli on October 14, 2013, 08:51:42 pm
     Do you success run with Qt5_CinematicExperience and saw tearing when "sun" image moving?
When the "sun" moving to bottom of movie picture, It will tearing.

There will be no tearing with X11 drivers and "SwapbuffersWait" set to "true" in xorg.conf. But there will be no 85 FPS either, because buffer flips will be synchronized with the monitor vertical refresh (assuming that fb0_framebuffer_num is set to 3 in fex and /var/log/Xorg.0.log does not complain about problems with zero-copy buffer swaps).

wickwire

October 15, 2013, 02:36:22 pm #55 Last Edit: October 17, 2013, 01:59:06 pm by wickwire
Update: correcting the values for the resolutions:

Running the QtCinematic Demo as root gives me mouse access:

At 720p, I'm getting:


~85FPS with everything ON
drops to around 50FPS when dropping the animated text scroll banner

~150FPS with everything OFF


At 1080p, I'm getting:


~45FPS with everything ON
drops to around 30FPS when dropping the animated text scroll banner

~80FPS with everything OFF

derekdhaas

Hi WickWire, can you please tell me how you cross compiled it? And how you fixed the problems (Could not create the egl surface: error = 0x300b, etc.)?

wickwire

Of course, but before that I'll just try to build the accelerated browser, I'm just cleaning up the software and steps and will post ASAP

wickwire

October 16, 2013, 07:45:11 am #58 Last Edit: October 17, 2013, 07:21:49 pm by wickwire
Update:

Added a tar.bz2 archive containing the linux-cubieboard2-g++ and qeglfshooks_stub.cpp I used

Update #2:

Getting the mouse working with the default user rather than root: /dev/input/mice in my case, and I set some udev rules to set read permissions on it, for a new "mouse" group - and added my regular "linaro" user to that group.

Letting go of "-platform eglfs" : if your system also has /etc/environment, edit that file and add the line below and reboot

QT_QPA_PLATFORM=eglfs



Ok, so based on the previous steps:


  • cubieboard 2 (A20)

  • I'm running Linaro rootfs 12.11 from my previous post in this thread

  • ssvb's patched kernel for mali libs r3p2-01rel2

  • installed mali libs r3p2-01rel2 (Framebuffer)

  • the coloured triangle being displayed on cubie's framebuffer

  • the following confirmation output:

    EGL 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 "




  • Install the following Webkit dependencies (I'm unsure at the moment if QtWebkit is working, but installing the deps shouldn't do any harm)

    sudo apt-get install flex bison gperf libicu-dev libxslt-dev ruby

  • Create an SD card image using dd on the cross compile host (I'm using Linux Mint) - check the paths!
    dd bs=1M if=/dev/mmcblk0 of=/opt/qt5.cubieboard2A20.workbench/linaro.1211.ssvb.malifb.Qt511.QtWebkit.img;sync

  • Adapt the Raspberry Pi's Cross Compile Guide:
    http://qt-project.org/wiki/RaspberryPi_Beginners_guide
    I used gcc-linaro-arm-linux-gnueabihf-4.8-2013.09_linux
    I used qt-everywhere-opensource-src-5.1.1
    git clone git://gitorious.org/cross-compile-tools/cross-compile-tools.git
    consider installing 32bit support if you're on a 64bit OS: sudo apt-get install ia32-libs

  • Uncompress the Qt5 archive as root and copy over a couple of files
    cp -R qeglfshooks_stub.cpp ./qt-everywhere-opensource-src-5.1.1/qtbase/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp
    cp -R linux-cubieboard2-g++ ./qt-everywhere-opensource-src-5.1.1/qtbase/mkspecs/devices/

  • Mount the SD Card image, just the OS partition (exclude the boot partition)
    With linux you have "parted" to find the byte offset:
    parted <sdcardimage>
    > unit B
    > p
    this will show the partitions on the SD Card image, use the starting byte for the root partition, where de system lies

  • In my case:
    mount -o loop,offset=68157440 /opt/qt5.cubieboard2A20.workbench/linaro.1211.ssvb.malifb.Qt511.QtWebkit.img /opt/qt5.cubieboard2A20.workbench/cubie2-rootfs/

  • Get ready to compile Qt5 (adapt the configure line paths to your own)
    cd qt-everywhere-opensource-src-5.1.1
    ./configure -opengl es2 -device linux-cubieboard2-g++ -device-option CROSS_COMPILE=/opt/sdcard.cubieboard.workbench/gcc-linaro-arm-linux-gnueabihf-4.8-2013.09_linux/bin/arm-linux-gnueabihf- -sysroot /opt/qt5.cubieboard2A20.workbench/cubie2-rootfs -opensource -confirm-license -optimized-qmake -release -make libs -prefix /usr/local/qt5cb2 -no-pch -nomake examples -nomake tests -no-xcb -eglfs -v


  • Check the config.summary file, mine is below:

    cat qt-everywhere-opensource-src-5.1.1/qtbase/config.summary

       Configure summary

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

                - Also available for Linux: linux-kcc linux-icc linux-cxx
           
    qmake vars .......... styles += mac fusion windows QMAKE_CFLAGS_FONTCONFIG = -I/opt/qt5.cubieboard2A20.workbench/cubie2-rootfs/usr/include/freetype2   QMAKE_LIBS_FONTCONFIG = -L/opt/qt5.cubieboard2A20.workbench/cubie2-rootfs/usr/lib/arm-linux-gnueabihf -lfontconfig -lfreetype   DEFINES += QT_NO_LIBUDEV DEFINES += QT_NO_XCB DEFINES += QT_NO_XKBCOMMON PRECOMPILED_DIR = .pch/release-shared OBJECTS_DIR = .obj/release-shared MOC_DIR = .moc/release-shared RCC_DIR = .rcc/release-shared UI_DIR = .uic/release-shared sql-drivers =  sql-plugins =  sqlite qmake switches .........

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

    Qt modules and options:
      Qt D-Bus ............... no
      Qt Concurrent .......... yes
      Qt GUI ................. yes
      Qt Widgets ............. yes
      JavaScriptCore JIT ..... yes (To be decided by JavaScriptCore)
      QML debugging .......... yes
      Use system proxies ..... no

    Support enabled for:
      Accessibility .......... yes
      ALSA ................... no
      CUPS ................... no
      FontConfig ............. yes
      Iconv .................. yes
      ICU .................... yes
      Image formats:
        GIF .................. yes (plugin, using system library)
        JPEG ................. yes (plugin, using bundled copy)
        PNG .................. yes (in QtGui, using bundled copy)
      Glib ................... no
      GStreamer .............. no
      GTK theme .............. no
      Large File ............. yes
      libudev ................ no
      Networking:
        getaddrinfo .......... yes
        getifaddrs ........... yes
        IPv6 ifname .......... yes
        OpenSSL .............. no
      NIS .................... 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 ................... no
      xkbcommon .............. no
      zlib ................... yes (system library)


  • make -j 5 && make install

  • my cross host took less than 1h to build everything successully, at this point, QtWebkit as well

  • unmount cubie2-rootfs

  • get an SD Card - either the original one used previously or another one with the same size and burn the image to it - check the device paths!
    dd bs=1M if=/opt/qt5.cubieboard2A20.workbench/linaro.1211.ssvb.malifb.Qt511.QtWebkit.img of=/dev/mmcblk0;sync

  • plug the card on cubie and let it run, make sure everything's ok with booting, networking, etc

  • back on the cross compile host:

    install Qt Creator if you haven't already
    re-mount cubie2-rootfs
    add the linaro gcc to creator
    add the built qmake to creator - mine is on /usr/local/qt5cb2/bin/qmake
    add the device and test ssh connectivity to cubieboard 2 over the LAN
    make sure cubie2-rootfs is mounted, qmake was built against that filesystem so it will search for the libs there
    get the Cinematic Demo --> wget http://quitcoding.com/download/Qt5_CinematicExperience_rpi_1.0.tgz
    uncompress it and open it in QtCreator
    edit the .pro file and add the following lines:
    # Add more folders to ship with the application, here
    folder_01.source = qml/content
    folder_01.target = qml
    DEPLOYMENTFOLDERS = folder_01

  • head over to Projects on the left vertical bar > Select the "run" tab on your kit > in the Run section below you have an "Arguments:" input text box, add: -platform eglfs

  • Build and Run



If all goes well, the cross-compile binary and qml files will be loaded to Cubie and executed. If upload fails with permissions, just grant permissions on /opt/ on the running cubie

if the demo starts up, you get a mouse pointer but can't move it around, stop the run execution on Qt Creator, login to Cubie and run the app locally - as root:

cd /opt/QtCinematicDemo/
./CinematicDemo -platform eglfs

And that should be all there is to it! :)

wickwire

October 16, 2013, 08:28:00 am #59 Last Edit: October 16, 2013, 08:31:04 am by wickwire
mlbrowser built ok, but when running as described in the github wiki, the screen remains blank.

I then compiled the fancy browser from the qtwebkit-examples and that one worked. I'm able to browse the web, but with not much fluidity where animations are concerned.

Still getting unstable behaviour, the apps crash after a few minutes:

EGL Error : Could not create the egl surface: error = 0x3003