Galaxy Shell / docs
Docs / Decisions and plans

Glass from the alpha channel: shape in the buffer, effect in the compositor (the part that did not land)

openspec/changes/glass-alpha-mask/design.md · Edit on GitHub ↗

This document records decisions, plans or evidence from a project stage. It does not imply that every item is implemented or validated in the current version.

On this page

Glass from the alpha channel: shape in the buffer, effect in the compositor (the part that did not land)

The landed part and the current rules are in openspec/specs/glass-alpha-mask/spec.md. The sections below are the original text of the doc, unchanged.

What the side channel costs

These costs come from the contract, not from the process split as such.

  • The glass lags the content. The pixels of a scrolled or resized bubble reach the compositor in a wl_surface commit at frame N. Its rectangle travels DOM measurement, HTTP, core validation and the control socket, and lands in the compositor state one or more frames later. During a scroll the blur and the rim are drawn where the bubble was. The reporter only sends on a change and the host flags bubbles with data-chat-glass only after a drawn frame (chatGlassDrawn), which hides part of the lag by keeping a plain tint while the glass is not there yet; it does not remove it.
  • Sixteen regions, half of the pixel budget. MAX_CHAT_REGIONS is 16 and the chat shares at most MAX_PIXELS / 2. A long visible conversation, or a chat on a large output, drops the glass of the lower bubbles. Each region is a separate offscreen target and two separate passes.
  • Only rounded rectangles. card_distance knows one shape. A pill with a tail, a card with a notch, a bubble that follows an inline component, or any organic form that liquid glass invites, cannot be described.
  • The design lives in two places. Radius, blur strength and saturation are constants in CSS and in Rust (BAR_BLUR, BAR_SATURATE_PERCENT), kept equal by hand. The host also carries a parallel geometry model of the UI that React already laid out.
  • Three validation layers for geometry. Reporter, barGlassGeometry in the core and BarGlass::valid in the compositor each check the same integers. This is correct for a side channel; it is work that a per-pixel contract does not need.

The other cost: client buffers cross the CPU (verified 2026-11-04)

Phase 1 below fixes this in the code; this section records the state before it. The first version of this record said that web pixels already reach the compositor as GPU buffers. That was wrong. The compositor offers clients no way to share GPU buffers:

  • native/smithay/src has no delegate_dmabuf!, no DmabufState and no wl_drm. The only buffer global is wl_shm (handlers/compositor.rs). The one mention of dmabuf is the output format list in drm.rs.
  • In the live session on this date, the compositor process maps memfd:shared-memory-* and .org.chromium.Chromium.* regions. The largest is 8.4 MB, the size of one 1920x1080 ARGB frame (8.3 MB). The two outputs are 1920x1080.
  • The product GPU process runs on the real driver (renderD128, Mesa gallium on amdgpu, a Polaris card) and its renderer has no --disable-gpu-compositing.

So each web frame, and each frame of every other client, reaches the compositor as CPU-visible memory that it uploads to a texture. The way Chromium fills that memory from its GPU work was not inspected; a readback is the likely path. This is the part of the owner's observation that this record first dismissed: the split costs far more today than it has to. It is a missing protocol in the compositor, not a property of Electron or of separate processes, and it affects every application on the desktop. The blur still runs on the compositor GPU in any architecture, and one frame of composition latency remains for every Wayland client, including an embedded engine that renders in its own web process.

Paths considered

Path Lag of the shape Shapes Cost of the change
Keep the rectangles over HTTP (today) One or more frames Rounded rectangles None; the lag and the limits stay
Embed a web engine in the compositor Still needs a channel Whatever the channel Engine change (WPE/CEF: WebKit or a second Chromium integration), loss of the Electron trust model of the host, failure coupling; the DOM is still invisible to the shader
Electron offscreen with a shared texture Still needs a channel Whatever the channel A native module and a DMA-BUF bridge to validate; keeps Electron; does not describe shapes
Shape in the alpha channel (proposed) None (same commit) Any A shader that reads the mask and a tile budget in Smithay; CSS that draws the material with a known alpha; the HTTP route becomes a fallback
A second "material" surface None for the same vsync Any, with parameters A second transparent Electron window per chat; two commits that are not atomic

Embedding the engine was the question that started this record. It does not solve the problem: an engine inside the compositor process still produces a buffer and still knows nothing about which DOM nodes are glass, so a channel from JavaScript to the shader remains, only faster. It also moves layout and script execution into the process that serves input and presentation, which the earlier assessment rejected for failure isolation, and the recovery principle of the project requires the recovery UI to survive the UI it recovers.

Proposal: the shape travels in the buffer

The web UI draws every glass surface with a translucent fill whose alpha is in a reserved band, and everything else fully transparent (alpha 0) or fully opaque (alpha 1). The compositor treats the pixels of the window whose alpha is inside the band as glass: it blurs, saturates and refracts the scene behind them, then composites the window on top as usual. Hyprland has a comparable threshold in its ignorealpha layer rule, and KWin takes a blur region protocol instead (both from memory, their documentation was not opened for this record). Here the band is a contract of the trusted CSS only.

Consequences:

  • Geometry and pixels arrive in the same wl_surface commit. The glass can not lag the bubble, whatever the scroll speed, and no HTTP, core route, validation or control command carries geometry.
  • Any shape. The outward normal that glass.wgsl (glass.frag before 2026-11-11) takes from card_distance comes from the gradient of the mask instead, and the rim distance from a short distance transform of the mask edge. The lens and the lit rim stay as they are.
  • No region count. The budget is the area of the tiles that contain glass pixels, not a number of rectangles.
  • One source of truth. The CSS of the trusted React decides radius, shape and tint; the compositor decides blur strength and saturation of the material, as today, from visual_style or a fixed material per band.
  • Less code. measureChatGlassRegions, the regions reporter, the chat_glass_regions command and its three validations become a fallback for a compositor without the capability, then history.

Shader sketch

The mask pass renders the surface tree of the window into an offscreen target. It does not read one texture, because a client can use subsurfaces, and Chromium may start to once dmabuf exists. The passes run over the window rectangle on the output, at reduced resolution:

  1. Mask and tiles. Write a one-channel mask, m = 1 where lo < alpha < hi and 0 elsewhere, at half resolution. A morphological opening of a few pixels then removes thin features, and a closing fills the holes of text and small controls inside a surface (see the alpha band below, and the histogram of phase 0). Reduce the result to a coarse tile grid (for example 32 px) that marks the tiles with any glass pixel. Tiles without glass skip the remaining passes.
  2. Distance and normal. A small separable blur or a two-step jump flood of m gives a soft coverage whose gradient is the edge normal and whose value stands in for the signed distance within the rim band (18 px today). This replaces card_distance and its analytic gradient.
  3. Blur, saturate, refract. The existing two Gaussian passes over the scene behind the window, run only on the marked tiles and at half or quarter resolution, with the lens offset along the mask normal and the rim from the mask distance. Upsample bilinearly to the output.

The window is then drawn over the result exactly as now. A custom shader that samples a client buffer must work with both sampler2D and samplerExternalOES, because imported dmabufs can arrive as external textures.

The alpha band

The chat window is already transparent on Smithay (desktopWindowOptions in web-shell/core/desktop-window-options.cjs). The first version of this record proposed the band 0.35 < alpha < 0.85 and said that the current material falls inside it. It does not. --material-glass-blurred in vendor/interface/host/theme.css was then a 22% veil under a sheen of 14% to 4%, which composes to an alpha of about 0.25 to 0.33 before the grain (a 75% veil under a sheen of 6% to 2% since 2026-11-04, see openspec/specs/web-panels/spec.md). The band must start lower, and the first candidate is 0.2 < alpha < 0.6, which the nested histogram of phase 0 supports.

Three things can leave false glass, and the plan must test each one:

  • Shadows. --shadow-surface reaches 16% and --shadow-bar 24% before their blur, so the margin to the material is small and the bar may overlap it.
  • Text and icons on a fully transparent background. Every antialiased edge crosses the band, so a label drawn directly on the transparent chat would get blur and a lit rim around its glyphs. The opening in the mask pass is meant to remove these thin fringes; inside a glass surface they cause no harm, because the mask is already set there.
  • Fades and translucent controls. A mask-image fade, a scrollbar thumb or a hover tint that crosses the band becomes a strip of glass. The rule of the trusted CSS is that non-glass translucency stays below lo, or above hi.

The compositor announces capabilities.alphaGlass. A host on an older compositor keeps the regions reporter; a host on a new compositor sends an empty region list and relies on the mask. The protected setting that turns the chat glass off keeps its meaning: off means the compositor skips the mask passes for that window and the CSS draws the solid fallback.

Budget and cost model

Today: up to 24 offscreen targets (MAX_PANELS) and 8,388,608 pixels, of which the chat takes at most half, in two full-resolution passes each, with the horizontal pass reused when the backdrop did not change.

Proposed: one mask pass per glass window at half resolution, and the blur passes only over marked tiles at half or quarter resolution. On a 1920x1080 output, a chat window that covers the output costs one mask pass of about 0.5 Mpx. Bubbles that cover a third of the window blur about 0.17 Mpx per pass at half resolution, against about 0.7 Mpx at full resolution today, plus the blur margin of each region. These are arithmetic estimates from the sizes, not measurements, and the mask pass is new work that the regions do not have.

The reuse rule changes: the horizontal pass can be reused only when neither the backdrop nor the mask changed. The mask pass takes the damage of the window surface, and the blur passes take the damage of the scene behind it.

What stays per element, and what does not

The mask carries shape and coverage. It does not carry per-element parameters such as thickness, refraction strength or a different blur for a card and a bubble. Two ways exist, in order of cost:

  1. A few bands. Two sub-ranges of the band select two materials. Cheap, two or three materials, chosen in CSS.
  2. A material surface. A second transparent Electron window on the same placement, with setIgnoreMouseEvents(true), draws RGB as normal and thickness and alpha as coverage. Both windows commit on the same vsync in Chromium, but Wayland does not make them atomic; a frame where they differ is possible during a resize. Only if a real design needs it.

The plan starts with one band and one material, the current liquid one.

Implementation plan

Each phase is its own commit and passes the gates of AGENTS.md. Publishing, build, next login and real activation stay separate steps. Live checks need the user. The dmabuf phase comes first because it is the larger measured gap, it helps every application, and the glass measurements would be misleading without it.

Phase 0: baseline, before any product change

In the nested session (scripts/nested-qa.py, synthetic profile), then once on the real session with the user, following the measurement protocol:

  1. Scroll a long synthetic conversation and resize the chat. Record CPU per process (scripts/benchmark-processes.py) and compositor phases (RUST_LOG=frame_timing=info).
  2. Count the frames between a bubble moving and its glass moving, from a capture and the frame timing. If the direct session shows less than one frame, phase 2 and later close, and this record says so. Phase 1 does not depend on this result.
  3. Read one frame of the chat window and histogram its alpha, for each glass surface, shadow and fade.

Results of 2026-11-04, nested only, run c1248e40 and the alpha frame of run 2bc00dab: compositor and host on the GPU with linux-dmabuf (the live compositor had it by then), one 1848x984 output at 60 Hz, a fixed PNG wallpaper, a synthetic conversation of 200 messages, no provider. The numbers came from a build that was never published: it added log lines for each commit of the chat, each chat_glass_regions and each frame, logged the regions held at a window capture, and allowed that capture of the chat, only while test_input is on. The state of the control socket alone answers about every 45 ms, too coarse to count frames.

Measure Result
One wheel step, first commit to first report (40 steps) median 3 ms, 0 frames; p95 75 ms, 4 frames; the report sometimes came first (-13 ms)
Sustained scroll, commits and reports per second about 60 and about 30
Sustained scroll, offset from the bubble edge in the buffer to the glass of the same frame 6 runs of 60 samples: median 0 to 7 px, p95 3 to 23 px; 15% to 97% of the samples off by 1 px or more
CPU at rest, host tree and compositor (10 s, 100% is one logical CPU) 8.8% and 3.8%
CPU in the sustained scroll with window captures, one run of 10 s 56% and 19%

Reading: a single step hides the lag, because Chromium commits and the report leaves on the same frame. A sustained scroll does not: the report takes the HTTP round trip and allows one in flight (createBarGlassReporter), so at most about every other frame carries a new shape. The offset can read low, because each edge of a region compares with the nearest edge in the buffer, which may belong to the next bubble. It varies a lot between runs at the same wheel step. The test input goes through the control socket, so its wheel events do not arrive at each frame like a touchpad. The direct session was not measured: the owner dropped that test on 2026-11-04 (see the decision under phase 3).

Alpha of one frame of the chat, at rest, read from the real buffer, 6 regions, 739x684:

Zone Alpha in 0.2 to 0.6 Median alpha
Inside the regions, 3 px in from the edge 93.0% 0.314
The region edge, 3 px 94.9% 0.318
The shadow ring, 24 px outside 0.24% 0.000
The rest of the window 0.60% 0.000
  • The first candidate band holds: 89% of the inside lies in 0.25 to 0.35, and narrowing the band to 0.25 to 0.4 changes little.
  • False glass in this frame: 530 pixels outside the regions, all 24 small marks of about 10x3 at the left of the conversation. An opening of 2 px removes them all and keeps 94.4% of the band pixels inside the regions.
  • A case this record missed: text and solid controls inside a glass surface sit above the band and leave holes in the mask, in the shape of each glyph. The mask pass needs a closing as well as an opening, or the blur fails under the text.
  • Not covered: hover and focus states, inline components, the settings panel, the review card, and a light profile color. This is one frame in a fixed state.

Phase 1: linux-dmabuf for clients

Built on 2026-11-04 (native/smithay/src/dmabuf.rs). Published and tested on the GPU, not yet active in the session in use: that needs a new login. This change is independent of glass and is useful alone.

  • The compositor announces zwp_linux_dmabuf_v1 v4 from renderer.dmabuf_formats() and the render node of the device, in drm.rs (and, until step 8 of the GLES removal, the GLES winit.rs). The compositor state does not hold the renderer, so dmabuf_imported queues the buffer and its ImportNotifier, and the render path drains the queue. A failed import fails that buffer only.
  • The global is announced once, and never without formats. A software renderer (the llvmpipe of a nested compositor on a parent without dmabuf) or a device without a name stays on wl_shm: llvmpipe announced formats that it then failed to map.
  • A commit whose dmabuf has an unsignalled implicit fence waits until the fence is ready (a hold, with a commit blocker and its own copy of the plane fds). Only that surface tree waits. A descriptor that is no dmabuf is refused at once.
  • The frame waits for the GPU for at most 32 ms (wait_for_render), then goes to KMS, which honours the implicit fence. A client can start a GPU job after its commit, which no check at commit time sees, so the hold alone does not protect the event loop. With the limit, input, the lock page and IPC go on while the picture waits. An unfinished frame confirms no lock: a later frame does. A preview gives up after 100 ms, and an output or offscreen capture waits 1 s for its frame and then fails once.
  • A client is disconnected above 64 holds, or when its commits after its oldest hold pass a budget of 1024 plus 512 for each second of that hold, up to 4096. A commit weighs as many as the surfaces of its tree. Smithay rescans its transaction queue at every commit, and the count is per client because a client can change its surface tree while a commit waits. Once per frame the render path drops the holds of destroyed surfaces and gone clients, whose fence may never signal. Out of descriptors, a commit goes on unheld.
  • An accept error no longer ends the session: the compositor logs it and retries every 250 ms, so a connection is taken as soon as a descriptor is free.
  • A create_immed client whose import fails at the next frame loses its connection, as the protocol asks. This applies to the Electron host too, and the rollback file is the way out of a restart loop. An import failure logs a warning, at most once per minute.
  • Rollback: --no-dmabuf. At login the file ~/.config/agent-native-os/no-dmabuf adds the flag, and an older known-good binary that lacks the flag starts without it. scripts/nested-qa.py start --no-dmabuf passes it to a nested run.
  • Observation: state --full has capabilities.dmabuf and clientBufferCommits with the counts of dmabuf and shm commits. The compositor log has one line, for example Agent Native DRM: linux-dmabuf on, N formats.
  • Not in scope: drm_syncobj explicit sync (the target card is amdgpu, which has implicit sync), direct scanout and overlay planes.

