Skip to content

Commit

Permalink
render-manager: Don't paint when session is not active (#2484)
Browse files Browse the repository at this point in the history
This can happen when switching to another tty. A test is to run glxgears
in a drm session with xwayland, then switch to another tty and run top.
The wayfire cpu usage is 100+%. However with this patch, when the session
is inactive, the cpu usage is negligible.

One note is that patches were pushed to seatd recently which make the
session->active state reliable. At the time of this writing, seatd does
not have a release containing these patches, so for this to work reliably,
seatd git master is recommended.
  • Loading branch information
soreau authored Oct 5, 2024
1 parent d5b0d27 commit 3cbc6b4
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/output/render-manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -957,6 +957,13 @@ class wf::render_manager::impl

on_frame.set_callback([&] (void*)
{
/* If the session is not active, don't paint.
* This is the case when e.g. switching to another tty */
if (!wf::get_core().session->active)
{
return;
}

delay_manager->start_frame();

auto repaint_delay = delay_manager->get_delay();
Expand Down

0 comments on commit 3cbc6b4

Please sign in to comment.