Skip to content
This repository has been archived by the owner on Jan 26, 2024. It is now read-only.

Apps on Unfocused Monitors Occasionally Freeze Until Given Focus Again #353

Closed
BenJarg opened this issue Dec 9, 2022 · 14 comments
Closed
Labels
A: bug Something isn't working

Comments

@BenJarg
Copy link
Contributor

BenJarg commented Dec 9, 2022

Info

dwl version: c60f651
wlroots version: 0.16

Description

Currently on the main branch, but have seen this since I've been on wlroots 0.16. For example, videos playing on an unfocused monitor will suddenly freeze on one frame with the audio continuing like normal. The video will continue when I focus that monitor again. I have also seen this happen for a bar on an external monitor, i.e. the output of yambar will freeze until I focus the monitor its on again.

If I put a video and a terminal side by side on the external monitor, and the video freezes, and then send some output to that terminal from a terminal on the main monitor, the output will show and then video then continues, so it seems like it affects only some cases of updating. This freezing also seems to sometimes be triggered by activity on the main monitor, such as launching a certain application, but not always.

This seems more likely to be a wlroots issue. Could be related to #256.

@BenJarg BenJarg added the A: bug Something isn't working label Dec 9, 2022
@sevz17
Copy link
Collaborator

sevz17 commented Dec 10, 2022

Can you try #350?

@BenJarg
Copy link
Contributor Author

BenJarg commented Dec 10, 2022

@sevz17 I already have and it doesn't fix it unfortunately

@sevz17
Copy link
Collaborator

sevz17 commented Dec 10, 2022

Can you play the video with WAYLAND_DEBUG=1 env var, and send me the output of it?

@BenJarg
Copy link
Contributor Author

BenJarg commented Dec 10, 2022

@sevz17 Sure, this is playing a video on YouTube through Firefox. There's a constant stream output in the log as the video plays, then when the video freezes, the log hangs too. This is a chunk up to the freeze:

[3432015.203] [email protected]()
[3432015.228] [email protected](21434)
[3432016.730]  -> [email protected](wl_buffer@87, 0, 0)
[3432016.743]  -> [email protected]_buffer(0, 0, 1536, 1173)
[3432016.791]  -> [email protected]()
[3432016.796]  -> [email protected](new id wl_callback@57)
[3432017.028] [email protected]_id(57)
[3432029.347] [email protected]_id(64)
[3432029.380] [email protected](21079933)
[3432029.394]  -> [email protected](new id wl_callback@64)
[3432029.404]  -> [email protected]()
[3432031.940] [email protected]()
[3432031.960] [email protected](21434)
[3432033.305]  -> [email protected](wl_buffer@54, 0, 0)
[3432033.318]  -> [email protected]_buffer(0, 0, 1536, 1173)
[3432033.372]  -> [email protected]()
[3432033.376]  -> [email protected](new id wl_callback@57)
[3432033.653] [email protected]_id(57)
[3432045.552] [email protected]_id(64)
[3432045.564] [email protected](21079949)
[3432045.570]  -> [email protected](new id wl_callback@64)
[3432045.574]  -> [email protected]()
[3432046.537] [email protected]()
[3432046.545] [email protected](21434)
[3432047.385]  -> [email protected](wl_buffer@87, 0, 0)
[3432047.392]  -> [email protected]_buffer(0, 0, 1536, 1173)
[3432047.424]  -> [email protected]()
[3432047.426]  -> [email protected](new id wl_callback@57)
[3432047.635] [email protected]_id(57)
[3432062.285] [email protected]_id(64)
[3432062.297] [email protected](21079966)
[3432062.302]  -> [email protected](new id wl_callback@64)
[3432062.305]  -> [email protected]()
[3432063.439] [email protected]()
[3432063.454] [email protected](21434)
[3432064.094]  -> [email protected](wl_buffer@54, 0, 0)
[3432064.099]  -> [email protected]_buffer(0, 0, 1536, 1173)
[3432064.130]  -> [email protected]()
[3432064.132]  -> [email protected](new id wl_callback@57)
[3432064.353] [email protected]_id(57)
[3433984.415]  -> [email protected]()

