---
title: "Offscreen frames"
description: "Offscreen frames copied only where they changed, and what that costs."
---

```swift
var pageConfiguration = CefPage.Configuration()
pageConfiguration.rendering = .offscreen(frameRate: 60)
```

Gallery: [`OffscreenOverlayDemo`](https://github.com/Rajaniraiyn/CefSwift/blob/main/Examples/Sources/Gallery/Demos/OffscreenOverlayDemo.swift).

## Offscreen frames: copied, and only where they changed

Presenting Chromium's `IOSurface` directly would cost nothing, but
Chromium renders into a delivered surface again two or three frames
later and nothing the browser process does stops it
([architecture](/internals/frame-timing#frame-ownership) has the source
citations). So `CefOffscreenCompositor` copies, and copies only the
damage Chromium reports with each frame, into up to four surfaces of its
own, three above 32 MB a surface.

`SelfTest -benchmark compositor` on 2026-11-13, AC power, Low Power Mode
off, other apps open and other builds running, offscreen frame rate 120,
3 s of animation, two runs each, the two modes from one build
(`-compositorCopy whole` copies every frame whole into up to four
surfaces, as before). "Full" is a page whose whole background changes
every frame; "one block" a 4×4 grid of which one block changes per frame.

| Page, surface | Whole frames: presented a second | Memory | Damage only: presented a second | Memory |
|---|---|---|---|---|
| Full, 1280×800 | 119.8 | +13–63 MB | 119.6–119.9 | +53–63 MB |
| Full, 2560×1600 | 93–116 | +36–56 MB | 106–113 | +50–60 MB |
| Full, 5120×3200 | 47.5–52 | +191–221 MB | 71–115 | +128–159 MB |
| One block, 1280×800 | 119.2–120.1 | +53–63 MB | 119.7–119.8 | +53–63 MB |
| One block, 2560×1600 | 119.9–120.2 | +33–60 MB | 116–117 | +48–60 MB |
| One block, 5120×3200 | 78–83 | +131–237 MB | 98–101 | +129–174 MB |

The 5120×3200 one-block rows again, the two modes alternating, two
processes each:

| 5120×3200, one block | Presented a second | App CPU | App CPU per presented frame | Memory, second run |
|---|---|---|---|---|
| Whole frames | 44.8–48.6 | 19.5–22.9% | 4.1–4.9 ms | +192 MB |
| Damage only | 73.8–100.6 | 23.6–30.0% | 2.9–3.2 ms | +128–129 MB |

The display shows at most 60 frames a second. In every run, no presented
surface changed while it was the layer's contents and every one-block
frame was whole (the `compositor` checks read each presented surface
every 2 ms). App CPU varied by ±8 points between runs on this machine
with other work running, more than any difference between the modes, so
it is not compared here.
