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

Reduce monitor rendering #85

Closed
MilesBreslin opened this issue Jan 14, 2021 · 0 comments · Fixed by #204
Closed

Reduce monitor rendering #85

MilesBreslin opened this issue Jan 14, 2021 · 0 comments · Fixed by #204

Comments

@MilesBreslin
Copy link

DWL appears to be redrawing the framebuffer on every refresh. On my test NixOS VM running under libvirt with a default configuration, each of the 8 cores has ~65% CPU usage. With this patch applied, the CPU usage goes to near 0 when there are no clients.

diff --git a/dwl.c b/dwl.c
index c09f598..bb1315a 100644
--- a/dwl.c
+++ b/dwl.c
@@ -1759,7 +1759,7 @@ void
 rendermon(struct wl_listener *listener, void *data)
 {
 	Client *c;
-	int render = 1;
+	int render = 0;

 	/* This function is called every time an output is ready to display a frame,
 	 * generally at the output's refresh rate (e.g. 60Hz). */
@@ -1770,6 +1770,7 @@ rendermon(struct wl_listener *listener, void *data)

 	/* Do not render if any XDG clients have an outstanding resize. */
 	wl_list_for_each(c, &stack, slink) {
+		render = 1;
 		if (c->resize) {
 			wlr_surface_send_frame_done(client_surface(c), &now);
 			render = 0;

This is not a pull request, just a test case to demonstrate the issue. This very quick and dirty patch disables drawing unless there is a client.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant