ARM - QML Tslib and Window issues



  • Hi all,
    I'm quite new to Qt and I'm pretty sure that I'm using most of it wrong :) However I am currently developing a camera app using QML and have some problems with it that community might help me with hopefully. I'm using Qt 5.2.1 on Allwinner A20 (Cortex-A7 platform). Although I'm a beginner with Qt, I'm quite good with C/C++ and I'm also maintaining kernel. Basically, I have two questions:

    1. What I want is to have a GUI on top of the running video (QML knows nothing about the video). I was partially successful in implementing it (very buggy currently due to QML or me not knowing QML). My main QML app is based on Window, not Rectangle. The problem is that window seems to have a lot of issues with repainting. It's also important to mention that I'm using EGLFS platform. Consider this small app:

    [code]
    Window {
    id : cameraUI

    width: 1024
    height: 600
    
    color: toggle ? "FFFFFF" : "transparent"
    visible: true
    
    property bool toggle: true
    
    MouseArea {
        anchors.fill: parent
        onPressed: {
            cameraUI.toggle = !cameraUI.toggle
            console.log("Click!");
        }
    }
    
    // Add control groups here
    Component.onCompleted: {
        console.log("Starting!")
    }
    

    }
    [/code]

    Every mouse click is registered and I get "Click!" for every click. Pay no attention to onPressed - I've tried with onClicked and it's the same. The problem is that window repainting is not triggered by color property change or click - it is only triggered if I click and move the mouse a bit (?!?). Just one pixel move is enough. Is this a bug or am I missing something?

    The app is started with:

    [code]
    int main(int argc, char* argv[])
    {
    QApplication app(argc, argv);
    QQuickWindow::setDefaultAlphaBuffer(true);
    QQmlApplicationEngine engine(QUrl("qrc:///camera_app.qml"));
    return app.exec();
    }
    [/code]

    1. Tslib issues with OpenGL. Without EGLFS, I can run the app with -plugin Tslib and touchscreen works perfectly. I can also run it with EVDEV, which works normally, but it's much worse than with tslib.
      With OpenGL no matter what I do I get segfaults when starting app with -plugin Tslib. In fact sometimes it will just deadlock in ts_configure() function (called in the constructor of Qt's Tslib plugin). I have tried this with and without QT_QPA_EGLFS_DISABLE_INPUT env variable, since I've seen that EGLFS has its own input handlers (which is quite dumb actually, since EVDEV touch driver is completely useless when compared to Tslib). Does anyone have a solution for this? I can't seem to find a way to start tslib plugin when using EGLFS platform at all.


  • Any solution ? I've the same issue with my a20 =) and 7p touch screen



  • You'll have to be more precise than that, since I've posted two questions, both relating to A20 and touchscreen.



  • I'm trying to use tslib on EGLFS.
    On Xserver everything is ok.
    On QT apps with EGLFS, the linux point follow the touchscreen but the QT pointer have it Y axis inverted. Using -plugin tslib don't change anything.
    I use 7inch ts from olimex



  • EVDEV for EGLFS is active - this is why one of the axes is inverted. There are multiple solutions for this problem:

    1. Make EVDEV functional - this is a bit more complicated, as it involves modifying both qt source (adding flip options to the qt driver) and kernel source (modifying calibration data, as EVDEV is not possible to calibrate like tslib). Modifying calibration data also involves some actual physical work (pressing the pen to the edges and looking at the output) - a few scripts in Linux will do it quite good. But still, this way is long and stupid and you should use it only if Tslib is not working for some reason.

    2. Kill EVDEV and use Tslib. This is the preffered way. You only need to set QT_QPA_EGLFS_DISABLE_INPUT to 1 as your env variable (/etc/environment) and after that load the app with '-plugin Tslib' switch. If your Tslib plugin is properly built and installed, TS will work with it. If you still have precision issues or some axis is inverted, just run 'ts_calibrate' and calibrate your screen (the program is where you installed tslib - /usr/local/tslib/bin or similar).



  • Hi thanks for your quick answer. I'm using your second solution but i can't make it works. I can't build Ts plugin since it is no more included into qt sources. I have built tslib for kergoth sources but qt don't use it. I need the plugin version to generate the "libqlinuxinputplugin.so" file.



  • You need to first build tslib from kergoth sources and install it to the rootfs. Then you need to edit your qmake.conf and add tslib headers and libs like so (my tslib is installed to the default location, QT_SYSROOT is where your rfs is):

    [code]

    tslib

    QMAKE_INCDIR += $$[QT_SYSROOT]/usr/include
    QMAKE_LIBDIR += $$[QT_SYSROOT]/usr/lib
    QMAKE_LFLAGS += -Wl,-rpath-link=$$[QT_SYSROOT]/usr/lib
    [/code]

    After this, you need to configure Qt to actually use the tslib driver, since it's not done by default anymore:

    [code]
    ./configure -v -opensource ...blabla... -tslib
    [/code]

    If you don't include the '-tslib' switch here, tslib plugin will not be built! After this, build Qt and tslib plugin will be built properly. Also beware of Qt issues - since Qt people don't really know how to write scripts properly for some reason, there's no real 'make confclean', unless you use git sources (as far as I saw it's not trivial then either). The suggestion is that if you need to reconfigure Qt (like you do now) - delete the current Qt source that you have and do it from the scratch - I've had all sorts of issues with paths when simply doing ./configure again on already configured sources (it works for some simple things, but just in case, do it all over again).

    Furthermore, there are some places out there, like this one (which I used as a starting point):

    "A13 Qt install guide":http://nickguthrie.com/embedd_gui/doc/full.html

    which suggest that you should also have a separate precompiled copy of tslib on host (cross of course). For some reason this didn't work for me so beware, but I don't like it anyway. I'm using NFS and my rfs is on my host, so simply building and installing it to the NFS'd rfs (and then supplying qt with these paths) did the trick.



  • Thanks but the issue came from my QT archive which was corrupted and i had't got the tslib plugin part.



  • Regarding issue #1, call update() on the window. (it's a slot so it should be usable from qml/javascript too) Setting the clear color merely stores the values and will not trigger rendering.


Log in to reply
 

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