mirror of
https://github.com/labwc/labwc.git
synced 2025-11-02 09:01:47 -05:00
magnifier: fix high CPU usage even with magnifier disabled
Fixes the high CPU usage issue reported by @droc12345. Changing `last_mag != is_magnify_on()` to `last_mag == is_magnify_on()` works fine, but this check isn't needed in the first place because magnifier state changes call `wlr_output_schedule_frame()`, which sets `wlr_output->needs_frame`. Also added a FIXME comment regarding the performance issue when the magnifier is enabled.
This commit is contained in:
parent
c1646ef2ea
commit
48742163fd
1 changed files with 7 additions and 5 deletions
|
|
@ -47,16 +47,18 @@ lab_wlr_scene_output_commit(struct wlr_scene_output *scene_output)
|
|||
struct wlr_output_state *state = &wlr_output->pending;
|
||||
struct output *output = wlr_output->data;
|
||||
bool wants_magnification = output_wants_magnification(output);
|
||||
static bool last_mag = false;
|
||||
|
||||
/*
|
||||
* FIXME: Regardless of wants_magnification, we are currently adding
|
||||
* damages to next frame when magnifier is shown, which forces
|
||||
* rendering on every output commit and overloads CPU.
|
||||
* We also need to verify the necessity of wants_magnification.
|
||||
*/
|
||||
if (!wlr_output->needs_frame && !pixman_region32_not_empty(
|
||||
&scene_output->damage_ring.current) && !wants_magnification
|
||||
&& last_mag != is_magnify_on()) {
|
||||
&scene_output->damage_ring.current) && !wants_magnification) {
|
||||
return false;
|
||||
}
|
||||
|
||||
last_mag = is_magnify_on();
|
||||
|
||||
if (!wlr_scene_output_build_state(scene_output, state, NULL)) {
|
||||
wlr_log(WLR_ERROR, "Failed to build output state for %s",
|
||||
wlr_output->name);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue