Bug 433484 - OpenGL-related Qt-based software does not work properly
Summary: OpenGL-related Qt-based software does not work properly
Status: RESOLVED DOWNSTREAM
Alias: None
Product: kwin
Classification: Plasma
Component: general (show other bugs)
Version: unspecified
Platform: Neon Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2021-02-23 12:53 UTC by geisserml
Modified: 2021-08-02 11:21 UTC (History)
6 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
OpenGL Rendering fault with Scantailor - I can provide examples from at least 3 more apps if necessary (893.48 KB, image/png)
2021-02-23 12:53 UTC, geisserml
Details
kdiff3 transparency and flickering (161.45 KB, image/png)
2021-05-12 07:41 UTC, geisserml
Details

Note You need to log in before you can comment on or make changes to this bug.
Description geisserml 2021-02-23 12:53:08 UTC
Created attachment 136081 [details]
OpenGL Rendering fault with Scantailor - I can provide examples from at least 3 more apps if necessary

SUMMARY
I am experiencing numerous issues related to Qt-based software with OpenGL(ES)-accelerated graphical interfaces.
The part of the application that should be drawn by Qt OpenGL(ES) is either completely invisible (on Wayland, even the application or wallpaper behind is shown), and/or severely suffering from rendering artifacts / flickering.
Some affected/tested applications:
- Gwenview (activate OpenGL in settings) [neon package]
- OBS Studio [neon package]
- ScanTailor Advanced (activate OpenGL in settings) [self-built]
- Olive Video Editor 0.1 branch [ubuntu package]
- Olive Video Editor 0.2 branch [self-built]

The enormous similarity of the issues, affecting both official builds from neon and self-built applications, makes me think that this problem may likely be caused by malconfigured Qt OpenGL(ES) packages in KDE Neon. It is rather unplausible that these problems are caused by my setup or configuration since all non-Qt OpenGL-related stuff works well.

STEPS TO REPRODUCE
1. Install or build one of the applications mentioned above (or, potentially, any application depending on libqt5gui5-gles or libqt5opengl5)
2. Open the respective application and (if necessary) activate OpenGL (there might be a need to restart)
3. Open/load an image, video, or whatever

OBSERVED RESULT
Applications using Qt OpenGL modules do not render footage/media at all, or only with extreme flickering and rendering artifacts.
-> On Wayland, you will see the application behind (or the desktop wallpaper) in the frame where the footage should be rendered
-> On X11, you will see nothing (only the background colour)

EXPECTED RESULT
Content should render at all on Qt-OpenGL(ES), and without artifacts or flickering. The stuff behind should not be visible in the content frame.

SOFTWARE/OS VERSIONS
Operating System: KDE neon 5.21
KDE Plasma Version: 5.21.0
KDE Frameworks Version: 5.79.0
Qt Version: 5.15.2
Linux Kernel Version: 5.4.0-66-generic
OS Type: 64-bit
Graphics Platform: Wayland (X11 is affected as well)
Processors: 4 × Intel® Core™ i5-3570K CPU @ 3.40GHz
Memory: 7.2 GiB of RAM
Graphics Processor: Mesa DRI Intel® HD Graphics 4000

ADDITIONAL INFORMATION
- The issue already existed in previous versions of neon (5.20)
- A possible idea is that a partial cause might be the libqt5gui5-gles package, which is not installable as it's still the Ubuntu version (but this cannot be the only reason, since Gwenview does not depend on this package, but is affected too)
- I am not certain whether this is related or not, but my self-built OpenToonz (latest stable release tarball) crashes on startup with a segmentation fault because the EGL context could not be created (only on Wayland, though; it at least comes up on X11)

DISCLAIMER
Although I believe these problems might be caused by neon packaging mistakes, I am not sure; it's nothing but an assumption. I might easily be wrong (it could even be an issue with Qt, for instance, or something hardware specific). However, I chose to report this here because the distribution seems like the first place to ask for help.

NOTES ON REPRODUCIBILITY
Information on whether other users can reproduce this issue or not would be important. Reproducibility might also depend on the hardware / drivers used.
Comment 1 geisserml 2021-02-23 12:58:37 UTC
More screenshots: https://www.magentacloud.de/share/txdrb5363v
Comment 2 David Edmundson 2021-02-25 15:06:17 UTC
These are bugs in the client apps.
Please file bugs there.

Gwenview has a bug report
OBS I fixed recently

