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. QQuickFramebufferObject render function on main thread
Forum Updated to NodeBB v4.3 + New Features

QQuickFramebufferObject render function on main thread

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 728 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.
  • bart_janssensB Offline
    bart_janssensB Offline
    bart_janssens
    wrote on last edited by
    #1

    Hi,

    I just realised this is more related to Qt Quick, so reposting from
    https://forum.qt.io/topic/70300/qmetaobject-invokemethod-with-qt-blockingqueuedconnection-from-render-thread

    I have a QQuickFramebufferObject where I would like to call an external rendering function (written in Julia). Because Julia is not thread-safe, the rendering function must be called from the main thread. The easiest solution is to just set QSG_RENDER_LOOP to basic, but that is easy to forget and sub-optimal for other components in the scene graph.

    Looking at the scene graph documentation, I thought it would have been possible to call back into the main thread using QMetaObject::invokeMethod with a Qt::BlockingQueuedConnection from within QQuickFramebufferObject::Renderer::render, but this seems to result in a deadlock. Using just a Qt::QueuedConnection doesn't work either, because then the rendering function gets called after the context is invalidated.

    It seems that the GUI thread does not continue processing events until QQuickFramebufferObject::Renderer::render has completed, even though the docs state that the GUI thread is unblocked during render? The documentation for QQuickFramebufferObject even states: "Using queued connections or events for communication between item and renderer is also possible".

    I have added a stand-alone test case here:
    https://github.com/barche/render-threads

    The problem is at line 18 in fborender.cpp:
    https://github.com/barche/render-threads/blob/master/fborender.cpp#L18

    Is the use of a Qt::BlockingQueuedConnection somehow disallowed here?

    Cheers,

    Bart

    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