Qt application laggy/rendering artifacts when startet using a systemd service



  • Hello,
    A Qt-based application is supposed to start on boot on a debian 9 based system. When starting the application manually over the console or deploy and start it with qt-creator it runs smoothly.

    When it gets startet by systemd on startup the application is not as responsive and there are some artifacts visible when swiping in the app.

    I thought that this might have something to do with priority and scheduling so I tried to set the priority manually. This did not help

    This is the .service:

    [Unit]
    Description=DM QT Application
    After=network.target
    
    [Service]
    Type=simple
    ExecStart=/usr/bin/sudo --user=dm /etc/init.d/dm-appstart-qt.sh
    #ExecStart=/etc/init.d/dm-appstart-qt.sh
    CPUSchedulingPriority=20
    
    [Install]
    WantedBy=multi-user.target
    

    What could be the reason for the difference in percieved performance between the systemd service starting the application and me manually starting it?


  • Moderators

    @bozo said in Qt application laggy/rendering artifacts when startet using a systemd service:

    What could be the reason for the difference in percieved performance between the systemd service starting the application and me manually starting it?

    I think your app is started before GPU driver is loaded - and the app starts with software renderer (MESA). If only possible, launch it later, preferably when some user is already logged in.



  • This post is deleted!


  • @sierdzio The issue still exists after delaying the start of the application by 60s. By then the gpu driver should be loaded. This version of debian has no desktop environment installed so the only graphical application is the qt-app.



  • I noticed this output from the systemd log:

    Oct 22 09:25:09 dlogic-dm dm-appstart-qt.sh[461]: QEglFSVivIntegration will set environment variable FB_MULTI_BUFFER=2 to enable double buffering and vsync.
    Oct 22 09:25:09 dlogic-dm dm-appstart-qt.sh[461]:  If this is not desired, you can override this via: export QT_EGLFS_IMX6_NO_FB_MULTI_BUFFER=1
    

    This message does not appear in the output when starting the app manually. I permanently set QT_EGLFS_IMX6_NO_FB_MULTI_BUFFER to 1 but there is still stuttering and tearing.

    I narrowed it down futher: When starting the service with

    systemctl start foo.service
    

    there also is stuttering. When calling the startscript the service uses manually, the application runs smoothly.



  • I managed to get it to run properly but I still am not sure why it behaved like described in the first place.
    Logging in as root and then starting the app manually also resulted in the same issues as using a service to start the app.
    The fix was to export the variable FB_MULTI_BUFFER=3. Setting it to 2 causes screen tearing, 1 results in animations running too fast since there is no vsync.


Log in to reply