Measured on 2026-11-04 with real_electron_frames_reach_the_screen_through_dmabuf, an ignored test: a real Electron from web-shell/node_modules, on the hardware device, a private socket and a test compositor, 1920x1080 with a full-window animated canvas, interleaved rounds of 10 s each, nine pairs in three runs while other work used the machine. One logical CPU is 100%. This is not the real desktop.

Path Commits Electron tree CPU Compositor CPU
dmabuf 510 to 599 dmabuf, 0 shm 9% to 15% 6% to 10%
wl_shm 505 to 581 shm, 0 dmabuf 18% to 30% 9% to 13%

The gain depends on the damage area: an earlier page with small damage showed no gain.

Checked: every texture shader that ships (glass, window_finish, canvas_warp, elastic, and the studio effects) has the EXTERNAL branch that a YUV buffer needs; outline and shadow are pixel shaders and sample nothing. No code reads client memory directly, so capture, previews and sharp zoom draw the same imported texture. A theme fragment without that branch draws a YUV client wrong, while RGB buffers stay correct (openspec/specs/themes/spec.md). What still needs the live session is listed in Not verified.

The nested session cannot prove the hardware path while the compositor in use has no dmabuf: the nested compositor falls to software and stays on wl_shm.

Phase 2: mask prototype behind a nested-only flag

Built and measured on 2026-11-04, then replaced by phase 3, which removed the flag --glass-mask of the compositor and of scripts/nested-qa.py. This section is the record of the prototype: the flag, the single target and the rule on chatGlassDrawn below are history. The pipeline, the ramp, the morphology and the tables stay valid as measurements of that code.

The tests named here that need EGL are ignored and hold their asserts only when someone runs them, on a machine with a GPU:

python3 scripts/prepare-project.py --root "$PWD" --cargo test --locked --features session glass_mask -- --ignored --nocapture --test-threads=1

Review round 1 changed the first version in two ways that this section already includes: the band 0.2 < alpha < 0.6 of the proposal lost its upper limit, and the default divisor went from 1 to 2.

What was built (native/smithay/src/glass_mask.rs and, as GLSL until 2026-11-11, glass_mask.frag and glass_mask_final.frag, now glass_mask.wgsl and glass_mask_final.wgsl):

  • With the flag, the primary chat under the conditions of chat_region_requests gets one glass over its whole window. An empty report still means no glass, so the protected setting keeps its meaning; a non-empty one only says that the glass is on, and its rectangles are not drawn. The frame reports chatGlassDrawn equal to the length of the list, which is what syncChatGlassFlag needs for the lighter tint. Under the flag that number counts the reported regions and does not prove glass behind each one: a region whose pixels stay under the alpha limit gets the lighter tint with no glass. The host does not change for this prototype. A chat drawn at another size gets no glass, as with the regions. A locked frame returns before this path (tested by native_wgpu_chat_mask_follows_the_alpha_and_ignores_the_regions, ignored, needs a GPU).
  • Mask pass: the surface tree through the normal render elements, offscreen with RGBA, at half resolution; a ramp of alpha from 0.18 to 0.25 (it was alpha > 0.2, see the rim step below); an opening of radius 1 texel (2 window px), then a closing of radius 2 texels (4 window px, so it fills gaps up to 8 px). An opaque pixel is glass under itself: with the upper limit of 0.6, opaque pixels left a lit ring around the send button and sharp backdrop in the counters of glyphs (off by 39, 77 and 22 levels in the GLES test egl_opaque_pixels_leave_no_hole_in_the_glass, deleted 2026-11-11, mirror native_wgpu_opaque_pixels_leave_no_hole_in_the_glass; 1 level without the limit). Why these radii: without the opening the marks stay, and radius 4 of the closing merges the 16 px gap between bubbles (6922 false half-resolution pixels). Without the limit the real frame no longer depends on the closing (table below); the closing stays for translucent content with fine gaps.
  • Soft mask, half resolution: red is the closed mask under a five tap binomial (1 4 6 4 1, since 2026-11-16), the coverage and the thin rim line. Until then it was a three tap tent, which is wider along a diagonal than along an axis and left the 2 px step of the mask in the edge: the lit line of a rounded corner came out stepped and thicker there, and the owner read the corners of the composer and of the Lumen dock as cut ("meio quadriculado"). With the binomial the line ends at 0.62 and 0.90 of red, not 0.65 and 0.975, so a strip of a few pixels stays as dim as the analytic glass (native_wgpu_a_free_thin_strip_matches_the_analytic_glass); green is a Gaussian of 9 window px, whose gradient is the normal and whose logit stands in for the distance. A free strip under about 12 px has no green above 0.5 anywhere (a strip against the edge of the window has more, from the clamp), so in the final pass red bounds the distance, and the lens and the glow scale with the short side as in glass.frag, the lens up to a full band at 60 px. The short side comes from the ridge of green, read at 8, 16 and 24 px inward, so it is a coarse estimate that can step inside a shape, and it saturates near 66 px. The glow reaches its full band there, not at the 104 px of glass.frag, so it is a little wide from 48 to 104 px. Without this, a free 6 or 10 px strip was lit 34 levels above the regions; with it, 2 at most. Free 24, 40 and 120 px strips are off by 3, 10 and 2 (one measurement; the test allows 12, and 4 for the 120 px strip) (native_wgpu_a_free_thin_strip_matches_the_analytic_glass, ignored, needs a GPU).
  • Final pass: on unit 1 a wrapping element binds the mask and restores the active unit. The look is the lens, the saturate and the rim of glass.frag, with the same material.
  • Blur: the two Gaussian passes of glass.frag over the padded window, at a divisor of 1, 2 or 4 as a constructor parameter (a box downsample first). The flag runs divisor 2.
  • Skipping work: an early return in the final pass where the coverage is 0. No tile skip in the horizontal pass: it needs a reduce and a dilate pass and a sampler, and the Gaussian reach of 74 px plus the lens makes it blur nearly the whole window in the real scene. Its cost shows in the sparse row below. Without it the horizontal pass does not depend on the mask, so a scroll over a still backdrop reuses it, which is better than the rule of "Budget and cost model" above.
  • Damage: the mask recomputes on the damage of the surface tree, the blur on the damage of the scene behind. The element keeps its id and commit while neither changes, and a static frame runs no pass and damages nothing (tested by native_wgpu_static_glass_does_not_invalidate_the_output, ignored, needs EGL). A change damages the whole window. The targets cost at most MAX_PIXELS, checked before any allocation (the_budget_runs_before_any_allocation, a normal test, and native_wgpu_a_window_over_the_budget_draws_no_glass, ignored, needs a GPU); failure draws no glass with one warning. Only the main scene releases the targets, so a transition keeps them; a locked frame keeps them too, unused (accepted).