The log stops there until I refocus the monitor and the video resumes.

@sevz17
Copy link
Collaborator

sevz17 commented Dec 10, 2022

Can you try this (apply it on main branch)?

diff --git a/dwl.c b/dwl.c
index 2f7f2bf..f8fa7d4 100644
--- a/dwl.c
+++ b/dwl.c
@@ -768,6 +768,9 @@ commitnotify(struct wl_listener *listener, void *data)
 			|| (c->surface.xdg->current.geometry.width == c->surface.xdg->pending.geometry.width
 			&& c->surface.xdg->current.geometry.height == c->surface.xdg->pending.geometry.height)))
 		c->resize = 0;
+
+	if (VISIBLEON(c, c->mon))
+		wlr_output_schedule_frame(c->mon->wlr_output);
 }
 
 void

@BenJarg
Copy link
Contributor Author

BenJarg commented Dec 10, 2022

@sevz17 Still froze after giving it a few minutes with that patch

@sevz17
Copy link
Collaborator

sevz17 commented Dec 12, 2022

@BenJarg can you apply this?

diff --git a/dwl.c b/dwl.c
index 2f7f2bf..5876761 100644
--- a/dwl.c
+++ b/dwl.c
@@ -1830,6 +1830,7 @@ rendermon(struct wl_listener *listener, void *data)
 
 	clock_gettime(CLOCK_MONOTONIC, &now);
 
+#if 0
 	/* Render if no XDG clients have an outstanding resize and are visible on
 	 * this monitor. */
 	/* Checking m->un_map for every client is not optimal but works */
@@ -1844,6 +1845,7 @@ rendermon(struct wl_listener *listener, void *data)
 			skip = 1;
 		}
 	}
+#endif
 	if (!skip && !wlr_scene_output_commit(m->scene_output))
 		return;
 	/* Let clients know a frame has been rendered */

@BenJarg
Copy link
Contributor Author

BenJarg commented Dec 12, 2022

@sevz17 I'll be away from a monitor to test with while traveling for a few weeks, so I may not be able to test this for a little while.

@BenJarg
Copy link
Contributor Author

BenJarg commented Jan 5, 2023

@sevz17 I'm now able to debug this again. I'm still seeing this on the current main and wlroots 0.16.1. The body of rendermon() has changed a lot so that patch won't apply. Anything else you'd like to try now?

@BenJarg
Copy link
Contributor Author

BenJarg commented Jan 20, 2023

As an update, this has nearly stopped altogether for me after no changes to dwl. I believe this likely wasn't an issue with dwl but likely a bug in my integrated graphics for a newer intel processor. I will keep an eye on it just in case.

@Kuchteq
Copy link

Kuchteq commented May 4, 2023

I can tell that the bug is still present. Most often it occurs to me on Firefox when I type something in a field and it doesn't appear till I switch focus (to basically any window using either mouse or using keybindings). When using neovim in the foot terminal I can also notice it, however, less frequently. I was trying to capture it but the bug seems to live its own life and is afraid cameras so once I get it to appear again I'll post some more findings.

@sevz17
Copy link
Collaborator

sevz17 commented May 26, 2023

Maybe #423 fixes this.

@BenJarg
Copy link
Contributor Author

BenJarg commented May 27, 2023

I'll give it a try, and report back after a few days if I see it happen again or not

@BenJarg
Copy link
Contributor Author

BenJarg commented Jun 1, 2023

@sevz17 I've been using #423 with my two monitor setup for a few days now, doing the things where I would normally expect to see this issue occasionally, like watching a video on the second monitor, and haven't see this happen once, so I think #423 may be the fix.

sevz17 added a commit to sevz17/dwl that referenced this issue Jun 3, 2023
@sevz17 sevz17 closed this as completed in 3d98907 Jun 3, 2023
youbitchoc pushed a commit to youbitchoc/dwl that referenced this issue Jun 29, 2023
youbitchoc pushed a commit to youbitchoc/dwl that referenced this issue Jun 29, 2023
mobygit pushed a commit to mobygit/dwl that referenced this issue Oct 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants