[roll] Roll fuchsia [display-tool] Draw whole rows with one copy per row

MappedImage::fill_region called Mapping::write_at once per pixel. Each
call is an out-of-line, bounds-checked SharedBuffer write followed by a
4-byte memcpy, about 6-16 ns per pixel. multilayer-squares redraws every
full-screen layer each frame (8.5M pixels with 2 layers), so drawing
took 54-141 ms per frame with 2 layers and 171-437 ms with 6.

fill_region now builds one row of the color and writes each clipped row
of the frame with a single write_at, which becomes one libc memcpy.
Clipping is unchanged. When the pixel stride derived from the row bytes
differs from the pixel size (padded rows of narrow images), it keeps
the per-pixel loop, so the written bytes are identical in every case.

The drawing moves into a new Surface type that wraps the Mapping and
the image geometry, so it can be unit-tested over a plain VMO without a
display coordinator.

Measured on a 6-layer display engine running at 60 fps, medians over
20 s, 2 runs, before -> after:
* squares: 58.9 -> 58.9 fps, render 4.3-4.6 -> 0.82 ms
* multilayer-squares --layer-count 2: 8.4-11.4 -> 58.9 fps,
  render 54-141 -> 1.3 ms
* multilayer-squares --layer-count 4: 4.5-5.9 -> 58.7-58.8 fps,
  render 112-222 -> 2.7-2.8 ms
* multilayer-squares --layer-count 6: 2.9-3.9 -> 58.2-58.3 fps,
  render 171-437 -> 4.4-5.0 ms
Cache clean times are unchanged (0.7 ms per layer). All scenes now run
at one frame per vsync (60 Hz), like squares did before.

      byte for byte with the old per-pixel algorithm: full, interior,
      clipped and past-the-edge frames, 1x1, empty frames, 3-byte
      pixels, padded strides, overlapping fills, bad color sizes)
      4, 6 on a 6-layer display engine, twice, and checked the 6-layer
      picture with a camera.

Original-Original-Bug: 568907194
Test: fx test display-tool-test (new draw::tests compare Surface fills
Test: Ran display-tool squares and multilayer-squares --layer-count 2,
Original-Original-Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/1864397
Original-Original-Revision: 77324ad44bdb782e8f912e0b4078ac36558012ad
GitOrigin-RevId: 3cbbeb5d562bafa397a5319c0eb2cf9b52d8bb74
Change-Id: I027e0bb4e255a4efd6a789408b627db51d587bae
Reviewed-on: https://fuchsia-review.googlesource.com/c/integration/+/1870690
Cr-Commit-Position: refs/heads/main@{#204504}
1 file changed
tree: d28f0469314799764140b3ed3746a9b97c724edf
  1. ctf/
  2. git-hooks/
  3. infra/
  4. third_party/
  5. cobalt
  6. flower
  7. jiri.lock
  8. MILESTONE
  9. minimal
  10. prebuilts
  11. README.md
  12. stem
  13. test_durations
README.md

Integration

This repository contains Fuchsia's Global Integration manifest files.

Making changes

All changes should be made to the internal version of this repository. Our infrastructure automatically updates this version when the internal one changes.

Currently all changes must be made by a Google employee. Non-Google employees wishing to make a change can ask for assistance in one of the communication channels documented at get involved.

Obtaining the source

First install Jiri.

Next run:

$ jiri init
$ jiri import minimal https://fuchsia.googlesource.com/integration
$ jiri update

Third party

Third party projects should have their own subdirectory in ./third_party.