Bug 442936 - wayland: Xwayland application contents disappearing upon changing some system settings
Summary: wayland: Xwayland application contents disappearing upon changing some system...
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: wayland-generic (show other bugs)
Version: 5.22.90
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
: 440939 (view as bug list)
Depends on:
Blocks:
 
Reported: 2021-09-25 10:03 UTC by deadite66
Modified: 2021-10-04 18:34 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.23


Attachments
screen before (1.81 MB, image/png)
2021-09-25 10:03 UTC, deadite66
Details
screen after (2.85 MB, image/png)
2021-09-25 10:04 UTC, deadite66
Details
supportInformation (6.80 KB, text/plain)
2021-09-25 10:04 UTC, deadite66
Details

Note You need to log in before you can comment on or make changes to this bug.
Description deadite66 2021-09-25 10:03:51 UTC
Created attachment 141898 [details]
screen before

SUMMARY
Under wayland and using virtual desktops some of the running applications contents are disappearing when changing compositor rendering opengl version or adding a window rule.
this happens when the program isn't on a visible virtual desktop, qt based appear programs to be unaffected.

STEPS TO REPRODUCE
1. run a program on a virtual desktop
2. change to a different desktop
3. change render backend or create window rule.
4. return to virtual desktop where program is running.

OBSERVED RESULT
only the window bar and edges are visible.

EXPECTED RESULT
to see the complete program contents.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Arch Linux kde-unstable
KDE Plasma Version: 5.22.90
KDE Frameworks Version: 5.15.2
Qt Version: 5.15.2
Comment 1 deadite66 2021-09-25 10:04:17 UTC
Created attachment 141899 [details]
screen after
Comment 2 deadite66 2021-09-25 10:04:59 UTC
Created attachment 141900 [details]
supportInformation
Comment 3 Vlad Zahorodnii 2021-09-29 07:06:43 UTC
Cannot reproduce the issue. Can you please attach the session log to the bug report? The session log can be found in ~/.local/share/sddm/wayland-session.log, before uploading it, make sure that it contains no sensitive information.
Comment 4 Vlad Zahorodnii 2021-09-29 07:09:09 UTC
Nvm, I can reproduce it on my laptop running beta.
Comment 5 Bug Janitor Service 2021-09-29 08:45:52 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/1475
Comment 6 Bug Janitor Service 2021-09-29 08:45:53 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/1475
Comment 7 Vlad Zahorodnii 2021-10-04 05:57:02 UTC
Git commit 52c9dbb487f4ac98017b83a1deee912546cbff5f by Vlad Zahorodnii.
Committed on 04/10/2021 at 05:56.
Pushed by vladz into branch 'master'.

wayland: Reset Toplevel::surfaceId after surface is created

Xwayland will re-create the wl_surface object if the X11 window is
unmapped and mapped. That, and the fact that the order in which the
WL_SURFACE_ID client message event is received and the wl_surface object
is created is undefined can cause the following bug:

* WL_SURFACE_ID is received
* the old wl_surface object is destroyed, m_surfaceId is reset to 0
* new wl_surface is created but because m_surfaceId is 0, it won't be
  associated with the x11 window

This change ensures that kwin will associate the wl_surface with x11
window by making it not reset cached surface id when the old wl_surface
is destroyed.

However, we cannot leave m_surfaceId as is because wayland aggressively
re-uses object ids so kwin can associate wrong surface with x11 window.

To prevent that, this change also makes Toplevel::setSurface() reset
cached surface id.
Related: bug 426069

M  +2    -3    src/events.cpp
M  +1    -2    src/toplevel.cpp
M  +4    -15   src/toplevel.h
M  +2    -2    src/wayland_server.cpp

https://invent.kde.org/plasma/kwin/commit/52c9dbb487f4ac98017b83a1deee912546cbff5f
Comment 8 Vlad Zahorodnii 2021-10-04 05:57:10 UTC
Git commit 8ac93a59ffb1a09bf6df46c7012bea7910e6b883 by Vlad Zahorodnii.
Committed on 04/10/2021 at 05:56.
Pushed by vladz into branch 'master'.

scene: Handle Xwayland windows changing surfaces

Xwayland can re-create the wl_surface if the window has been previously
unmapped.
Related: bug 426069

M  +23   -19   src/windowitem.cpp

https://invent.kde.org/plasma/kwin/commit/8ac93a59ffb1a09bf6df46c7012bea7910e6b883
Comment 9 Vlad Zahorodnii 2021-10-04 05:57:34 UTC
Git commit a75559c39081c80c7e31e9c7324b17e7a4efb3f1 by Vlad Zahorodnii.
Committed on 04/10/2021 at 05:57.
Pushed by vladz into branch 'Plasma/5.23'.

wayland: Reset Toplevel::surfaceId after surface is created

Xwayland will re-create the wl_surface object if the X11 window is
unmapped and mapped. That, and the fact that the order in which the
WL_SURFACE_ID client message event is received and the wl_surface object
is created is undefined can cause the following bug:

* WL_SURFACE_ID is received
* the old wl_surface object is destroyed, m_surfaceId is reset to 0
* new wl_surface is created but because m_surfaceId is 0, it won't be
  associated with the x11 window

This change ensures that kwin will associate the wl_surface with x11
window by making it not reset cached surface id when the old wl_surface
is destroyed.

However, we cannot leave m_surfaceId as is because wayland aggressively
re-uses object ids so kwin can associate wrong surface with x11 window.

To prevent that, this change also makes Toplevel::setSurface() reset
cached surface id.
Related: bug 426069


(cherry picked from commit 52c9dbb487f4ac98017b83a1deee912546cbff5f)

M  +2    -3    src/events.cpp
M  +1    -2    src/toplevel.cpp
M  +4    -15   src/toplevel.h
M  +2    -2    src/wayland_server.cpp

https://invent.kde.org/plasma/kwin/commit/a75559c39081c80c7e31e9c7324b17e7a4efb3f1
Comment 10 Vlad Zahorodnii 2021-10-04 05:58:28 UTC
Git commit 626b5b4c0d30b0bd040f8fc1da582a6c782cf5a9 by Vlad Zahorodnii.
Committed on 04/10/2021 at 05:58.
Pushed by vladz into branch 'Plasma/5.23'.

scene: Handle Xwayland windows changing surfaces

Xwayland can re-create the wl_surface if the window has been previously
unmapped.
Related: bug 426069


(cherry picked from commit 8ac93a59ffb1a09bf6df46c7012bea7910e6b883)

M  +23   -19   src/windowitem.cpp

https://invent.kde.org/plasma/kwin/commit/626b5b4c0d30b0bd040f8fc1da582a6c782cf5a9
Comment 11 Vlad Zahorodnii 2021-10-04 15:02:17 UTC
*** Bug 440939 has been marked as a duplicate of this bug. ***