Discussion:
[Interest] Display issue with Qt application over SSH/X11
charlie hemlock
2018-07-16 23:47:55 UTC
Permalink
Hello,

I was recommended to post an issue here, rather than the qt forum.

*Original post*: https://forum.qt.io/topic/92664/display-issue-with-qt-
application-windows-over-ssh-x11
*Pretty much copied below verbatim:*

I'm attempting to use PyQt apps on a remote Linux server by SSH and X11
forwarding.

The application window is all black and unusable. Only the window's title
bar exists to close it.
I believe it has to do with Qt and OpenGL over ssh/X11.

Using Windows 10, PuTTY, VcXsrv, and the PyQt apps are on a Linux OpenSUSE
42.3 host (nVidia drivers).
The apps work fine locally. More details follow:
I can display glxgears over ssh/x11 - not optimal, but at least displays.


*1. Display issues with Spyder 3.2.8 & 3.3.0 with Qt/PyQt (5.9.4/5.9.2)*

- Full issue description: https://github.com/spyder-ide/
spyder/issues/7447
- Issue was closed since it is likely a Qt/PyQt problem.
- Note: Spyder displays correctly over ssh/x11 when older versions of
Qt/PyQt(5.6.2/5.6.0) are used

The PuTTY terminal displays following:

% spyder
QQuickWidget: Failed to make context current
QQuickWidget::resizeEvent() no OpenGL context
QQuickWidget: Failed to make context current
QQuickWidget: Failed to make context current
QQuickWidget::resizeEvent() no OpenGL context
QQuickWidget: Failed to make context current
QQuickWidget: Attempted to render scene with no context
QQuickWidget: Attempted to render scene with no context
composeAndFlush: makeCurrent() failed


*2. Display issues with PyQt5 opengl examples from*:
https://github.com/baoboa/pyqt5

- Specifically 2dpainting.py from: https://github.com/baoboa/
pyqt5/tree/master/examples/opengl
<https://github.com/baoboa/pyqt5/tree/master/examples/opengl>
- *However* these examples even fail with qt/pyqt(5.6.2/5.6.0) over
ssh/x11, not just (5.9.4/5.9.2)
- The non-opengl examples seem to work ok. (not black filled)

QOpenGLWidget: Failed to make context current
QPainter::begin: Paint device returned engine == 0, type: 1
QPainter::setRenderHint: Painter must be active to set rendering hints
QPainter::translate: Painter not active
QPainter::save: Painter not active
QPainter::setBrush: Painter not active
QPainter::setPen: Painter not active
...
QPainter::restore: Unbalanced save/restore
QPainter::setPen: Painter not active
QPainter::setFont: Painter not active
QPainter::end: Painter not active, aborted
composeAndFlush: makeCurrent() failed
composeAndFlush: makeCurrent() failed
QPainter::begin: Paint device returned engine == 0, type: 1
QPainter::setRenderHint: Painter must be active to set rendering hints


*Any recommendations to try for #1 & #2?*

- I tried pyqt 5.11.2 but with same results.
- Qt/ OpenGL Environment variables/settings?
- Could this be any way related to how Qt is compiled? I'm using
versions from https://repo.anaconda.com/pkgs/main/linux-64/ or
https://conda-forge.org/feedstocks/ <https://conda-forge.org/feedstocks/>.



*3. qt5/pyqt5 performance degradation over ssh/x11*
This maybe a separate topic all together, but I will likely notice
performance degradation over ssh/x11
if it occurs. Based on previous posts I suspect it will.

Any idea if these changes will be in later versions of qt/pyqt? (To help
with ssh/X11 performance)

- https://codereview.qt-project.org/#/c/181609/
- https://codereview.qt-project.org/#/c/151141/
See Bug/Posts:
- https://bugreports.qt.io/browse/QTBUG-56851
- https://forum.qt.io/topic/56672/need-help-with-
performance-of-qt-application-when-x11-forwarding
<https://forum.qt.io/topic/56672/need-help-with-performance-of-qt-application-when-x11-forwarding>
- https://stackoverflow.com/questions/28782162/serious-
performance-problems-with-qt5-and-x11
<https://stackoverflow.com/questions/28782162/serious-performance-problems-with-qt5-and-x11>

4. Can anyone comments on these apps rather than the standard ssh w/x11
forwarding?

( ssh/x11 method has worked fine for years for several Qt applications
-- looks like a qt regression to me )

- https://xpra.org/
- https://wiki.x2go.org/doku.php
- https://virtualgl.org/

Thank you!
Thiago Macieira
2018-07-17 01:09:30 UTC
Permalink
Post by charlie hemlock
% spyder
QQuickWidget: Failed to make context current
QQuickWidget::resizeEvent() no OpenGL context
QQuickWidget: Failed to make context current
QQuickWidget: Failed to make context current
QQuickWidget::resizeEvent() no OpenGL context
QQuickWidget: Failed to make context current
QQuickWidget: Attempted to render scene with no context
QQuickWidget: Attempted to render scene with no context
composeAndFlush: makeCurrent() failed
Yep, definitely OpenGL issues.