The 2 px rim step, fixed for phase 3. The mask started as a hard limit at alpha 0.2 at half resolution, so a bubble edge at an odd window row fell in the middle of a texel, whose alpha is half of the tint, and the limit cut through it as the tint changed along the edge: 118 of 305 texels passed in the phase 0 frame, and the rim stepped by 2 px. The threshold is now a ramp, smoothstep(0.18, 0.25, a). The shadows of the phase 0 frame end at 0.18 and its tints start at 0.25 (only 139 pixels between them), so the ramp keeps both results and an odd edge takes a partial value. With a tint from 0.37 to 0.42 along an odd edge, the largest change between neighbor columns went from 61 levels to 3 (native_wgpu_a_rim_at_an_odd_row_has_no_step, ignored, needs a GPU, allows 6). With the ramp the false glass of the table below reads: text on transparent 1.43%, a fade 56.6%, the rest unchanged.

The tables below are one-off measurements, printed by the ignored tests or by scripts outside Git. No test holds their values, only the coarser bounds named next to them. All are at the current code: no upper limit, thin shape fix.

GPU and wall time, offscreen, on the real GPU (AMD RX 550, radeonsi), debug build, the machine in normal use, with the six regions of the real chat in a 739x684 window on a 1280x800 output, 120 frames after 20 of warm-up, round 1 of two. GPU medians of the rounds agree within 0.1 ms; wall p95 varies more, up to 11 ms in round 2, from other work on the machine. GPU is GL_TIME_ELAPSED (EXT_disjoint_timer_query); wall reaches a glFinish and includes the debug Rust. "Changing" has a new backdrop and new bubble text in every frame. "Static" repaints the output with age 0 and reuses every pass, the case of the nested backend. Regions has no divisor: it is the pipeline as it ships.

Pipeline Changing, GPU median / p95 ms Changing, wall median / p95 ms Static, GPU median / p95 ms
Regions 3.52 / 3.84 3.85 / 4.62 0.72 / 0.88
Mask, divisor 1 2.55 / 2.56 4.23 / 4.54 0.94 / 1.04
Mask, divisor 2 (default) 1.29 / 1.30 3.13 / 6.38 0.59 / 0.60
Mask, divisor 4 1.06 / 1.06 2.92 / 7.57 0.49 / 0.50

A sparse window, the composer alone, changing, is the one case where the mask costs more: regions 0.66 ms; mask 2.01, 0.98 and 0.82 ms at divisors 1, 2 and 4.

CPU frame timing, nested with real Electron, median of 13 windows of 2 s over the same scripted scrolls and captures, average / p95 ms; no GPU time. Scene 0.68 / 1.15 with the mask at divisor 2 and 0.73 / 1.52 with the flag off; render 0.16 / 0.22 and 0.18 / 0.25; total 0.97 / 1.32 and 1.06 / 1.83. In this run the mask shows no CPU increase over the flag off; the first version at divisor 1 did show one, 0.59 against 0.22 in the scene, in a run with less scrolling, so these are not a stable comparison.

