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

+27
View File
@@ -306,6 +306,33 @@ void lgDisplaysRepack(
}
}
bool lgDisplaysRectToAtlas(const KVMFRDisplay * d,
int32_t x, int32_t y, int32_t width, int32_t height,
FrameDamageRect * out)
{
if (width <= 0 || height <= 0)
return false;
int64_t x0 = x, y0 = y;
int64_t x1 = (int64_t)x + width;
int64_t y1 = (int64_t)y + height;
// clip to the display it came from
if (x0 < 0) x0 = 0;
if (y0 < 0) y0 = 0;
if (x1 > (int64_t)d->atlasWidth ) x1 = d->atlasWidth;
if (y1 > (int64_t)d->atlasHeight) y1 = d->atlasHeight;
if (x0 >= x1 || y0 >= y1)
return false;
out->x = (uint32_t)(d->atlasX + x0);
out->y = (uint32_t)(d->atlasY + y0);
out->width = (uint32_t)(x1 - x0);
out->height = (uint32_t)(y1 - y0);
return true;
}
int lgDisplaysFindAtPoint(const KVMFRDisplay * displays, unsigned count,
int32_t x, int32_t y)
{