Bug 488860 - Massive frame drops with intel iris xe graphics and triple buffering
Summary: Massive frame drops with intel iris xe graphics and triple buffering
Status: RESOLVED DUPLICATE of bug 488843
Alias: None
Product: kwin
Classification: Plasma
Component: performance (show other bugs)
Version: 6.1.0
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2024-06-21 05:03 UTC by Yujiro Hanma
Modified: 2024-11-27 09:32 UTC (History)
5 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Yujiro Hanma 2024-06-21 05:03:21 UTC
***
If you're not sure this is actually a bug, instead post about it at https://discuss.kde.org

If you're reporting a crash, attach a backtrace with debug symbols; see https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports
***

SUMMARY
I have an i5-1235U with onboard Intel Iris Xe graphics. With the latest update to plasma 6.1, there have been massive frame drops (into the 30ish fps) and reduced performance in graphics situations in general. Most of the time the frame rate does stay at 60, but the drops are frequent, about every 15-20 seconds. I am sorry I cannot attach the fps graph since I cannot capture the show fps applet in video. This only used to happen in the x11 session but now it also occurs in the wayland session. I think this has something to do with triple buffering but I am not really sure.

STEPS TO REPRODUCE
1. Have Intel Iris Xe graphics
2. Enable the show fps option in kwin
3. See the Current FPS

OBSERVED RESULT
There should be no frame drops.

EXPECTED RESULT
Frame drops every 15-20 seconds.

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: Arch Linux
(available in About System)
KDE Plasma Version: 6.1.0
KDE Frameworks Version: 6.3.0
Qt Version: 6.7.1