Pixel diff against the regions frame, inside the window, on the same scene (of 255, RGB). The tests hold only a mean under 3.0 on the synthetic scene:

Scene Divisor Mean abs diff Pixels off by more than 8 At region edges Inside Outside
Synthetic 1 1.30 4.90% 20.0% 3.7% 0.0%
Synthetic 2 1.33 4.88% 20.1% 3.6% 0.0%
Synthetic 4 1.34 4.90% 20.0% 3.7% 0.0%
Real frame 1 1.14 3.82% 15.6% 2.9% 0.0%
Real frame 2 1.17 3.80% 15.7% 2.8% 0.0%
Real frame 4 1.18 3.82% 15.6% 2.9% 0.0%

The largest blocks are the rim of the composer at its corner, the bubble clipped at the top of the window, and the rim at corners. The first version, with the band and without the thin shape fix, had means of 1.52 and 1.99 at divisor 1. The real frame is the phase 0 buffer, with its synthetic text, read once and not committed. The divisor changes almost nothing here.

Limit and morphology on that real frame, in half resolution pixels (one-off, no test):

Open Close Regions covered False glass outside
1 2 (default) 99.30% 95
0 2 99.31% 155
1 0 99.30% 95
1 3 99.30% 95
1 4 99.36% 6922 (gaps merged)

The 95 sit within about 1 px of a region edge; with the band, a simulation of the frame found no mark among them. With the band, the default covered 97.40%.

False glass, each case asserted in native_wgpu_false_glass_cases (ignored, needs a GPU):

Case Result
--shadow-surface (16%), --shadow-bar (24%, 3 px), and 24% with 0 8px 24px Removed: 0 pixels. They stay under 0.2 at the bubble edge
A shadow that shows its full 24% past the bubble (0 40px 16px) Remains, 11476 pixels. A rule for the CSS
The 10x3 marks Removed: 0% with the opening, 3.4% without
Text on a transparent background 2.5% left (asserted under 3%), 13.7% without morphology
A 16 px line icon on transparent Removed: 0%
A 24 px solid icon on transparent Glass under itself, 54.7% of its 32 px box (asserted over 50%), none past it. Its own pixels cover it, except in its antialiased edge
A fade from alpha 0 to 0.5 Remains: 60% of the fade, every row above 0.2. A rule for the CSS
A hover tint of 30% Remains, 100%. A rule for the CSS; a tint of 12% is no glass
A scrollbar thumb 6 px wide at 35% Removed: 0%. A wider one would remain
The gap of 16 px between two bubbles Survives: 0%
A bubble with opaque text 100% covered

Small terminal text behind a blank bubble, with the terminal scrolling 1 px per frame. The test holds every value under 1.0:

Pipeline Laplacian RMS inside the bubble Mean frame to frame luma change / largest (of 255)
Regions 0.456 0.034 / 0.038
Mask, divisor 1 0.455 0.034 / 0.037
Mask, divisor 2 (default) 0.787 0.228 / 0.395
Mask, divisor 4 0.741 0.132 / 0.327

No legible text leaks at any divisor, by these values, all under one level of 255, and by eye on the first version. The reduced blur has a few times more residual and motion, still below one level.

Nested with real Electron, one 1848x984 output, a fixed checkered wallpaper, 200 synthetic messages, in one session of work: flag on at divisor 2 (run cdf07330) and flag off (a029bd1e). The clients used dmabuf, with 0 wl_shm commits. At rest the composer and the marks at the left are right, the ring around the send button and the flecks at the glyphs of the first version are gone, and the top bar and the bottom bar do not change, because their glass is not this path. With the flag chatGlassDrawn was 6 of 6 (see above for what it counts), and no "unavailable" warning appeared in the logs. The bubble edge at an odd row shows the step of the known defect.

During a wheel scroll, each capture was compared with a capture of the wallpaper, at the vertical edges of the checkers: a row that is still sharp but tinted is a place where the tint moved and the glass did not. One-off, by a script outside Git:

Run Tinted and sharp rows of 6312, rest Fast scroll, -6 per 16 ms, 8 captures Slow scroll, -1 per 16 ms, 12 captures
Flag off 145 147 to 1044; 5 captures from 832, with runs of 16 px 122 to 847; 6 captures from 697, with runs of 12 px
Flag on, divisor 2 166 155 to 193, runs of 2 to 3 px 141 to 185, runs of 2 px

In the captures with the flag off the bubbles and their glass are visibly apart. These runs scrolled under captures, so this is not a new lag number. With the flag on no capture shows them apart. By construction the mask and the window come from the same surface state in the same frame, and native_wgpu_chat_mask_follows_the_alpha_and_ignores_the_regions (ignored, needs a GPU) proves that a commit moves the glass in that frame, with the earlier place sharp.

Shimmer at divisor 2, from the 12 captures of the slow scroll over the still wallpaper: inside the composer, which does not scroll, consecutive captures are identical (mean and largest change 0), and a montage of the moving bubbles at 2x shows no pattern moving inside the blur. This is weak evidence. The backdrop stood still, so the half resolution blur had nothing to alias, and captures are a few stills of a moving picture, not the motion that an eye sees on a panel. A backdrop that moves under the glass was tested only offscreen, in the terminal table above. The odd row step should alternate as a bubble scrolls 1 px at a time; that is inferred from the still and was not observed as motion.

