Adopt wlr_box_intersects where useful

This makes wlr_scene_node_at roughly 50% faster, and gives a minor boost
to node modification as well.

Before:

create test tree:               7030 nodes, 473.510 s, 15 nodes/ms
wlr_scene_node_at:              10000 iters, 894.945 s, 78552 nodes/ms (hits: 10/10000)
wlr_scene_node_for_each_buffer: 10000 iters, 330.597 s, 212646 nodes/ms (hits: 0/10000)

After:

create test tree:               7030 nodes, 385.930 s, 18 nodes/ms
wlr_scene_node_at:              10000 iters, 586.013 s, 119963 nodes/ms (hits: 10/10000)
wlr_scene_node_for_each_buffer: 10000 iters, 334.559 s, 210127 nodes/ms (hits: 0/10000)
This commit is contained in:
Kenny Levinsen 2026-02-26 16:50:16 +01:00 committed by Simon Ser
parent 2938c10cd3
commit 7ccef7d9eb
4 changed files with 6 additions and 10 deletions

View file

@ -159,9 +159,8 @@ static void output_cursor_update_visible(struct wlr_output_cursor *cursor) {
struct wlr_box cursor_box;
output_cursor_get_box(cursor, &cursor_box);
struct wlr_box intersection;
cursor->visible =
wlr_box_intersection(&intersection, &output_box, &cursor_box);
wlr_box_intersects(&output_box, &cursor_box);
}
static bool output_pick_cursor_format(struct wlr_output *output,

View file

@ -615,7 +615,7 @@ static bool output_basic_test(struct wlr_output *output,
};
struct wlr_box dst_box;
output_state_get_buffer_dst_box(state, &dst_box);
if (!wlr_box_intersection(&output_box, &output_box, &dst_box)) {
if (!wlr_box_intersects(&output_box, &dst_box)) {
wlr_log(WLR_ERROR, "Primary buffer is entirely off-screen or 0-sized");
return false;
}