[kwin] Gamma correction
Open, NormalPublic


The DRM platform should be able to adjust gamma and to support things like redshift.

The current plan for KWin is:

  • Abstract away X and Wayland differences in platform plugins
    • X: use existing gamma changer in KWin's X plugin (via effect?)
    • Wayland: Call drmModeCrtcSetGamma from libdrm in the drm plugin
  • DBus interface to allow apps/applets to set the gamma or color temperature value (alternative: write own KWin KCMs)

See also: https://bugs.kde.org/show_bug.cgi?id=371494

sitter added a subscriber: sitter.
graesslin updated the task description. (Show Details)Jan 28 2017, 7:58 PM
graesslin added a project: KWin.
romangg claimed this task.Feb 11 2017, 4:35 PM
romangg triaged this task as Normal priority.
romangg updated the task description. (Show Details)
romangg added a subscriber: davidedmundson.
romangg moved this task from Backlog to Work In Progress on the KWin board.Apr 16 2017, 8:37 PM
cfeck added a subscriber: cfeck.Apr 24 2017, 11:20 AM

Test image for (sRGB) gamma calibration: http://imagezero.maxiom.de/files/sRGB-gamma.png

If you see squares in the squares, gamma is not correct. Needs to be displayed unscaled, or upscaled with box filter.

romangg moved this task from Under Review to Work In Progress on the KWin board.Mar 13 2018, 3:35 PM
In T4465#129202, @cfeck wrote:

Test image for (sRGB) gamma calibration: http://imagezero.maxiom.de/files/sRGB-gamma.png

How is this supposed to work? I see inside squares all the time (trying different Gamma values with KGamma on X session).

cfeck added a comment.Mar 25 2018, 9:56 PM

I use a 33 point custom curve loaded via XF86VidModeSetGammaRamp, not a single value. Today's displays need some 'S' shaped curve, but unfortunately needs fine tuning for each display.

After much research my current plan looks like this:

  • add color intensity ramps to outputmanagement Wayland interface [1],
  • libkscreen using above interface to exchange values,
  • KScreen for saving these values,
  • libcolorcorrect via libkscreen providing means to change output color ramps via gamma value setting and curve interpolation similar to how graphics editors do it (for example Krita [1]),
  • separate KCM to do this in gui or integrate into the Displays KCM.

[1] https://cgit.kde.org/kwayland.git/tree/src/client/protocols/output-management.xml
[2] https://docs.krita.org/Adjust#Color_Adjustment_Curves

bruns added a subscriber: bruns.Apr 12 2018, 7:39 PM
romangg moved this task from Plasma 5.13 to Plasma 5.14 on the Plasma board.Aug 3 2018, 10:53 AM
romangg edited projects, added Plasma (Plasma 5.14); removed Plasma (Plasma 5.13).

The patch to KWayland D12388 for arbitrary color curve manipulation has a problem from the start: Wayland protocol messages can only be max 4KB. Sending an array of 256 16bit colors is this. But what if a hardware supports finer curves?

It might make more sense to support wlroot's wlr_gamma_control_unstable_v1 protocol, which hands over the color curves via file descriptor.

romangg moved this task from Work In Progress to Backlog on the KWin board.
romangg removed a project: Plasma (Plasma 5.14).
romangg moved this task from Done to Peripheral on the Plasma on Wayland board.Jun 14 2019, 5:06 PM

Mistakenly moved the task to Done on Plasma on Wayland board? The task is not yet fully done.

Besides night mode and color correction this can also help test how something looks for different types of colorblindness, it can make it easy to make sure everything looks nice in those cases.

romangg removed romangg as the assignee of this task.Apr 23 2020, 5:06 PM
romangg added a subscriber: romangg.