Skip to content

RediWM is a Wayland compositor written in Zig (OpenGL ES) that includes everything in one process

Stage 7a: resolve and present only the groups that changed

oxydizerb25b90054103
diff --git a/AGENTS.md b/AGENTS.md
index 55d23a6..583e225 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -38,7 +38,12 @@ panel painting. The key rules:
trees, hosted under the scene's disabled host and placed by an own `Foreign`
node: their `data` points back at it (`Foreign.of`, `scene_data.fromWlrNode`),
and positions inside them go through `node.wlrCoords`. Hits come from
- `Projection.nodeAt` (own node, or `foreign` for a client surface).
+ `Projection.nodeAt` (own node, or `foreign` for a client surface). A sync
+ resolves only the top-level subtrees (groups) whose nodes changed, and nothing
+ when no group and not the camera did: a change the node setters cannot see (done
+ to a hosted wlr_scene subtree) must call `Node.touch`, and a node whose geometry
+ depends on another group's (a glass effect) is walked every sync. The
+ `-Ddamage-audit` build logs any item the gate left stale.
* **The world has no second tree:** its source tree stays disabled. Pick with
`rediwm_projection_node_at`, send callbacks through `Server.sendFrameDone`,
and emit feedback/`output_sample` on source buffers. GLES may release
diff --git a/TESTING.md b/TESTING.md
index 03d183b..35d6e61 100644
--- a/TESTING.md
+++ b/TESTING.md
@@ -66,7 +66,9 @@ compiler, `wayland-scanner` and wayland-protocols; D-Bus suites need PyGObject,
(`grep -h "damage audit" /dir/*.log`). A hit means a change reached the graph
without damaging itself (`docs/plans/scene-graph-stage6.md`, 6b); the
`capture` suite is known to show a few corner pixels (unsubmitted isolated
- renders upset buffer age, which predates the graph damage).
+ renders upset buffer age, which predates the graph damage). The same build self-checks the projection's per-group resolve: after every gated sync it
+ resolves everything again and logs `gate audit: leaf N was stale` for any item the
+ gate left behind (a change path that never marked its group).
- `REDIWM_*_PREVIEW=/tmp/...` (lock, greeter, OSD, settings, switcher, tray,
notification): keep the compositor's own screenshots.
- GLES2 at a fractional scale can differ by one level depending on render
diff --git a/build.zig b/build.zig
index 6c74e67..9f8d883 100644
--- a/build.zig
+++ b/build.zig
@@ -815,7 +815,7 @@ fn addGlass(b: *std.Build, module: *std.Build.Module, damage_audit: bool) void {
module.linkSystemLibrary("wlroots-0.20", .{});
module.linkSystemLibrary("egl", .{});
module.linkSystemLibrary("glesv2", .{});
- module.addCSourceFile(.{ .file = b.path("src/projection.c"), .flags = &.{ "-std=c11", "-Wall", "-Wextra" } });
+ module.addCSourceFile(.{ .file = b.path("src/projection.c"), .flags = if (damage_audit) &.{ "-std=c11", "-Wall", "-Wextra", "-DREDIWM_DAMAGE_AUDIT" } else &.{ "-std=c11", "-Wall", "-Wextra" } });
module.addCSourceFile(.{ .file = b.path("src/node.c"), .flags = &.{ "-std=c11", "-Wall", "-Wextra", "-Werror" } });
module.addCSourceFile(.{ .file = b.path("src/scene_pass.c"), .flags = &.{ "-std=c11", "-Wall", "-Wextra", "-Werror" } });
module.addCSourceFile(.{ .file = b.path("src/scene_output.c"), .flags = if (damage_audit) &.{ "-std=c11", "-Wall", "-Wextra", "-Werror", "-DREDIWM_DAMAGE_AUDIT" } else &.{ "-std=c11", "-Wall", "-Wextra", "-Werror" } });
diff --git a/src/LayerSurface.zig b/src/LayerSurface.zig
index 81526b3..6fd2533 100644
--- a/src/LayerSurface.zig
+++ b/src/LayerSurface.zig
@@ -78,6 +78,7 @@ pub fn arrange(self: *Self) void {
var usable = full;
if (output) |out| usable = out.usableBox();
self.scene.configure(&full, &usable);
+ self.foreign.node.touch();
}
fn committed(listener: *wl.Listener(*wlr.Surface), _: *wlr.Surface) void {
const self: *Self = @fieldParentPtr("commit", listener);
diff --git a/src/Toplevel.zig b/src/Toplevel.zig
index dbf9c90..2a08d94 100644
--- a/src/Toplevel.zig
+++ b/src/Toplevel.zig
@@ -3132,6 +3132,8 @@ pub fn applyOpacity(toplevel: *Toplevel, now_ms: i64) void {
buffer.setOpacity(value.*);
}
}.iter, &opacity);
+ // The surfaces' opacity is set on wlr_scene nodes, which tell nobody.
+ if (opacity != toplevel.shape_opacity) toplevel.frame_tree.node.touch();
const color = toplevel.borderColor().scale(opacity);
for (toplevel.border_rects) |rect| col.setRect(rect, color);
for (toplevel.frame_fills) |rect| col.setRect(rect, chrome.fillColor().scale(opacity));
diff --git a/src/node.c b/src/node.c
index 5a7b88e..d81c907 100644
--- a/src/node.c
+++ b/src/node.c
@@ -6,9 +6,18 @@
#include <wlr/types/wlr_buffer.h>
#include <wlr/types/wlr_scene.h>
-static void changed(struct rediwm_node *node) {
+// A change to `node`'s own state; `structural` when the tree's shape changed (nodes made,
+// moved, stacked or destroyed), which the owner treats as a change of everything.
+static void report(struct rediwm_node *node, bool structural) {
struct rediwm_scene *scene = node->scene;
- if (scene && scene->changed) scene->changed(scene->changed_data);
+ if (scene && scene->changed) scene->changed(scene->changed_data, node, structural);
+}
+static void changed(struct rediwm_node *node) { report(node, false); }
+static void structure(struct rediwm_node *node) { report(node, true); }
+// The root and the layers under it are what groups hang from: a change to one of them
+// touches every group below.
+static bool is_layer(const struct rediwm_node *node) {
+ return !node->parent || !node->parent->node.parent;
}
static void buffer_damaged(struct rediwm_buffer *b, const pixman_region32_t *damage) {
@@ -34,7 +43,8 @@ static void node_init(struct rediwm_node *node, enum rediwm_node_type type, stru
}
}
-struct rediwm_scene *rediwm_scene_create(struct wlr_scene_tree *host, void (*notify)(void *),
+struct rediwm_scene *rediwm_scene_create(struct wlr_scene_tree *host,
+ void (*notify)(void *, struct rediwm_node *, bool),
void *data) {
struct rediwm_scene *scene = calloc(1, sizeof(*scene));
if (!scene) return NULL;
@@ -59,7 +69,7 @@ struct rediwm_tree *rediwm_tree_create(struct rediwm_tree *parent) {
if (!tree) return NULL;
node_init(&tree->node, REDIWM_NODE_TREE, parent);
wl_list_init(&tree->children);
- changed(&tree->node);
+ structure(&tree->node);
return tree;
}
@@ -76,7 +86,7 @@ struct rediwm_rect *rediwm_rect_create(struct rediwm_tree *parent, int width, in
rect->width = width;
rect->height = height;
memcpy(rect->color, color, sizeof(rect->color));
- changed(&rect->node);
+ structure(&rect->node);
return rect;
}
@@ -94,7 +104,7 @@ struct rediwm_buffer *rediwm_buffer_create(struct rediwm_tree *parent, struct wl
b->transform = WL_OUTPUT_TRANSFORM_NORMAL;
pixman_region32_init(&b->opaque_region);
if (buffer) rediwm_buffer_set_buffer(b, buffer);
- changed(&b->node);
+ structure(&b->node);
return b;
}
@@ -113,7 +123,7 @@ struct rediwm_foreign *rediwm_foreign_create(struct rediwm_tree *parent, struct
f->wlr = wlr;
f->wlr_destroy.notify = foreign_wlr_destroyed;
wl_signal_add(&wlr->events.destroy, &f->wlr_destroy);
- changed(&f->node);
+ structure(&f->node);
return f;
}
@@ -149,27 +159,29 @@ void rediwm_node_destroy(struct rediwm_node *node) {
wlr_addon_set_finish(&node->addons);
wl_list_remove(&node->link);
free(node);
- if (shown && scene && scene->changed) scene->changed(scene->changed_data);
+ if (shown && scene && scene->changed) scene->changed(scene->changed_data, NULL, true);
}
+void rediwm_node_touch(struct rediwm_node *node) { report(node, is_layer(node)); }
+
void rediwm_node_set_enabled(struct rediwm_node *node, bool enabled) {
if (node->enabled == enabled) return;
node->enabled = enabled;
- changed(node);
+ report(node, is_layer(node));
}
void rediwm_node_set_position(struct rediwm_node *node, int x, int y) {
if (node->x == x && node->y == y) return;
node->x = x;
node->y = y;
- changed(node);
+ report(node, is_layer(node));
}
// Moves the node to follow `after` (a link of its parent's list, or the list head).
static void move_after(struct rediwm_node *node, struct wl_list *after) {
wl_list_remove(&node->link);
wl_list_insert(after, &node->link);
- changed(node);
+ structure(node);
}
void rediwm_node_raise_to_top(struct rediwm_node *node) {
@@ -211,8 +223,8 @@ void rediwm_node_reparent(struct rediwm_node *node, struct rediwm_tree *parent)
// A different scene keeps its own owner informed from now on.
struct rediwm_scene *from = node->scene;
node->scene = parent->node.scene;
- if (from && from != node->scene && from->changed) from->changed(from->changed_data);
- changed(node);
+ if (from && from != node->scene && from->changed) from->changed(from->changed_data, NULL, true);
+ structure(node);
}
bool rediwm_node_coords(struct rediwm_node *node, int *lx, int *ly) {
diff --git a/src/node.h b/src/node.h
index f9124e5..226fb34 100644
--- a/src/node.h
+++ b/src/node.h
@@ -104,7 +104,9 @@ struct rediwm_scene {
// foreign subtrees, so wlroots computes nothing for them.
struct wlr_scene_tree *host;
// Something the tree shows may have changed: the owner schedules a frame.
- void (*changed)(void *data);
+ // `node` is the one that changed (NULL when it is gone); `structural` when nodes
+ // were made, moved, stacked or destroyed, or a layer changed.
+ void (*changed)(void *data, struct rediwm_node *node, bool structural);
// A buffer node was given a buffer (set_buffer, set_buffer_with_damage): the
// buffer-local `damage` of what differs, or NULL for all of it. The projection turns
// this into screen damage, as wlroots did for the nodes it tracked.
@@ -127,7 +129,8 @@ static inline struct rediwm_foreign *rediwm_foreign_from_node(struct rediwm_node
// A scene is its root tree. `host` is where carriers and foreign subtrees live (the
// caller disables it); `changed` may be NULL.
-struct rediwm_scene *rediwm_scene_create(struct wlr_scene_tree *host, void (*changed)(void *),
+struct rediwm_scene *rediwm_scene_create(struct wlr_scene_tree *host,
+ void (*changed)(void *, struct rediwm_node *, bool),
void *data);
void rediwm_scene_destroy(struct rediwm_scene *);
@@ -145,6 +148,9 @@ struct wlr_scene_tree *rediwm_tree_host(const struct rediwm_tree *);
// Destroys the node and everything under it; each node emits events.destroy first.
void rediwm_node_destroy(struct rediwm_node *);
+// Reports a change the node itself cannot see (something done to the wlr_scene subtree
+// it hosts): asks for a frame.
+void rediwm_node_touch(struct rediwm_node *);
void rediwm_node_set_enabled(struct rediwm_node *, bool enabled);
void rediwm_node_set_position(struct rediwm_node *, int x, int y);
// Restacking: all of these are no-ops where the node already sits.
diff --git a/src/node.zig b/src/node.zig
index 815c7a5..e72c7d7 100644
--- a/src/node.zig
+++ b/src/node.zig
@@ -29,6 +29,10 @@ pub const Node = extern struct {
extern fn rediwm_node_destroy(node: *Node) void;
pub const destroy = rediwm_node_destroy;
+ extern fn rediwm_node_touch(node: *Node) void;
+ /// Reports a change the node cannot see itself (something done to the wlr_scene
+ /// subtree it hosts): asks for a frame and a fresh resolve.
+ pub const touch = rediwm_node_touch;
extern fn rediwm_node_set_enabled(node: *Node, enabled: bool) void;
pub const setEnabled = rediwm_node_set_enabled;
extern fn rediwm_node_set_position(node: *Node, x: c_int, y: c_int) void;
@@ -244,6 +248,7 @@ pub const Foreign = extern struct {
/// Clips the hosted surface tree, as wlr_scene_subsurface_tree_set_clip.
pub fn subsurfaceTreeSetClip(foreign: *Foreign, clip: ?*const wlr.Box) void {
wlr.SceneNode.subsurfaceTreeSetClip(foreign.wlr.?, clip);
+ foreign.node.touch();
}
pub fn fromNode(node: *Node) *Foreign {
@@ -255,10 +260,11 @@ pub const Foreign = extern struct {
pub const Scene = extern struct {
tree: Tree,
host: *wlr.SceneTree,
- changed: ?*const fn (data: ?*anyopaque) callconv(.c) void,
+ changed: ?*const fn (data: ?*anyopaque, node: ?*Node, structural: bool) callconv(.c) void,
+ buffer_damaged: ?*const fn (data: ?*anyopaque, buffer: *Buffer, damage: ?*const pixman.Region32) callconv(.c) void,
changed_data: ?*anyopaque,
- extern fn rediwm_scene_create(host: *wlr.SceneTree, changed: ?*const fn (?*anyopaque) callconv(.c) void, data: ?*anyopaque) ?*Scene;
+ extern fn rediwm_scene_create(host: *wlr.SceneTree, changed: ?*const fn (?*anyopaque, ?*Node, bool) callconv(.c) void, data: ?*anyopaque) ?*Scene;
/// `host` is a hidden, disabled wlr_scene tree for the carriers and the
/// clients' subtrees.
pub fn create(host: *wlr.SceneTree) !*Scene {
diff --git a/src/node_test.c b/src/node_test.c
index 8fd99df..7f254c5 100644
--- a/src/node_test.c
+++ b/src/node_test.c
@@ -10,8 +10,10 @@
#include <wlr/types/wlr_scene.h>
static int changes;
-static void on_change(void *data) {
+static void on_change(void *data, struct rediwm_node *node, bool structural) {
(void)data;
+ (void)node;
+ (void)structural;
changes++;
}
diff --git a/src/projection.c b/src/projection.c
index 28d15c8..7be6160 100644
--- a/src/projection.c
+++ b/src/projection.c
@@ -37,6 +37,13 @@ struct rediwm_projection {
struct rediwm_scene *own;
struct rediwm_tree *world;
struct wlr_scene *scene;
+ // What changed since the last sync. A change to one top-level subtree (a group) marks
+ // that group; a change to the shape of the tree, a layer or anything not tied to
+ // one group marks them all (`all_dirty`). A sync resolves and presents only the
+ // marked groups, or none when nothing changed and the camera did not move.
+ bool any_dirty, all_dirty, have_camera;
+ double camera[5];
+ struct rediwm_tree *fixed;
// Every adapter, in creation order; `paint` holds the groups resolve() last
// reached, bottom to top.
struct wl_list leaves, groups, paint;
@@ -62,6 +69,10 @@ struct rediwm_projection {
struct rediwm_damage_event events[DAMAGE_EVENTS];
uint64_t next_event; // sequence number of the next event; 0 is never used
};
+// The compositor has one projection; setters on nodes inside a client's subtree, which
+// cannot reach it through a scene, tell it directly.
+static struct rediwm_projection *current;
+static void mark_all(struct rediwm_projection *p);
// Source top-level subtrees are contiguous in paint order: each is a group, and
// a window going away damages everything its leaves showed at once.
struct group {
@@ -71,6 +82,11 @@ struct group {
// The leaves resolve() last reached under this group, bottom to top.
struct wl_list items;
bool enabled;
+ // Changed since resolve() last walked it; walked at least once; walked by this sync.
+ bool dirty, resolved, touched;
+ // Holds a glass effect, whose box is its target's, which may be a node of another group:
+ // such a group is walked whenever anything is.
+ bool has_effect;
struct rediwm_projection *projection;
struct rediwm_node *source;
struct wl_listener destroy;
@@ -94,6 +110,8 @@ struct leaf {
// `foreign` is the own node hosting that subtree.
struct rediwm_node *own;
struct rediwm_foreign *foreign;
+ // The group the last resolve() put it in.
+ struct group *group;
// A glass effect: decided when the leaf is made, as an effect is its own node.
bool effect;
struct wl_listener destroy, commit;
@@ -200,9 +218,13 @@ static struct tree_props *tree_props_get(struct wlr_addon_set *set, void **slot)
wlr_addon_init(&props->addon, set, NULL, &tree_props_impl);
return props;
}
+// Set by a setter that changed something, so the wrappers below ask for a frame only
+// then: a window's zoom and clip are applied every frame and mostly unchanged.
+static bool props_changed;
static bool set_tree_zoom(struct wlr_addon_set *set, void **slot, double scale) {
struct tree_props *props = tree_props_get(set, slot);
if (!props) return false;
+ if (!props->has_zoom || props->zoom != scale) props_changed = true;
props->zoom = scale;
props->has_zoom = true;
return true;
@@ -211,6 +233,7 @@ static bool set_tree_scale(struct wlr_addon_set *set, void **slot, double factor
if (factor <= 0) return false;
struct tree_props *props = tree_props_get(set, slot);
if (!props) return false;
+ if (!props->has_scale || props->scale != factor) props_changed = true;
props->scale = factor;
props->has_scale = true;
return true;
@@ -220,6 +243,7 @@ static bool set_tree_clip(struct wlr_addon_set *set, void **slot,
const struct rediwm_clip_spec *spec) {
if (!spec) {
struct tree_props *props = tree_props_find(set, slot);
+ if (props && props->has_clip) props_changed = true;
if (props) props->has_clip = false;
return true;
}
@@ -233,6 +257,7 @@ static bool set_tree_clip(struct wlr_addon_set *set, void **slot,
return false;
struct tree_props *props = tree_props_get(set, slot);
if (!props) return false;
+ if (!props->has_clip || memcmp(&props->clip, spec, sizeof(*spec))) props_changed = true;
props->clip = *spec;
props->has_clip = true;
return true;
@@ -241,6 +266,7 @@ static bool set_tree_shadow(struct wlr_addon_set *set, void **slot,
const struct rediwm_shadow_spec *spec) {
if (!spec) {
struct tree_props *props = tree_props_find(set, slot);
+ if (props && props->has_shadow) props_changed = true;
if (props) props->has_shadow = false;
return true;
}
@@ -251,6 +277,7 @@ static bool set_tree_shadow(struct wlr_addon_set *set, void **slot,
if (!finite_at_least_zero(spec->radii[i]) || !isfinite(spec->color[i])) return false;
struct tree_props *props = tree_props_get(set, slot);
if (!props) return false;
+ if (!props->has_shadow || memcmp(&props->shadow, spec, sizeof(*spec))) props_changed = true;
props->shadow = *spec;
props->has_shadow = true;
return true;
@@ -262,11 +289,13 @@ static bool set_tree_dim(struct wlr_addon_set *set, void **slot, float brightnes
if (brightness == 0 && saturation == 0) {
// Nothing taken away is no dim; a tree that has none gets no addon for it.
struct tree_props *props = tree_props_find(set, slot);
+ if (props && props->has_dim) props_changed = true;
if (props) props->has_dim = false;
return true;
}
struct tree_props *props = tree_props_get(set, slot);
if (!props) return false;
+ if (!props->has_dim || props->dim.brightness != brightness || props->dim.saturation != saturation) props_changed = true;
props->dim = (struct dim){brightness, saturation};
props->has_dim = true;
return true;
@@ -274,36 +303,48 @@ static bool set_tree_dim(struct wlr_addon_set *set, void **slot, float brightnes
static bool set_tree_unclipped(struct wlr_addon_set *set, void **slot, bool unclipped) {
struct tree_props *props = unclipped ? tree_props_get(set, slot) : tree_props_find(set, slot);
if (unclipped && !props) return false;
+ if (props && props->unclipped != unclipped) props_changed = true;
if (props) props->unclipped = unclipped;
return true;
}
static bool set_tree_inert(struct wlr_addon_set *set, void **slot, bool inert) {
struct tree_props *props = inert ? tree_props_get(set, slot) : tree_props_find(set, slot);
if (inert && !props) return false;
+ if (props && props->inert != inert) props_changed = true;
if (props) props->inert = inert;
return true;
}
-bool rediwm_projection_set_tree_zoom(struct rediwm_node *node, double scale) { return set_tree_zoom(&node->addons, &node->props, scale); }
-bool rediwm_projection_set_wlr_tree_zoom(struct wlr_scene_node *node, double scale) { return set_tree_zoom(&node->addons, NULL, scale); }
-bool rediwm_projection_set_tree_scale(struct rediwm_node *node, double factor) { return set_tree_scale(&node->addons, &node->props, factor); }
-bool rediwm_projection_set_wlr_tree_scale(struct wlr_scene_node *node, double factor) { return set_tree_scale(&node->addons, NULL, factor); }
-bool rediwm_projection_set_tree_clip(struct rediwm_node *node, const struct rediwm_clip_spec *spec) { return set_tree_clip(&node->addons, &node->props, spec); }
-bool rediwm_projection_set_wlr_tree_clip(struct wlr_scene_node *node, const struct rediwm_clip_spec *spec) { return set_tree_clip(&node->addons, NULL, spec); }
-bool rediwm_projection_set_tree_shadow(struct rediwm_node *node, const struct rediwm_shadow_spec *spec) { return set_tree_shadow(&node->addons, &node->props, spec); }
-bool rediwm_projection_set_wlr_tree_shadow(struct wlr_scene_node *node, const struct rediwm_shadow_spec *spec) { return set_tree_shadow(&node->addons, NULL, spec); }
-bool rediwm_projection_set_tree_dim(struct rediwm_node *node, float brightness, float saturation) { return set_tree_dim(&node->addons, &node->props, brightness, saturation); }
-bool rediwm_projection_set_wlr_tree_dim(struct wlr_scene_node *node, float brightness, float saturation) { return set_tree_dim(&node->addons, NULL, brightness, saturation); }
-bool rediwm_projection_set_tree_unclipped(struct rediwm_node *node, bool unclipped) { return set_tree_unclipped(&node->addons, &node->props, unclipped); }
-bool rediwm_projection_set_wlr_tree_unclipped(struct wlr_scene_node *node, bool unclipped) { return set_tree_unclipped(&node->addons, NULL, unclipped); }
-bool rediwm_projection_set_tree_inert(struct rediwm_node *node, bool inert) { return set_tree_inert(&node->addons, &node->props, inert); }
-bool rediwm_projection_set_wlr_tree_inert(struct wlr_scene_node *node, bool inert) { return set_tree_inert(&node->addons, NULL, inert); }
+bool rediwm_projection_set_tree_zoom(struct rediwm_node *node, double scale) { props_changed = false; bool ok = set_tree_zoom(&node->addons, &node->props, scale); if (props_changed) rediwm_node_touch(node); return ok; }
+bool rediwm_projection_set_wlr_tree_zoom(struct wlr_scene_node *node, double scale) { props_changed = false; bool ok = set_tree_zoom(&node->addons, NULL, scale); if (props_changed && current) mark_all(current); return ok; }
+bool rediwm_projection_set_tree_scale(struct rediwm_node *node, double factor) { props_changed = false; bool ok = set_tree_scale(&node->addons, &node->props, factor); if (props_changed) rediwm_node_touch(node); return ok; }
+bool rediwm_projection_set_wlr_tree_scale(struct wlr_scene_node *node, double factor) { props_changed = false; bool ok = set_tree_scale(&node->addons, NULL, factor); if (props_changed && current) mark_all(current); return ok; }
+bool rediwm_projection_set_tree_clip(struct rediwm_node *node, const struct rediwm_clip_spec *spec) { props_changed = false; bool ok = set_tree_clip(&node->addons, &node->props, spec); if (props_changed) rediwm_node_touch(node); return ok; }
+bool rediwm_projection_set_wlr_tree_clip(struct wlr_scene_node *node, const struct rediwm_clip_spec *spec) { props_changed = false; bool ok = set_tree_clip(&node->addons, NULL, spec); if (props_changed && current) mark_all(current); return ok; }
+bool rediwm_projection_set_tree_shadow(struct rediwm_node *node, const struct rediwm_shadow_spec *spec) { props_changed = false; bool ok = set_tree_shadow(&node->addons, &node->props, spec); if (props_changed) rediwm_node_touch(node); return ok; }
+bool rediwm_projection_set_wlr_tree_shadow(struct wlr_scene_node *node, const struct rediwm_shadow_spec *spec) { props_changed = false; bool ok = set_tree_shadow(&node->addons, NULL, spec); if (props_changed && current) mark_all(current); return ok; }
+bool rediwm_projection_set_tree_dim(struct rediwm_node *node, float brightness, float saturation) { props_changed = false; bool ok = set_tree_dim(&node->addons, &node->props, brightness, saturation); if (props_changed) rediwm_node_touch(node); return ok; }
+bool rediwm_projection_set_wlr_tree_dim(struct wlr_scene_node *node, float brightness, float saturation) { props_changed = false; bool ok = set_tree_dim(&node->addons, NULL, brightness, saturation); if (props_changed && current) mark_all(current); return ok; }
+bool rediwm_projection_set_tree_unclipped(struct rediwm_node *node, bool unclipped) { props_changed = false; bool ok = set_tree_unclipped(&node->addons, &node->props, unclipped); if (props_changed) rediwm_node_touch(node); return ok; }
+bool rediwm_projection_set_wlr_tree_unclipped(struct wlr_scene_node *node, bool unclipped) { props_changed = false; bool ok = set_tree_unclipped(&node->addons, NULL, unclipped); if (props_changed && current) mark_all(current); return ok; }
+bool rediwm_projection_set_tree_inert(struct rediwm_node *node, bool inert) { props_changed = false; bool ok = set_tree_inert(&node->addons, &node->props, inert); if (props_changed) rediwm_node_touch(node); return ok; }
+bool rediwm_projection_set_wlr_tree_inert(struct wlr_scene_node *node, bool inert) { props_changed = false; bool ok = set_tree_inert(&node->addons, NULL, inert); if (props_changed && current) mark_all(current); return ok; }
static const struct wlr_addon_interface source_lookup_impl, group_source_impl;
struct watched_surface {
struct rediwm_projection *projection;
+ struct wlr_surface *surface;
struct wl_list link;
struct wl_listener commit, destroy;
};
+static void mark_all(struct rediwm_projection *p) { p->any_dirty = p->all_dirty = true; }
+static void mark_group(struct rediwm_projection *p, struct group *g) {
+ if (!g) {
+ mark_all(p);
+ return;
+ }
+ g->dirty = true;
+ p->any_dirty = true;
+}
static void schedule(struct rediwm_projection *p) {
struct wlr_scene_output *out;
wl_list_for_each(out, &p->scene->outputs, link)
@@ -493,6 +534,7 @@ static void committed(struct wl_listener *listener, void *data) {
!pixman_region32_union(&l->damage, &l->damage, &surface->buffer_damage))
l->full_damage = true;
l->dirty = true;
+ mark_group(l->projection, l->group);
schedule(l->projection);
}
static struct leaf *get_leaf(struct rediwm_projection *p, struct wlr_scene_node *source,
@@ -679,6 +721,7 @@ static void resolve_leaf(struct rediwm_projection *p, struct group *g, struct wl
if (l->inert != w->inert) l->inert = w->inert;
if (l->own != own) l->own = own;
if (l->foreign != w->foreign) l->foreign = w->foreign;
+ l->group = g;
// Flattened leaves within each group retain the source's paint order.
wl_list_insert(g->items.prev, &l->paint);
struct rediwm_item *item = &l->item;
@@ -701,6 +744,7 @@ static void resolve_leaf(struct rediwm_projection *p, struct group *g, struct wl
memcpy(item->content.color, r->color, sizeof(item->content.color));
} else {
struct wlr_scene_buffer *b = wlr_scene_buffer_from_node(node);
+ if (l->effect) g->has_effect = true;
item->kind = l->effect ? REDIWM_ITEM_EFFECT
: l->surface ? REDIWM_ITEM_SURFACE
: REDIWM_ITEM_BUFFER;
@@ -1015,6 +1059,7 @@ void rediwm_projection_damage_buffer(struct rediwm_projection *p,
l->full_damage = true;
l->owned_damage = true;
l->dirty = true;
+ mark_group(p, l->group);
schedule(p);
}
static uint32_t region_area(const pixman_region32_t *region) {
@@ -1146,7 +1191,21 @@ void rediwm_projection_send_frame_done(struct rediwm_projection *p, struct wlr_s
wl_signal_emit_mutable(&wlr_scene_buffer_from_node(f->leaf->source)->events.frame_done, &event);
}
}
-static void schedule_changed(void *data) { schedule(data); }
+// The group a node belongs to: the child of a layer it hangs under (root 0, layer 1,
+// group 2), or NULL for the root and the layers, and for a node not yet grouped.
+static struct group *group_of(struct rediwm_node *node) {
+ int depth = 0;
+ for (struct rediwm_node *n = node; n->parent; n = &n->parent->node) depth++;
+ if (depth < 2) return NULL;
+ for (; depth > 2; depth--) node = &node->parent->node;
+ return node->group;
+}
+static void scene_changed(void *data, struct rediwm_node *node, bool structural) {
+ struct rediwm_projection *p = data;
+ if (structural || !node) mark_all(p);
+ else mark_group(p, group_of(node));
+ schedule(p);
+}
static void buffer_given(void *data, struct rediwm_buffer *b, const pixman_region32_t *damage) {
rediwm_projection_damage_buffer(data, &b->carrier->node, damage);
}
@@ -1166,7 +1225,8 @@ struct rediwm_projection *rediwm_projection_create(struct rediwm_scene *own, str
wl_list_init(&p->new_surface.link);
pixman_region32_init(&p->pending);
// Every change to the tree asks for a frame; the next sync finds what moved.
- own->changed = schedule_changed;
+ current = p;
+ own->changed = scene_changed;
own->buffer_damaged = buffer_given;
own->changed_data = p;
return p;
@@ -1174,15 +1234,20 @@ struct rediwm_projection *rediwm_projection_create(struct rediwm_scene *own, str
// Source tree -> graph. Every adapter is detached from the paint lists first, so
// the lists hold exactly what this pass reaches, in source paint order.
static void resolve(struct rediwm_projection *p, double z, double cx, double cy,
- double ox, double oy, struct rediwm_tree *fixed) {
+ double ox, double oy, struct rediwm_tree *fixed, bool full) {
struct leaf *l;
- wl_list_for_each(l, &p->leaves, link) {
- l->seen = false;
- detach(&l->paint);
- }
struct group *g;
+ // A full pass walks every group; otherwise only the marked ones are, and the rest
+ // keep the leaves and items they had.
+ if (full) {
+ wl_list_for_each(l, &p->leaves, link) {
+ l->seen = false;
+ detach(&l->paint);
+ }
+ }
wl_list_for_each(g, &p->groups, link) {
g->seen = false;
+ g->touched = false;
detach(&g->paint);
}
const struct rediwm_xform camera = rediwm_xform_camera(z, cx, cy, ox, oy);
@@ -1202,21 +1267,34 @@ static void resolve(struct rediwm_projection *p, double z, double cx, double cy,
wlr_log(WLR_ERROR, "zoom: cannot allocate presentation group");
continue;
}
- struct walk w = base;
- // The fixed subtree is laid out as is; everything else follows the camera.
- if (world && fixed && node == &fixed->node) w.t = identity;
g->seen = true;
g->enabled = base.enabled && node->enabled;
wl_list_insert(p->paint.prev, &g->paint);
+ if (!full && g->resolved && !g->dirty && !g->has_effect) continue;
+ if (!full) {
+ struct leaf *next;
+ wl_list_for_each_safe(l, next, &g->items, paint) {
+ l->seen = false;
+ detach(&l->paint);
+ }
+ }
+ struct walk w = base;
+ // The fixed subtree is laid out as is; everything else follows the camera.
+ if (world && fixed && node == &fixed->node) w.t = identity;
+ g->resolved = true;
+ g->dirty = false;
+ g->touched = true;
+ g->has_effect = false;
resolve_own(p, g, node, &w);
}
}
}
static void damage_restacked(struct rediwm_projection *p);
// Graph -> damage, then forget what the graph no longer reaches.
-static void present(struct rediwm_projection *p) {
+static void present(struct rediwm_projection *p, bool full) {
struct group *g;
wl_list_for_each(g, &p->paint, paint) {
+ if (!full && !g->touched) continue;
struct leaf *l, *next;
wl_list_for_each_safe(l, next, &g->items, paint) present_leaf(l);
}
@@ -1226,7 +1304,8 @@ static void present(struct rediwm_projection *p) {
damage_shadow(l, false, (struct rediwm_snap){0});
l->ranked = false;
}
- damage_restacked(p);
+ // Nothing was stacked differently unless the shape of the tree changed.
+ if (full) damage_restacked(p);
}
// A leaf that is above what it was below, or the reverse, changes every pixel of
// the two where they overlap, and nothing else tells the screen: wlroots damaged a
@@ -1296,13 +1375,58 @@ static void apply_damage(struct rediwm_projection *p) {
if (pixman_region32_not_empty(&p->pending)) rediwm_scene_damage_layout(p->scene, &p->pending);
pixman_region32_clear(&p->pending);
}
+#ifdef REDIWM_DAMAGE_AUDIT
+static void audit_gate(struct rediwm_projection *p, double z, double cx, double cy, double ox,
+ double oy, struct rediwm_tree *fixed) {
+ size_t n = 0;
+ struct leaf *l;
+ wl_list_for_each(l, &p->leaves, link) n++;
+ struct rediwm_item *before = calloc(n ? n : 1, sizeof(*before));
+ struct leaf **who = calloc(n ? n : 1, sizeof(*who));
+ if (!before || !who) {
+ free(before);
+ free(who);
+ return;
+ }
+ size_t i = 0;
+ wl_list_for_each(l, &p->leaves, link) {
+ before[i] = l->item;
+ who[i++] = l;
+ }
+ resolve(p, z, cx, cy, ox, oy, fixed, true);
+ for (i = 0; i < n; i++) {
+ const struct rediwm_item *a = &before[i], *b = &who[i]->item;
+ if (a->enabled != b->enabled || a->kind != b->kind || memcmp(&a->edges, &b->edges, sizeof(a->edges)) ||
+ !rediwm_content_equal(&a->content, &b->content))
+ wlr_log(WLR_ERROR, "gate audit: leaf %llu (kind %d) was stale: enabled %d->%d edges %.1f,%.1f %.1f,%.1f -> %.1f,%.1f %.1f,%.1f",
+ (unsigned long long)who[i]->item.id, b->kind, a->enabled, b->enabled, a->edges.x1, a->edges.y1,
+ a->edges.x2, a->edges.y2, b->edges.x1, b->edges.y1, b->edges.x2, b->edges.y2);
+ }
+ free(before);
+ free(who);
+}
+#endif
void rediwm_projection_sync_fixed(struct rediwm_projection *p, double z, double cx,
double cy, double ox, double oy,
struct rediwm_tree *fixed) {
if (!p)
return;
- resolve(p, z, cx, cy, ox, oy, fixed);
- present(p);
+ const double camera[5] = {z, cx, cy, ox, oy};
+ const bool moved = !p->have_camera || p->fixed != fixed || memcmp(p->camera, camera, sizeof(camera));
+ if (!moved && !p->any_dirty)
+ return;
+ const bool full = moved || p->all_dirty;
+ p->any_dirty = p->all_dirty = false;
+ p->have_camera = true;
+ p->fixed = fixed;
+ memcpy(p->camera, camera, sizeof(camera));
+ resolve(p, z, cx, cy, ox, oy, fixed, full);
+#ifdef REDIWM_DAMAGE_AUDIT
+ // Self-check of the gate: what a full walk would put in the graph must be what the
+ // gated one did. Reports every leaf that differs, then goes on with the full result.
+ if (!full) audit_gate(p, z, cx, cy, ox, oy, fixed);
+#endif
+ present(p, full);
apply_damage(p);
}
void rediwm_projection_sync(struct rediwm_projection *p, double z, double cx,
@@ -1417,8 +1541,15 @@ static void watched_commit(struct wl_listener *listener, void *data) {
(void)data;
struct watched_surface *watch = wl_container_of(listener, watch, commit);
// Covers the first commit of new/desynchronized subsurfaces and popups,
- // before they have presentation leaves of their own.
- schedule(watch->projection);
+ // before they have presentation leaves of their own: a surface with a leaf is
+ // told by its leaf; any other may be about to appear anywhere.
+ struct rediwm_projection *p = watch->projection;
+ struct feedback *f;
+ bool known = false;
+ wl_list_for_each(f, &p->feedback, link)
+ if (f->leaf->surface && f->leaf->surface->surface == watch->surface) known = true;
+ if (!known) mark_all(p);
+ schedule(p);
}
static void watched_destroy(struct wl_listener *listener, void *data) {
(void)data;
@@ -1437,6 +1568,7 @@ static void new_surface(struct wl_listener *listener, void *data) {
return;
}
watch->projection = p;
+ watch->surface = surface;
watch->commit.notify = watched_commit;
watch->destroy.notify = watched_destroy;
wl_signal_add(&surface->events.commit, &watch->commit);
@@ -1456,6 +1588,7 @@ void rediwm_projection_destroy(struct rediwm_projection *p) {
struct group *g, *next_group;
wl_list_for_each_safe(g, next_group, &p->groups, link) destroy_group(g);
wl_list_remove(&p->new_surface.link);
+ if (current == p) current = NULL;
if (p->own->changed_data == p) {
p->own->changed = NULL;
p->own->buffer_damaged = NULL;
diff --git a/src/projection_test.c b/src/projection_test.c
index 0ae318e..bb69bc8 100644
--- a/src/projection_test.c
+++ b/src/projection_test.c
@@ -164,6 +164,64 @@ static bool probe_item(const struct rediwm_item *item, struct wlr_scene_node *tr
assert(item->kind == probe->expected.kind && rediwm_content_equal(&item->content, &probe->expected.content));
return true;
}
+// A sync with nothing changed resolves nothing; every kind of change brings it back.
+static void test_clean_sync(struct wlr_scene *scene) {
+ struct rig rig = rig_create(scene);
+ struct rediwm_projection *p = rediwm_projection_create(rig.own, rig.world, scene);
+ struct wlr_buffer *buffer = buffer_create();
+ struct rediwm_tree *frame = rediwm_tree_create(rig.world);
+ struct rediwm_buffer *node = rediwm_buffer_create(frame, buffer);
+ rediwm_buffer_set_dest_size(node, 40, 30);
+ rediwm_projection_sync(p, 1, 0, 0, 0, 0);
+ struct leaf *l = leaf_of(p, &node->node);
+ assert(l && l->item.edges.x2 - l->item.edges.x1 == 40);
+ // Poke the graph: a clean sync leaves it alone.
+ l->item.edges.x2 = 12345;
+ rediwm_projection_sync(p, 1, 0, 0, 0, 0);
+ assert(l->item.edges.x2 == 12345);
+ // The scene changed.
+ rediwm_node_set_position(&frame->node, 5, 5);
+ rediwm_projection_sync(p, 1, 0, 0, 0, 0);
+ assert(l->item.edges.x2 == 45);
+ // The camera moved.
+ l->item.edges.x2 = 12345;
+ rediwm_projection_sync(p, 1, 0, 0, 0, 0);
+ assert(l->item.edges.x2 == 12345);
+ rediwm_projection_sync(p, 2, 0, 0, 0, 0);
+ assert(l->item.edges.x2 == 90);
+ // A tree property changed.
+ l->item.edges.x2 = 12345;
+ assert(rediwm_projection_set_tree_scale(&frame->node, .5));
+ rediwm_projection_sync(p, 2, 0, 0, 0, 0);
+ assert(l->item.edges.x2 == 50);
+ // A surface commit, or an owned buffer's damage.
+ l->item.edges.x2 = 12345;
+ rediwm_projection_damage_buffer(p, &node->carrier->node, NULL);
+ rediwm_projection_sync(p, 2, 0, 0, 0, 0);
+ assert(l->item.edges.x2 == 50);
+ // Only the group that changed is walked again; a change to the tree's shape walks all.
+ const float color[4] = {1, 0, 0, 1};
+ struct rediwm_tree *other = rediwm_tree_create(rig.world);
+ struct rediwm_rect *rect = rediwm_rect_create(other, 10, 10, color);
+ rediwm_projection_sync(p, 2, 0, 0, 0, 0);
+ struct leaf *rl = leaf_of(p, &rect->node);
+ assert(rl && rl->item.edges.x2 - rl->item.edges.x1 == 20);
+ rl->item.edges.x2 = 777;
+ l->item.edges.x2 = 12345;
+ rediwm_node_set_position(&frame->node, 7, 7);
+ rediwm_projection_sync(p, 2, 0, 0, 0, 0);
+ assert(l->item.edges.x2 != 12345 && rl->item.edges.x2 == 777);
+ rediwm_node_set_position(&rect->node, 1, 1);
+ rediwm_projection_sync(p, 2, 0, 0, 0, 0);
+ assert(rl->item.edges.x2 != 777);
+ rl->item.edges.x2 = 777;
+ rediwm_node_raise_to_top(&frame->node);
+ rediwm_projection_sync(p, 2, 0, 0, 0, 0);
+ assert(rl->item.edges.x2 != 777);
+ rediwm_projection_destroy(p);
+ rig_destroy(&rig);
+ wlr_buffer_drop(buffer);
+}
static void test_graph(struct wlr_scene *scene) {
struct rig rig = rig_create(scene);
struct rediwm_tree *source = rig.world;
@@ -204,9 +262,11 @@ static void test_graph(struct wlr_scene *scene) {
struct wlr_surface surface = {0};
struct wlr_scene_surface scene_surface = {.surface = &surface};
client_leaf->surface = &scene_surface;
+ mark_all(p); // the test changed a leaf behind the scene's back
rediwm_projection_sync(p, 1, 0, 0, 0, 0);
assert(client_leaf->item.kind == REDIWM_ITEM_SURFACE);
client_leaf->surface = NULL; // The synthetic surface has no lifecycle listeners.
+ mark_all(p);
rediwm_projection_sync(p, 1, 0, 0, 0, 0);
assert(client_leaf->item.kind == REDIWM_ITEM_BUFFER);
@@ -218,7 +278,7 @@ static void test_graph(struct wlr_scene *scene) {
// Resolving alone shows nothing: what the last present showed is kept.
const struct rediwm_snap shown_before = client_leaf->shown;
const double z = .85, cx = 6.5, cy = -2.5, ox = -17, oy = 31;
- resolve(p, z, cx, cy, ox, oy, NULL);
+ resolve(p, z, cx, cy, ox, oy, NULL, true);
assert(client_leaf->has_shown && client_leaf->shown.x == shown_before.x &&
client_leaf->shown.y == shown_before.y && client_leaf->shown.width == shown_before.width);
@@ -245,17 +305,17 @@ static void test_graph(struct wlr_scene *scene) {
assert(s.width == lround(e.x2) - lround(e.x1) && s.x == lround(e.x1));
// Scaled content is filtered bilinearly whatever the client asked for.
rediwm_buffer_set_filter_mode(client, WLR_SCALE_FILTER_NEAREST);
- resolve(p, z, cx, cy, ox, oy, NULL);
+ resolve(p, z, cx, cy, ox, oy, NULL, true);
assert(client_leaf->item.content.filter_mode == WLR_SCALE_FILTER_BILINEAR);
- resolve(p, 1, 0, 0, 0, 0, NULL);
+ resolve(p, 1, 0, 0, 0, 0, NULL, true);
assert(rediwm_projection_set_tree_zoom(&frame->node, 1.0));
- resolve(p, 1, 0, 0, 0, 0, NULL);
+ resolve(p, 1, 0, 0, 0, 0, NULL, true);
assert(client_leaf->item.content.filter_mode == WLR_SCALE_FILTER_NEAREST);
assert(rediwm_projection_set_tree_zoom(&frame->node, .85));
rediwm_buffer_set_filter_mode(client, WLR_SCALE_FILTER_BILINEAR);
// Presenting shows exactly that graph, and only that graph.
- present(p);
+ present(p, true);
assert_presented(p);
{
const struct rediwm_snap now = rediwm_edges_snap(client_leaf->item.edges);
@@ -487,13 +547,13 @@ static void test_clip_projection(struct wlr_scene *scene) {
assert(near(want.edges.x1, 37) && near(want.edges.x2, 37 + .85 * 120)); // The origin stays put.
assert(!overlay_leaf->item.clip); // A sibling window is not clipped.
// It follows the camera with the window.
- resolve(p, .5, 12, -8, 3, 4, NULL);
+ resolve(p, .5, 12, -8, 3, 4, NULL, true);
const struct rediwm_xform moved = rediwm_xform_scale_about(rediwm_xform_camera(.5, 12, -8, 3, 4), .85, 37, 29);
const struct rediwm_clip want_moved = rediwm_clip_resolve(moved, 37, 29, &spec);
assert(near(client_leaf->item.clip->edges.x1, want_moved.edges.x1) &&
near(client_leaf->item.clip->edges.y2, want_moved.edges.y2) &&
near(client_leaf->item.clip->radii[0], 10 * .85 * .5));
- resolve(p, 1, 0, 0, 0, 0, NULL);
+ resolve(p, 1, 0, 0, 0, 0, NULL, true);
// A popup lives under its parent's tree but is no part of the window's shape;
// its siblings, such as subsurfaces, still are. The barrier can be lifted.
@@ -506,28 +566,28 @@ static void test_clip_projection(struct wlr_scene *scene) {
rediwm_node_set_position(&popup->node, 90, 70); // Hanging outside the 120x80 frame.
assert(rediwm_projection_set_tree_unclipped(&popup->node, true));
assert(rediwm_projection_set_tree_unclipped(&popup->node, true)); // Idempotent.
- resolve(p, 1, 0, 0, 0, 0, NULL);
+ resolve(p, 1, 0, 0, 0, 0, NULL, true);
struct leaf *popup_leaf = leaf_of(p, &popup_content->node), *sub_leaf = leaf_of(p, &sub_content->node);
assert(!popup_leaf->item.clip && sub_leaf->item.clip && client_leaf->item.clip);
assert(rediwm_projection_set_tree_unclipped(&popup->node, false));
assert(rediwm_projection_set_tree_unclipped(&popup->node, false)); // Nothing to lift is fine.
- resolve(p, 1, 0, 0, 0, 0, NULL);
+ resolve(p, 1, 0, 0, 0, 0, NULL, true);
assert(popup_leaf->item.clip);
assert(rediwm_projection_set_tree_unclipped(&popup->node, true));
// A barrier does not hide a clip the subtree sets for itself.
struct rediwm_clip_spec own = {.width = 50, .height = 40, .radii = {3, 3, 3, 3}};
assert(rediwm_projection_set_tree_clip(&popup->node, &own));
- resolve(p, 1, 0, 0, 0, 0, NULL);
+ resolve(p, 1, 0, 0, 0, 0, NULL, true);
assert(popup_leaf->item.clip && near(popup_leaf->item.clip->edges.x2 - popup_leaf->item.clip->edges.x1, .85 * .5 * 50));
assert(rediwm_projection_set_tree_clip(&popup->node, NULL));
- resolve(p, 1, 0, 0, 0, 0, NULL);
+ resolve(p, 1, 0, 0, 0, 0, NULL, true);
assert(!popup_leaf->item.clip);
assert(rediwm_projection_set_tree_unclipped(&popup->node, false));
// An inner clipped tree shapes its own leaves only.
struct rediwm_clip_spec inner_spec = {.width = 30, .height = 20, .radii = {4, 4, 4, 4}};
assert(rediwm_projection_set_tree_clip(&nested->node, &inner_spec));
- resolve(p, 1, 0, 0, 0, 0, NULL);
+ resolve(p, 1, 0, 0, 0, 0, NULL, true);
assert(near(client_leaf->item.clip->edges.x2 - client_leaf->item.clip->edges.x1, .85 * .5 * 30));
assert(near(title_leaf->item.clip->edges.x2 - title_leaf->item.clip->edges.x1, .85 * 120));
assert(rediwm_projection_set_tree_clip(&nested->node, NULL));
@@ -538,15 +598,15 @@ static void test_clip_projection(struct wlr_scene *scene) {
{.width = 120, .height = 80, .radii = {1, -1, 1, 1}}, {.width = 120, .height = 80, .radii = {NAN, 1, 1, 1}},
{.width = 120, .height = 80, .border = INFINITY}};
for (size_t i = 0; i < sizeof(bad) / sizeof(bad[0]); ++i) assert(!rediwm_projection_set_tree_clip(&frame->node, &bad[i]));
- resolve(p, 1, 0, 0, 0, 0, NULL);
+ resolve(p, 1, 0, 0, 0, 0, NULL, true);
assert(near(client_leaf->item.clip->edges.x2, want.edges.x2));
spec.width = 200;
assert(rediwm_projection_set_tree_clip(&frame->node, &spec));
- resolve(p, 1, 0, 0, 0, 0, NULL);
+ resolve(p, 1, 0, 0, 0, 0, NULL, true);
assert(near(client_leaf->item.clip->edges.x2, 37 + .85 * 200));
assert(rediwm_projection_set_tree_clip(&frame->node, NULL));
assert(rediwm_projection_set_tree_clip(&frame->node, NULL)); // Removing nothing is fine.
- resolve(p, 1, 0, 0, 0, 0, NULL);
+ resolve(p, 1, 0, 0, 0, 0, NULL, true);
assert(!client_leaf->item.clip && !border_leaf->item.clip);
// Presenting a clipped graph changes nothing about the view tree yet: the
@@ -1456,6 +1516,7 @@ int main(void) {
rediwm_projection_destroy(p);
test_groups(scene, out);
test_graph(scene);
+ test_clean_sync(scene);
test_clip_geometry();
test_clip_opaque();
test_clip_projection(scene);