Hello all,
Asking for help on VTK/Qt performance issue.
We are using VTK 8.2 on Linux (based on Ubuntu 18.04) in software for medical device, with several VTK views within a Qt application. There is a live camera view using pure OpenGL calls in addition to the VTK views. We have been using VTK 8.2 and Qt 5.12.2 successfully. Now after upgrading to Qt 5.15.2 (and recompiling the same version VTK 8.2 against the new Qt 5.15.2) we are seeing performance degradation due to slower render times in the VTK views.
Each VTK view has its own visualization pipeline with its own vtkRenderWindow.
There are 3 orthogonal image slice views, these render fast before (~1.5-2ms) as well as after (~3ms) upgrade.
Then there is a 3D view rendering polygonal geometry (45k polys + some smaller objects), which rendered in ~4.5ms before, and ~7ms after Qt upgrade.
The most impacted is a volume rendered scene, which took ~7ms per render before, now doubled to 14-15ms per render.
The timings are measured as delta between vtkRenderWindow’s StartEvent and EndEvent.
We use QVTKOpenGLNativeWidget for the Qt/VTK interface, same before and after upgrade.
The live camera view was performing at ~30fps stable before with Qt 5.12, now it’s ~10fps. When the VTK views are hidden, the camera view gets to stable 30fps again.
Using NVIDIA P4000 GPU with 470.* drivers, which seems to work correctly (checked with nvidia-smi
, glxgears
) with vsync turned off (__GL_SYNC_TO_VBLANK=0
). Some relevant output of glxinfo:
OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: Quadro P4000/PCIe/SSE2
OpenGL core profile version string: 4.6.0 NVIDIA 470.103.01
OpenGL core profile shading language version string: 4.60 NVIDIA
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 4.6.0 NVIDIA 470.103.01
OpenGL shading language version string: 4.60 NVIDIA
Although the vsync should be disabled (glxgears
confirms that __GL_SYNC_TO_VBLANK=0 works), I see this in the log when I set QSG_INFO=1:
[23:45:20.125 DEBUG] >>> [QT/QML] threaded render loop
[23:45:20.125 DEBUG] >>> [QT/QML] Using sg animation driver
[23:45:20.125 DEBUG] >>> [QT/QML] Animation Driver: using vsync: 16.67 ms
It seems the Qt SG thread still syncs to vblank regardless of the __GL_SYNC_TO_VBLANK.
Has anyone experienced similar performance issues in VTK views after Qt upgrade? Any pointers to improve performance with Qt + multiple VTK renderwindows?
For reference, the new Qt 5.15.2 was compiled with
$QT5_SRC_DIR/configure -commercial -confirm-license \
-release \
-shared \
-no-static \
-no-pch \
-c++std c++17 \
-silent \
-prefix $INSTALL_DIR \
-nomake tests \
-nomake examples \
-inotify \
-icu \
-ssl \
-cups \
-libudev \
-qt-doubleconversion \
-qt-pcre \
-qt-zlib \
-qt-harfbuzz \
-qt-libpng \
-qt-libjpeg \
-qt-sqlite \
-qt-webengine-icu \
-qt-webengine-ffmpeg \
-system-freetype \
-alsa \
-webengine-alsa \
-opengl desktop \
-qpa xcb \
-xcb-xlib \
-xkbcommon
Unfortunately I don’t have build notes from previous build Qt 5.12.
Any and all thoughts/comments/advice greatly appreciated!!
Cheers,
Miro