--- a/sway/desktop/layer_shell.c +++ b/sway/desktop/layer_shell.c @@ -1,3 +1,6 @@ +#include +#include +#include "sway/tree/root.h" #include #include #include @@ -340,7 +343,26 @@ struct wlr_layer_surface_v1 *layer_surface = surface->layer_surface; - // Rerender the optimized blur on change + /* WHY: verify actual source ownership before interpreting cache invalidation. + * CONTRACT: passive private trace; reads borrowed scene/surface pointers. + * INVARIANT: no extra dirty call or change to commit/arrangement order. */ + if (getenv("OPT_TRACE")) { + struct timespec t; clock_gettime(CLOCK_MONOTONIC, &t); + struct wlr_surface *s = layer_surface->surface; + int x = 0, y = 0; bool valid = wlr_scene_node_coords(&surface->scene->tree->node, &x, &y); + fprintf(stderr, "OPT_BACKGROUND_COMMIT ns=%lld output=%s surface=%p resource=%u buffer=%p seq=%u layer=%u mapped=%d coords=%d,%d valid=%d tree=%p parent=%p layer_parent=%p background=%p background_parent=%p global_background=%p bottom=%p blur_tree=%p opt_node=%p opt_parent=%p damage=%d,%d,%d,%d namespace=%s\n", + (long long)t.tv_sec * 1000000000LL + t.tv_nsec, surface->output ? surface->output->wlr_output->name : "none", + (void *)s, wl_resource_get_id(s->resource), (void *)s->buffer, s->current.seq, layer_surface->current.layer, s->mapped, x, y, valid, + (void *)surface->scene->tree, (void *)surface->scene->tree->node.parent, (void *)surface->tree->node.parent, + surface->output ? (void *)surface->output->layers.shell_background : NULL, + surface->output ? (void *)surface->output->layers.shell_background->node.parent : NULL, (void *)root->layers.shell_background, + surface->output ? (void *)surface->output->layers.shell_bottom : NULL, + (void *)root->layers.blur_tree, surface->output ? (void *)surface->output->layers.blur_layer : NULL, + surface->output ? (void *)surface->output->layers.blur_layer->node.parent : NULL, + s->buffer_damage.extents.x1, s->buffer_damage.extents.y1, s->buffer_damage.extents.x2, s->buffer_damage.extents.y2, + layer_surface->namespace); + } + // Rerender the optimized blur on change if (layer_surface->current.layer == ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND || layer_surface->current.layer == ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM) {