Skip to content

fix(pipewire): revert back to compositor-side pacing - #5538

Draft
psyke83 wants to merge 1 commit into
LizardByte:masterfrom
psyke83:pipewire_compositor_pacing
Draft

fix(pipewire): revert back to compositor-side pacing#5538
psyke83 wants to merge 1 commit into
LizardByte:masterfrom
psyke83:pipewire_compositor_pacing

Conversation

@psyke83

@psyke83 psyke83 commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Description

KWin 5.x/6.x has poor frame pacing when not using variable rate capture for screencasting, but KWin 6.7 also breaks desktop animation pacing - which runs at half speed - when variable rate capture (0/1) is negotiated.

The upcoming KWin 6.8 improves pacing for non-variable rate capture, so if we switch back to capture using a negotiated target maxFramerate, we can also fix desktop animation pacing.

This change also avoids first-time negotiation failure for mutter, but we can retain the negotiate_maxframerate_ fallback to negotiate the target fps only via SPA_FORMAT_VIDEO_framerate, just in case there are other compositors that don't handle maxFramerate negotiation robustly.

Screenshot

Issues Fixed or Closed

Roadmap Issues

Type of Change

  • feat: New feature (non-breaking change which adds functionality)
  • fix: Bug fix (non-breaking change which fixes an issue)
  • docs: Documentation only changes
  • style: Changes that do not affect the meaning of the code (white-space, formatting, missing semicolons, etc.)
  • refactor: Code change that neither fixes a bug nor adds a feature
  • perf: Code change that improves performance
  • test: Adding missing tests or correcting existing tests
  • build: Changes that affect the build system or external dependencies
  • ci: Changes to CI configuration files and scripts
  • chore: Other changes that don't modify src or test files
  • revert: Reverts a previous commit
  • BREAKING CHANGE: Introduces a breaking change (can be combined with any type above)

Checklist

  • Code follows the style guidelines of this project
  • Code has been self-reviewed
  • Code has been commented, particularly in hard-to-understand areas
  • Code docstring/documentation-blocks for new or existing methods/components have been added or updated
  • Unit tests have been added or updated for any new or modified functionality

AI Usage

See our AI usage policy.

  • None: No AI tools were used in creating this PR
  • Light: AI provided minor assistance (formatting, simple suggestions)
  • Moderate: AI helped with code generation or debugging specific parts
  • Heavy: AI generated most or all of the code changes

KWin 5.x/6.x has poor frame pacing when not using variable rate capture
for screencasting, but KWin 6.7 also breaks desktop animation pacing
when variable rate capture (0/1) is negotiated.

The upcoming KWin 6.8 improves pacing for non-variable rate capture,
so switch back to capture using a negotiated target maxFramerate, thus
fixing desktop animation pacing.

This change also avoids first-time negotiation failure for mutter, but
we can retain the _negotiatiate_maxframerate fallback
to negotiate the target fps only via SPA_FORMAT_VIDEO_framerate,
just in case there are other compositors that don't handle maxFramerate
negotiation robustly.
@psyke83

psyke83 commented Aug 21, 2026

Copy link
Copy Markdown
Contributor Author

Technically I'm happy with the change as-is, but I'm keeping it in draft as it's a quasi-breaking change until Plasma 6.8 releases in October, or if the related fix for improved pacing gets backported to older branches.

Summary of effects:

  • Mutter/GNOME: no downsides. Sunshine will no longer need to renegotiate pipewire session on first probe, so it's an overall improvement.
  • Users of KWin 5.x-6.7 will see overall pacing get worse (1% skew or ~57fps on a 60fps stream).
  • Users of KWin 6.7 will see the general 1% pacing skew, but desktop animations will run at proper speed (albeit with the same 1% skew).
  • Users of KWin 6.8 will have good pacing for both desktop animations and general/in-game pacing.

If anyone is interested in testing the improved pacing, it's trivial to manually backport the single commit to KWin 6.7.

@sonarqubecloud

Copy link
Copy Markdown

@Kishi85

Kishi85 commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Technically I'm happy with the change as-is, but I'm keeping it in draft as it's a quasi-breaking change until Plasma 6.8 releases in October, or if the related fix for improved pacing gets backported to older branches.

Summary of effects:

  • Mutter/GNOME: no downsides. Sunshine will no longer need to renegotiate pipewire session on first probe, so it's an overall improvement.
  • Users of KWin 5.x-6.7 will see overall pacing get worse (1% skew or ~57fps on a 60fps stream).
  • Users of KWin 6.7 will see the general 1% pacing skew, but desktop animations will run at proper speed (albeit with the same 1% skew).
  • Users of KWin 6.8 will have good pacing for both desktop animations and general/in-game pacing.

If anyone is interested in testing the improved pacing, it's trivial to manually backport the single commit to KWin 6.7.

Not sure if holding this back until 6.8 will help as much because only rolling release distributions will get the fix within a reasonable time frame. Most regular distributions will stick to the KDE (therefore KWin) version that it shipped on release and therefore will lack behind until a new release is available (and upgraded to by the user).

One way to handle this would be to detect the running KWin version and change the logic accordingly based on that. IMHO we should avoid such workarounds if possible (keep code simple for future maintenance) but atm it's the only thing I could come up that would solve the issues above for users stuck on older versions of KWin.

@psyke83

psyke83 commented Aug 21, 2026

Copy link
Copy Markdown
Contributor Author

We should probably keep in mind that Plasma 6.6 is the currently assigned LTS release, and that version currently has no downsides with variable rate pacing; only 6.7 onwards exhibits the half-rate desktop animation bug. Merging this PR as-is would not be good for distros adhering to the 6.6 LTS release or earlier.

Other non-rolling release distros that use Plasma 6.7 (such as Fedora 43 onwards) will also be impacted, as they have good general pacing but very poor desktop responsiveness due to the animation bug caused by variable pacing.

Maybe a version check to determine whether to set up variable rate is warranted, and we can justify the effort by also using it to determine if the compositor is not KWin at all, just avoid variable rate entirely and thus avoid mutter having to renegotiate. Let's first see if the pacing improvement commit is cherry-picked to the 6.7 branch at least... but I doubt it.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants