Qt 5.3.2 Application on Framebuffer



  • 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)



  • 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.



  • 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
    

Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.