Command-line testing utility for Fuchsia display drivers.
The tool's design prioritizes minimizing the System Under Test (SUT) size.
Key decisions:
fuchsia.hardware.display/Coordinator FIDL interface directly.display-tool is included in the tools bundle for the display drivers stack.
fx add-test //src/graphics/display:tools
If you‘re iterating on the tool, include the display drivers’ tests bundle.
fx add-test //src/graphics/display:tests
Use balanced or release builds for frame rate testing. The current scene rendering logic can bottleneck the CPU in debug.
Recommended method:
ffx target ssh -- display-tool <command> [options]
To terminate continuous animation or vsync monitoring commands, send SIGINT (Ctrl+C).
By default, every command uses the display‘s preferred mode (mode 0 in info). The top-level --refresh-rate <hz> option goes before the command. It selects the mode whose refresh rate is closest to <hz>, among the modes with the preferred mode’s resolution, and prints the selected mode. It also prints a warning if the selected mode's rate is more than 2% away from <hz>.
ffx target ssh -- display-tool --refresh-rate 60 frame-rate-test
The option applies to the command‘s display (the first display if the command does not name one). The mode takes effect when the command commits its first configuration, so info ignores it. frame-rate-test prints the selected mode’s rate as its expected frame rate.
Modes flagged VARIABLE_REFRESH_RATE are listed with “(variable refresh rate)” in info and on the selected mode line; their rate is the maximum rate, and the display may refresh less often.
Test that the display drivers detect connected panels and register the correct display modes and pixel formats.
ffx target ssh -- display-tool info
Add the --fidl flag to inspect the raw FIDL structure.
Checklist:
60000 mHz (in millihertz) for 60 Hz.Test the driver's ability to handle solid color fill layers. This test does not depend on Sysmem integration or IOMMU configuration.
ffx target ssh -- display-tool color --color ff0000
ff0000 is pure red.Display 1 config is applied, refresh rate 60.00 Hz (16.66667 ms)Test that the display driver integrates with Sysmem and manages its IOMMU correctly.
ffx target ssh -- display-tool vsync --color 00ff00 --pixel-format bgra32
00ff00 is pure green.Test that the display driver submits a sequence of display configurations correctly to the hardware.
ffx target ssh -- display-tool squares
Four colored squares animate and bounce off the display borders against a black background.
#ff6400): starts at top-left#ff00ff): starts at top-right#64ff00): starts at bottom-left#0064ff): starts at bottom-rightDisplay 60.00 fps (16.66667 ms) render 2.104 ms clean 1.302 ms. render is the CPU time spent drawing a frame, and clean is the CPU time spent cleaning caches so the frame reaches memory. All values are moving averages over recent frames.Timed out while waiting output. See --vsync-timeout-ms <ms> for tuning the timeout value.Test the display engine driver's support for multi-layer hardware composition, layer z-ordering, and hardware alpha blending modes.
Start with two layers, to test basic blender configuration.
ffx target ssh -- display-tool multilayer-squares --layer-count 2
Follow-up with a test covering the maximum layer count supported by the hardware, to catch DRAM bandwidth configuration issues.
Each layer displays one square. The layers are described below, from the bottom of the Z-order to the top.
#ff00ff), four times as large as the smaller square described below. Fully opaque (alpha blending disabled).#00ff64), semi-transparent (alpha set to 150). Premultiplied alpha blending.#0064ff), 4x size, fully opaque.#ff6400), semi-transparent (alpha set to 150). Premultiplied alpha blending.#00ffff), 4x size, fully opaque.#ffff00), semi-transparent (alpha set to 150). Premultiplied alpha blending.#ffffff), 4x size, fully opaque.#808080), semi-transparent (alpha set to 150). Premultiplied alpha blending.Test that the display engine does not drop or skip committed frames.
ffx target ssh -- display-tool frame-rate-test
10x6 rectangular grid. A single colored cell traverses every grid location sequentially following a continuous Hamiltonian cycle.
Cell color:
#0000ff).#ffffff).#ff0000).Expected frame rate: 60.000 fps.Test that the display driver handles submitted configurations while the display hardware is powered on and off.
ffx target ssh -- display-tool squares --power-cycle-frame-count 300 \ --power-cycle-off-frame-count 60
See the swapchain section above for a description of the squares visual output. Additionally, the display powers off and back on every few seconds.
See the swapchain section above for verifying squares. The conditions described there must continue to hold after power cycling.
Additional checks:
SetDisplayPowerMode line reports -> Ok(Ok(())).first vsync after power on line appears.Test that the display driver delivers vsync events at the selected mode‘s rate, and shows each submitted frame promptly, whatever the client’s frame rate. This step matters most for displays with several refresh rates or a variable refresh rate.
ffx target ssh -- display-tool --refresh-rate 120 cadence --fps 24 \ --burst-frames 48 --idle-ms 3000 --duration-s 20 --verbose
cadence presents frames on a timer that does not depend on vsync, and records every vsync event. Before the measurement starts, it presents a black warm-up frame and waits until a vsync reports it, plus one more vsync. So a mode switch that --refresh-rate causes, and the display pipeline's start-up, stay out of the measurement. Each frame is rendered as soon as its image is free, and committed when it is due. Options:
--fps <f>: frame rate. Defaults to 60. 0 presents one frame and then idles, which shows the vsync cadence of a static screen.--burst-frames <n> --idle-ms <ms>: present n frames, pause for ms milliseconds (more than 0), and repeat. If frames fall behind the schedule, a burst starts ms milliseconds after the last frame of the previous burst was committed, rather than back to back with it, and the rest of the schedule moves with it.--duration-s <s>: length of the measurement. Defaults to 10.--verbose: also report every second. Each report covers the second that just ended. A frame counts as shown in the report of the second it was presented in, so a frame whose first vsync comes after the report counts as not shown there, but as shown in the final report.--log-vsync: print a line for every vsync event, with its time, the interval since the previous vsync, the displayed config stamp, and the frame it shows.The final report includes:
The same values are printed on one cadence_summary line (cadence_window for --verbose reports) of space-separated key=value pairs, for scripts. Missing values are nan.
The same 10x6 grid as the frame rate test. The moving cell's color changes every frame, cycling through red, green, blue, yellow, cyan, magenta and white. A bar below the grid shows the same color.
frames_shown is close to frames_presented when --fps is clearly below the selected mode's refresh rate. Near the refresh rate, the phase between the frame timer and vsync drifts, and some frames are replaced before a vsync reports them. Check the rate the tool printed when it selected the mode: for example, --refresh-rate 60 may select a 58.897 Hz mode, which is below the default --fps 60. The frame committed last may also still be waiting for its vsync when the measurement ends.vsyncs_stale is 0.