Composite only what changed since the window's buffer was drawn

Each frame still composited every layer over the whole window, which on a weak GPU is most of a frame's cost when nothing changed: on the Ryzen's integrated GPU, a full-window layer took about 0.2ms to composite. EGL's buffer age says how many frames ago the back buffer was drawn, and so what it still shows; the compositor keeps the damage of the last few frames, and composites again only the rectangles that changed since. A frame that changes nothing composites nothing. Overlapping rectangles are merged first, so that no pixel is drawn twice, and within each, the parts of a layer that an opaque layer in front covers aren't drawn: the base under the terminals, and the terminals under a floating pane. Without the merging, dragging a large floating pane drew its area four times over, and was slower than compositing the whole window. The headless target draws into a ring of buffers, as a window's swapchain does, so the tests check frames brought up to date from one, two and three frames back. TestPlan checks the merging and cutting against drawing every pixel, in 2000 random scenes. A 1080p window of four panes, on the Ryzen's integrated GPU: a frame that changes nothing went from 0.80ms to 0.18ms, a dragged pane header from 0.93ms to 0.23ms, and a dragged floating pane from 1.04ms to 0.37ms. On an Intel N100, against drawing with Gio alone, they went from 10.0ms to 0.48ms, 10.6ms to 0.58ms and 13.2ms to 2.2ms.


Author Daniel Patterson Date Commit Parent 4c5eb937 Change ID