Please make sure glxgears works before trying a Qt application.

Can you switch back to Mesa from the NVidia drivers and try that? If that
isn't enough, try setting LIBGL_ALWAYS_SOFTWARE=1.
Post by charlie hemlock
Using Windows 10, PuTTY, VcXsrv, and the PyQt apps are on a Linux OpenSUSE
42.3 host (nVidia drivers).
On OpenSUSE, the GL libraries are indirected through libglvnd. I don't know
how to tell it to load the Mesa raster instead of the NVidia drivers.
--
Thiago Macieira - thiago.macieira (AT) intel.com
Software Architect - Intel Open Source Technology Center
charlie hemlock
2018-07-19 00:22:33 UTC
Permalink
Hello,
Thank you for replying Thiago.

Yes, I can display glxgears over ssh/x11 - not optimal, but at least
displays. (gears turn really slow, and framerate reported is high (~1000
FPS)
Can you switch back to Mesa from the Nvidia drivers and try that?
I'm not exactly sure how to do that w/o uninstall of Nvidia drivers, or are
there some run-time setting changes just for the app?

setting LIBGL_ALWAYS_SOFTWARE=1.
didn't help. (but believe expected since Nvidia drivers used)

However:
I have tried spyder and the other pyqt5/examples/opengl/ on another server
(CentOS 7, w/o Nvidia drivers) and also have problems.
Though the app **doesn't display at all** in most cases . But some cases it
does appear but is so slow it is unusable.
(glxgears will display). More details below.

For example, VcXsrv has a default setting called "Native opengl"
"Use the native windows opengl library (wgl). Make sure to export the
LIBGL_ALWAYS_INDIRECT environment variable". This defaults setting seems
to work fine for several apps, and I believe is preferred.

Its these newer qt5 apps with opengl that appear to be problematic.
Between qt 5.6 and 5.9 something changed.

Previously spyder used qt4, and I had improved responsiveness when I set
QT_GRAPHICSSYTEM=native
Though I believe that environment variable is deprecated in qt5. (see
links in original message)


Results below:

VcXsrv Native openGL = on (default, checked)
#Result#: Fails. Does not appear. Have to kill processes.
libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast
QQuickWidget: Failed to make context current
QQuickWidget::resizeEvent() no OpenGL context

VcXsrv Native openGL = on
LIBGL_ALWAYS_SOFTWARE=1
LIBGL_ALWAYS_INDIRECT=1
#Result#: Fails. Does not appear. Have to kill processes.
QQuickWidget: Failed to make context current
QQuickWidget::resizeEvent() no OpenGL context

VcXsrv Native openGL = on
LIBGL_ALWAYS_SOFTWARE=1
#Result#: Fails. Does not appear. Have to kill processes.
libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast
QQuickWidget: Failed to make context current
QQuickWidget::resizeEvent() no OpenGL context


VcXsrv Native openGL = on
LIBGL_ALWAYS_INDIRECT=1
#Result#: Fails. Does not appear. Have to kill processes.
QQuickWidget: Failed to make context current
QQuickWidget::resizeEvent() no OpenGL context

VcXsrv Native openGL = off
LIBGL_ALWAYS_SOFTWARE=1
#Result#: appears ok. responsive = very slow, unusable

VcXsrv Native openGL = off
LIBGL_ALWAYS_INDIRECT=1
#Result#: SegFault (expected issues w/this)

VcXsrv Native openGL = off
#Result#: appears ok. responsive = very slow, unusable


Thanks!
Post by charlie hemlock
% spyder
QQuickWidget: Failed to make context current
QQuickWidget::resizeEvent() no OpenGL context
QQuickWidget: Failed to make context current
QQuickWidget: Failed to make context current
QQuickWidget::resizeEvent() no OpenGL context
QQuickWidget: Failed to make context current
QQuickWidget: Attempted to render scene with no context
QQuickWidget: Attempted to render scene with no context
composeAndFlush: makeCurrent() failed
Yep, definitely OpenGL issues.
Please make sure glxgears works before trying a Qt application.
Can you switch back to Mesa from the NVidia drivers and try that? If that
isn't enough, try setting LIBGL_ALWAYS_SOFTWARE=1.
Post by charlie hemlock
Using Windows 10, PuTTY, VcXsrv, and the PyQt apps are on a Linux
OpenSUSE
Post by charlie hemlock
42.3 host (nVidia drivers).
On OpenSUSE, the GL libraries are indirected through libglvnd. I don't know
how to tell it to load the Mesa raster instead of the NVidia drivers.
--
Thiago Macieira - thiago.macieira (AT) intel.com
Software Architect - Intel Open Source Technology Center
_______________________________________________
Interest mailing list
http://lists.qt-project.org/mailman/listinfo/interest
Loading...