Bug 498628 - Framerate Doubling in Bursts when mirroring screens
Summary: Framerate Doubling in Bursts when mirroring screens
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: multi-screen (other bugs)
Version First Reported In: 6.2.5
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords: multiscreen
Depends on:
Blocks:
 
Reported: 2025-01-13 22:16 UTC by Jake
Modified: 2025-06-03 12:40 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 6.3.6
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jake 2025-01-13 22:16:28 UTC
SUMMARY
KDE will double the framerate of mirrored high refresh rate screens in bursts, this will create stuttering and smoothness issues



STEPS TO REPRODUCE
1. Set two monitors to a high refresh rate
2. Mirror the two monitors using Display configuration


OBSERVED RESULT
Frame rate will frequently swap between desired frame rate and the combined frame rates of the two screens.


EXPECTED RESULT
Both screens stay at the maximum framerate set in Display configuration

SOFTWARE/OS VERSIONS
Linux/KDE Plasma:  Arch 6.12.8
KDE Plasma Version: 6.2.5
KDE Frameworks Version: 6.9.0
Qt Version: 6.8.1

ADDITIONAL INFORMATION
Video of the effect here:
https://imgur.com/a/T6HzVD6
along with screenshot of monitor settings
Comment 1 Zamundaaa 2025-01-13 23:28:39 UTC
I'm not sure why this would come in bursts, but the issue is likely that we send frame callbacks for every time KWin renders the window, on any output. If we restrict that to only send frame callbacks for one output, then the problem should go away.
Comment 2 Bug Janitor Service 2025-06-02 22:31:29 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/7713
Comment 3 Zamundaaa 2025-06-03 11:41:44 UTC
Git commit 8424bf88b67800c3d22384022e60c08d26e50ea4 by Xaver Hugl.
Committed on 03/06/2025 at 11:10.
Pushed by zamundaaa into branch 'master'.

scene/item: restrict frame callbacks based on the output rather than geometry

Sending frame callbacks based on whether or not the bounding rect intersects with the
rendered output has two big problems:
- when a window is entirely off-screen, it never gets frame callbacks. This is particularly
  problematic when the application waits for frame callbacks to render the next frame, but
  KWin waits with moving them to an output until the application commits the surface
- when a window is on two outputs at once (like with cloning), then it gets twice the
  amount of frame callbacks - which means the application ends up rendering twice as
  fast, which doesn't make any sense

This commit replaces that approach with just checking if the output is the same as the one
Workspace picks for the center of the window. If the window is entirely off-screen, that
will still result in an output getting chosen, and it also can't be on two outputs at once.
Related: bug 479694, bug 505060

M  +2    -1    src/scene/item.cpp
M  +2    -3    src/scene/item.h
M  +9    -0    src/scene/rootitem.cpp
M  +2    -0    src/scene/rootitem.h

https://invent.kde.org/plasma/kwin/-/commit/8424bf88b67800c3d22384022e60c08d26e50ea4
Comment 4 Zamundaaa 2025-06-03 12:36:05 UTC
Git commit ada3f238db01027b7100afe60868f75b64828018 by Xaver Hugl.
Committed on 03/06/2025 at 12:04.
Pushed by zamundaaa into branch 'Plasma/6.4'.

scene/item: restrict frame callbacks based on the output rather than geometry

Sending frame callbacks based on whether or not the bounding rect intersects with the
rendered output has two big problems:
- when a window is entirely off-screen, it never gets frame callbacks. This is particularly
  problematic when the application waits for frame callbacks to render the next frame, but
  KWin waits with moving them to an output until the application commits the surface
- when a window is on two outputs at once (like with cloning), then it gets twice the
  amount of frame callbacks - which means the application ends up rendering twice as
  fast, which doesn't make any sense

This commit replaces that approach with just checking if the output is the same as the one
Workspace picks for the center of the window. If the window is entirely off-screen, that
will still result in an output getting chosen, and it also can't be on two outputs at once.
Related: bug 479694, bug 505060
(cherry picked from commit 8424bf88b67800c3d22384022e60c08d26e50ea4)

M  +2    -1    src/scene/item.cpp
M  +2    -3    src/scene/item.h
M  +9    -0    src/scene/rootitem.cpp
M  +2    -0    src/scene/rootitem.h

https://invent.kde.org/plasma/kwin/-/commit/ada3f238db01027b7100afe60868f75b64828018
Comment 5 Zamundaaa 2025-06-03 12:40:29 UTC
Git commit dc3f798e74b5b049c1506246fa37e2751052565c by Xaver Hugl.
Committed on 03/06/2025 at 12:08.
Pushed by zamundaaa into branch 'Plasma/6.3'.

scene/workspacescene: restrict frame callbacks based on the output rather than geometry

Sending frame callbacks based on whether or not the bounding rect intersects with the
rendered output has two big problems:
- when a window is entirely off-screen, it never gets frame callbacks. This is particularly
  problematic when the application waits for frame callbacks to render the next frame, but
  KWin waits with moving them to an output until the application commits the surface
- when a window is on two outputs at once (like with cloning), then it gets twice the
  amount of frame callbacks - which means the application ends up rendering twice as
  fast, which doesn't make any sense

This commit replaces that approach with just checking if the output is the same as the one
Workspace picks for the center of the window. If the window is entirely off-screen, that
will still result in an output getting chosen, and it also can't be on two outputs at once.
Related: bug 479694, bug 505060
(cherry picked from commit 8424bf88b67800c3d22384022e60c08d26e50ea4)

M  +1    -1    src/scene/workspacescene.cpp

https://invent.kde.org/plasma/kwin/-/commit/dc3f798e74b5b049c1506246fa37e2751052565c