https://bugs.kde.org/show_bug.cgi?id=525841

--- Comment #8 from Conn O'Griofa <[email protected]> ---
I've retested against Plasma 6.8.3 with a build of Sunshine patched to force
variable rate (0/1 for maxFramerate) instead of the default fixed rate. The
reason why I'm (re)checking is that game pacing with Sunshine's default
negotiation of fixed rate has quite annoying stuttering issues compared to the
6.8 beta before commit timing support was merged. I particularly notice that
games running in immediate presentation mode with a 60fps frame cap have very
bad stuttering on a fixed rate stream that is much improved if switching to
variable rate.

Speaking of Kwin's animations, however, I actually think that the temporal
pacing of animation in variable rate is probably correct on 6.8.3, but the
difference is caused by GPU exhaustion due to the animation perhaps being
triggered to the 1000fps synthetic vblank from here:
```
uint ScreenCastStream::framerate()
{
    constexpr uint32_t maxFramerate = 1'000'000;
    if (m_pwStream && m_videoFormat.max_framerate.num != 0 &&
m_videoFormat.max_framerate.denom != 0) {
        return std::min((1000 * m_videoFormat.max_framerate.num) /
m_videoFormat.max_framerate.denom, maxFramerate);
    }

    return maxFramerate;
}
```

Checking amdgpu_top while repeatedly minimizing/show a maximized Konsole window
shows that GPU usage rises to 100% in variable rate, which explains why the
effect is so laggy, whereas in fixed rate mode it only reaches ~15% and remains
smooth. When testing minimize/show of a smaller window, the GPU usage is still
higher than fixed rate, but doesn't reach high enough to cause the same
stuttering as a maximized window.

I noticed another odd bug: with a 60Hz host and 60fps stream, `MANGOHUD=1
vkcube --present_mode 2` results in the window being limited to exactly 20fps.
Changing to immediate or mailbox allows it to run unthrottled, or FIFO can run
at the proper 60fps if I force `--wsi xcb` or `--wsi xlib`.

This change resolves the 20fps vkcube issue with the default wayland wsi mode,
but is likely not a proper fix and doesn't help improve animation GPU usage.
```
diff --git a/src/plugins/screencast/screencaststream.cpp
b/src/plugins/screencast/screencaststream.cpp
index 4667d17733..7d03a970b5 100644
--- a/src/plugins/screencast/screencaststream.cpp
+++ b/src/plugins/screencast/screencaststream.cpp
@@ -588,7 +588,7 @@ void ScreenCastStream::record(std::chrono::nanoseconds
timestamp, Contents conte
         return;
     }

-    m_source->setNextPresentationTimestamp(timestamp, framerate());
+    m_source->setNextPresentationTimestamp(timestamp,
m_source->refreshRate());

     struct spa_buffer *spa_buffer = pwBuffer->buffer;
     struct spa_data *spa_data = spa_buffer->datas;
```

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to