ADDITIONAL INFORMATION
Comment 1 Yujiro Hanma 2024-06-21 05:10:48 UTC
This also spams my journal log, which I think confirms my suspicion that this is related to triple buffering.
``kwin_scene_opengl: 0x2: GL_INVALID_OPERATION in glDrawBuffers(unsupported buffer GL_BACK_LEFT)``
Comment 2 Vlad Zahorodnii 2024-06-21 07:40:44 UTC
The show fps effect is not a proper profiling tool and it can report sometimes lower refresh rates if the screen is not being repainted actively. Regarding GL_INVALID_OPERATION, it's a Qt issue.
Comment 3 Yujiro Hanma 2024-06-21 07:59:26 UTC
(In reply to Vlad Zahorodnii from comment #2)
> The show fps effect is not a proper profiling tool and it can report
> sometimes lower refresh rates if the screen is not being repainted actively.
> Regarding GL_INVALID_OPERATION, it's a Qt issue.

I do not mean to invalidate your point, but it does show lower fps and I can actually feel it as my cursor lags and the animations slow down. Could you please tell me how I can properly give the refresh rate statistics?
Comment 4 Vlad Zahorodnii 2024-06-21 08:02:13 UTC
Is there a lag with KWIN_DRM_DISABLE_TRIPLE_BUFFERING=1 envvar set?
Comment 5 Yujiro Hanma 2024-06-21 08:15:12 UTC
(In reply to Vlad Zahorodnii from comment #4)
> Is there a lag with KWIN_DRM_DISABLE_TRIPLE_BUFFERING=1 envvar set?

I have been using my computer, opening various programs and graphically demanding games, but fps never goes below 55-56 ( and that's only on opening overview ), the weird stuttering I felt in games is also gone. And the desktop and cursor feel much smoother than before.
Comment 6 Yujiro Hanma 2024-06-21 09:19:58 UTC
I should also add that disabling triple buffering also fixed frame time spikes and general stutters in games.
Comment 7 hbr 2024-06-21 12:38:31 UTC
I can confirm this.

Since updating to Plasma 6.1 I have stuttery animations a lot more often compared to Plasma 6 and 5 (and lag spikes too). A lot more often meaning more than a dozen times in an hour.

This happens on an Intel laptop and a desktop with AMD graphics (see https://bugs.kde.org/show_bug.cgi?id=488843).

Setting "KWIN_DRM_DISABLE_TRIPLE_BUFFERING=1" fixes it on both machines.

SOFTWARE/OS VERSIONS
Operating System: EndeavourOS 
KDE Plasma Version: 6.1.0
KDE Frameworks Version: 6.3.0
Qt Version: 6.7.1
Kernel Version: 6.6.34-lts (64-bit)
Graphics Platform: Wayland
Mesa: 24.1
Processors: i5-1135G7
Memory: 8 GiB of RAM
Graphics Processor: Intel Xe Graphics
Comment 8 gus 2024-06-22 12:30:21 UTC
I can confirm this as well. Animation is extremely choppy when going from one desktop to another. Windows are not updated for 1 second or so (very noticeable in Zoom calls). Log filled with this error:

Jun 22 08:26:25 gus-cachyos kwin_wayland[967]: OpenGL vendor string:                   Intel
Jun 22 08:26:25 gus-cachyos kwin_wayland[967]: OpenGL renderer string:                 Mesa Intel(R) Xe Graphics (TGL GT2)
Jun 22 08:26:25 gus-cachyos kwin_wayland[967]: OpenGL version string:                  4.6 (Core Profile) Mesa 24.1.2-arch1.2
Jun 22 08:26:25 gus-cachyos kwin_wayland[967]: OpenGL shading language version string: 4.60
Jun 22 08:26:25 gus-cachyos kwin_wayland[967]: Driver:                                 Intel
Jun 22 08:26:25 gus-cachyos kwin_wayland[967]: GPU class:                              Tiger Lake
Jun 22 08:26:25 gus-cachyos kwin_wayland[967]: OpenGL version:                         4.6
Jun 22 08:26:25 gus-cachyos kwin_wayland[967]: GLSL version:                           4.60
Jun 22 08:26:25 gus-cachyos kwin_wayland[967]: Mesa version:                           24.1.2
Jun 22 08:26:25 gus-cachyos kwin_wayland[967]: Requires strict binding:                no
Jun 22 08:26:25 gus-cachyos kwin_wayland[967]: Virtual Machine:                        no
Jun 22 08:26:25 gus-cachyos kwin_wayland[967]: kwin_scene_opengl: 0x3: GL_INVALID_OPERATION in glDrawBuffers(unsupported buffer GL_BACK_LEFT)

inux/KDE Plasma: CachyOS Linux
KDE Plasma Version: 6.1.0
KDE Frameworks Version: 6.3.0
Qt Version: 6.7.1
Comment 9 Zamundaaa 2024-06-24 13:52:09 UTC

*** This bug has been marked as a duplicate of bug 488843 ***
Comment 10 edy.burt 2024-11-27 09:32:37 UTC
> Yujiro Hanma 2024-06-21 05:10:48 UTC
> This also spams my journal log, which I think confirms my suspicion that this is related to triple buffering.
> ``kwin_scene_opengl: 0x2: GL_INVALID_OPERATION in glDrawBuffers(unsupported buffer GL_BACK_LEFT)``

> Vlad Zahorodnii 2024-06-21 07:40:44 UTC
> ... Regarding GL_INVALID_OPERATION, it's a Qt issue.

I believe Vlad is right, I just posted https://bugreports.qt.io/browse/QTBUG-122819#comment-844572 with a tentative explanation/patch for the `GL_INVALID_OPERATION` errors caused by `GL_BACK_LEFT`.

I'm not sure the `glDrawBuffers` call failing even has any effect - if it did, you would probably see some UI elements never render at all, my best guess is that the OpenGL default behavior "just works" in this case.

Part of my reasoning it that `glDrawBuffers` used to not be called at all, on the now-failing path: https://github.com/qt/qtbase/commit/c9ad5ad3b73ff60e9a40173b1ae49e67800a4b72#diff-23f339fbfdf978a2c6cbdb4b300ed9dce434d55ca6168c558b8ba8e99f87b2b7R3019