Bug 445631

Summary: GStreamer with waylandsink: No video shown when rendered to child widget in Plasma Wayland session (works in Weston)
Product: [Plasma] kwin Reporter: Michael Weghorn <m.weghorn>
Component: wayland-genericAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED UPSTREAM    
Severity: normal CC: m.weghorn, nate
Priority: NOR    
Version: 5.23.3   
Target Milestone: ---   
Platform: Debian testing   
OS: Linux   
URL: https://bugreports.qt.io/browse/QTBUG-86229
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Sample program to reproduce the issue
Screencast demonstrating the issue

Description Michael Weghorn 2021-11-17 09:20:14 UTC
Created attachment 143652 [details]
Sample program to reproduce the issue

SUMMARY

When using GStreamer's "waylandsink" to play a video, the video does not show if rendered to a widget that is a child widget when run in a KDE Plasma Wayland session using KWin as Wayland compositor. It works fine when using a nested Weston instead.


STEPS TO REPRODUCE
1. make sure that gstreamer-plugins-bad and the GStreamer headers are installed
2. download and extract attached sample program
3. build the program using Qt6 (the program is more broken when using Qt 5; note: include paths might have to be adapted in the .pro file):
   .../path/to/qt6/qmake
   make
4. run the sample program
    ./waylandsink
5. look at the program's window.

OBSERVED RESULT

The window content is blank, no video is shown.

EXPECTED RESULT

The GStreamer test video should show up, as is e.g. the case when running the sample program in Weston (screencast will be attached.)

SOFTWARE/OS VERSIONS
Operating System: Debian GNU/Linux
KDE Plasma Version: 5.23.3
KDE Frameworks Version: 5.86.0
Qt Version: 5.15.2
Kernel Version: 5.14.0-4-amd64 (64-bit)
Graphics Platform: Wayland
Processors: 12 × Intel® Core™ i7-9850H CPU @ 2.60GHz
Memory: 62.4 GiB of RAM
Graphics Processor: Mesa Intel® UHD Graphics 630

ADDITIONAL INFORMATION

* This still happens with the fix for bug 445346 in place.
* The sample program "doesn't work at all" when compiled against Qt 5 instead of Qt 6, no window shows up at all.
* I've used a self-compiled qtbase (as of commit 6652bf2353) and qtwayland (as of  6a7b8402) from the Qt 6 "dev" branch.
* The video is shown just fine when the widget that the video is rendered to does not have a parent widget (s. commented out code in main.cpp in the sample project).
* sample program is based on https://github.com/woutervanh/qt-waylandsink-demo
* original/actual use case is making video rendering in LibreOffice Impress work for the qt6 integration when run on Wayland
Comment 1 Michael Weghorn 2021-11-17 09:20:49 UTC
Created attachment 143653 [details]
Screencast demonstrating the issue
Comment 2 Vlad Zahorodnii 2022-01-19 14:20:38 UTC
    // child widget with video is NOT shown in Plasma Wayland session, but is shown in Weston
    parentWidget->show();

videoWidget is not shown. kwin strictly follows the wayland spec regarding what subsurfaces should be considered mapped. 

> A sub-surface becomes mapped, when a non-NULL wl_buffer is applied and the parent surface is mapped. The order of which one happens first is irrelevant. A sub-surface is hidden if the parent becomes hidden, or if a NULL wl_buffer is applied. These rules apply recursively through the tree of surfaces.

videoWidget has no buffer, so the subsurface created by gstreamer will be hidden. weston doesn't enforce visibility checks recursively so the overlay is visible even though it shouldn't be.

Whether it's a Qt bug is up to debate though.