[client] tests: add framebuffer rendering validation

Add an optional EGL framebuffer capture path for the test transport.
Capture the fully composed frame before presentation and retain its
surface format and HDR state for validation.

Add GoogleTest integration tests which run the production client
under a headless Weston compositor and compare every output pixel
against an independent reference implementation.

The matrix covers BGRA, RGBA, BGR32, RGB24, PQ RGBA10 and scRGB
RGBA16F with full, moving, overlapping, maximum-count, invalid, null
and zero-area damage rectangles. Validate HDR-to-SDR conversion and
native HDR output metadata when supported by the compositor.

Keep tests opt-in through ENABLE_RENDER_TESTS and document how to run
the software and native HDR tiers.
This commit is contained in:
Geoffrey McRae
2026-07-30 14:53:38 +10:00
parent a1fc3d20d3
commit 74ae4f543e
11 changed files with 1172 additions and 6 deletions

46
client/tests/README.md Normal file
View File

@@ -0,0 +1,46 @@
# Client rendering tests
These gtests run the production client with the synthetic `test` transport,
capture the fully composed framebuffer immediately before presentation, and
compare every pixel with an independent reference implementation.
The default CTest entry starts an isolated headless Weston compositor using
Mesa software rendering. It covers:
- BGRA, RGBA, packed BGR32, RGB24, PQ RGBA10, and scRGB RGBA16F;
- odd widths and 24-bit row pitches;
- the Cartesian matrix of every format with full-frame, moving old/new-box,
overlapping, maximum-count, invalid, null, and zero-area damage;
- HDR-to-SDR transfer, gamut conversion, and tone mapping.
When run on a color-managed Wayland compositor with a compatible EGL surface,
the same tests validate native RGB10A2 or FP16 output. Native PQ tests also
check the requested BT.2020 image description, reference white, mastering
luminance, MaxCLL, and MaxFALL in the client log.
## Building and running
```sh
cmake -S client -B client/build \
-DENABLE_TEST_TRANSPORT=ON \
-DENABLE_RENDER_TESTS=ON
cmake --build client/build
ctest --test-dir client/build --output-on-failure \
-R looking-glass-render-tests
```
GoogleTest and Weston are required when `ENABLE_RENDER_TESTS` is enabled.
Failed cases retain their capture and client log under `/tmp` and print the
artifact paths.
To exercise native HDR on the current Wayland session instead of the headless
SDR compositor:
```sh
client/build/tests/looking-glass-render-tests \
--gtest_filter='*rgba10*:*rgba16f*'
```
Framebuffer readback verifies the signal produced by Looking Glass. Verifying
a compositor's scanout and a physical panel's luminance remains a separate
hardware test.