Can you file bugs on the others and link me, so I can help them, with a common problem
Comment 3 David Edmundson 2021-02-25 15:08:09 UTC
Relevant OBS https://github.com/obsproject/obs-studio/pull/3782
Comment 4 geisserml 2021-02-25 18:39:05 UTC
Okay, then I was entirely wrong, sorry ;)
I will file bug reports with Olive and OpenToonz as soon as I have enough free time. ScanTailor Advanced is, it seems, abandoned by its developper, but I can make a report nevertheless.
Comment 5 geisserml 2021-02-25 19:37:46 UTC
I guess the Gwenview bug you meant is https://bugs.kde.org/show_bug.cgi?id=403323 ? It got addressed recently, maybe the way how it was fixed in Gwenview is also something to point at in the bug reports.
Comment 6 geisserml 2021-03-03 11:03:55 UTC
I just filed a bug report with Olive: https://github.com/olive-editor/olive/issues/1507
Comment 7 geisserml 2021-04-29 09:53:14 UTC
I filed another bug report with NodeGraphQt: https://github.com/jchanvfx/NodeGraphQt/issues/207
Comment 8 geisserml 2021-05-06 12:01:47 UTC
I think I have found the cause for Scantailor Advanced: It's the same as with Gwenview and NodeGraphQt - the deprecated QGLWidget. I ran a recursive grep across the source tree which found:
```
src/core/ImageViewBase.cpp:#include <QGLWidget>
src/core/ImageViewBase.cpp:      setViewport(new QGLWidget(format));

```
Comment 9 David Edmundson 2021-05-06 12:07:11 UTC
Please file a bug with Scantailor
Comment 10 geisserml 2021-05-06 12:35:08 UTC
I have created a simple patch for STA that appears to work for me (first time ever that I write some c++). I'm not sure what to do about this format thing. Is it still necessary for QOpenGLWidget? If so, how do you do it? I looked at QSurfaceFormat but it appears not to provide the methods used.

10c10,11
< #include <QGLWidget>
---
> // #include <QGLWidget>
> #include <QOpenGLWidget>
152,158c153,159
<       QGLFormat format;
<       format.setSampleBuffers(true);
<       format.setStencil(true);
<       format.setAlpha(true);
<       format.setRgba(true);
<       format.setDepth(false);
< 
---
>       //QGLFormat format;
>       //format.setSampleBuffers(true);
>       //format.setStencil(true);
>       //format.setAlpha(true);
>       //format.setRgba(true);
>       //format.setDepth(false);
>       
160,162c161,163
<       format.setDirectRendering(false);
< 
<       setViewport(new QGLWidget(format));
---
>       //format.setDirectRendering(false);
>         
>       setViewport(new QOpenGLWidget());
Comment 11 geisserml 2021-05-06 12:35:57 UTC
ScanTailor Advanced is unmaintained, so filing a bug is pointless, sadly. I'll upload the patch to my personal STA repository soon.
Comment 12 geisserml 2021-05-06 12:44:45 UTC
What I find really confusing, ScanTailor Experimental by the original author Joseph Artsimovich uses QGLWidget, too, but there it actually works on Wayland, and it's way faster too. Not sure why.
See https://github.com/Tulon/scantailor/blob/experimental/ImageViewBase.cpp
Comment 13 geisserml 2021-05-06 13:01:00 UTC
Oh, I just see Qt/OpenGL support behind an ifdef guard in STE:
```
#ifdef ENABLE_OPENGL
#include <QGLWidget>
#include <QGLFormat>
#endif
```
Probably I just built without it and the setting got silently ignored, that would be a good explanation.
Comment 14 geisserml 2021-05-06 13:01:14 UTC
* is behind
Comment 15 geisserml 2021-05-12 07:40:34 UTC
I've just found another app with this problem, this time from KDE again: KDiff3. This has been introduced recently (-> regression) and causes the most terrible flickering and artifacts I'd ever seen.
Also, none of the buttons to select a file work anymore. I'll file bug reports with KDiff3, unless someone else has already done so.
Comment 16 geisserml 2021-05-12 07:41:32 UTC
Created attachment 138350 [details]
kdiff3 transparency and flickering
Comment 17 geisserml 2021-08-02 11:21:36 UTC
I finally uploaded the ScanTailor Advanced patch:
https://github.com/4lex4/scantailor-advanced/pull/179/files