fix(shells): paint and present Servo frames and report readiness truthfully
With servo-embed, weft-servo-shell and weft-app-shell did not compile
against the selected Servo revision: the keyboard event shape, key and
mouse action variants, frame readback, shutdown, URL type and window
handle APIs had changed. The frame path never called WebView::paint; the
software path rebuilt its softbuffer surface every frame and read pixels
without painting, and the EGL path presented nothing. weft-app-shell
printed READY right after creating its WebView, before any frame, and its
feature-disabled build printed READY and parked. Servo also disables CSS
Grid by default, which the system UI uses.
Both hosts now build against the selected API. Each frame is painted with
WebView::paint and presented: the software path reads the painted frame
back, presents the context and copies it into a persistent softbuffer
surface; the EGL path presents its window context. Nothing is presented
before Servo's first repaint request. Shutdown drops the WebView and
Servo, whose drop completes the shutdown, and exits the event loop. Both
hosts enable layout_grid_enabled.
weft-app-shell prints READY on the first frame presented after the
document has loaded and Servo reports its rendering settled: on load
completion it requests WebView::take_screenshot, which completes only once
every frame has fired load, render-blocking resources, images and web
fonts are done and the rendering is up to date. Feature-disabled builds of
both hosts exit with an error instead of reporting readiness. weft-appd
does not consume the app shell's READY yet.
tests/frame/check_frame.py runs weft-compositor nested on Xvfb with the
winit backend, starts a host showing tests/frame/reference.html and checks
the presented pixels (four colour quadrants and text). For the app host
the page must be on screen within two seconds of READY; --slow-style
delays a render-blocking stylesheet that reveals the page, so premature
readiness fails.
Validation (Ubuntu 24.04, Mesa 25.2.8 llvmpipe, software path):
- check_frame.py --host system, --host app and --host app --slow-style 3:
5 of 5 runs pass each
- negative fixtures fail: page with red and green swapped; a fake host
printing READY without rendering; a local build printing READY on its
first presented frame (--slow-style 4, 3 of 3)
- cargo clippy -D warnings with and without servo-embed; cargo fmt --check
- unverified: EGL path, DRM, resize, output scale, idle wakeup, input
2026-10-09 01:02:26 +00:00
|
|
|
"""Check that a Servo host paints and presents a known page through weft-compositor.
|
|
|
|
|
|
|
|
|
|
The harness starts Xvfb, runs weft-compositor nested on it with the winit
|
|
|
|
|
backend, launches a Servo host as a Wayland client showing `reference.html`,
|
|
|
|
|
captures the X screen and checks the presented pixels: four solid quadrants
|
|
|
|
|
(red, green, blue, white) in the page's arrangement and dark text pixels
|
|
|
|
|
inside the white quadrant. It exits non-zero when the frame never appears or
|
|
|
|
|
does not match.
|
|
|
|
|
|
|
|
|
|
`--host system` runs weft-servo-shell with the page as its system UI.
|
|
|
|
|
`--host app` installs the page as a package in a temporary app store and runs
|
|
|
|
|
weft-app-shell for it. The host must print READY, and the page must be on
|
|
|
|
|
screen within a short grace period after READY, because the compositor shows
|
|
|
|
|
a presented frame slightly later. READY printed within that grace before the
|
|
|
|
|
page is presented is therefore not detected. `--slow-style SECONDS` makes
|
2026-10-09 09:39:37 +00:00
|
|
|
early readiness observable: the page stays hidden until a stylesheet next to it
|
|
|
|
|
reveals it, and the harness holds a file lease that keeps the stylesheet from
|
|
|
|
|
being opened until the delay has passed, so a host that reports
|
fix(shells): paint and present Servo frames and report readiness truthfully
With servo-embed, weft-servo-shell and weft-app-shell did not compile
against the selected Servo revision: the keyboard event shape, key and
mouse action variants, frame readback, shutdown, URL type and window
handle APIs had changed. The frame path never called WebView::paint; the
software path rebuilt its softbuffer surface every frame and read pixels
without painting, and the EGL path presented nothing. weft-app-shell
printed READY right after creating its WebView, before any frame, and its
feature-disabled build printed READY and parked. Servo also disables CSS
Grid by default, which the system UI uses.
Both hosts now build against the selected API. Each frame is painted with
WebView::paint and presented: the software path reads the painted frame
back, presents the context and copies it into a persistent softbuffer
surface; the EGL path presents its window context. Nothing is presented
before Servo's first repaint request. Shutdown drops the WebView and
Servo, whose drop completes the shutdown, and exits the event loop. Both
hosts enable layout_grid_enabled.
weft-app-shell prints READY on the first frame presented after the
document has loaded and Servo reports its rendering settled: on load
completion it requests WebView::take_screenshot, which completes only once
every frame has fired load, render-blocking resources, images and web
fonts are done and the rendering is up to date. Feature-disabled builds of
both hosts exit with an error instead of reporting readiness. weft-appd
does not consume the app shell's READY yet.
tests/frame/check_frame.py runs weft-compositor nested on Xvfb with the
winit backend, starts a host showing tests/frame/reference.html and checks
the presented pixels (four colour quadrants and text). For the app host
the page must be on screen within two seconds of READY; --slow-style
delays a render-blocking stylesheet that reveals the page, so premature
readiness fails.
Validation (Ubuntu 24.04, Mesa 25.2.8 llvmpipe, software path):
- check_frame.py --host system, --host app and --host app --slow-style 3:
5 of 5 runs pass each
- negative fixtures fail: page with red and green swapped; a fake host
printing READY without rendering; a local build printing READY on its
first presented frame (--slow-style 4, 3 of 3)
- cargo clippy -D warnings with and without servo-embed; cargo fmt --check
- unverified: EGL path, DRM, resize, output scale, idle wakeup, input
2026-10-09 01:02:26 +00:00
|
|
|
READY before the document has loaded shows no page within the grace period.
|
|
|
|
|
|
test: verify native pointer and keyboard input through weft-compositor
Nothing checked that input reaches a page through the compositor; the
Servo hosts' input forwarding had only been compiled.
tests/frame/check_input.py runs weft-servo-shell with
tests/frame/input.html on the nested desktop and injects real X input
with xdotool into weft-compositor's window. The compositor's winit backend
routes it through its seat to the Wayland client, which has no X display.
The page must react in its presented pixels: clicks 6 px either side of
the boundary between its halves change only the half under the pointer,
and the a and Shift+a key presses arrive with the right key value and
modifier. The harness gives the compositor's X window input focus, as a
window manager would; the client's keyboard focus comes from the
compositor's click-to-focus.
The nested desktop setup shared with check_frame.py moves to
tests/frame/session.py. Xvfb now reports the display it picked through
-displayfd, so concurrent runs cannot share an X server, and a run clears
only the logs and capture it writes.
Validation:
- check_input.py: 3 of 3 runs pass; two concurrent runs pass
- negative pages fail: no script; left click handled by the right half;
an element extending the left half 20 px across the boundary; a key
handler ignoring Shift
- check_frame.py --host system, --host app, --host app --slow-style 3 pass
after the refactor
- unverified: key release and repeat, pointer motion and button release
events, wheel, focus loss, non-US layouts, non-ASCII text, scale changes,
weft-app-shell input
2026-10-09 01:18:53 +00:00
|
|
|
Requires Xvfb, xwd and ImageMagick's convert; see session.py.
|
fix(shells): paint and present Servo frames and report readiness truthfully
With servo-embed, weft-servo-shell and weft-app-shell did not compile
against the selected Servo revision: the keyboard event shape, key and
mouse action variants, frame readback, shutdown, URL type and window
handle APIs had changed. The frame path never called WebView::paint; the
software path rebuilt its softbuffer surface every frame and read pixels
without painting, and the EGL path presented nothing. weft-app-shell
printed READY right after creating its WebView, before any frame, and its
feature-disabled build printed READY and parked. Servo also disables CSS
Grid by default, which the system UI uses.
Both hosts now build against the selected API. Each frame is painted with
WebView::paint and presented: the software path reads the painted frame
back, presents the context and copies it into a persistent softbuffer
surface; the EGL path presents its window context. Nothing is presented
before Servo's first repaint request. Shutdown drops the WebView and
Servo, whose drop completes the shutdown, and exits the event loop. Both
hosts enable layout_grid_enabled.
weft-app-shell prints READY on the first frame presented after the
document has loaded and Servo reports its rendering settled: on load
completion it requests WebView::take_screenshot, which completes only once
every frame has fired load, render-blocking resources, images and web
fonts are done and the rendering is up to date. Feature-disabled builds of
both hosts exit with an error instead of reporting readiness. weft-appd
does not consume the app shell's READY yet.
tests/frame/check_frame.py runs weft-compositor nested on Xvfb with the
winit backend, starts a host showing tests/frame/reference.html and checks
the presented pixels (four colour quadrants and text). For the app host
the page must be on screen within two seconds of READY; --slow-style
delays a render-blocking stylesheet that reveals the page, so premature
readiness fails.
Validation (Ubuntu 24.04, Mesa 25.2.8 llvmpipe, software path):
- check_frame.py --host system, --host app and --host app --slow-style 3:
5 of 5 runs pass each
- negative fixtures fail: page with red and green swapped; a fake host
printing READY without rendering; a local build printing READY on its
first presented frame (--slow-style 4, 3 of 3)
- cargo clippy -D warnings with and without servo-embed; cargo fmt --check
- unverified: EGL path, DRM, resize, output scale, idle wakeup, input
2026-10-09 01:02:26 +00:00
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
import argparse
|
2026-10-09 09:39:37 +00:00
|
|
|
import fcntl
|
|
|
|
|
import os
|
fix(shells): paint and present Servo frames and report readiness truthfully
With servo-embed, weft-servo-shell and weft-app-shell did not compile
against the selected Servo revision: the keyboard event shape, key and
mouse action variants, frame readback, shutdown, URL type and window
handle APIs had changed. The frame path never called WebView::paint; the
software path rebuilt its softbuffer surface every frame and read pixels
without painting, and the EGL path presented nothing. weft-app-shell
printed READY right after creating its WebView, before any frame, and its
feature-disabled build printed READY and parked. Servo also disables CSS
Grid by default, which the system UI uses.
Both hosts now build against the selected API. Each frame is painted with
WebView::paint and presented: the software path reads the painted frame
back, presents the context and copies it into a persistent softbuffer
surface; the EGL path presents its window context. Nothing is presented
before Servo's first repaint request. Shutdown drops the WebView and
Servo, whose drop completes the shutdown, and exits the event loop. Both
hosts enable layout_grid_enabled.
weft-app-shell prints READY on the first frame presented after the
document has loaded and Servo reports its rendering settled: on load
completion it requests WebView::take_screenshot, which completes only once
every frame has fired load, render-blocking resources, images and web
fonts are done and the rendering is up to date. Feature-disabled builds of
both hosts exit with an error instead of reporting readiness. weft-appd
does not consume the app shell's READY yet.
tests/frame/check_frame.py runs weft-compositor nested on Xvfb with the
winit backend, starts a host showing tests/frame/reference.html and checks
the presented pixels (four colour quadrants and text). For the app host
the page must be on screen within two seconds of READY; --slow-style
delays a render-blocking stylesheet that reveals the page, so premature
readiness fails.
Validation (Ubuntu 24.04, Mesa 25.2.8 llvmpipe, software path):
- check_frame.py --host system, --host app and --host app --slow-style 3:
5 of 5 runs pass each
- negative fixtures fail: page with red and green swapped; a fake host
printing READY without rendering; a local build printing READY on its
first presented frame (--slow-style 4, 3 of 3)
- cargo clippy -D warnings with and without servo-embed; cargo fmt --check
- unverified: EGL path, DRM, resize, output scale, idle wakeup, input
2026-10-09 01:02:26 +00:00
|
|
|
import shutil
|
2026-10-09 09:39:37 +00:00
|
|
|
import signal
|
fix(shells): paint and present Servo frames and report readiness truthfully
With servo-embed, weft-servo-shell and weft-app-shell did not compile
against the selected Servo revision: the keyboard event shape, key and
mouse action variants, frame readback, shutdown, URL type and window
handle APIs had changed. The frame path never called WebView::paint; the
software path rebuilt its softbuffer surface every frame and read pixels
without painting, and the EGL path presented nothing. weft-app-shell
printed READY right after creating its WebView, before any frame, and its
feature-disabled build printed READY and parked. Servo also disables CSS
Grid by default, which the system UI uses.
Both hosts now build against the selected API. Each frame is painted with
WebView::paint and presented: the software path reads the painted frame
back, presents the context and copies it into a persistent softbuffer
surface; the EGL path presents its window context. Nothing is presented
before Servo's first repaint request. Shutdown drops the WebView and
Servo, whose drop completes the shutdown, and exits the event loop. Both
hosts enable layout_grid_enabled.
weft-app-shell prints READY on the first frame presented after the
document has loaded and Servo reports its rendering settled: on load
completion it requests WebView::take_screenshot, which completes only once
every frame has fired load, render-blocking resources, images and web
fonts are done and the rendering is up to date. Feature-disabled builds of
both hosts exit with an error instead of reporting readiness. weft-appd
does not consume the app shell's READY yet.
tests/frame/check_frame.py runs weft-compositor nested on Xvfb with the
winit backend, starts a host showing tests/frame/reference.html and checks
the presented pixels (four colour quadrants and text). For the app host
the page must be on screen within two seconds of READY; --slow-style
delays a render-blocking stylesheet that reveals the page, so premature
readiness fails.
Validation (Ubuntu 24.04, Mesa 25.2.8 llvmpipe, software path):
- check_frame.py --host system, --host app and --host app --slow-style 3:
5 of 5 runs pass each
- negative fixtures fail: page with red and green swapped; a fake host
printing READY without rendering; a local build printing READY on its
first presented frame (--slow-style 4, 3 of 3)
- cargo clippy -D warnings with and without servo-embed; cargo fmt --check
- unverified: EGL path, DRM, resize, output scale, idle wakeup, input
2026-10-09 01:02:26 +00:00
|
|
|
import sys
|
|
|
|
|
import threading
|
|
|
|
|
import time
|
|
|
|
|
from pathlib import Path
|
|
|
|
|
|
test: verify native pointer and keyboard input through weft-compositor
Nothing checked that input reaches a page through the compositor; the
Servo hosts' input forwarding had only been compiled.
tests/frame/check_input.py runs weft-servo-shell with
tests/frame/input.html on the nested desktop and injects real X input
with xdotool into weft-compositor's window. The compositor's winit backend
routes it through its seat to the Wayland client, which has no X display.
The page must react in its presented pixels: clicks 6 px either side of
the boundary between its halves change only the half under the pointer,
and the a and Shift+a key presses arrive with the right key value and
modifier. The harness gives the compositor's X window input focus, as a
window manager would; the client's keyboard focus comes from the
compositor's click-to-focus.
The nested desktop setup shared with check_frame.py moves to
tests/frame/session.py. Xvfb now reports the display it picked through
-displayfd, so concurrent runs cannot share an X server, and a run clears
only the logs and capture it writes.
Validation:
- check_input.py: 3 of 3 runs pass; two concurrent runs pass
- negative pages fail: no script; left click handled by the right half;
an element extending the left half 20 px across the boundary; a key
handler ignoring Shift
- check_frame.py --host system, --host app, --host app --slow-style 3 pass
after the refactor
- unverified: key release and repeat, pointer motion and button release
events, wheel, focus loss, non-US layouts, non-ASCII text, scale changes,
weft-app-shell input
2026-10-09 01:18:53 +00:00
|
|
|
sys.dont_write_bytecode = True
|
|
|
|
|
from session import ROOT, Desktop, SessionError, bounding_box, missing_tools, parse_ppm # noqa: E402
|
|
|
|
|
|
fix(shells): paint and present Servo frames and report readiness truthfully
With servo-embed, weft-servo-shell and weft-app-shell did not compile
against the selected Servo revision: the keyboard event shape, key and
mouse action variants, frame readback, shutdown, URL type and window
handle APIs had changed. The frame path never called WebView::paint; the
software path rebuilt its softbuffer surface every frame and read pixels
without painting, and the EGL path presented nothing. weft-app-shell
printed READY right after creating its WebView, before any frame, and its
feature-disabled build printed READY and parked. Servo also disables CSS
Grid by default, which the system UI uses.
Both hosts now build against the selected API. Each frame is painted with
WebView::paint and presented: the software path reads the painted frame
back, presents the context and copies it into a persistent softbuffer
surface; the EGL path presents its window context. Nothing is presented
before Servo's first repaint request. Shutdown drops the WebView and
Servo, whose drop completes the shutdown, and exits the event loop. Both
hosts enable layout_grid_enabled.
weft-app-shell prints READY on the first frame presented after the
document has loaded and Servo reports its rendering settled: on load
completion it requests WebView::take_screenshot, which completes only once
every frame has fired load, render-blocking resources, images and web
fonts are done and the rendering is up to date. Feature-disabled builds of
both hosts exit with an error instead of reporting readiness. weft-appd
does not consume the app shell's READY yet.
tests/frame/check_frame.py runs weft-compositor nested on Xvfb with the
winit backend, starts a host showing tests/frame/reference.html and checks
the presented pixels (four colour quadrants and text). For the app host
the page must be on screen within two seconds of READY; --slow-style
delays a render-blocking stylesheet that reveals the page, so premature
readiness fails.
Validation (Ubuntu 24.04, Mesa 25.2.8 llvmpipe, software path):
- check_frame.py --host system, --host app and --host app --slow-style 3:
5 of 5 runs pass each
- negative fixtures fail: page with red and green swapped; a fake host
printing READY without rendering; a local build printing READY on its
first presented frame (--slow-style 4, 3 of 3)
- cargo clippy -D warnings with and without servo-embed; cargo fmt --check
- unverified: EGL path, DRM, resize, output scale, idle wakeup, input
2026-10-09 01:02:26 +00:00
|
|
|
|
|
|
|
|
HERE = Path(__file__).resolve().parent
|
|
|
|
|
COLORS = {
|
|
|
|
|
"red": (255, 0, 0),
|
|
|
|
|
"green": (0, 255, 0),
|
|
|
|
|
"blue": (0, 0, 255),
|
|
|
|
|
"white": (255, 255, 255),
|
|
|
|
|
}
|
|
|
|
|
MIN_SIDE = 40
|
|
|
|
|
MIN_TEXT_PIXELS = 30
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def dark_pixels(width, pixels, box):
|
|
|
|
|
x0, y0, x1, y1 = box
|
|
|
|
|
count = 0
|
|
|
|
|
for y in range(y0, y1 + 1):
|
|
|
|
|
for x in range(x0, x1 + 1):
|
|
|
|
|
offset = (y * width + x) * 3
|
|
|
|
|
if max(pixels[offset:offset + 3]) < 96:
|
|
|
|
|
count += 1
|
|
|
|
|
return count
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def evaluate(width, height, pixels):
|
|
|
|
|
"""Return a list of problems with the captured frame; empty means it matches."""
|
|
|
|
|
boxes = {name: bounding_box(width, height, pixels, color) for name, color in COLORS.items()}
|
|
|
|
|
problems = [f"no {name} region" for name, box in boxes.items() if box is None]
|
|
|
|
|
if problems:
|
|
|
|
|
return problems
|
|
|
|
|
for name, (x0, y0, x1, y1) in boxes.items():
|
|
|
|
|
if x1 - x0 < MIN_SIDE or y1 - y0 < MIN_SIDE:
|
|
|
|
|
problems.append(f"{name} region too small: {x1 - x0 + 1}x{y1 - y0 + 1}")
|
|
|
|
|
red, green, blue, white = (boxes[n] for n in ("red", "green", "blue", "white"))
|
|
|
|
|
if not green[0] > red[2]:
|
|
|
|
|
problems.append("green is not right of red")
|
|
|
|
|
if not blue[1] > red[3]:
|
|
|
|
|
problems.append("blue is not below red")
|
|
|
|
|
if not (white[0] > blue[2] and white[1] > green[3]):
|
|
|
|
|
problems.append("white is not below green and right of blue")
|
|
|
|
|
if abs(red[1] - green[1]) > 4 or abs(red[0] - blue[0]) > 4:
|
|
|
|
|
problems.append("quadrants are not aligned")
|
|
|
|
|
text = dark_pixels(width, pixels, white)
|
|
|
|
|
if text < MIN_TEXT_PIXELS:
|
|
|
|
|
problems.append(f"no text in white region ({text} dark pixels)")
|
|
|
|
|
return problems
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
APP_ID = "org.weft.test.frame"
|
|
|
|
|
COMPOSITE_GRACE = 2.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def install_app(store, page):
|
|
|
|
|
"""Install `page` as the UI entry of a minimal package and return the store root."""
|
|
|
|
|
package = store / APP_ID
|
|
|
|
|
(package / "ui").mkdir(parents=True)
|
|
|
|
|
shutil.copyfile(page, package / "ui" / "index.html")
|
|
|
|
|
(package / "wapp.toml").write_text(
|
|
|
|
|
"[package]\n"
|
|
|
|
|
f'id = "{APP_ID}"\n'
|
|
|
|
|
'name = "Frame reference"\n'
|
|
|
|
|
'version = "0.0.0"\n'
|
|
|
|
|
"\n[runtime]\n"
|
|
|
|
|
'module = "app.wasm"\n'
|
|
|
|
|
"\n[ui]\n"
|
|
|
|
|
'entry = "ui/index.html"\n',
|
|
|
|
|
encoding="utf-8",
|
|
|
|
|
)
|
|
|
|
|
return store
|
|
|
|
|
|
|
|
|
|
|
2026-10-09 09:39:37 +00:00
|
|
|
def slow_style(directory, delay):
|
|
|
|
|
"""Create `directory/reveal.css`, a stylesheet revealing the page, that
|
|
|
|
|
cannot be opened until `delay` seconds have passed. A write lease makes
|
|
|
|
|
any other process's open() wait until the lease is released. The
|
|
|
|
|
stylesheet is a local file next to the page, so an application host
|
|
|
|
|
confined to its UI directory may load it."""
|
|
|
|
|
sheet = directory / "reveal.css"
|
|
|
|
|
sheet.write_text("body { visibility: visible; }", encoding="utf-8")
|
|
|
|
|
# The kernel signals the lease holder when another open() waits on it.
|
|
|
|
|
signal.signal(signal.SIGIO, signal.SIG_IGN)
|
|
|
|
|
lease = os.open(sheet, os.O_WRONLY)
|
|
|
|
|
fcntl.fcntl(lease, fcntl.F_SETLEASE, fcntl.F_WRLCK)
|
fix(shells): paint and present Servo frames and report readiness truthfully
With servo-embed, weft-servo-shell and weft-app-shell did not compile
against the selected Servo revision: the keyboard event shape, key and
mouse action variants, frame readback, shutdown, URL type and window
handle APIs had changed. The frame path never called WebView::paint; the
software path rebuilt its softbuffer surface every frame and read pixels
without painting, and the EGL path presented nothing. weft-app-shell
printed READY right after creating its WebView, before any frame, and its
feature-disabled build printed READY and parked. Servo also disables CSS
Grid by default, which the system UI uses.
Both hosts now build against the selected API. Each frame is painted with
WebView::paint and presented: the software path reads the painted frame
back, presents the context and copies it into a persistent softbuffer
surface; the EGL path presents its window context. Nothing is presented
before Servo's first repaint request. Shutdown drops the WebView and
Servo, whose drop completes the shutdown, and exits the event loop. Both
hosts enable layout_grid_enabled.
weft-app-shell prints READY on the first frame presented after the
document has loaded and Servo reports its rendering settled: on load
completion it requests WebView::take_screenshot, which completes only once
every frame has fired load, render-blocking resources, images and web
fonts are done and the rendering is up to date. Feature-disabled builds of
both hosts exit with an error instead of reporting readiness. weft-appd
does not consume the app shell's READY yet.
tests/frame/check_frame.py runs weft-compositor nested on Xvfb with the
winit backend, starts a host showing tests/frame/reference.html and checks
the presented pixels (four colour quadrants and text). For the app host
the page must be on screen within two seconds of READY; --slow-style
delays a render-blocking stylesheet that reveals the page, so premature
readiness fails.
Validation (Ubuntu 24.04, Mesa 25.2.8 llvmpipe, software path):
- check_frame.py --host system, --host app and --host app --slow-style 3:
5 of 5 runs pass each
- negative fixtures fail: page with red and green swapped; a fake host
printing READY without rendering; a local build printing READY on its
first presented frame (--slow-style 4, 3 of 3)
- cargo clippy -D warnings with and without servo-embed; cargo fmt --check
- unverified: EGL path, DRM, resize, output scale, idle wakeup, input
2026-10-09 01:02:26 +00:00
|
|
|
|
2026-10-09 09:39:37 +00:00
|
|
|
def release():
|
|
|
|
|
time.sleep(delay)
|
|
|
|
|
fcntl.fcntl(lease, fcntl.F_SETLEASE, fcntl.F_UNLCK)
|
|
|
|
|
os.close(lease)
|
fix(shells): paint and present Servo frames and report readiness truthfully
With servo-embed, weft-servo-shell and weft-app-shell did not compile
against the selected Servo revision: the keyboard event shape, key and
mouse action variants, frame readback, shutdown, URL type and window
handle APIs had changed. The frame path never called WebView::paint; the
software path rebuilt its softbuffer surface every frame and read pixels
without painting, and the EGL path presented nothing. weft-app-shell
printed READY right after creating its WebView, before any frame, and its
feature-disabled build printed READY and parked. Servo also disables CSS
Grid by default, which the system UI uses.
Both hosts now build against the selected API. Each frame is painted with
WebView::paint and presented: the software path reads the painted frame
back, presents the context and copies it into a persistent softbuffer
surface; the EGL path presents its window context. Nothing is presented
before Servo's first repaint request. Shutdown drops the WebView and
Servo, whose drop completes the shutdown, and exits the event loop. Both
hosts enable layout_grid_enabled.
weft-app-shell prints READY on the first frame presented after the
document has loaded and Servo reports its rendering settled: on load
completion it requests WebView::take_screenshot, which completes only once
every frame has fired load, render-blocking resources, images and web
fonts are done and the rendering is up to date. Feature-disabled builds of
both hosts exit with an error instead of reporting readiness. weft-appd
does not consume the app shell's READY yet.
tests/frame/check_frame.py runs weft-compositor nested on Xvfb with the
winit backend, starts a host showing tests/frame/reference.html and checks
the presented pixels (four colour quadrants and text). For the app host
the page must be on screen within two seconds of READY; --slow-style
delays a render-blocking stylesheet that reveals the page, so premature
readiness fails.
Validation (Ubuntu 24.04, Mesa 25.2.8 llvmpipe, software path):
- check_frame.py --host system, --host app and --host app --slow-style 3:
5 of 5 runs pass each
- negative fixtures fail: page with red and green swapped; a fake host
printing READY without rendering; a local build printing READY on its
first presented frame (--slow-style 4, 3 of 3)
- cargo clippy -D warnings with and without servo-embed; cargo fmt --check
- unverified: EGL path, DRM, resize, output scale, idle wakeup, input
2026-10-09 01:02:26 +00:00
|
|
|
|
2026-10-09 09:39:37 +00:00
|
|
|
threading.Thread(target=release, daemon=True).start()
|
fix(shells): paint and present Servo frames and report readiness truthfully
With servo-embed, weft-servo-shell and weft-app-shell did not compile
against the selected Servo revision: the keyboard event shape, key and
mouse action variants, frame readback, shutdown, URL type and window
handle APIs had changed. The frame path never called WebView::paint; the
software path rebuilt its softbuffer surface every frame and read pixels
without painting, and the EGL path presented nothing. weft-app-shell
printed READY right after creating its WebView, before any frame, and its
feature-disabled build printed READY and parked. Servo also disables CSS
Grid by default, which the system UI uses.
Both hosts now build against the selected API. Each frame is painted with
WebView::paint and presented: the software path reads the painted frame
back, presents the context and copies it into a persistent softbuffer
surface; the EGL path presents its window context. Nothing is presented
before Servo's first repaint request. Shutdown drops the WebView and
Servo, whose drop completes the shutdown, and exits the event loop. Both
hosts enable layout_grid_enabled.
weft-app-shell prints READY on the first frame presented after the
document has loaded and Servo reports its rendering settled: on load
completion it requests WebView::take_screenshot, which completes only once
every frame has fired load, render-blocking resources, images and web
fonts are done and the rendering is up to date. Feature-disabled builds of
both hosts exit with an error instead of reporting readiness. weft-appd
does not consume the app shell's READY yet.
tests/frame/check_frame.py runs weft-compositor nested on Xvfb with the
winit backend, starts a host showing tests/frame/reference.html and checks
the presented pixels (four colour quadrants and text). For the app host
the page must be on screen within two seconds of READY; --slow-style
delays a render-blocking stylesheet that reveals the page, so premature
readiness fails.
Validation (Ubuntu 24.04, Mesa 25.2.8 llvmpipe, software path):
- check_frame.py --host system, --host app and --host app --slow-style 3:
5 of 5 runs pass each
- negative fixtures fail: page with red and green swapped; a fake host
printing READY without rendering; a local build printing READY on its
first presented frame (--slow-style 4, 3 of 3)
- cargo clippy -D warnings with and without servo-embed; cargo fmt --check
- unverified: EGL path, DRM, resize, output scale, idle wakeup, input
2026-10-09 01:02:26 +00:00
|
|
|
|
|
|
|
|
|
2026-10-09 09:39:37 +00:00
|
|
|
def hidden_until_styled(page, destination):
|
fix(shells): paint and present Servo frames and report readiness truthfully
With servo-embed, weft-servo-shell and weft-app-shell did not compile
against the selected Servo revision: the keyboard event shape, key and
mouse action variants, frame readback, shutdown, URL type and window
handle APIs had changed. The frame path never called WebView::paint; the
software path rebuilt its softbuffer surface every frame and read pixels
without painting, and the EGL path presented nothing. weft-app-shell
printed READY right after creating its WebView, before any frame, and its
feature-disabled build printed READY and parked. Servo also disables CSS
Grid by default, which the system UI uses.
Both hosts now build against the selected API. Each frame is painted with
WebView::paint and presented: the software path reads the painted frame
back, presents the context and copies it into a persistent softbuffer
surface; the EGL path presents its window context. Nothing is presented
before Servo's first repaint request. Shutdown drops the WebView and
Servo, whose drop completes the shutdown, and exits the event loop. Both
hosts enable layout_grid_enabled.
weft-app-shell prints READY on the first frame presented after the
document has loaded and Servo reports its rendering settled: on load
completion it requests WebView::take_screenshot, which completes only once
every frame has fired load, render-blocking resources, images and web
fonts are done and the rendering is up to date. Feature-disabled builds of
both hosts exit with an error instead of reporting readiness. weft-appd
does not consume the app shell's READY yet.
tests/frame/check_frame.py runs weft-compositor nested on Xvfb with the
winit backend, starts a host showing tests/frame/reference.html and checks
the presented pixels (four colour quadrants and text). For the app host
the page must be on screen within two seconds of READY; --slow-style
delays a render-blocking stylesheet that reveals the page, so premature
readiness fails.
Validation (Ubuntu 24.04, Mesa 25.2.8 llvmpipe, software path):
- check_frame.py --host system, --host app and --host app --slow-style 3:
5 of 5 runs pass each
- negative fixtures fail: page with red and green swapped; a fake host
printing READY without rendering; a local build printing READY on its
first presented frame (--slow-style 4, 3 of 3)
- cargo clippy -D warnings with and without servo-embed; cargo fmt --check
- unverified: EGL path, DRM, resize, output scale, idle wakeup, input
2026-10-09 01:02:26 +00:00
|
|
|
"""Copy `page`, hiding its body until the delayed stylesheet loads."""
|
|
|
|
|
html = page.read_text(encoding="utf-8")
|
2026-10-09 09:39:37 +00:00
|
|
|
link = ('<style>body { visibility: hidden; }</style>\n'
|
|
|
|
|
'<link rel="stylesheet" href="reveal.css">\n</head>')
|
fix(shells): paint and present Servo frames and report readiness truthfully
With servo-embed, weft-servo-shell and weft-app-shell did not compile
against the selected Servo revision: the keyboard event shape, key and
mouse action variants, frame readback, shutdown, URL type and window
handle APIs had changed. The frame path never called WebView::paint; the
software path rebuilt its softbuffer surface every frame and read pixels
without painting, and the EGL path presented nothing. weft-app-shell
printed READY right after creating its WebView, before any frame, and its
feature-disabled build printed READY and parked. Servo also disables CSS
Grid by default, which the system UI uses.
Both hosts now build against the selected API. Each frame is painted with
WebView::paint and presented: the software path reads the painted frame
back, presents the context and copies it into a persistent softbuffer
surface; the EGL path presents its window context. Nothing is presented
before Servo's first repaint request. Shutdown drops the WebView and
Servo, whose drop completes the shutdown, and exits the event loop. Both
hosts enable layout_grid_enabled.
weft-app-shell prints READY on the first frame presented after the
document has loaded and Servo reports its rendering settled: on load
completion it requests WebView::take_screenshot, which completes only once
every frame has fired load, render-blocking resources, images and web
fonts are done and the rendering is up to date. Feature-disabled builds of
both hosts exit with an error instead of reporting readiness. weft-appd
does not consume the app shell's READY yet.
tests/frame/check_frame.py runs weft-compositor nested on Xvfb with the
winit backend, starts a host showing tests/frame/reference.html and checks
the presented pixels (four colour quadrants and text). For the app host
the page must be on screen within two seconds of READY; --slow-style
delays a render-blocking stylesheet that reveals the page, so premature
readiness fails.
Validation (Ubuntu 24.04, Mesa 25.2.8 llvmpipe, software path):
- check_frame.py --host system, --host app and --host app --slow-style 3:
5 of 5 runs pass each
- negative fixtures fail: page with red and green swapped; a fake host
printing READY without rendering; a local build printing READY on its
first presented frame (--slow-style 4, 3 of 3)
- cargo clippy -D warnings with and without servo-embed; cargo fmt --check
- unverified: EGL path, DRM, resize, output scale, idle wakeup, input
2026-10-09 01:02:26 +00:00
|
|
|
if "</head>" not in html:
|
|
|
|
|
raise ValueError(f"{page} has no </head>")
|
|
|
|
|
destination.write_text(html.replace("</head>", link, 1), encoding="utf-8")
|
|
|
|
|
return destination
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def main(argv=None):
|
|
|
|
|
parser = argparse.ArgumentParser(description=__doc__,
|
|
|
|
|
formatter_class=argparse.RawDescriptionHelpFormatter)
|
|
|
|
|
parser.add_argument("--compositor", type=Path,
|
|
|
|
|
default=ROOT / "target/debug/weft-compositor")
|
|
|
|
|
parser.add_argument("--host", choices=("system", "app"), default="system")
|
|
|
|
|
parser.add_argument("--shell", type=Path,
|
|
|
|
|
help="host binary (default: target/debug/weft-servo-shell or "
|
|
|
|
|
"target/debug/weft-app-shell)")
|
|
|
|
|
parser.add_argument("--page", type=Path, default=HERE / "reference.html")
|
|
|
|
|
parser.add_argument("--slow-style", type=float, metavar="SECONDS",
|
|
|
|
|
help="hide the page until a stylesheet delayed by SECONDS loads")
|
|
|
|
|
parser.add_argument("--timeout", type=float, default=120.0,
|
|
|
|
|
help="seconds to wait for a matching frame")
|
|
|
|
|
parser.add_argument("--output", type=Path, default=ROOT / "target/frame-check",
|
|
|
|
|
help="directory for logs and the captured screenshot")
|
|
|
|
|
args = parser.parse_args(argv)
|
2026-10-09 09:39:37 +00:00
|
|
|
if args.slow_style:
|
|
|
|
|
# The kernel revokes a lease that is held longer than this.
|
|
|
|
|
limit = int(Path("/proc/sys/fs/lease-break-time").read_text())
|
|
|
|
|
if not 0 < args.slow_style < limit:
|
|
|
|
|
parser.error(f"--slow-style must be between 0 and {limit} seconds")
|
fix(shells): paint and present Servo frames and report readiness truthfully
With servo-embed, weft-servo-shell and weft-app-shell did not compile
against the selected Servo revision: the keyboard event shape, key and
mouse action variants, frame readback, shutdown, URL type and window
handle APIs had changed. The frame path never called WebView::paint; the
software path rebuilt its softbuffer surface every frame and read pixels
without painting, and the EGL path presented nothing. weft-app-shell
printed READY right after creating its WebView, before any frame, and its
feature-disabled build printed READY and parked. Servo also disables CSS
Grid by default, which the system UI uses.
Both hosts now build against the selected API. Each frame is painted with
WebView::paint and presented: the software path reads the painted frame
back, presents the context and copies it into a persistent softbuffer
surface; the EGL path presents its window context. Nothing is presented
before Servo's first repaint request. Shutdown drops the WebView and
Servo, whose drop completes the shutdown, and exits the event loop. Both
hosts enable layout_grid_enabled.
weft-app-shell prints READY on the first frame presented after the
document has loaded and Servo reports its rendering settled: on load
completion it requests WebView::take_screenshot, which completes only once
every frame has fired load, render-blocking resources, images and web
fonts are done and the rendering is up to date. Feature-disabled builds of
both hosts exit with an error instead of reporting readiness. weft-appd
does not consume the app shell's READY yet.
tests/frame/check_frame.py runs weft-compositor nested on Xvfb with the
winit backend, starts a host showing tests/frame/reference.html and checks
the presented pixels (four colour quadrants and text). For the app host
the page must be on screen within two seconds of READY; --slow-style
delays a render-blocking stylesheet that reveals the page, so premature
readiness fails.
Validation (Ubuntu 24.04, Mesa 25.2.8 llvmpipe, software path):
- check_frame.py --host system, --host app and --host app --slow-style 3:
5 of 5 runs pass each
- negative fixtures fail: page with red and green swapped; a fake host
printing READY without rendering; a local build printing READY on its
first presented frame (--slow-style 4, 3 of 3)
- cargo clippy -D warnings with and without servo-embed; cargo fmt --check
- unverified: EGL path, DRM, resize, output scale, idle wakeup, input
2026-10-09 01:02:26 +00:00
|
|
|
if args.shell is None:
|
|
|
|
|
name = "weft-servo-shell" if args.host == "system" else "weft-app-shell"
|
|
|
|
|
args.shell = ROOT / "target/debug" / name
|
|
|
|
|
|
test: verify native pointer and keyboard input through weft-compositor
Nothing checked that input reaches a page through the compositor; the
Servo hosts' input forwarding had only been compiled.
tests/frame/check_input.py runs weft-servo-shell with
tests/frame/input.html on the nested desktop and injects real X input
with xdotool into weft-compositor's window. The compositor's winit backend
routes it through its seat to the Wayland client, which has no X display.
The page must react in its presented pixels: clicks 6 px either side of
the boundary between its halves change only the half under the pointer,
and the a and Shift+a key presses arrive with the right key value and
modifier. The harness gives the compositor's X window input focus, as a
window manager would; the client's keyboard focus comes from the
compositor's click-to-focus.
The nested desktop setup shared with check_frame.py moves to
tests/frame/session.py. Xvfb now reports the display it picked through
-displayfd, so concurrent runs cannot share an X server, and a run clears
only the logs and capture it writes.
Validation:
- check_input.py: 3 of 3 runs pass; two concurrent runs pass
- negative pages fail: no script; left click handled by the right half;
an element extending the left half 20 px across the boundary; a key
handler ignoring Shift
- check_frame.py --host system, --host app, --host app --slow-style 3 pass
after the refactor
- unverified: key release and repeat, pointer motion and button release
events, wheel, focus loss, non-US layouts, non-ASCII text, scale changes,
weft-app-shell input
2026-10-09 01:18:53 +00:00
|
|
|
missing = missing_tools() + [str(b) for b in (args.compositor, args.shell) if not b.is_file()]
|
|
|
|
|
if missing:
|
|
|
|
|
print("missing: " + ", ".join(missing), file=sys.stderr)
|
|
|
|
|
return 2
|
fix(shells): paint and present Servo frames and report readiness truthfully
With servo-embed, weft-servo-shell and weft-app-shell did not compile
against the selected Servo revision: the keyboard event shape, key and
mouse action variants, frame readback, shutdown, URL type and window
handle APIs had changed. The frame path never called WebView::paint; the
software path rebuilt its softbuffer surface every frame and read pixels
without painting, and the EGL path presented nothing. weft-app-shell
printed READY right after creating its WebView, before any frame, and its
feature-disabled build printed READY and parked. Servo also disables CSS
Grid by default, which the system UI uses.
Both hosts now build against the selected API. Each frame is painted with
WebView::paint and presented: the software path reads the painted frame
back, presents the context and copies it into a persistent softbuffer
surface; the EGL path presents its window context. Nothing is presented
before Servo's first repaint request. Shutdown drops the WebView and
Servo, whose drop completes the shutdown, and exits the event loop. Both
hosts enable layout_grid_enabled.
weft-app-shell prints READY on the first frame presented after the
document has loaded and Servo reports its rendering settled: on load
completion it requests WebView::take_screenshot, which completes only once
every frame has fired load, render-blocking resources, images and web
fonts are done and the rendering is up to date. Feature-disabled builds of
both hosts exit with an error instead of reporting readiness. weft-appd
does not consume the app shell's READY yet.
tests/frame/check_frame.py runs weft-compositor nested on Xvfb with the
winit backend, starts a host showing tests/frame/reference.html and checks
the presented pixels (four colour quadrants and text). For the app host
the page must be on screen within two seconds of READY; --slow-style
delays a render-blocking stylesheet that reveals the page, so premature
readiness fails.
Validation (Ubuntu 24.04, Mesa 25.2.8 llvmpipe, software path):
- check_frame.py --host system, --host app and --host app --slow-style 3:
5 of 5 runs pass each
- negative fixtures fail: page with red and green swapped; a fake host
printing READY without rendering; a local build printing READY on its
first presented frame (--slow-style 4, 3 of 3)
- cargo clippy -D warnings with and without servo-embed; cargo fmt --check
- unverified: EGL path, DRM, resize, output scale, idle wakeup, input
2026-10-09 01:02:26 +00:00
|
|
|
|
|
|
|
|
try:
|
test: verify native pointer and keyboard input through weft-compositor
Nothing checked that input reaches a page through the compositor; the
Servo hosts' input forwarding had only been compiled.
tests/frame/check_input.py runs weft-servo-shell with
tests/frame/input.html on the nested desktop and injects real X input
with xdotool into weft-compositor's window. The compositor's winit backend
routes it through its seat to the Wayland client, which has no X display.
The page must react in its presented pixels: clicks 6 px either side of
the boundary between its halves change only the half under the pointer,
and the a and Shift+a key presses arrive with the right key value and
modifier. The harness gives the compositor's X window input focus, as a
window manager would; the client's keyboard focus comes from the
compositor's click-to-focus.
The nested desktop setup shared with check_frame.py moves to
tests/frame/session.py. Xvfb now reports the display it picked through
-displayfd, so concurrent runs cannot share an X server, and a run clears
only the logs and capture it writes.
Validation:
- check_input.py: 3 of 3 runs pass; two concurrent runs pass
- negative pages fail: no script; left click handled by the right half;
an element extending the left half 20 px across the boundary; a key
handler ignoring Shift
- check_frame.py --host system, --host app, --host app --slow-style 3 pass
after the refactor
- unverified: key release and repeat, pointer motion and button release
events, wheel, focus loss, non-US layouts, non-ASCII text, scale changes,
weft-app-shell input
2026-10-09 01:18:53 +00:00
|
|
|
with Desktop(args.compositor, args.output, outputs=["frame.ppm"]) as desktop:
|
|
|
|
|
page = args.page
|
|
|
|
|
if args.slow_style:
|
2026-10-09 09:39:37 +00:00
|
|
|
page = hidden_until_styled(args.page, desktop.runtime / "page.html")
|
test: verify native pointer and keyboard input through weft-compositor
Nothing checked that input reaches a page through the compositor; the
Servo hosts' input forwarding had only been compiled.
tests/frame/check_input.py runs weft-servo-shell with
tests/frame/input.html on the nested desktop and injects real X input
with xdotool into weft-compositor's window. The compositor's winit backend
routes it through its seat to the Wayland client, which has no X display.
The page must react in its presented pixels: clicks 6 px either side of
the boundary between its halves change only the half under the pointer,
and the a and Shift+a key presses arrive with the right key value and
modifier. The harness gives the compositor's X window input focus, as a
window manager would; the client's keyboard focus comes from the
compositor's click-to-focus.
The nested desktop setup shared with check_frame.py moves to
tests/frame/session.py. Xvfb now reports the display it picked through
-displayfd, so concurrent runs cannot share an X server, and a run clears
only the logs and capture it writes.
Validation:
- check_input.py: 3 of 3 runs pass; two concurrent runs pass
- negative pages fail: no script; left click handled by the right half;
an element extending the left half 20 px across the boundary; a key
handler ignoring Shift
- check_frame.py --host system, --host app, --host app --slow-style 3 pass
after the refactor
- unverified: key release and repeat, pointer motion and button release
events, wheel, focus loss, non-US layouts, non-ASCII text, scale changes,
weft-app-shell input
2026-10-09 01:18:53 +00:00
|
|
|
if args.host == "system":
|
2026-10-09 09:39:37 +00:00
|
|
|
if args.slow_style:
|
|
|
|
|
slow_style(desktop.runtime, args.slow_style)
|
test: verify native pointer and keyboard input through weft-compositor
Nothing checked that input reaches a page through the compositor; the
Servo hosts' input forwarding had only been compiled.
tests/frame/check_input.py runs weft-servo-shell with
tests/frame/input.html on the nested desktop and injects real X input
with xdotool into weft-compositor's window. The compositor's winit backend
routes it through its seat to the Wayland client, which has no X display.
The page must react in its presented pixels: clicks 6 px either side of
the boundary between its halves change only the half under the pointer,
and the a and Shift+a key presses arrive with the right key value and
modifier. The harness gives the compositor's X window input focus, as a
window manager would; the client's keyboard focus comes from the
compositor's click-to-focus.
The nested desktop setup shared with check_frame.py moves to
tests/frame/session.py. Xvfb now reports the display it picked through
-displayfd, so concurrent runs cannot share an X server, and a run clears
only the logs and capture it writes.
Validation:
- check_input.py: 3 of 3 runs pass; two concurrent runs pass
- negative pages fail: no script; left click handled by the right half;
an element extending the left half 20 px across the boundary; a key
handler ignoring Shift
- check_frame.py --host system, --host app, --host app --slow-style 3 pass
after the refactor
- unverified: key release and repeat, pointer motion and button release
events, wheel, focus loss, non-US layouts, non-ASCII text, scale changes,
weft-app-shell input
2026-10-09 01:18:53 +00:00
|
|
|
shell = desktop.launch_client(
|
|
|
|
|
"shell", [args.shell], {"WEFT_SYSTEM_UI_HTML": str(page.resolve())})
|
|
|
|
|
else:
|
|
|
|
|
store = install_app(desktop.runtime / "store", page)
|
2026-10-09 09:39:37 +00:00
|
|
|
if args.slow_style:
|
|
|
|
|
slow_style(store / APP_ID / "ui", args.slow_style)
|
test: verify native pointer and keyboard input through weft-compositor
Nothing checked that input reaches a page through the compositor; the
Servo hosts' input forwarding had only been compiled.
tests/frame/check_input.py runs weft-servo-shell with
tests/frame/input.html on the nested desktop and injects real X input
with xdotool into weft-compositor's window. The compositor's winit backend
routes it through its seat to the Wayland client, which has no X display.
The page must react in its presented pixels: clicks 6 px either side of
the boundary between its halves change only the half under the pointer,
and the a and Shift+a key presses arrive with the right key value and
modifier. The harness gives the compositor's X window input focus, as a
window manager would; the client's keyboard focus comes from the
compositor's click-to-focus.
The nested desktop setup shared with check_frame.py moves to
tests/frame/session.py. Xvfb now reports the display it picked through
-displayfd, so concurrent runs cannot share an X server, and a run clears
only the logs and capture it writes.
Validation:
- check_input.py: 3 of 3 runs pass; two concurrent runs pass
- negative pages fail: no script; left click handled by the right half;
an element extending the left half 20 px across the boundary; a key
handler ignoring Shift
- check_frame.py --host system, --host app, --host app --slow-style 3 pass
after the refactor
- unverified: key release and repeat, pointer motion and button release
events, wheel, focus loss, non-US layouts, non-ASCII text, scale changes,
weft-app-shell input
2026-10-09 01:18:53 +00:00
|
|
|
shell = desktop.launch_client(
|
|
|
|
|
"shell", [args.shell, APP_ID, "1"], {"WEFT_APP_STORE": str(store)})
|
|
|
|
|
problems, screenshot = watch(desktop, shell, args)
|
|
|
|
|
except SessionError as error:
|
|
|
|
|
print(error, file=sys.stderr)
|
|
|
|
|
return 1
|
|
|
|
|
|
|
|
|
|
if screenshot is not None:
|
|
|
|
|
(args.output / "frame.ppm").write_bytes(screenshot)
|
|
|
|
|
if problems:
|
|
|
|
|
print("frame check failed: " + "; ".join(problems), file=sys.stderr)
|
|
|
|
|
print(f"logs and last capture in {args.output}", file=sys.stderr)
|
|
|
|
|
return 1
|
|
|
|
|
print(f"frame check passed; capture in {args.output / 'frame.ppm'}")
|
|
|
|
|
return 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def watch(desktop, shell, args):
|
|
|
|
|
"""Capture until the frame matches, the host exits or the time runs out."""
|
|
|
|
|
def ready_printed():
|
|
|
|
|
return any(line.strip() == "READY" for line in desktop.log_text("shell").splitlines())
|
|
|
|
|
|
|
|
|
|
problems = ["no frame captured"]
|
|
|
|
|
screenshot = None
|
|
|
|
|
ready_at = None
|
|
|
|
|
deadline = time.monotonic() + args.timeout
|
|
|
|
|
while time.monotonic() < deadline:
|
|
|
|
|
if shell.poll() is not None:
|
|
|
|
|
return [f"shell exited with status {shell.returncode}"], screenshot
|
|
|
|
|
if args.host == "app" and ready_at is None and ready_printed():
|
|
|
|
|
ready_at = time.monotonic()
|
|
|
|
|
screenshot = desktop.capture()
|
|
|
|
|
problems = evaluate(*parse_ppm(screenshot))
|
|
|
|
|
if ready_at is not None and problems and time.monotonic() - ready_at > COMPOSITE_GRACE:
|
|
|
|
|
return [f"page not on screen {COMPOSITE_GRACE:g} s after READY"] + problems, screenshot
|
|
|
|
|
if not problems and (args.host == "system" or ready_at is not None):
|
|
|
|
|
return [], screenshot
|
|
|
|
|
if not problems:
|
|
|
|
|
problems = ["frame presented but READY not printed"]
|
|
|
|
|
time.sleep(1)
|
|
|
|
|
return problems, screenshot
|
fix(shells): paint and present Servo frames and report readiness truthfully
With servo-embed, weft-servo-shell and weft-app-shell did not compile
against the selected Servo revision: the keyboard event shape, key and
mouse action variants, frame readback, shutdown, URL type and window
handle APIs had changed. The frame path never called WebView::paint; the
software path rebuilt its softbuffer surface every frame and read pixels
without painting, and the EGL path presented nothing. weft-app-shell
printed READY right after creating its WebView, before any frame, and its
feature-disabled build printed READY and parked. Servo also disables CSS
Grid by default, which the system UI uses.
Both hosts now build against the selected API. Each frame is painted with
WebView::paint and presented: the software path reads the painted frame
back, presents the context and copies it into a persistent softbuffer
surface; the EGL path presents its window context. Nothing is presented
before Servo's first repaint request. Shutdown drops the WebView and
Servo, whose drop completes the shutdown, and exits the event loop. Both
hosts enable layout_grid_enabled.
weft-app-shell prints READY on the first frame presented after the
document has loaded and Servo reports its rendering settled: on load
completion it requests WebView::take_screenshot, which completes only once
every frame has fired load, render-blocking resources, images and web
fonts are done and the rendering is up to date. Feature-disabled builds of
both hosts exit with an error instead of reporting readiness. weft-appd
does not consume the app shell's READY yet.
tests/frame/check_frame.py runs weft-compositor nested on Xvfb with the
winit backend, starts a host showing tests/frame/reference.html and checks
the presented pixels (four colour quadrants and text). For the app host
the page must be on screen within two seconds of READY; --slow-style
delays a render-blocking stylesheet that reveals the page, so premature
readiness fails.
Validation (Ubuntu 24.04, Mesa 25.2.8 llvmpipe, software path):
- check_frame.py --host system, --host app and --host app --slow-style 3:
5 of 5 runs pass each
- negative fixtures fail: page with red and green swapped; a fake host
printing READY without rendering; a local build printing READY on its
first presented frame (--slow-style 4, 3 of 3)
- cargo clippy -D warnings with and without servo-embed; cargo fmt --check
- unverified: EGL path, DRM, resize, output scale, idle wakeup, input
2026-10-09 01:02:26 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
|
raise SystemExit(main())
|