https://bugs.kde.org/show_bug.cgi?id=525841
Bug ID: 525841
Summary: Screencasting with maxFramerate (0/1) causes
incorrectly paced desktop animations
Classification: Plasma
Product: kwin
Version First 6.7.0
Reported In:
Platform: Arch Linux
OS: Linux
Status: REPORTED
Severity: normal
Priority: NOR
Component: screencasting
Assignee: [email protected]
Reporter: [email protected]
Target Milestone: ---
DESCRIPTION
When variable rate (maxFramerate = 0/1) is negotiated for a screencast via
Sunshine game streaming software, desktop animations run at incorrect speeds
(approximately 30fps when the active host screen mode is 1080P@60Hz). While the
issue impact desktop animations, pacing for fullscreen games, etc., looks to be
correct.
This issue first appeared in KWin 6.7.0 and is still reproducible up to 6.7.90;
KWin 6.6.x and prior had normal desktop animation speeds.
STEPS TO REPRODUCE - PREREQUISITES
Host configuration: physical/virtual active display mode set to 60Hz @ 1080P.
Client configuration: select 60fps for stream in Moonlight.
STEPS TO REPRODUCE
1. Install a patched or older[1] build of Sunshine and use `portal` or `kwin`
capture.
2. Observe the default scale, stretch and squash animations on the desktop when
manipulating (maximizing, minimizing, opening, closing) windows.
3. Optional: enable wobbly windows and observe the effect's speed when dragging
a window.
ACTUAL RESULT
The animations appear to run at half rate (30fps), but wobbly windows seem to
run at the expected speed (on 6.7.90, at least).
EXPECTED RESULT
Although the stream did negotiate variable rate (so the stream could
potentially send more FPS than the host vblank period when vsync is disabled in
an application), I would expect the speed of desktop animations to continue
matching the host's active display mode vblank rate. If connecting via the
legacy kmsgrab capture method instead of a pipewire capture method that uses
screencasting, the animation speeds are paced correctly for a 60Hz screen.
SOFTWARE/OS VERSIONS
Operating System: Arch Linux
KDE Plasma Version: 6.7.90
KDE Frameworks Version: 6.30.0
Qt Version: 6.12.0
Kernel Version: 7.2.6-zen2-1-zen (64-bit)
Graphics Platform: Wayland
Processors: 16 × AMD Ryzen 7 5700X 8-Core Processor
Memory: 24 GiB of RAM (23.4 GiB usable)
Graphics Processor: AMD Radeon RX 6600
FURTHER TESTING
I also tested a modified Sunshine build that requests variable rate and
disables pacing (so it attempts to encode every buffer received) [2] with these
results:
1. On an idle desktop, moving a window with wobbly windows attempts to encode
at max uncapped FPS (200-300) during window movement (expected 60, but perhaps
this is normal).
2. Moving the mouse pointer quickly encodes at max FPS (expected).
2. Running `vkcube --present_mode 0` attempts to encode at uncapped FPS
(expected).
3. Leaving the vkcube window visible, then repeatedly attempting to
minimize/maximize causes the encoding FPS to degrade from ~300 to 30
(unexpected?).
Fixed-rate capture has properly timed desktop animations, but has other issues.
Fixed rate had a 3% pacing deficit up to 6.7.x, and KWin 6.7.90 resolves the 3%
regression but has a different regression that's reported separately via
https://bugs.kde.org/show_bug.cgi?id=525619
[1] Sunshine recently changed behavior to try fixed rate capture with KWin. To
test variable rate, an older build (v2026.516.143833) will negotiate variable
rate. Otherwise, you can patch master branch by forcing this check:
```
diff --git a/src/platform/linux/pipewire.cpp b/src/platform/linux/pipewire.cpp
index 6cfb0a0f..6978387a 100644
--- a/src/platform/linux/pipewire.cpp
+++ b/src/platform/linux/pipewire.cpp
@@ -853,7 +853,7 @@ namespace pipewire {
// KWin 6.8+ will have good overall (fixed) pacing if #525619
can be resolved, otherwise we will update docs advising to disable VSync in
games.
// Also negotiate variable rate for all other compositors. Mutter's
variable rate pacing is superior.
const static std::vector<int> kwin_version = get_running_kwin_version();
- const static bool negotiate_variable_rate = kwin_version.empty() ||
(kwin_version[0] == 5 || (kwin_version[0] == 6 && (kwin_version[1] < 7 ||
(kwin_version[1] == 7 && kwin_version[2] < 80))));
+ const static bool negotiate_variable_rate = true; //kwin_version.empty()
|| (kwin_version[0] == 5 || (kwin_version[0] == 6 && (kwin_version[1] < 7 ||
(kwin_version[1] == 7 && kwin_version[2] < 80))));
const AVRational fps = (negotiate_variable_rate ? AVRational {0, 1} :
::video::framerate_to_rational(config));
if (fps.den != 1) {
```
[2] Patched Sunshine to negotiate variable rate with unthrottled pacing:
```
diff --git a/src/platform/linux/pipewire.cpp b/src/platform/linux/pipewire.cpp
index 6cfb0a0f..f0b10572 100644
--- a/src/platform/linux/pipewire.cpp
+++ b/src/platform/linux/pipewire.cpp
@@ -239,7 +239,7 @@ namespace pipewire {
};
int rate_comparison = av_cmp_q(negotiated_rate, requested_framerate);
bool variable_rate = negotiated_rate.num == 0 && negotiated_rate.den ==
1;
- bool pacing_required = variable_rate || rate_comparison > 0;
+ bool pacing_required = false; //variable_rate || rate_comparison > 0;
if (!variable_rate && rate_comparison < 0) {
BOOST_LOG(warning)
@@ -853,7 +853,7 @@ namespace pipewire {
// KWin 6.8+ will have good overall (fixed) pacing if #525619
can be resolved, otherwise we will update docs advising to disable VSync in
games.
// Also negotiate variable rate for all other compositors. Mutter's
variable rate pacing is superior.
const static std::vector<int> kwin_version = get_running_kwin_version();
- const static bool negotiate_variable_rate = kwin_version.empty() ||
(kwin_version[0] == 5 || (kwin_version[0] == 6 && (kwin_version[1] < 7 ||
(kwin_version[1] == 7 && kwin_version[2] < 80))));
+ const static bool negotiate_variable_rate = true; //kwin_version.empty()
|| (kwin_version[0] == 5 || (kwin_version[0] == 6 && (kwin_version[1] < 7 ||
(kwin_version[1] == 7 && kwin_version[2] < 80))));
const AVRational fps = (negotiate_variable_rate ? AVRational {0, 1} :
::video::framerate_to_rational(config));
if (fps.den != 1) {
```
--
You are receiving this mail because:
You are watching all bug changes.