Bug 466238 - Exiting full screen video playback with on a multi-monitor setup causes a freeze
Summary: Exiting full screen video playback with on a multi-monitor setup causes a freeze
Status: RESOLVED WORKSFORME
Alias: None
Product: kwin
Classification: Plasma
Component: wayland-generic (show other bugs)
Version: 5.27.1
Platform: Arch Linux Linux
: NOR crash
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-02-22 11:28 UTC by Rune
Modified: 2023-06-01 12:27 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Output of journalctl --user-unit plasma-kwin_wayland --boot 0 (14.93 KB, text/plain)
2023-03-06 13:02 UTC, Rune
Details
Output of drm_info on the desktop (100.35 KB, text/plain)
2023-03-06 18:57 UTC, Rune
Details
Output of drm_info during playback (100.35 KB, text/plain)
2023-03-06 18:58 UTC, Rune
Details
Output of drm_info after trying to exit fullscreen playback (100.36 KB, text/plain)
2023-03-06 18:58 UTC, Rune
Details
Output of drm_info around 20 seconds later (100.36 KB, text/plain)
2023-03-06 18:58 UTC, Rune
Details
DRM log (804.80 KB, application/gzip)
2023-03-09 13:57 UTC, Rune
Details
Recording of the artifacts (3.29 MB, video/mp4)
2023-05-08 21:26 UTC, Rune
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Rune 2023-02-22 11:28:45 UTC
SUMMARY

Having multiple screens with different scaling factors in the plasma wayland session makes it impossible to exit fullscreen video playback. The screen that played back the video becomes unusable, the second screen works fine. Graphical glitches can be observed on the primary screen when trying to exit the full screen playback.


STEPS TO REPRODUCE
1. Set different scaling factors on two monitors.
2. Start playing back video in full screen mode (tried firefox (Youtube, Netflix) as well as VLC (local file).
3. Try exiting the playback.

OBSERVED RESULT

The screen becomes unresponsive and shows graphical artifacts.

EXPECTED RESULT

The video playback can be exited normally.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Arch Linux 6.1.12-arch
(available in About System)
KDE Plasma Version: 5.27.1
KDE Frameworks Version: 5.103.0
Qt Version: 5.15.8

ADDITIONAL INFORMATION

AMD GPU with open source drivers, though proprietary OpenGL driver is installed. Hardware acceleration is enabled.
Comment 1 Rune 2023-02-22 13:07:47 UTC
(In reply to Rune from comment #0)
> SUMMARY
> 
> Having multiple screens with different scaling factors in the plasma wayland
> session makes it impossible to exit fullscreen video playback. The screen
> that played back the video becomes unusable, the second screen works fine.
> Graphical glitches can be observed on the primary screen when trying to exit
> the full screen playback.
> 
> 
> STEPS TO REPRODUCE
> 1. Set different scaling factors on two monitors.
> 2. Start playing back video in full screen mode (tried firefox (Youtube,
> Netflix) as well as VLC (local file).
> 3. Try exiting the playback.
> 
> OBSERVED RESULT
> 
> The screen becomes unresponsive and shows graphical artifacts.
> 
> EXPECTED RESULT
> 
> The video playback can be exited normally.
> 
> SOFTWARE/OS VERSIONS
> Linux/KDE Plasma: Arch Linux 6.1.12-arch
> (available in About System)
> KDE Plasma Version: 5.27.1
> KDE Frameworks Version: 5.103.0
> Qt Version: 5.15.8
> 
> ADDITIONAL INFORMATION
> 
> AMD GPU with open source drivers, though proprietary OpenGL driver is
> installed. Hardware acceleration is enabled.

The graphical glitches also occur with non-mixed scaling factors. It is possible to exit fullscreen though. Graphical artifafcts on newly drawn elements persist until reboot.
Comment 2 Nate Graham 2023-02-22 17:59:10 UTC
What scale factors are you using on each screen?
Comment 3 Rune 2023-02-22 18:01:08 UTC
(In reply to Nate Graham from comment #2)
> What scale factors are you using on each screen?

1.5 on my primary and 1 on my secondary.
Comment 4 Nate Graham 2023-02-22 21:23:39 UTC
Tried to reproduce this with 1.5x scale on my primary laptop screen and 1x scale on my secondary HDMI screen on Wayland. No issues when exiting a full-screen video in Firefox+YouTube or a local video played with either VLC or DragonPlayer when the player is on either screen.

Likely related to GPU drivers, as you're using AMD while I have an Intel iGPU. I'll let the KWin devs take it from here.
Comment 5 Rune 2023-02-23 06:34:39 UTC
(In reply to Rune from comment #0)
> SUMMARY
> 
> Having multiple screens with different scaling factors in the plasma wayland
> session makes it impossible to exit fullscreen video playback. The screen
> that played back the video becomes unusable, the second screen works fine.
> Graphical glitches can be observed on the primary screen when trying to exit
> the full screen playback.
> 
> 
> STEPS TO REPRODUCE
> 1. Set different scaling factors on two monitors.
> 2. Start playing back video in full screen mode (tried firefox (Youtube,
> Netflix) as well as VLC (local file).
> 3. Try exiting the playback.
> 
> OBSERVED RESULT
> 
> The screen becomes unresponsive and shows graphical artifacts.
> 
> EXPECTED RESULT
> 
> The video playback can be exited normally.
> 
> SOFTWARE/OS VERSIONS
> Linux/KDE Plasma: Arch Linux 6.1.12-arch
> (available in About System)
> KDE Plasma Version: 5.27.1
> KDE Frameworks Version: 5.103.0
> Qt Version: 5.15.8
> 
> ADDITIONAL INFORMATION
> 
> AMD GPU with open source drivers, though proprietary OpenGL driver is
> installed. Hardware acceleration is enabled.

More info: Even without mixed scaling factors, being unable to exit fullscreen is a problem. Wether it occurs or not seems to be linked to the time spent in fullscreen mode,
It also does only happen with video playback, not when playing e.g. video games in full screen.
Comment 6 Rune 2023-02-23 06:48:48 UTC
(In reply to Rune from comment #5)
> (In reply to Rune from comment #0)
> > SUMMARY
> > 
> > Having multiple screens with different scaling factors in the plasma wayland
> > session makes it impossible to exit fullscreen video playback. The screen
> > that played back the video becomes unusable, the second screen works fine.
> > Graphical glitches can be observed on the primary screen when trying to exit
> > the full screen playback.
> > 
> > 
> > STEPS TO REPRODUCE
> > 1. Set different scaling factors on two monitors.
> > 2. Start playing back video in full screen mode (tried firefox (Youtube,
> > Netflix) as well as VLC (local file).
> > 3. Try exiting the playback.
> > 
> > OBSERVED RESULT
> > 
> > The screen becomes unresponsive and shows graphical artifacts.
> > 
> > EXPECTED RESULT
> > 
> > The video playback can be exited normally.
> > 
> > SOFTWARE/OS VERSIONS
> > Linux/KDE Plasma: Arch Linux 6.1.12-arch
> > (available in About System)
> > KDE Plasma Version: 5.27.1
> > KDE Frameworks Version: 5.103.0
> > Qt Version: 5.15.8
> > 
> > ADDITIONAL INFORMATION
> > 
> > AMD GPU with open source drivers, though proprietary OpenGL driver is
> > installed. Hardware acceleration is enabled.
> 
> More info: Even without mixed scaling factors, being unable to exit
> fullscreen is a problem. Wether it occurs or not seems to be linked to the
> time spent in fullscreen mode,
> It also does only happen with video playback, not when playing e.g. video
> games in full screen.

Uninstalling the amdgpu-pro-oglp package (Proprietary AMD OpenGL driver) did not help.
Comment 7 Rune 2023-03-06 10:19:17 UTC
I have to add: the HDMI monitor (secondary) has a different refresh rate (66Hz) than the primary one (60Hz).
Comment 8 Zamundaaa 2023-03-06 12:39:24 UTC
Please attach the output of
> journalctl --user-unit plasma-kwin_wayland --boot 0
after making the bug happen again
Comment 9 Rune 2023-03-06 13:02:01 UTC
(In reply to Zamundaaa from comment #8)
> Please attach the output of
> > journalctl --user-unit plasma-kwin_wayland --boot 0
> after making the bug happen again

Output attached.
Comment 10 Rune 2023-03-06 13:02:31 UTC
Created attachment 157039 [details]
Output of journalctl --user-unit plasma-kwin_wayland --boot 0
Comment 11 Zamundaaa 2023-03-06 13:49:10 UTC
That's odd, there's not even a single relevant warning in that log. To narrow down where to go from here, please attach the output of drm_info (https://gitlab.freedesktop.org/emersion/drm_info)
- once before you play the video, just on the desktop
- once while you play the video in fullscreen
- twice after you try exiting fullscreen, with at least a few seconds in between

Also, if you drag another window on top of the fullscreen video instead of exiting fullscreen, does that also cause the problem?
Comment 12 Nate Graham 2023-03-06 15:22:24 UTC
(In reply to Rune from comment #7)
> I have to add: the HDMI monitor (secondary) has a different refresh rate
> (66Hz) than the primary one (60Hz).
Hmm, maybe it's Bug 465712?
Comment 13 Rune 2023-03-06 18:46:27 UTC
(In reply to Nate Graham from comment #12)
> (In reply to Rune from comment #7)
> > I have to add: the HDMI monitor (secondary) has a different refresh rate
> > (66Hz) than the primary one (60Hz).
> Hmm, maybe it's Bug 465712?

No, I only see these glitches when I exit fullscreen video playback.
Comment 14 Rune 2023-03-06 18:57:40 UTC
Created attachment 157056 [details]
Output of drm_info on the desktop
Comment 15 Rune 2023-03-06 18:58:01 UTC
Created attachment 157057 [details]
Output of drm_info during playback
Comment 16 Rune 2023-03-06 18:58:32 UTC
Created attachment 157058 [details]
Output of drm_info after trying to exit fullscreen playback
Comment 17 Rune 2023-03-06 18:58:59 UTC
Created attachment 157059 [details]
Output of drm_info around 20 seconds later
Comment 18 Rune 2023-03-06 19:02:39 UTC
(In reply to Zamundaaa from comment #11)
> That's odd, there's not even a single relevant warning in that log. To
> narrow down where to go from here, please attach the output of drm_info
> (https://gitlab.freedesktop.org/emersion/drm_info)
> - once before you play the video, just on the desktop
> - once while you play the video in fullscreen
> - twice after you try exiting fullscreen, with at least a few seconds in
> between
> 
> Also, if you drag another window on top of the fullscreen video instead of
> exiting fullscreen, does that also cause the problem?

I attached the requested logs.

If I drag a window on top of the video, the behaviour is about the same as when trying to exit fullscreen: artifacts and the screen becomes unresponsive. The window never shows up, it is dragged "behind" the video.
Comment 19 Zamundaaa 2023-03-08 22:29:11 UTC
This seems to be caused by direct scanout, which you can disable by putting
> KWIN_DRM_NO_DIRECT_SCANOUT=1
into /etc/environment and rebooting. If you do that, does the hang still happen?
Comment 20 Rune 2023-03-08 23:17:18 UTC
(In reply to Zamundaaa from comment #19)
> This seems to be caused by direct scanout, which you can disable by putting
> > KWIN_DRM_NO_DIRECT_SCANOUT=1
> into /etc/environment and rebooting. If you do that, does the hang still
> happen?

Yes, that fixes the issue!
Comment 21 Zamundaaa 2023-03-08 23:30:22 UTC
good, that narrows it down a lot. To narrow it down further, could you remove that again and test with
> KWIN_DRM_PREFER_COLOR_DEPTH=24
and
> KWIN_DRM_USE_MODIFIERS=0
(one at a time only) instead?
Comment 22 Rune 2023-03-09 12:02:23 UTC
(In reply to Zamundaaa from comment #21)
> good, that narrows it down a lot. To narrow it down further, could you
> remove that again and test with
> > KWIN_DRM_PREFER_COLOR_DEPTH=24
> and
> > KWIN_DRM_USE_MODIFIERS=0
> (one at a time only) instead?

Neither one of those helped.
Comment 23 Zamundaaa 2023-03-09 13:32:34 UTC
Okay, so the problem could be in either KWin or the driver.
Can you remove all the environment variables again, enable drm logging and record the dmesg output while reproducing the bug again? For details on how to do that, see https://invent.kde.org/plasma/kwin/-/wikis/Debugging-DRM-issues
Comment 24 Rune 2023-03-09 13:57:38 UTC
Created attachment 157144 [details]
DRM log
Comment 25 Rune 2023-05-01 07:59:20 UTC
I think this is the same problem, so I am adding to this thread. I have been using the wayland session with KWIN_DRM_NO_DIRECT_SCANOUT=1 since it provided a workaround. Lately (maybe since updating to 5.27.4?), I have been getting screen artifacts in full screen applications, including games, so this is not limited to video playback. Note that this happens pretty irregularily, mostly after a long time of using the fullscreen application, but sometimes directly after starting it. When the flickering artifacts appear, the framerate also becomes very very low.
Comment 26 Rune 2023-05-01 08:00:06 UTC
I think this is the same problem, so I am adding to this thread. I have been using the wayland session with KWIN_DRM_NO_DIRECT_SCANOUT=1 since it provided a workaround. Lately (maybe since updating to 5.27.4?), I have been getting screen artifacts in full screen applications, including games, so this is not limited to video playback. Note that this happens pretty irregularily, mostly after a long time of using the fullscreen application, but sometimes directly after starting it. When the flickering artifacts appear, the framerate also becomes very very low.
Comment 27 Zamundaaa 2023-05-02 16:23:15 UTC
Do you ever get artifacts with an app in windowed mode?
Comment 28 Rune 2023-05-02 17:59:29 UTC
(In reply to Zamundaaa from comment #27)
> Do you ever get artifacts with an app in windowed mode?

No, never.
Comment 29 Zamundaaa 2023-05-03 11:42:24 UTC
Do you know if this has happened with native Wayland apps, or only with Xwayland?
Comment 30 Rune 2023-05-03 14:23:49 UTC
(In reply to Zamundaaa from comment #29)
> Do you know if this has happened with native Wayland apps, or only with
> Xwayland?

This has happened in both - Xwayland (wine game) and Firefox (wayland enabled)
Comment 31 Zamundaaa 2023-05-03 14:29:35 UTC
Can you describe the flicker in more detail? With KWIN_DRM_NO_DIRECT_SCANOUT=1 set, there should be no difference for native Wayland apps vs windowed, at least on the KWin and driver side.
Comment 32 Rune 2023-05-03 19:35:59 UTC
(In reply to Zamundaaa from comment #31)
> Can you describe the flicker in more detail? With
> KWIN_DRM_NO_DIRECT_SCANOUT=1 set, there should be no difference for native
> Wayland apps vs windowed, at least on the KWin and driver side.

The "flickering" starts at the upper edge of the screen, it is a multi-colored bar (whole width of the screen) that flickers and sometimes travels down the screen while flickering.
Comment 33 Zamundaaa 2023-05-03 21:52:11 UTC
ok, that sounds like a driver bug then. Are you using adaptive sync? If so, does disabling that change anything?
Comment 34 Rune 2023-05-04 15:16:15 UTC
(In reply to Zamundaaa from comment #33)
> ok, that sounds like a driver bug then. Are you using adaptive sync? If so,
> does disabling that change anything?

It was set to automatic, I now have it set to never. For video playback, without the NP_DIRECT_SCANOUT line, exiting full screen still causes the screen to become unresponsive. I will watch if the flickering issue happens again, as it is kind of rare.
Comment 35 Rune 2023-05-08 21:08:31 UTC
(In reply to Rune from comment #34)
> (In reply to Zamundaaa from comment #33)
> > ok, that sounds like a driver bug then. Are you using adaptive sync? If so,
> > does disabling that change anything?
> 
> It was set to automatic, I now have it set to never. For video playback,
> without the NP_DIRECT_SCANOUT line, exiting full screen still causes the
> screen to become unresponsive. I will watch if the flickering issue happens
> again, as it is kind of rare.

Okay, the artifacting happened again today while playing back video even though adaptive sync is set to never.
Comment 36 Rune 2023-05-08 21:26:59 UTC
Created attachment 158785 [details]
Recording of the artifacts
Comment 37 Zamundaaa 2023-05-09 08:15:31 UTC
I've seen glitches similar to that before, they were caused by sort of broken hardware acceleration. Can you check if playing a video without hardware acceleration triggers the glitches and/or the freeze?
Comment 38 Rune 2023-05-10 09:03:38 UTC
It seems like the issue with exiting fullscreen video playback has been fixed in 5.27.5. I can't comment on the flickering issue yet.
Comment 39 Rune 2023-05-10 20:38:50 UTC
(In reply to Rune from comment #38)
> It seems like the issue with exiting fullscreen video playback has been
> fixed in 5.27.5. I can't comment on the flickering issue yet.

It is not fixed completely. It just does not happen every time anymore.
Comment 40 Rune 2023-05-21 21:09:18 UTC
The flickering issue still randomly appears.
Comment 41 Vlad Zahorodnii 2023-06-01 12:13:48 UTC
Given comment 38, the original issue has been fixed so this bug report can be closed. Please open a new bug report for the flickering issue.
Comment 42 Rune 2023-06-01 12:27:42 UTC
(In reply to Vlad Zahorodnii from comment #41)
> Given comment 38, the original issue has been fixed so this bug report can
> be closed. Please open a new bug report for the flickering issue.

As stated in comment 39, this is not the case. The original issue still exists, it just takes a little bit of time in fullscreen before it happens.