Uploaded image for project: ' AGL Development'
  1. AGL Development
  2. SPEC-1484

Qt based app main thread is blocked until shown on screen



    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: Dab 4.0.2
    • Fix Version/s: None
    • Component/s: Graphics
    • Labels:
    • Environment:
      Qt based app (should repro using QML based app)


      Simple scenario:

      • You have QTimer in your QML based app, to be fired every 5 sec after application starts.
      • Launch your application, and you can see QTimer is initialized.
      • But you do not see timer being fired.
      • Only after you make your app visible on screen (by LayerManagerControl), timer is fired as expected.


      I debugged further (putting a lot of qDebug lines), and here is what I am seeing.

      Qt Quick has following two threads involved in window rendering on screen:

      A) GUI (Application Main Thread)
      B) RENDER (Scene Graph Thread)

      GUI dispatches RENDER and wait for its completion by wait().
      RENDER does its job and when done wakes GUI by wakeOne().

      But RENDER seems to be blocked while in its operation at OpenGL APIs like clear, swapBuffers, etc.
      (Not crashing since process is there.)
      Since RENDER does not wake GUI, GUI (app main thread) is blocked.

      Once the app is shown on screen (via manual operation on LayerManagerControl), app main thread seems to be unblocked and the app starts working.

      One possibility is that my app still have issues on AGL that causing the RENDER thread to block.

      But I feel more likely is that RENDER thread does not work well while it is operating against offscreen (at least, before it is shown on screen).

      And, the issue is not experienced on existing AGL demo application (Qt based) because thanks to the AGL window manager/homescreen they are shown on screen once they are launched.
      (So that they do not try to operate background.)
      And the above render loop goes well if the app is shown once and initialization is done (and continue working if it is sent to background after that?)

      Also not obvious with desktop-shell + wayland environment, where app is always shown when launched?

      Additional info:

      The below talk about qt wayland deadlock issues that sound similar.

      Events are queued when rendering blocked

      A Qt Platform Abstraction plugin for KWin


        No reviews matched the request. Check your Options in the drop-down menu of this sections header.



            ntanibata Nobuhiko Tanibata
            tmatsuzawa Takashi Matsuzawa
            0 Vote for this issue
            3 Start watching this issue