darktable-org / darktable-org/darktable

Darktable 5.4 might under wayland apply color profile twice

Open
#19,977 10 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

depends: wayland priority: high scope: color management scope: UI wip
Dominant language
C
Stars
13.1k
Forks
1.4k
Avg merge
22h 14m
Merged PRs (30d)
198

Description

I might be reading the code wrong but I think #19646 might be doing the wrong thing, if it is running under a wayland compositor with the color management protocol enabled. This goes wrong since wayland color management is by design full screen (this is necessary to make SDR/low gamut applications look good on HDR/wide gamut monitors)

How it goes wrong:

  • darktable queries colord and gets an output (icc) profile
  • darktable uses that profile to render the buffer out in display color space but does not use the wayland color management to tell the compositor it is doing so (<- this part I'm not 100% sure about since that depends on GTK stuff I'm not familiar with)
  • Since the compositor is unaware that darktable is doing any color management it will assume the buffers are in sRGB and will wrongly do an sRGB to Display transform

As can be seen from the above sequence this will apply an unwanted color transform, provided darktable is running on wayland and the wayland compositor supports the color management protocol. I see a couple of ways around this:

  • Use the color managment protocol I think in particular wp_color_management_output_v1 and wp_color_management_surface_v1 are worth a look in this case (the first to replace the call to colord, the second to make the compositor aware of the surface colorspace)
  • If the above is not possible the next best option is to set the display to be sRGB and let the compositor handle the rest (of course a user override is desirable here), this will have the effect on not really be able to use wide gamut monitors but at least should keep the colors (mostly) correct (since on a wide gamut monitor sRGB to Display transform should be a no-op mathematically speaking).

I hope I'm wrong here and this issue can just be closed

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing issue #19646 and the darktable path that queries colord and applies the display profile. Then trace the GTK/Wayland color-management behavior, including wp_color_management_output_v1 and wp_color_management_surface_v1, to verify whether the compositor applies a second transform. Done means confirming or disproving the double-transform scenario and identifying the appropriate correction path.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
computer-graphics, desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.