Repository navigation
Conversation
…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 (1M context) <[email protected]>
…ps/focus (move) 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]>
…itor/xinerama (move) Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
… and module map Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…commits Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…randr_ext/ trees Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…rpose results as inconclusive Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…poses Co-Authored-By: Claude Opus 5.5 (1M context) <[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.
A build with the Wayland host takes --rootless (without --headless) as the host, as a build with a window shell does: shell_mode is asked with the host as the KMS build's window shell. YSERVER_BACKEND goes, and with it the exit in wayland_requested; a build without the host refuses --rootless as before. --rootless --headless stays the recording host.
wl_keyboard.modifiers was kept for its group alone, and the keymap for its layout's name. Now: - The state (depressed, latched and locked modifiers, and the group) is X's as it is, as Xwayland takes it: no key is pressed for it. The compositor's masks, virtual modifiers too, are resolved to X's eight real ones on its own keymap and set with update_mask (HostItem::Keyboard, set_host_keyboard_state), then announced as an XkbStateNotify. A Shift held as the keyboard enters, a Num Lock or Caps Lock already on, and a group switch reach X. Keys held at enter are not pressed in X; leaving drops the depressed and latched state, the locks stay. - The keymap is the compositor's whole text (DisplayHost::keymap), so its options and custom keys hold; it is the startup map too, which a server reset starts on. _XKB_RULES_NAMES still names the layout where the rules know it. - The keymap is read, not mapped: the size must fit the file (fstat) and 4 MiB, and the text ends at its NUL. Tests: the compositor's masks as X's real modifiers and group; a keymap read within its file and the limit; the seat passing the state without a key, and leaving; the backend cooking a key under the host's state; a host keymap with ctrl:nocaps kept across a server reset.
A toplevel's size on the client side came only from the compositor's configures, so after an X client resized its window (a font change, a game's resolution) the next configure that left the size to the window answered with the old one, and Resized put the X window back to it. configured_by_x now gives the client the window's new size (Client::resized_by_x), which such a configure answers with. Test: a configure leaving the size to the window answers with the size X gave it, not the compositor's last.
parent_changed and reposition_popup's fallback (xdg_wm_base below 3) destroy a popup's surface and make another, but the presenter's frame state stayed that of the old one: Ready and shown, so a reparented menu stayed blank until new damage, and a repositioned one, still marked configured, had its frames dropped and retried at once until the configure came. The host now says FrameEvent::Recreated and takes the window as not configured. The presenter goes back to Setup with nothing shown (WindowFrames::restart), drops a readback under way and owes a whole frame (CpuState::restart), so the new surface's configure brings a full frame. A remake that failed is retried as a refused popup. Test: a window made again takes no frame before its setup, then a whole one, which no earlier frame stands for.
The pipe for an X client's paste of the compositor's selection was made with O_NONBLOCK, which is both ends': the writing end goes to the selection's owner, and an ordinary blocking writer got EAGAIN and cut the paste short. Only the server's reading end is non-blocking now. Test: the reading end does not block and the writing end does.
SelectionNotify was matched by target alone and every conversion asked into the same property, so a CLIPBOARD answer that came after its paste was given up went to the next paste, even a PRIMARY one. An answer must now name the selection, the type and the property of the transfer being asked for (or refuse it); each transfer asks into the next of four properties, so a late answer for the same selection is told apart too, and its data on the server's window is deleted. INCR answers, which the bridge does not take, now say that the paste is empty, and a compositor selection too large for one property says so. Test: an answer is the transfer's only with its selection, type and property, or as a refusal.
A frame with part of a notch in axis_value120 has no whole click, so its continuous value was counted as well, and one notch made two clicks. The continuous value is now left out of a frame that carries axis_value120 for its axis or comes from a wheel (axis_source wheel or tilt): the wheel's own count is the scroll. Test: four quarter-notch frames are one click; a touchpad's continuous scroll is kept.
X takes any WM_NORMAL_HINTS and WM_TRANSIENT_FOR, xdg-shell does not: a greatest size below the least is invalid_size, and a parent that is the window or one of its dialogs is invalid_parent, and either ends the connection, every window with it. The limits are now clamped (each at most i32::MAX, a greatest size raised to the least, per axis), and a parent that would close a cycle of the compositor's parents is refused; the host keeps each window's compositor parent, which a parent that goes hands on to its dialogs, as xdg-shell has it. Tests: clamped limits; a window refused as a dialog of itself, of a window naming it, and round a ring of three.
The root took the compositor's screen's size at start only; a later mode or scale change left it as it was. The host now asks for the new size (HostRequest::ScreenLayout, which the core answers with ScreenChanged) when its screen's size differs from the one the root was given, and the KMS platform resizes the root's storage before the core reads the RandR state from it. Tests: the layout asked for a size change and not for a refresh alone; the backend's root, RandR screen and storage take a later host size.
While a transfer was under way the host had the loop come round every 5 ms to move it. The bridge now watches its transfers' pipes with an epoll descriptor of its own (readable for a paste being read, writable for one being written), which the core loop polls as a second HostDisplay source (DisplayHost::wake_fd); its readiness brings the loop round, and the host's service moves the data. The host's deadline is the oldest transfer's patience, or at once for a paste waiting to be asked for; without an epoll descriptor it polls as before. Test: the descriptor is readable once a watched pipe has data, and not after the pipe is forgotten.
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 CI run for a folded branch. Not for merge.