Not verified by this phase: see Not verified.

Phase 3: the contract for the chat

The owner dropped the direct session measurement on 2026-11-04 and the plan goes on: "podemos ignorar esse teste? quando eu ver problema te aviso", then "podemos continuar o plano". So the closing condition of phase 0 no longer applies, and phase 3 is not gated on a lag number. No lag number exists for the direct session, so this is no proof that the lag there is below one frame or above it; the owner will report a problem if one shows. If the question comes back: the window capture refuses the chat ("Shell is protected") and the release build has no probe log, so a measurement compares the text travel in the composed frame with the regions read before and after each capture, which gives a lower and an upper bound; a nested run of this method held a zero spread of 0 px inside each segment.

Built on 2026-11-04 from the brief of the owner's plan: the mask is the path of the chat, with no setting beyond chatBlur and no fallback besides version skew. Proof so far is the Rust and Node tests, the ignored EGL tests on one GPU and nested runs. Nothing below ran on the direct session or on DRM.

Compositor:

  • capabilities.alphaGlass, and the control command chat_alpha_glass {enabled}. A window connection gets a refusal. It is allowed while locked, because it only says what the normal scene draws.
  • On is a crate::canvas::Lease, the same as canvas_warp: 60 s after the last connection that sent it closes, the regions draw again, so a rollback of the core alone returns to a working path. Off drops the lease at once with no grace, because the user asked for it. A compositor whose core never sent the command behaves as before, with the regions.
  • Every chat that can get regions takes a mask: the primary chat and the output chats, shared views included, under the same conditions as the regions (not locked, no overview, the chat at the size of its window). An output chat on a Canvas workspace gets the mask too, which the regions refused there, unless an older host reported dock glass for it. The mask no longer needs a report, because the host sends none.
  • One target per window in a BTreeMap, released when its window is gone or no longer asks for glass. A failed render drops the target of that window. MAX_PIXELS is one budget over all the mask targets, checked before any allocation. GlassPipeline (plain scene) keeps its own MAX_PIXELS for the bar, the panels and the regions, so the two together can hold about 16.8 Mpx. A chat that covers a 1920x1080 output costs about 5.2 Mpx, so two full screen chats exceed it and the second draws no glass, and a 2560x1440 chat exceeds it alone. The floating chat of the nested run (739x684) fits many times.
  • State: alphaGlassEnabled, and chatAlphaGlass next to chatGlassDrawn, and in each entry of outputChatGlass, whose entry the mask creates when the host reported nothing. True only when the last frame of that output drew the mask. False when the pipeline failed, the budget refused it, the chat drew at another size, in the overview and in a workspace transition. chatGlassDrawn stays 0 under the mask.

Core (core/smithay.js, core/server.js): setChatAlphaGlass from chatBlur, at startup and in /api/chat-blur-enabled. Each state compares the wanted value with the report, sends one request at a time and only with the capability, and sends on once per socket even when the report is equal, since a lease belongs to its connection. A refusal retries after visualStyleRetryMs. validState checks the new fields. The route of the regions refuses nothing new.

Host (host/host.js): the mask counts as active with capabilities.alphaGlass and alphaGlassEnabled together. Then it measures nothing and posts no region, and an empty measurement clears what was reported before. A scroll schedules nothing. data-chat-glass follows chatAlphaGlass of this chat (its entry when it is an output chat), on the body and on each surface and bubble, without the limit of sixteen. A capable compositor without the lease draws regions, so the host reports them again. The core sends the command at startup, after a reconnect and after the setting turns on, so a report of off is normal for a moment: the host waits 2 s (alphaLeaseSettleMs) before it goes back, with no glass in that time, and the return to the mask is at once. Without the capability nothing changed. Recovery still sends its empty list and needs nothing else, since the recovery page is opaque.

CSS: the rule is in the CSS structure. .inline-surface was already opaque. The audit of the trusted chat CSS found one case of false glass, the 60% scrim of the approval dialogs over the whole window. A smaller scrim is no answer: it stacks with what is under it, and at 16% a pixel of alpha 0.024 passes the limit, so faint shadows become rings. So on the desktop the approval ::backdrop is transparent, and while a dialog is open filter: var(--filter-approval-backdrop) (brightness(0.4) blur(4px)) dims each child of the body except the approval dialogs: the frame of #surface, which profile CSS cannot restyle, the composer area and the other dialogs. It is a :has on [open], not a flag, so close, cancel and reload have nothing to clear. A filter makes a containing block, so the frame takes the size of the window while it dims; without that the conversation collapses to a height of 0, which web-shell/scripts/test-approval-browser.js holds.

Accepted limit: application windows and the wallpaper behind the transparent chat window are no longer dimmed by an approval. That includes the agent browser, which needs no approval to open a page, so such a page can stay sharp beside the dialog with reassuring text. Nothing can be approved without a real click on an armed Permitir, and the dialog keeps its fixed palette. The bubbles keep their lit glass rim under the filter, darker inside, because the rim is the compositor's.

Known limits of this version:

  • New host on a capable compositor with an older core: no lease, so the host keeps the regions, after the 2 s of settle at each start. The checkout normally carries all three together.
  • An older host on a new core and compositor still posts its regions, which draw nothing while the mask is on, and it keeps the heavier tint because chatGlassDrawn stays 0.
  • Rectangle checks, the route and the region code stay for version skew. Removing them is a later step.

