[Interest] Mouse/Pen input latency in Qt Quick and render loop
Andreas Cord-Landwehr
cordlandwehr at kde.org
Wed Aug 19 16:55:36 CEST 2020
Hi Daljit,
do you work on Wayland or on X11? If you are on Wayland, the problem with the
render loop sounds like:
https://codereview.qt-project.org/c/qt/qtwayland/+/306305
Cheers,
Andreas
On Mittwoch, 19. August 2020 13:08:26 CEST Daljit Singh wrote:
> To follow up on this, I was looking at the source code for the renderloop in
> the Qt repositories and I found this comment here
> https://github.com/qt/qtdeclarative/blob/dev/src/quick/scenegraph/qsgrender
> loop.cpp#L79:
> [https://avatars2.githubusercontent.com/u/159455?s=400&v=4]<https://github.
> com/qt/qtdeclarative/blob/dev/src/quick/scenegraph/qsgrenderloop.cpp#L79>
> qt/qtdeclarative<https://github.com/qt/qtdeclarative/blob/dev/src/quick/sce
> negraph/qsgrenderloop.cpp#L79> Qt Declarative (Quick 2). Contribute to
> qt/qtdeclarative development by creating an account on GitHub. github.com
>
>
> - Uses one QRhi (and so OpenGL Context, Vulkan device, etc.) to render
> multiple windows. - This assumes multiple screens can use the OpenGL
> context.
> - Animations are advanced using the standard timer, so QML animations run as
> expected even when vsync throttling is broken.
>
> Does that mean that with Qt6 the "threaded" render loop used by the QML
> SceneGraph has animations correctly even when v-sync is disabled?
> ________________________________
> From: Daljit Singh <daljit97 at live.com>
> Sent: 15 August 2020 01:08
> To: interest at qt-project.org <interest at qt-project.org>
> Subject: Mouse/Pen input latency in Qt Quick and render loop
>
> Hi, I am developing a cross platform application for displaying pen input.
> The project requires real-time rendering of digital ink (stylus input) and
> hence the latency of the rendered strokes is very important. To render the
> strokes I am using a custom QQuickItem together with QSGRenderNode.
> Unfortunately, drawing the ink results in significant latency as the input
> is rendered with some delay (e.g. comparing it to something like OneNote I
> would say there seems to be around 10-15ms more delay). I came across a
> previous mail thread here
> https://lists.qt-project.org/pipermail/interest/2014-March/011692.html
> where it is mentioned that this is largely due to VSync and it's possible
> to disable this by calling QSurfaceFormat::setSwapInterval(0). This works
> well and reduces the latency significantly, unfortunately it also
> introduces another problem: the render loop for the Qt Quick scenegraph
> must be set to "basic" otherwise QML animations go a bit crazy.
>
> My application requires that some of the ink to be rendered when the user is
> scrolling a large canvas (for which I am currently using Flickable), but
> using the basic render loop results in the animation being quite jerky (so
> scrolling is not smooth at all) as while the strokes are rendered the
> animation system is stopped (at least this is my understanding). Is there a
> way to overcome what I described? I only require the app to be in
> "low-latency" mode while the user is drawing on the screen and for all
> other scenario I would like to stick with the threaded render loop.
>
>
> Best,
>
> Daljit
More information about the Interest
mailing list