Bug 491452 - Color correction (built-in) performance issues
Summary: Color correction (built-in) performance issues
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: wayland-generic (show other bugs)
Version: 6.1.4
Platform: Arch Linux Linux
: NOR minor
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-08-08 20:26 UTC by Bruno Filipe
Modified: 2024-08-09 19:39 UTC (History)
2 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Bruno Filipe 2024-08-08 20:26:50 UTC
SUMMARY

When built-in color correction is enabled I see the following performance issues on two systems:
1. At 1440p 180hz running glxgears/vkcube, system with 7950x AMD iGPU get's like +30-50% usage compared to color correction off. 
2. At 1440p 240hz running glxgears/vkcube, system with NVIDIA RTX 3090 gets constant periodic usage spikes (+30%) and stutters (going from P2 to P5), compared to smooth 240hz at P2 with color correction off.

ADDITIONAL INFORMATION

I'm thankful this got implemented, just reporting this as a minor issue as it deserves to get optimized further. There are a few too many wide gamut panels without any form of sRGB emulation, or handicapped ones.
Comment 1 Zamundaaa 2024-08-09 13:32:03 UTC
Git commit 6bd07ad6b30e34f43652934630d30234ad65ac7c by Xaver Hugl.
Committed on 09/08/2024 at 13:18.
Pushed by zamundaaa into branch 'master'.

backends/drm: remove the shadow buffer when possible, and reduce it to 10bpc when not

Using the custom values for min. and max. luminance in transfer functions, we can reduce the
ranges of values in the shadow buffer to be limited to [0, 1], and with that we can switch
from a floating point buffer back to a normalized format. As gamma 2.2 encoding is much more
efficient at storing color values, this also drops the buffer from 16bpc down to 10bpc.

Furthermore, this offloads the gamma 2.2 -> PQ conversion to KMS when possible, and then uses
the scanout buffer with gamma 2.2 encoding directly. This way the shadow buffer gets completely
skipped and performance and efficiency get improved a lot.
Related: bug 477223

M  +7    -7    autotests/test_colorspaces.cpp
M  +7    -10   src/backends/drm/drm_egl_layer.cpp
M  +34   -26   src/backends/drm/drm_egl_layer_surface.cpp
M  +2    -2    src/backends/drm/drm_egl_layer_surface.h
M  +45   -28   src/backends/drm/drm_output.cpp
M  +11   -3    src/backends/drm/drm_output.h
M  +4    -10   src/backends/drm/drm_pipeline.cpp
M  +2    -2    src/backends/x11/standalone/x11_standalone_output.cpp
M  +1    -1    src/compositor_wayland.cpp
M  +3    -3    src/core/colorpipeline.cpp
M  +1    -1    src/core/colorpipeline.h
M  +16   -2    src/core/colorspace.cpp
M  +3    -1    src/core/colorspace.h
M  +2    -2    src/wayland/frog_colormanagement_v1.cpp
M  +1    -1    src/wayland/frog_colormanagement_v1.h
M  +3    -3    src/wayland/xx_colormanagement_v4.cpp

https://invent.kde.org/plasma/kwin/-/commit/6bd07ad6b30e34f43652934630d30234ad65ac7c