Results of the acceptance list of the plan: no visible lag in the nested captures (not a measurement; see phase 0 for why a number was dropped), the GPU tables of phase 2 are the same pipeline at divisor 2, the sixteen-region limit is gone from the chat, and a compositor without the capability still gets regions from the host (host-script.test.js). The nested check of the bar and of one panel in the list only saw that they did not change, since their glass is another path and stays so until phase 4.

Nested runs of 2026-11-04 at the rebased code, 1848x984, synthetic conversation of 200 messages, crystals and nebula wallpapers (85163e6b, 3857f849), composed frame captures: capabilities.alphaGlass true, alphaGlassEnabled true, chatAlphaGlass true, chatGlassRegions empty. Composer box, conversation, settings panel, hover on a bubble and a scroll looked right, with the glass under the bubbles and sharp marks at the left. chatBlur off: alphaGlassEnabled and chatAlphaGlass false and no blur; on again: true. Overview: chatAlphaGlass false, back to true after it. With --outputs 2 (d5bad0cf), two chats in the composer box, one per nested output: chatAlphaGlass true at the top level and in the outputChatGlass entry of NESTED-2, which only the mask created, and the glass drawn on both. A shared view on two outputs was not opened in a run; the_mask_covers_the_output_chats_with_or_without_a_report and the EGL test of two targets cover the path. In the first run, clicks and a scroll in the first 20 s or so changed nothing, and the same steps worked later in that run and from the start in 3857f849; the cause is not known.

An approval in the mask (96738e2e, a throwaway copy of the launcher with a debugging port, one output): the synthetic transport did not start in a nested run, so the dialog was forced open over CDP with synthetic content and its close replaced; the host did not ask for it. Backdrop rgba(0, 0, 0, 0), filter on the frame, the conversation at its height. In a capture the dialog is sharp, the text behind cannot be read, and no ring shows around it over the gap between bubbles. Where the opaque dialog meets two bubbles the mask joins them, a neck of glass of a few pixels on the gap beside the dialog. The whole approval flow, on the real host logic, is proof from test-approval-browser.js in headless Chromium, with no compositor.

Compared with origin/main 20699b3 in nested (33abb4cf): the lighter bottom bar on the second output and the bright overview with a ghost of the settings dialog both exist there, so neither comes from this change.

Phase 4: bar pill and panels

Each with its own measurement. Parameters per element (several bands or a material surface) enter only if a real design needs them.

Built on 2026-11-06 for the notification popups and the top bar only, with the declared alpha of a glass (Web panels). The one parameter per element is the closing, off for these windows. The other panels and the bottom bar pill keep the rectangle. Its cost was not measured: both windows are small and their mask only reruns when they commit, but the blur of the scene behind them runs as the scene changes, as for the chat.

Not verified

  • How Chromium fills wl_shm buffers while it composites on the GPU, and what it does when dmabuf appears (subsurfaces, formats and modifiers).
  • Phase 1 in the session in use: the CPU of the real host on the real desktop, and other clients with dmabuf (GTK 4, Qt, Firefox, Chromium with video and subsurfaces, a YUV buffer through the custom shaders). The test above used Electron with RGB buffers only.
  • The bounded render wait on a real DRM output with a long client GPU job. Its unit test uses fake fences, and it assumes that KMS honours the fence of an unfinished frame.
  • The size of the shape lag in the direct session. Phase 0 measured it nested only.
  • The mask outside nested: the direct session, DRM with its damage and vsync, a real second output, a full screen chat, and the GPU cost on another card. The GPU tables of phase 2 are offscreen on one card and no test holds them.
  • Shimmer of the half resolution blur on a real panel, with a backdrop that moves under the glass, and of the 1 px rim wobble of the known defect. Captures cannot judge motion.
  • The mask with focus states, inline components, the review card, the real approval flow (the dialog was forced open once, see phase 3), a light profile color, a resize, subsurfaces and YUV buffers (hover and the settings panel were seen in nested, once each). The opaque inline surface is a test on the CSS, not a frame. The EXTERNAL branch of its shaders compiles and no external texture went through them. Popups of the chat enter the mask with the surface tree, and none was drawn in these runs.
  • Whether the rim from the soft mask looks right to the owner: it differs from the analytic rim at the corners. This was judged in captures only.
  • Whether Chromium always commits the chat window with an alpha channel once it can choose dmabuf formats.
  • Whether the floating chat in Canvas keeps the mask aligned when the window is drawn at another scale. The regions are refused in that case and phase 3 refuses it too; the mask could follow the texture, which is an advantage to confirm.

References

  • UI rendering and the compositor process, the 2026-10-27 assessment that this record extends.
  • Visual effects, 3D and shaders, glass with real blur.
  • Web panels, the current glass contracts of the bar, the dock and the chat regions.
  • Performance, the measurement protocol that phase 0 follows.
  • native/smithay/src/glass.rs, plain_glass.rs, glass.wgsl (glass.frag until 2026-11-11), glass_mask.rs, scene.rs (chat_region_requests, mask_request), vendor/interface/host/workspace-zoom.js (measureChatGlassRegions).
  • Hyprland ignorealpha and the KWin blur region protocol, as precedents of each approach. Cited from memory; their documentation was not opened.