dxgi: track damage per output and translate it into atlas space
build / client (Debug, map[cc:clang cxx:clang++], xdg-shell) (push) Failing after 20s
build / client (Debug, map[cc:gcc cxx:g++], libdecor) (push) Failing after 20s
build / client (Debug, map[cc:clang cxx:clang++], libdecor) (push) Failing after 21s
build / client (Release, map[cc:clang cxx:clang++], libdecor) (push) Failing after 20s
build / client (Debug, map[cc:gcc cxx:g++], xdg-shell) (push) Failing after 20s
build / client (Release, map[cc:clang cxx:clang++], xdg-shell) (push) Failing after 20s
build / module (push) Failing after 16s
build / client (Release, map[cc:gcc cxx:g++], libdecor) (push) Failing after 20s
build / client (Release, map[cc:gcc cxx:g++], xdg-shell) (push) Failing after 20s
build / host-linux (push) Failing after 19s
build / host-windows-cross (push) Failing after 19s
build / obs (clang) (push) Failing after 20s
build / docs (push) Failing after 3s
build / obs (gcc) (push) Failing after 20s
build / idd (push) Canceled after 0s
build / host-windows-native (push) Canceled after 0s

Damage is now gathered from every output that presented this cycle rather
than reporting the whole frame. An output that did not present contributes
nothing, so a static monitor costs no transfer at all — which matters when
the atlas is tens of megabytes and only one display is moving.

The translation clips each rectangle to the display it came from, so one
output's damage can never reach into another's part of the atlas, and
scaling is applied after placement since the downscale applies to the frame
as a whole. If the combined damage cannot be described the count is left at
zero, meaning full damage: redrawing too much only costs time, whereas
redrawing too little leaves stale pixels on screen.

lgDisplaysRectToAtlas is in common and unit tested, including a sweep of
awkward inputs asserting no translated rectangle ever escapes its display.
The DXGI plumbing around it still needs hardware.
This commit is contained in:
donny committed 2026-07-28 08:43:57 +00:00
1 parent e425b15a87
commit e582faed84
12 files changed
+253 -24

No files matched your search

+16
View File
@@ -103,6 +103,22 @@ void lgDisplaysRepack(
unsigned count,
unsigned bytesPerPixel);
/**
* Translate a rectangle from one display's own coordinate space, where (0, 0)
* is that display's top left, into packed atlas space.
*
* The rectangle is clipped to the display: a capture API may report a damaged
* region larger than the display it came from, and a rectangle that escaped
* into a neighbour's part of the atlas would make a consumer redraw the wrong
* display from the wrong pixels.
*
* Returns false if nothing of the rectangle falls inside the display, in
* which case `out` is untouched and the rectangle should be dropped.
*/
bool lgDisplaysRectToAtlas(const KVMFRDisplay * display,
int32_t x, int32_t y, int32_t width, int32_t height,
FrameDamageRect * out);
/**
* Returns the index of the display in `displays` containing the virtual
* desktop point (x, y), or -1 if the point falls in a gap between displays.