Skip to content

linux-capture: XComposite enumerates all windows and rebuilds the pixmap every 2 s while the window is minimized or unmapped #1357

Closed

Description

@zackees

Part of #1273 (found by the #1285 capture-plugin audit). B, graphics thread.

plugins/linux-capture/xcomposite-input.c.h:596-626 (FIND_WINDOW_INTERVAL 2.0, line 4): while the captured window is "lost" (not MAP_STATE_VIEWABLE, or no texture), every 2 s the tick does two things under obs_enter_graphics():

  1. calls xcomp_find_window, which fetches the client list and then makes a name and class lookup per top-level window, with two synchronous replies each;
  2. tears down and recreates the pixmap and the watcher.

Failure scenario: a window that is minimized, on another workspace, or whose pixmap creation fails (the code mentions NVIDIA) stays "lost" forever. For as long as the source is showing, OBS then enumerates every window and rebuilds the pixmap every 2 s on the render thread. On a desktop with many windows this is a periodic frame hitch. The 2 s interval keeps it from spinning.

Fix:

  • Don't rebuild the pixmap when the found window is the same one as before (same XID, still unmapped).
  • Back off the search interval while the window keeps being found-but-unmapped, for example doubling up to 30 s and resetting on MapNotify or a settings change.
  • Do the window search outside the graphics lock.

Test: with a minimized or unmapped target window, count xcomp_find_window calls and pixmap recreations over about 20 s: a backoff instead of one every 2 s, and no pixmap rebuild when the XID is unchanged.

Activity

  1. zackees commented on Oct 17, 2026

    @zackees
    MemberAuthor

    Claiming. Plan: skip the pixmap rebuild when the search finds the same XID that's still unmapped, and back off the 2 s search (doubling to a cap, reset on MapNotify or a settings change). RED under Xvfb: with an unmapped target window, count the window searches and pixmap rebuilds over a fixed time.

  2. added
    claimedAn agent or person has claimed this; check the claim comment before starting
    on Oct 17, 2026
  3. added a commit that references this issue on Oct 17, 2026
  4. removed
    claimedAn agent or person has claimed this; check the claim comment before starting
    on Oct 20, 2026
  5. zackees commented on Oct 23, 2026

    @zackees
    MemberAuthor

    Fixed by #1366 (merged). That PR used Refs, so the issue stayed open, but its body lists no remaining work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions