Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Qt 5.3.2 Application on Framebuffer
Qt 6.11 is out! See what's new in the release blog

Qt 5.3.2 Application on Framebuffer

Scheduled Pinned Locked Moved QML and Qt Quick
3 Posts 2 Posters 4.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kDohmen
    wrote on last edited by kDohmen
    #1

    Hello,

    I want to run an Qt Quick application on the framebuffer of my linux-board.

    When I start the application it just outputs:
    EGL Error : Could not create the egl surface: error = 0x300b

    (crosspost: http://forum.odroid.com/viewtopic.php?f=82&t=6804&p=55111#p55111)

    1 Reply Last reply
    0
    • A Offline
      A Offline
      agocs
      wrote on last edited by
      #2

      Because you have no platform-specific adaption for setting up EGL on fbdev with the Mali drivers.

      Using the Beagleboard/bone approach will not work: There there is no device-specific adaptation needed. Other devices, like the Mali-based ones, will need some vendor-specific initialization to create the native "windows".

      Take a look at the hix5hd2 makespecs at qtbase/mkspecs/devices/linux-arm-hisilicon-hix5hd2-g++. The eglfs hooks there are probably usable on any Mali-based board.

      You could also try configuring with -device linux-arm-hisilicon-hix5hd2-g++ but be aware that this may break badly if the compiler flags are not what your board expects.

      1 Reply Last reply
      0
      • K Offline
        K Offline
        kDohmen
        wrote on last edited by kDohmen
        #3

        Thank you, it works :D

        here my qmake.conf and qeglfshooks.cpp

        qmake.conf

        #
        # qmake configuration for the odroid u2/u3 boards
        # http://hardkernel.com/
        # http://forum.odroid.com/viewtopic.php?f=9&t=1645
        # http://qt-project.org/forums/viewthread/48704/
        
        
        include(../common/linux_device_pre.conf)
        EGLFS_PLATFORM_HOOKS_SOURCES = $$PWD/qeglfshooks_odroidu2.cpp
        
        # Extra stuff (OpenGL, DirectFB, ...)
        QMAKE_INCDIR_EGL        += $$[QT_SYSROOT]/usr/include
        QMAKE_LIBDIR_EGL        += $$[QT_SYSROOT]/usr/lib/arm-linux-gnueabihf/mali-egl
        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  += -lMali
        QMAKE_LIBS_OPENGL_ES2   += $$QMAKE_LIBS_EGL
        QMAKE_LIBS_OPENVG       += $$QMAKE_LIBS_EGL
        
        #modifications to gcc-base.conf
        COMPILER_FLAGS  += -march=armv7-a -mcpu=cortex-a9 -mtune=cortex-a9 -mfpu=neon -mvectorize-with-neon-quad
        DISTRO_OPTS   += hard-float
        QMAKE_CXXFLAGS_RELEASE += -O3
        
        include(../common/linux_arm_device_post.conf)
        
        load(qt_config)
        

        qeglfshooks_odroidu2.cpp (just the one from linux-arm-hisilicon-hix5hd2-g++)

        #include "qeglfshooks.h"
        #include <EGL/fbdev_window.h>
        
        #include <unistd.h>
        #include <fcntl.h>
        #include <sys/ioctl.h>
        #include <linux/fb.h>
        
        #include <private/qcore_unix_p.h>
        
        QT_BEGIN_NAMESPACE
        
        class QEglFSOdroidHooks : public QEglFSHooks
        {
        private:
            void fbInit();
        public:
            void platformInit() Q_DECL_OVERRIDE;
            EGLNativeWindowType createNativeWindow(QPlatformWindow *window, const QSize &size, const QSurfaceFormat &format) Q_DECL_OVERRIDE;
            void destroyNativeWindow(EGLNativeWindowType window) Q_DECL_OVERRIDE;
        };
        
        void QEglFSOdroidHooks::fbInit()
        {
            int fd = qt_safe_open("/dev/fb0", O_RDWR, 0);
            if (fd == -1)
                qWarning("Failed to open fb to detect screen resolution!");
        
            struct fb_var_screeninfo vinfo;
            memset(&vinfo, 0, sizeof(vinfo));
            if (ioctl(fd, FBIOGET_VSCREENINFO, &vinfo) == -1)
                qWarning("Could not get variable screen info");
        
            vinfo.bits_per_pixel   = 32;
            vinfo.red.length       = 8;
            vinfo.green.length     = 8;
            vinfo.blue.length      = 8;
            vinfo.transp.length    = 8;
            vinfo.blue.offset      = 0;
            vinfo.green.offset     = 8;
            vinfo.red.offset       = 16;
            vinfo.transp.offset    = 24;
            vinfo.yres_virtual     = 2 * vinfo.yres;
        
            if (ioctl(fd, FBIOPUT_VSCREENINFO, &vinfo) == -1)
                qErrnoWarning(errno, "Unable to set double buffer mode!");
        
            qt_safe_close(fd);
            return;
        }
        
        void QEglFSOdroidHooks::platformInit()
        {
            QEglFSHooks::platformInit();
            fbInit();
        }
        
        EGLNativeWindowType QEglFSOdroidHooks::createNativeWindow(QPlatformWindow *window, const QSize &size, const QSurfaceFormat &format)
        {
            fbdev_window *fbwin = reinterpret_cast<fbdev_window *>(malloc(sizeof(fbdev_window)));
            if (NULL == fbwin)
                return 0;
        
            fbwin->width = size.width();
            fbwin->height = size.height();
            return (EGLNativeWindowType)fbwin;
        }
        
        void QEglFSOdroidHooks::destroyNativeWindow(EGLNativeWindowType window)
        {
            free(window);
        }
        
        QEglFSOdroidHooks eglFSOdroidHooks;
        QEglFSHooks *platformHooks = &eglFSOdroidHooks;
        
        QT_END_NAMESPACE
        
        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved