Repository navigation
Conversation
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Pure move by `tools/split apply tools/split/manifests/engine_2.toml` plus
`cargo +nightly fmt`: phase 2.10 for kms/render/engine.rs. Inherent
`impl RenderEngine`/`RenderEngineInner`/helper-type members and free fns go
to depth-1 descendant modules (log-target filters on kms::render::engine
still match); each child starts `use super::*;`. Every type stays in the
root (private fields stay visible to all children).
13034 lines → engine.rs 1104 (imports, all types, Debug/Send/Sync/From
impls) + engine/{emit 2155, composite 1534, frame 1498, glyphs 1159,
fill_copy 1054, lifecycle 666, text 572, batch 570, traps 547, put_get 535,
scratch 502, staging 395, pixels 334, export 225, for_tests 181, gradients
166}.
split verify: 426/426 leaves identical (tokens, effective cfg, comments),
46 manifest visibility changes (14 methods + 30 free fns + 2 consts private
→ pub(super); same reach, 16 of them needed only by engine/tests), 0
audited exceptions, 0 audited locations, 18 leaves with log targets moved
to descendant modules, no shadowed names outside the existing test helpers.
verify --tests against the fresh pre-move snapshot: 4008 / 4013 / 4121
tests (default / tcp-transport / xdmcp) mapped, equal per binary, name and
ignored status.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…move)
Pure move by `tools/split apply tools/split/manifests/scene_2.toml` plus
`cargo +nightly fmt`: phase 2.9 for kms/render/scene.rs. Inherent
`impl SceneCompositor`/helper-type members and free fns go to depth-1
descendant modules (log-target filters on kms::render::scene still match);
each child starts `use super::*;`. Every type and the ComposeRenderTarget
trait stay in the root (private fields stay visible to all children).
9646 lines → scene.rs 1195 (imports, all types, SceneError From impls) +
scene/{tick 1412, damage_audit 1197, walk 1104, build 985, compose 788,
cursor 687, transform 441, flip 436, lifecycle 430, damage 340, for_tests
251, repaint 241, root_readback 210}.
split verify: 447/447 leaves identical (tokens, effective cfg, comments),
89 manifest visibility changes (private → pub(super); same reach, 23 of
them needed only by scene/tests), 0 audited exceptions, 3 audited
locations (root_overlay_{toggle,clear,on_disconnect} call the
#[track_caller] damage-audit helpers; the recorded site moves from scene.rs
to scene/damage.rs, diagnostic attribution only), 27 leaves with log calls
moved to descendant modules. verify --tests against the fresh pre-move
snapshot: 4008 / 4013 / 4121 tests (default / tcp-transport / xdmcp)
mapped, equal per binary, name and ignored status.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…es (move)
Pure move by `tools/split apply tools/split/manifests/platform_2.toml` plus
`cargo +nightly fmt`: phase 2.8 for kms/render/platform.rs. Inherent
`impl PlatformBackend`/helper-type members and free fns go to depth-1
descendant modules (log-target filters on kms::render::platform still
match); each child starts `use super::*;`. Every type and const stays in
the root (private fields stay visible to all children and platform/tests).
7055 lines → platform.rs 741 (imports, all types, consts) + GPU-only
platform/{submit 442, fence 384, storage_alloc 330} + KMS
platform/{connectors 1158, cursor 995, qualify 925, init 874, flip_events
475, scanout_bos 377, power 227, devices 192}.
split verify: 350/350 leaves identical (tokens, effective cfg, comments),
53 manifest visibility changes (private → pub(super); same reach, 32 of
them needed only by platform/tests), 0 audited exceptions, 0 locations,
35 leaves with log calls moved to descendant modules. verify --tests
against the fresh pre-move snapshot: 4008 / 4013 / 4121 tests (default /
tcp-transport / xdmcp) mapped, equal per binary, name and ignored status.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
… (move)
Pure move by `tools/split apply tools/split/manifests/scanout_2.toml` plus
`cargo +nightly fmt`: phase 2.7 for kms/vk/scanout.rs. Inherent impls of
the BO, pool and copied-ownership types and free fns go to depth-1
descendant modules (log-target filters on kms::vk::scanout still match);
each child starts `use super::*;`. Every type stays in the root (private
fields stay visible to all children and scanout/tests).
6617 lines → scanout.rs 809 (allocation doc, imports, all types) +
scanout/{copied 1632, probe 819, image_alloc 740, bo 723, bo_pool 498,
modifiers 498, dmabuf_metadata 355, alloc_plan 291, bo_state 241,
errors 63}.
split verify: 376/376 leaves identical (tokens, effective cfg, comments),
105 manifest visibility changes (private → pub(super); same reach, 25 of
them needed only by scanout/tests), 0 audited exceptions, 4 audited
locations (exact_copied_source_plans, probe_directional_modifiers,
probe_dmabuf_scanout_metadata, scanout_modifier_single_plane_supports_feature
call #[track_caller] format queries; only the `asked from file:line` of the
yserver::format_query debug log changes), 22 leaves with log calls moved
to descendant modules. verify --tests against the fresh pre-move
snapshot: 4008 / 4013 / 4121 tests (default / tcp-transport / xdmcp)
mapped, equal per binary, name and ignored status.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…mmits Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…d scanout/ trees Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
libc 0.2.190 removed FreeBSD's NOTE_PCTRLMASK, which nix 0.31.3 still uses. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…e pitch (joske#235) * docs(kms): plan — pad the copied PRIME transport width Co-Authored-By: Claude Opus 5.5 <[email protected]> * docs(kms): copied-pitch plan — review round 1 converged (the copy-region audit is the bounds evidence) Co-Authored-By: Claude Opus 5.5 <[email protected]> * docs(kms): copied PRIME transport plan — Task 1 keeps the transport in system memory (memory probe); pitch padding becomes Task 2 Co-Authored-By: Claude Opus 5.5 <[email protected]> * docs(kms): copied PRIME transport plan — review round 2 (the headless two-GPU harness is one disposable attempt with bounded waits) Co-Authored-By: Claude Opus 5.5 <[email protected]> * docs(kms): copied PRIME transport plan — review round 3 converged; the direction these defects affect Co-Authored-By: Claude Opus 5.5 <[email protected]> * docs(kms): copied PRIME transport plan — April's iGPU-to-dGPU direction gets its own test; the APU transport moves to GTT Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(kms): keep the copied PRIME transport in system memory so the sink GPU can read it The copied (reverse-PRIME) route allocated its DMA-BUF transport in the renderer's DEVICE_LOCAL memory. When the renderer is a discrete GPU, that is its own VRAM, which another GPU cannot read without peer access: with an NVIDIA renderer and an AMD radv sink the sink copy fails with 'amdgpu: Not enough memory for command submission' and VK_ERROR_DEVICE_LOST, so start-up qualification rejects the route. The transport now prefers a compatible non-DEVICE_LOCAL (system memory) type; same-device exports keep DEVICE_LOCAL. On an APU renderer (the iGPU-to-dGPU direction joske#95 was built for) the transport moves from the carve-out to GTT; both are system RAM. Tested on an RTX 5060 Ti + Ryzen 7 7700 (radv) host in both directions. Implemented-By: codex (model gpt-6-luna, reasoning effort xhigh) Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(kms): pad the copied PRIME transport so linear-pitch sinks can import it A linear DMA-BUF transport takes the renderer driver's row pitch. NVIDIA aligns it to 128 bytes, but radv on GFX9+ imports a linear surface only if its pitch is a multiple of 256 bytes, so the copied route failed at widths 1366, 1440 and 1680 (pitches 5504, 5760 and 6784 bytes): VK_ERROR_INVALID_DRM_FORMAT_MODIFIER_PLANE_LAYOUT_EXT. The transport is now allocated and imported at the logical width rounded up to 64 BGRA8 pixels (256 bytes); the render target, every copy region, readback and digest keep the logical extent, so the padded columns never reach the scanout image. Widths already a multiple of 64 allocate exactly as before. Implemented-By: codex (model gpt-6-luna, reasoning effort xhigh) Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(kms): skip the two-GPU copied PRIME tests when the GPU pair is absent CI's lavapipe step runs every `#[ignore]`d test on a GPU-less runner, and these three panicked there for lack of an NVIDIA and an AMD RADV device. Like the other hardware tests they now skip when the pair is missing; once both devices are present every failure still fails the test. Co-Authored-By: Claude Opus 5.5 <[email protected]> * docs(status): copied PRIME transport entry covers both fixes Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: Jos Dehaes <[email protected]>
…bounded extract verifier Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…equests keep the empty write Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…ract split extract generates one fn per listed match arm (or hoists a dispatcher's fn-local items); verify --extract checks the dispatcher transformation, call shape, body forms, binding equivalence through a bounded lexical resolver (refusing unmodelled forms), comments, macro resolution and the hoist. Fixtures for every modelled binding form. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…als, any mismatch fails Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…joske#340) Co-authored-by: Claude Opus 5.5 <[email protected]>
Version bump; releasing.md: line number, yserver-xauth, Windows zips. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…test; cap the job at 45 minutes OpenBSD 8.0 can lose the wakeup of a blocking loopback connect() or accept() after the handshake completes, leaving a test asleep until the 6-hour job limit. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…tch apply, as Xorg's do (joske#263) * fix(vidmode): a local client's SetGamma, SetGammaRamp and LockModeSwitch apply, as Xorg's do GetPermissions tells a local client it may write, and every write was then refused with ClientNotLocal. Wine's X driver sets the gamma through XF86VidModeSetGamma when the gamma ramp is not 256 entries, with no X error handler (X11DRV_XF86VM_SetGammaRamp, dlls/winex11.drv/xvidmode.c), so the error went to Xlib's default handler and ended the program that asked; a Wine launcher needed UseXVidMode=N in its prefix to start. A local client's gamma and lock writes now apply as on Xorg's modesetting server, where VidMode's gamma is the CMap gamma table (xf86cmap.c, set up by drmmode_display.c's xf86HandleColormaps with 10 significant bits) and every CRTC loads it under its own RANDR ramp (xf86RandR12LoadPalette, xf86RandR12CrtcComputeGamma). backend::gamma::VidModeGammaTable is that table: - SetGamma: each value in [0.1, 10] or BadValue with nothing stored (CMapChangeGamma); the values are kept for GetGamma and the table is ComputeGamma's. - SetGammaRamp: the size must equal GetGammaRampSize's (BadValue), the request must hold exactly that many even-padded entries (BadLength), and the ramp becomes the table (ComputeGammaRamp); GetGamma keeps its values. - GetGammaRampSize reports the table's 1024 entries, as modesetting does, and GetGammaRamp the table (xf86GetGammaRamp), not a CRTC's RANDR ramp; 0 and an empty ramp where the CRTC has no gamma. - LockModeSwitch succeeds: xf86VidModeLockZoom fails only under DontZoom. The backend gets the table through Backend::set_vidmode_gamma. The KMS backend keeps it and loads every live output's LUT as crtc_lut of the output's RANDR ramp: the root TrueColor palette from the table, each value looked up in the RANDR ramp, spread over or sampled down to the hardware size. That happens wherever it already reloads gamma: a RANDR set, a CRTC configuration, VT entry. RANDR's GetCrtcGamma keeps reporting the RANDR ramp, and a later RRSetCrtcGamma keeps the VidMode correction. Xorg's RANDR ramp has the table's 1024 entries; yserver's follows the hardware size, so the lookup scales the palette value to it, which is the same index at 1024. Until the first VidMode write the CRTCs load their RANDR ramps alone. Mode setting (ModModeLine, SwitchMode, AddModeLine, DeleteModeLine, SwitchToMode, SetViewPort) stays RANDR's and keeps ClientNotLocal, and a remote client's writes are refused as before. For a big-endian client the swap table now swaps SetGamma's screen and values, LockModeSwitch's screen and lock, and all of SetGammaRamp, as SProcVidModeSetGamma, SProcVidModeLockModeSwitch and SProcVidModeSetGammaRamp do. * fix(vidmode): keep the gamma across a server reset, resample the RANDR ramp Review of joske#263: - Server reset. reset_generation builds a fresh ServerState, so GetGamma went back to 1.0 while the KMS backend kept the old VidMode table and reapplied it on every RANDR set, VT entry and DPMS-on. Xorg keeps pScrn->gamma across regeneration (xf86SetGamma in PreInit) and xf86HandleColormaps rebuilds the CMap table from it in ScreenInit. The fresh state now carries the gamma values, and reinstall_vidmode_gamma rebuilds the table from them and pushes it with set_vidmode_gamma: no table at 1.0, and a table set only by SetGammaRamp falls back to the gamma curve. - 256-entry hardware. The palette value was scaled into a hardware-sized RANDR ramp by value * (len - 1) / 1023, which truncates: a no-op SetGamma(1, 1, 1) moved 252 of 256 levels one step darker. crtc_lut now resamples a RANDR ramp of any size other than 1024 to 1024 entries (resample_channel) and indexes it directly, as Xorg indexes its 1024-entry ramp; every level then stays within one 8-bit step of the RANDR ramp, and of Xorg's result for the same gamma. - VidModeGammaTable::from_ramp debug-asserts its 1024-entry slices. - Rebased on master: joske#285's atomic GAMMA_LUT path now queues the stacked LUT, so its per-CRTC mode/enable reapply (reapply_gamma_for_output) loads the VidMode table under the RANDR ramp too; that function is visible to the backend's tests for it. - The ramp-size comment describes what a backend without gamma does instead of claiming Xwayland parity. Tests: the reset carries the gamma, rebuilds the table and pushes it, and drops a ramp-only table at 1.0 (fails with the carry removed); the 256-entry KMS path against Xorg's 1024-entry path at every level, with pinned values; the KMS backend's queued LUT is the RANDR ramp over the VidMode table after a VidMode write and after a per-CRTC reapply, and the RANDR ramp alone once the table is cleared (fails with the table ignored). Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Covers the case PR joske#112 left open (intersecting parent/child Bounding masks past the 32-rect region limit, a grandchild under both, disjoint and empty ancestor shapes), fixed on master by joske#325. Co-authored-by: erpalma <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
…quests (joske#342) * docs(plans): access control PR 3a — resource and property hooks, core requests Co-Authored-By: Claude Opus 5.5 <[email protected]> * docs(plans): access control PR 3a — review round 1 (GLX geometry target, shared unmap contract, denial test contract) Co-Authored-By: Claude Opus 5.5 <[email protected]> * docs(plans): access control PR 3a — review round 2 (denied remap runs the UnmapWindow transition once) Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(core): writes into an existing XFIXES region, DAMAGE parts or Present selection keep its owner A write into an existing XFIXES region (SetRegion, CopyRegion, Union/ Intersect/SubtractRegion, InvertRegion, RegionExtents) and a DAMAGE Subtract into an existing parts region replaced the region's owner with the writer. Disconnect cleanup removes regions by owner, so client A's region disappeared when client B, who had written into it, disconnected. Writes into an existing region now keep its owner; a new id still belongs to the requester. Present SelectInput on an event id that belongs to another client or to another window now answers BadMatch with the id as value, as Xorg's present_select_input; the owner's own update changes only the mask. Mask-0 removal is unchanged. Access control PR 3a, Task 1. Implemented-By: codex (gpt-6-luna xhigh) Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(core): access control PR 3a, Task 2: resource and property hooks, owner resolver AccessPolicy gains resource() and property(), both default allow. AccessContext gains owner() (its own resolver over every ResourceKind, separate from resource_owner so KillClient's BadValue is unchanged), is_root() and atom_name(). ServerState gains check_resource and check_property on first_denial; both return Allow without building a context when no policy is installed and without asking for SERVER_OWNER, whose calls are server work. AccessMode gains the XLibre access bits the core sites use. No request site asks yet. Implemented-By: codex (gpt-6-luna xhigh) Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(core): access control PR 3a, Task 3: drawing requests The drawing helpers validate_drawable_and_gc, validate_drawable_only and validate_gc_only ask the resource check right after each operand's existing validation: drawable, then GC, then depth, so a denied operand reports the policy's error with the same precedence a missing one has today. CopyArea and CopyPlane keep their src, dst, GC order; PolyText's inline fonts are checked in the existing pre-draw pass; ClearArea, GetImage, SetDashes, SetClipRectangles, ChangeGC's GC and QueryBestSize ask for their targets. Opcodes come from the request header. Implemented-By: codex (gpt-6-luna xhigh) Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(core): access control PR 3a, Task 4: window creation, attributes and destruction CreateWindow asks for its parent (Add), its CW operands and the new window (Create+SetAttr, with a creation record naming the parent); ChangeWindowAttributes asks Receive for the event mask and SetAttr for the rest; GetWindowAttributes, DestroyWindow (and its parent's Remove), DestroySubwindows and ChangeSaveSet ask for their windows. DestroySubwindows keeps Xorg's order: every child is unmapped, then each is checked right before its destroy, and a denial stops the loop without an error. Calls made as SERVER_OWNER, such as the screensaver's, are not checked. Implemented-By: codex (gpt-6-luna xhigh) Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(core): access control PR 3a, Task 5: window tree, mapping and pointer queries ReparentWindow, MapWindow, MapSubwindows, UnmapWindow, UnmapSubwindows, ConfigureWindow, CirculateWindow, GetGeometry (including a GLX pbuffer with no backing pixmap), QueryTree, QueryPointer, GetMotionEvents, TranslateCoordinates and WarpPointer ask for their windows right after each one's existing validation. A denied MapWindow maps nothing and succeeds, as XLibre; MapSubwindows and UnmapSubwindows skip a denied child and go on; a denied CirculateWindow child is not restacked. A ReparentWindow whose remap is denied runs UnmapWindow's transition once and reparents without remapping. Policies see a core request's minor opcode as 0, as Xorg's client->minorOp, through one constructor, RequestOpcodes::for_request; extensions keep their minor from the data byte. Implemented-By: codex (gpt-6-luna xhigh) Co-Authored-By: Claude Opus 5.5 <[email protected]> * docs(plans): access control PR 3a — core requests give policies minor opcode 0 Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(core): access control PR 3a, Task 6: GC, pixmap, cursor and font requests CreatePixmap, FreePixmap, CreateGC, ChangeGC, CopyGC, FreeGC, OpenFont, CloseFont, QueryFont, QueryTextExtents, CreateCursor, CreateGlyphCursor, FreeCursor and RecolorCursor ask for their operands, and creations for the new id with a creation record. Destroys are checked before the removal, so a denied CloseFont or FreePixmap leaves the object usable. CreateGC and ChangeGC share one ordered check of the value list's tile, stipple, font and clip mask. An operand yserver does not validate today is checked only when its id resolves. Implemented-By: codex (gpt-6-luna xhigh) Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(core): access control PR 3a, Task 7: colormaps CreateColormap (its window, and the new colormap with a creation record), FreeColormap, CopyColormapAndFree, Install/UninstallColormap, ListInstalledColormaps, the Alloc* requests, FreeColors, StoreColors, StoreNamedColor, QueryColors and LookupColor ask for their colormap before any effect. Where yserver does not look the colormap up today, the check runs only when the id resolves, so the unconditional BadAlloc and BadAccess answers stay as they are. Implemented-By: codex (gpt-6-luna xhigh) Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(core): access control PR 3a, Task 8: grabs, focus, selection windows and KillClient GrabPointer, GrabButton, UngrabButton, ChangeActivePointerGrab, GrabKeyboard, GrabKey, UngrabKey, SetInputFocus, SetSelectionOwner's owner window, ConvertSelection's requestor and KillClient's named resource ask for their operands right after each one's validation. The selection checks run before the atom checks and the stale-time return, as the windows are validated first. KillClient's check uses the store resource_owner found the id in, so colormaps keep their BadValue. Implemented-By: codex (gpt-6-luna xhigh) Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(core): access control PR 3a, Task 9: window properties ChangeProperty, DeleteProperty, GetProperty, ListProperties and RotateProperties ask the resource hook for the window (SetProp, GetProp, ListProp) and the property hook for each existing property: Write for Replace, Blend for Append and Prepend, Create+Write for a new property, Read (plus Destroy when GetProperty deletes), Destroy for DeleteProperty, Read+Write per rotated item. ListProperties leaves a denied property out and still succeeds. Server writes through change_property_as_server are not checked. check_property loses its temporary dead_code allow. Implemented-By: codex (gpt-6-luna xhigh) Co-Authored-By: Claude Opus 5.5 <[email protected]> * docs(spec): access control PR 3a denial rows and server work; PolyPoint measurement The denial table gains ListProperties entries (left out), MapWindow and the ReparentWindow remap (Success, unmapped), and the children of Map/UnmapSubwindows and CirculateWindow (skipped). "Where the checks go" states that work run as SERVER_OWNER is server work and that subtree descendants are consequences, not derived targets. An ignored test, bench_poly_point_with_and_without_policy, prints the cost of a one-point PolyPoint through process_request with no policy and with one allow-all policy. Idle, release build, 100 000 requests, three runs: 217-222 ns without a policy, 215-218 ns with one. Implemented-By: codex (gpt-6-luna xhigh) Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(core): access control PR 3a — GetImage and SetDashes ask right after the operand resolves Final review: GetImage asked for its drawable after the rectangle bounds and viewability checks, and SetDashes asked for its GC after rejecting a zero dash value, so a denied operand combined with a later invalid argument answered BadMatch or BadValue without asking the policy. Both now ask as soon as the operand resolves, as Xorg's dixLookupDrawable and dixLookupGC do. The PolyPoint measurement now checks that every request drew and that the policy was asked for the drawable and the GC once per request; RecordingBackend records poly_point instead of panicking. Implemented-By: codex (gpt-6-luna xhigh) Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(core): PolyPoint measurement times a counting allow-all policy The recording policy pushes every call into a Mutex<Vec>, which costs more than the access check itself (about 120 ns per request). The measurement now also runs an allow-all policy that only counts its calls and prints it beside the others; the recording phase stays as the correctness control. Release build, 100 000 requests, three runs: no policy 254-263 ns, counting allow-all 244-248 ns, recording allow-all 372-382 ns per request. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
… a time unpack_to_staging copied each row into the staging buffer and then went over it again storing 0xFF into every fourth byte: two passes over the destination, the second a byte store per pixel the compiler cannot widen. Steam's web helper puts its whole window, 7.7 MB at depth 24, every frame. Copy and set the alpha in one pass of word stores, which vectorise; depth24_unpack_forces_alpha_ff still holds.
send_reply_with_fd spun on yield_now until the client's queued output drained, then sent the reply with one sendmsg and ignored its count. A client that read slowly held up the core thread, and on a full socket the rest of the reply was dropped, so the client's stream was torn and Xlib ended it with "XIO: fatal IO error". Like Xorg's WriteFdToClient, the descriptor is now queued with the output: ClientState::outbound_fds keeps a duplicate of it with its reply's offset and length, and drain_outbound sends that reply alone with sendmsg and SCM_RIGHTS when it reaches it. The rest goes like any other output, so nothing waits for the client. On the BSDs, macOS included, a full peer makes sendmsg with a descriptor fail with EMSGSIZE instead of EAGAIN; that is would-block too.
A client that selects XI_DeviceChanged on the root window was sent a "bootstrap" DeviceChanged for each selected master, reason SlaveSwitch, with the master's class source as its sourceid. On a master no slave has driven yet that source is the master itself (CorePointerProc's classes, dix/devices.c:1357,1433), so the event announced a switch to the master. No X server sends that: Xorg sends no DeviceChanged on XISelectEvents at all (Xi/xiselectev.c), and its only XISlaveSwitch is the one dix/getevents.c:699 sends when an event comes from another slave than the last, naming that slave. Wine's winex11 trips on it. x11drv_xinput2_init selects DeviceChanged for XIAllMasterDevices, then asks XIGetClientPointer and XIQueryDevice; X11DRV_DeviceChanged answers a SlaveSwitch by opening its sourceid with XOpenDevice to read the device's button map (update_device_mapping). XOpenDevice of a master is BadDevice, as in Xorg (Xi/opendev.c), and Wine hands that unexpected error to Xlib's default handler, which ends the process: every Wine process on a rootless server, before its first window. The bootstrap now goes only once a slave has driven the master, and names that slave, which is what Xorg would have sent at that switch. A client that selects after the first input (the Cinnamon case it was added for, aea9b0f, on a server with live devices) is sent it as before; one that selects before any input is sent nothing, as Xorg sends nothing, and gets the real SlaveSwitch with the first event. A test runs Wine's start-up sequence and checks that no event names a master as its source.
…shClient
The core dropped a client once 4 MiB of its output were queued, a cap
sized to one large QueryFont reply. A game's X client was
dropped that way during start-up ("client 270: output could not be
written (peer gone or 4194304 bytes unread)") and the game exited. Xorg
has no such cap: FlushClient (os/io.c) grows the output buffer while
notWritten + BUFSIZE <= INT_MAX and aborts the client only past that or
when the allocation fails. The cap is INT_MAX now, for a reply that
carries a descriptor as for any other.
The disconnect message printed the cap whatever the cause, so a peer
that had gone looked like a slow reader. The failure now says why where
it happens: the peer gone with its error and the bytes unread, or the cap
with the real count. A backlog is logged when it passes 1 MiB and at each
doubling, with the newest message's kind (reply, error, event code,
GenericEvent extension and type), so the next one shows what the client
was sent while it did not read.
Writes still never wait: a test queues 16 MiB of events for a client
that reads nothing, writes to another client between them, and then
reads all 16 MiB back in order. It fails at the old cap. Tests that
saturate a client use a 4 MiB cap of their thread's own
(client_io::outbound_cap), so they cost what they did.
stays_quiet set SO_RCVTIMEO to wait QUIET for bytes. macOS refuses that setsockopt with EINVAL once the socket's peer has closed, and a closed peer is one of the outcomes the helper watches for, so the quarantine test failed on macOS whenever the server closed first. The restore after the read already tolerated EINVAL; the first set did not. The helper now waits with poll(2) for QUIET and reads only once the socket is readable or hung up, so the read timeout is never touched. Its verdicts are unchanged: nothing within QUIET, end of file and ECONNRESET are quiet; a byte is not.
…pha map and clip mask reach the renderer as client XIDs (joske#347) * fix(render): translate CompositeGlyphs switches and CreatePicture's alpha map and clip mask to backend handles CompositeGlyphs forwarded its item stream unchanged, and the renderer read a glyphset switch's value as a key of its own glyphset table, whose handles are allocated apart from the client's XIDs. A client's switch was therefore ignored, and its glyphs drawn from the previous glyphset, while a value equal to some backend handle switched to that glyphset whoever owned it. Xorg resolves the switch as a GlyphSet XID. The core now translates each switch to the glyphset's backend handle and sends 0, which the renderer ignores, for a value that is not a client glyphset. CreatePicture forwarded its value list unchanged, so its alpha map and clip mask reached the backend as client XIDs. It now shares ChangePicture's per-attribute translation; an attribute that does not resolve is sent as 0 and the picture is still registered, as before. ChangePicture keeps dropping the whole request on an unresolved attribute. Implemented-By: codex (gpt-6-luna xhigh) Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(render): a glyphset switch is 12 bytes; a switch that is not a GlyphSet is BadGlyphSet Review on joske#347. A CompositeGlyphs glyphset switch is the 8-byte xGlyphElt header followed by the 4-byte GlyphSet XID (Xorg render/render.c), 12 bytes in all. The core translator, the KMS renderer's parser and the host-X11 command patcher read the XID at offset 4 of the header (deltax/deltay) and advanced 8 bytes, and the test fixtures encoded the same layout, so a correctly encoded switch never reached the renderer as its backend handle. All three now use the 12-byte layout, and the tests encode switches through one helper. Before forwarding, the core now checks every switch in stream order, as ProcRenderCompositeGlyphs does: a value that is not a client GlyphSet answers BadGlyphSet with that value and nothing is drawn. As in Xorg, a switch whose XID ends exactly at the end of the stream is not looked up. Implemented-By: codex (gpt-6-luna xhigh) Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(host-x11): the glyph command patcher fixture reaches its switch The fixture's glyph runs lacked their padded payloads, so the walker never reached the switch element and the test passed with an 8-byte switch stride too. Both runs now carry their payloads, the switch uses the shared encoder with a nonzero XID, and the test asserts the switch comes out unchanged and the run after it is patched at the right offset. Implemented-By: codex (gpt-6-luna xhigh) Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
…as a descriptor DRI3 1.4's explicit sync is built on exporting a syncobj as an opaque descriptor: Mesa's WSI exports each image's timeline syncobjs so and imports them into the server with DRI3ImportSyncobj. A render node with timeline syncobjs that serves sync files only had Mesa choose explicit sync and then fail to make its swapchain. The node is now probed for that export at start; without it DRI3 stays at 1.3, with implicit sync, and Present offers no syncobjs.
…nder node A server started with no KMS card (a rootless host's, whose window system owns the display) found no render node, since only a card led to one, so DRI3 stayed off and X clients' GL and Vulkan could not hand frames over as dma-bufs. The card-less server now opens a render node of its own: YSERVER_DRI_RENDER_NODE's, else the render node of the device its Vulkan device advertises (VK_EXT_physical_device_drm), else the machine's only one when the device names none. A software Vulkan device (lavapipe) drives no GPU and gets a render node only when YSERVER_DRI_RENDER_NODE names one, and only when it can import dma-bufs (VK_KHR_external_memory_fd): then the clients render on that GPU and the server imports their LINEAR buffers. Asked for, never guessed.
…aphores 17d29c5 stopped advertising DRI3 fences (Dri3Caps::fence_fd) on a renderer without VK_KHR_external_semaphore_fd, so that a sync-fd import or export fails as an error instead of calling an unloaded Vulkan entry point. The request handler also refused FenceFromFD outright when that cap is off, with BadImplementation. That was more than the fix needed: what a client sends with FenceFromFD is Mesa's xshmfence, shared memory the backend maps and triggers without Vulkan (kms/export.rs tries it first), and Xorg takes it on every screen (miSyncShmFenceFromFD). Only a sync_file goes to the Vulkan import, and that already fails as an error since 17d29c5, which the handler answers with a server-only fence. On lavapipe, which has no external semaphore fds, every Vulkan swapchain of Mesa's X11 WSI shares an xshmfence per buffer through FenceFromFD and waits on it for the buffer to be idle; refused, it waited for ever. A Proton game on a rootless server whose renderer is lavapipe showed one frame in five minutes. FenceFromFD is now taken whatever the cap says; FDFromFence, which exports a SYNC_FD, stays refused without it, so nothing 17d29c5 fixed comes back. No path waits on a client's fence on the core thread: an AwaitFence on it parks the client (sync_await), as before. A test covers FenceFromFD, FDFromFence and AwaitFence on a renderer without sync-fd semaphores.
…s Xorg FenceFromFD made its fence without Xorg's checks (proc_dri3_fence_from_fd, dri3/dri3_request.c): no LEGAL_NEW_RESOURCE, so a client could name an ID outside its range or one in use, overwriting another client's fence, and no drawable lookup. A missing fd was BadAlloc, and a fd the backend could neither map as an xshmfence nor import as a sync_file still made a server-only fence, where miSyncShmCreateFenceFromFd answers BadValue when xshmfence_map_shm fails. The checks now run in Xorg's order: the length, the new ID (BadIDChoice), the drawable (BadDrawable), the fd (BadValue). A fd the backend can't take is BadValue and makes no fence. A test covers each refusal, that none of them touches the fence already there, and that a destroyed fence's ID can be taken again.
A rootless host whose window system is a socket the server is a client of (a Wayland compositor) can serve it on the core thread rather than on a UI thread of its own: its fd is a backend poll source of a new kind, BackendFdKind::HostDisplay, and its readiness calls Backend::on_host_display_ready with the state in hand. A `false` answer (the window system closed the connection) ends the server as the loss of its only display would. XBackend hands it to Platform; the default is a no-op. Serving it on the core thread keeps the host's events in one order with the clients' requests and needs no channel or lock between them.
A game that turns the mouse into a direction grabs the pointer to its
window, hides the cursor and warps the pointer back to the window's
centre after each motion. Under a host whose window system moves the
pointer itself that breaks: X's warp moves X's pointer only, the host's
runs into the screen's edge, and the next absolute motion jumps X's
pointer to wherever the host's is.
The core now decides when the host should lock its pointer, starting
from Xwayland's rule (xwl_seat_maybe_lock_on_hidden_cursor,
xwl_seat_emulate_pointer_warp): the displayed cursor is hidden (the None
cursor or XFIXES HideCursor), the host's pointer is on the top-level
(pointer scope), and a grab confines the pointer to it or a WarpPointer
lands inside it. It lets go when the cursor is shown, the pointer
leaves, the grab ends, or, for a lock a warp took, X's pointer leaves
the window. Three parts are ours, not Xwayland's: a fully transparent
cursor image counts as hidden (Backend::displayed_cursor_hidden), which
is how SDL and most games hide it; the host's keyboard must be on the
top-level too (Activated), and its leaving lets go; and a lock a warp
took during a grab goes when the grab ends. Each change is one
RootlessEvent::PointerLock { id } from the reconcile.
While a lock is held the host sends RootlessInput::PointerRelative: X's
pointer moves by the whole pixels of its accelerated delta from where X
has it (which after a game's warp is the centre), the fraction kept for
the next, with the unaccelerated delta as XI2 raw motion. Without a lock
it is dropped.
…'s name Two things a host needs from the core that the interface lacked. A host that bridges its window system's clipboard with X's selections (CLIPBOARD and PRIMARY) needs an X window that owns a selection on the host's behalf and asks X clients for theirs. Under Xwayland that window is the compositor's X window manager's (wlroots' xwayland/selection, Mutter): Xwayland itself bridges no selection. Here the host is that window manager, so rootless::selection gives it the server's selection window (a server-owned InputOnly child of the root at a fixed server XID, made on first use and again after a reset). The server's SetSelectionOwner, ConvertSelection and SelectionNotify go through typed entry points, as the spec (§4.4) has internal X actions do: the request handlers are split into parse and apply, and the server calls the apply half, so every client hears what another client's request would make it hear. The server passes every access check, so the typed calls check what the request would refuse (BadWindow, BadAtom, and for ChangeProperty BadValue and BadLength, in ProcChangeProperty's order), and refuse it the same way, changing nothing. A server window has no connection, so what the protocol would send it -- the SelectionRequest for a selection it owns, the SelectionClear when a client takes one from it or the server gives it up (under Xorg's rule, dix/selection.c:183-191), the SelectionNotify answering its ConvertSelection, a refusal when nothing owns one, and the PropertyNotify of its properties and of the client windows the host watches -- is queued for the host (take_selection_events), and so is the destruction of a watched window, which ends a transfer to it. That is all ICCCM's INCR needs in either direction; the transfer itself is the host's, as it is the window manager's under Xwayland. Only the bridge's own window, set as an owner by the server, is the host's: the server's other windows (the window manager's check window, which owns WM_S0) hear nothing, as a window whose client is gone. The host also hears who owns the selections it watches (watch_selection) each time that changes, as a compositor's X window manager selects XFIXES SelectionNotify: the same hook that fans those out (Xorg's selection callbacks) queues SelectionEvent::Owner for a SetSelectionOwner, the server's own included, and for an owner's window destroyed or its client gone. The host never has to look at the selections itself. rootless::name_window_manager names the built-in window manager after the host's in _NET_WM_NAME of the _NET_SUPPORTING_WM_CHECK window, rather than "yserver": a client that shows its window manager (Steam's "X Window Manager") then names the one that really manages its windows. The name is kept across a server reset.
The presenter was the surface platform's only, and a host there has no DRI3: the surface platform imports no client buffers. A host whose window system is a Linux compositor needs the card-less KMS platform instead, which keeps DRI3 on its renderer's render node, MIT-SHM and Present for the host's clients. * The presenter's tick runs on any Platform (it only reads the store, the engine and the GPU core, which every platform has). * rootless::display: a DisplayHost is a RootlessHost served on the core thread, whose connection is polled as BackendFdKind::HostDisplay. A dispatch collects what the window system said as HostWork, one queue of host requests, input and frame events in the order they came, which the platform applies in that order once the host is no longer borrowed: a key pressed before a focus change in the same read goes to the window it was pressed in. Its flush must not block, as nothing on the core thread may; what the socket does not take is sent on a later iteration. * kms/rootless.rs: KmsBackend::attach_rootless_host (the root takes the host's screen, the keymap its layout) and start_rootless (the core's mode, Opaque policy, and the presenter). RandR lists one connected output covering the root at the host's refresh, keeps its CRTC association across rebuilds, and lists no provider, as Xwayland does (a provider that owns no CRTC sent Wine's X driver dividing by a DPI of zero). * rootless::present_clock: that output's Present clock, Xorg's present_fake timer at the host's refresh, read on demand and armed for parked Present work. The host's frame callbacks do not move it, so a client pacing itself by the MSC measures the refresh and not the host's latency. The output is never in a scanout blackout. Nothing attaches a host yet; the Wayland host does.
The core scraps a Present not yet executed when a later one for the same
window and target MSC comes, as Xorg's present_scmd.c does ("don't
bother doing the previous one if this one will overwrite it in the same
frame"). Xwayland scraps no copy there: xwl_present_pixmap executes each
in turn, since the compositor, not the X server, decides which frame a
refresh shows. Its only scrap is a flip queued behind a pending one
(xwl_present_execute's mailbox handling), and a rootless server here
has no flips. A game that presents twice a millisecond apart for the
same MSC lost one of the two: in one such game 32.5 presents a second
came in and the scrap left 19.3 to be shown.
Backend::present_supersedes_same_msc (default true) says whether the
scrap applies. The card-less KMS platform says false while it serves a
rootless host.
With YSERVER_BACKEND=wayland (and the new `wayland` feature, Linux only) the server is a client of the Wayland compositor WAYLAND_DISPLAY names: it owns neither the console nor a card, runs on the card-less KMS platform (DRI3 on its renderer's render node, Present on the host output's clock), and each top-level X window becomes an xdg_toplevel of the compositor's, each override-redirect one an xdg_popup. It is served on the core thread as a DisplayHost. The Wayland side is wayland-client on its own Rust implementation of the wire, not the `system` libwayland backend: the server links no C Wayland library, and the protocols it speaks beyond the core (xdg-shell, xdg-output, cursor-shape, relative pointer, pointer constraints, ext-data-control) come from wayland-protocols, all behind the feature. wayland/client.rs keeps what the protocol makes a client keep (the configure handshake, each surface's wl_shm buffers and which the compositor still reads, the seat's serials and focus, the cursor) and hands the host the rest as events in the order the compositor sent them, so a relative motion still comes before the pointer motion it belongs to. The connection's descriptor is polled by the core loop; each readiness flushes, reads what the socket holds without waiting and dispatches it. What the host queues between reads (the frame events of the presenter's tick) the platform takes each loop iteration (DisplayHost::take_queued). This is SetZero's fork's backend ported onto the rootless interface rather than replayed: its topology diff, popup parent guess, seat mapping, pointer scope, WM_STATE, EWMH announcement and server-as-client request helpers are the core's now, and what remains here is the host (spec §8.2): * Windows from RootlessEvents: Mapped makes the compositor's window with title, app id (WM_CLASS's class), parent (WM_TRANSIENT_FOR) and size limits (WM_NORMAL_HINTS) set before the first commit, where a compositor decides whether it floats; InfoChanged follows them (a title ends at a NUL, which no Wayland string can hold). A popup hangs from the core's parent, else the window the pointer is on, else the newest, at its outer corner relative to the parent's, anchored there with no constraint adjustment so the compositor does not move it; ParentChanged makes it again, Configured repositions it (xdg_popup.reposition, or made again under the same id before xdg_wm_base 3), and one the compositor took away is not made again until it unmaps. A window the compositor refuses is tried again a second later, not on every pass. * The compositor's first configure is SetupDone; a later one with another size is HostRequest::Resized, its close CloseRequested, the keyboard's enter and leave Activated and Deactivated; _NET_WM_MOVERESIZE (WmRequest::BeginMove/BeginResize) is the compositor's drag, with the last press's serial. _NET_ACTIVE_WINDOW for the window the keyboard is on is granted, as the compositor's XWM grants it under Xwayland: the window is activated again, WM_TAKE_FOCUS included. Wine asks this after a window of its own closes (the game's launcher webview), and the game took no input until it was answered. * Pixels: CPU frames from the presenter's asynchronous readback, copied straight into a free wl_shm buffer of the window's (XRGB8888 below depth 32, premultiplied ARGB8888 at it; one memfd pool per buffer, kept until the size changes) and damaged by the presenter's damage with damage_buffer; the frame callback is asked for on the commit that shows the frame, which paces the window. A top-level is shown without its X border, which the compositor's frame takes the place of, as a reparenting window manager's would; a popup whole. * The seat is a slave pointer and a slave keyboard of the core pair, "Wayland pointer" and "Wayland keyboard", announced before any input, as Xwayland's xwayland-pointer and xwayland-keyboard are; its input comes from them (InputOrigin::Physical), so each event names the slave as its source and the first switches the master to it. A master as an event's source is one no X server sends: Wine opens a raw button's source with XOpenDevice, which is BadDevice for a master, and Xlib's default handler ends the process. The server makes no libinput context (InputSource::HostSeat, at platform init) and starts no input thread: the compositor owns the devices. * Input: pointer-local input, buttons, the wheel as buttons 4 to 7 (axis_value120 summed to clicks, else axis_discrete, else ten units a click), keys as evdev + 8 on the server's own XKB state, which takes the compositor's layout at start: the keymap is compiled with xkbcommon and its group's name looked up in the XKB rules' layout list (evdev.lst, else base.lst), so "German (no dead keys)" is de nodeadkeys. Every input's time, keys, buttons, the wheel, motion and crossings alike, is the server's clock as the event is handed to X, in the order the compositor sent them, as Xwayland stamps its seat's: a motion handed over with its device's earlier time came before a button already handed over. The cursor is the X cursor as a wl_shm surface, the compositor's arrow (wp_cursor_shape_v1) before the first; and a lock of the pointer, which the core decides (RootlessEvent::PointerLock) and a persistent zwp_locked_pointer_v1 holds, gives relative motion (zwp_relative_pointer_v1) while it is in force. * The clipboard, X's CLIPBOARD and PRIMARY both ways with ext_data_control_v1, through the core's selection window; text only, no INCR. * Nothing on the core thread waits: a dispatch flushes without blocking (what the socket does not take stays queued for the next flush), reads what the socket holds and returns; only the connect, at start, makes round trips. The host is built on Linux alone, with the feature (cfg(wayland_host), which build.rs sets). * RandR: one output, WAYLAND-1, at the compositor's first screen's logical size (zxdg_output_v1's, else its mode over its scale) and refresh; the window manager is named after the compositor's process (SO_PEERCRED), else YSERVER_WM_NAME.
Client::flush took a full socket (WouldBlock) as success: what the socket did not take stayed queued for the next flush. But the next flush came only when the host had new work: the loop watched the connection for readable alone, so with the compositor's socket full and nothing else happening, the queued requests sat there and the host stalled. The loop now watches a host display connection for writable too while its last flush left output queued, as it watches a client's output (watch_writable). The host says so (DisplayHost::unsent, from the Wayland client's flush), the backend passes it on (Backend::host_display_wants_writable), and the loop, asked after before_block, re-registers the fd READABLE | WRITABLE, and READABLE again once everything is out. Its readiness is on_host_display_ready, which flushes. The poller is edge-triggered, so a socket that drained between the flush and the re-registration reports at once, and a full one does not wake the loop until it takes more. Nothing waits on the core thread. Tests: the core loop with a host connection whose socket is full and output queued sends it all once the peer reads, with nothing else to wake it, and then sleeps (without the write interest the output never went out); and the Wayland client's flush into a full socket says the request stays queued, and that it went out once the peer read.
Collaborator
Author
|
Scratch CI run done. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Scratch PR to run upstream's full CI on ci/rev349 before it goes to joske/yserver. Closed after the run.