-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Description
Description
An app has some content in format A and says to compositor that it is in format B. The compositor stores it in format C and tells video drivers that it is in D. Monitor display it as E which leaves the user with what the F is going on?
To reduce this frustration and get some better visuals a color management system is needed for proper content processing on the way to a display device.
- Compositor needs to decide which format better suits current clients and outputs:
-
Simple: single monitor - use the max supported format
-
Advanced: take into account all the clients and use a lesser format if it is enough to reduce resource consumption
-
Tricky: multi-monitor setup - needs some common format
Caveat: monitors lie about their capabilities, clients lie about their contentSome relevant info is in
output->parsedEDIDfor monitor capabilities andsurface->colorManagement->imageDescription()for a client (assume sRGB if missing)
-
Compositor should convert all clients' buffers to the selected format and prepare a buffer for displaying
Needs some shaders. Direct buffer manipulation might be easier but highly ineffective. This step should be avoided if possible. -
Compositor should convert prepared buffer and/or set some drm properties to match output capabilities
- https://drmdb.emersion.fr/properties/3435973836/DEGAMMA_LUT
output->state->setDeGammaLut - https://drmdb.emersion.fr/properties/3435973836/CTM
output->state->setCTM - https://drmdb.emersion.fr/properties/3435973836/GAMMA_LUT
output->state->setGammaLut - https://drmdb.emersion.fr/properties/3233857728/HDR_OUTPUT_METADATA
output->state->setHDRMetadata
Caveat: not all properties might be supported by the given video driver, some of this properties might accept different values on different drivers, properties listed in a "natural" color pipeline order but it is not guaranteed to be so
HDR10 for a fullscreen app is the easiest thing to do because it can got straight to step 3 with little to none modifications. Might still need some drm properties adjusting. Current implementation uses only HDR_OUTPUT_METADATA.
On paper color management should be relatively simple and straightforward. In reality some bits should be ignored in favor of some sane defaults. Some double back and forth conversions might be needed just to slap a transformation in between. What those bits and defaults are might depend on hw setup.
Lots of docs about color and HDR https://gitlab.freedesktop.org/pq/color-and-hdr
Somewhat a duplicate of #4377
- Convert primaries
- Handle luminances
- Mark relevant proto features as supported
- Add a way to change output image description
- Add a setting for fullscreen passthrough
- Fix desktop effects with HDR
- CM for decorations
- Wiki page
- CM for blur
- CM for cursor
- software
- hardware
- hardware with cpu buffer copy
- Better monitor image description settings HDR/CM: Black levels aren't perfectly black, huge issue for OLED #9716 Monitor v2 HDR rules #10623
- Better fullscreen logic Auto hdr #9785
- SDR passthrough Fix CM for DS and SDR passthrough #11503
- HDR passthrough
- Direct scanout
- SDR
- primaries Fix CM for DS and SDR passthrough #11503
- luminances
- HDR
- PQ10
- scRGB (not possible?)
- Handle SDR/HDR switch with DS or block DS when content and monitor settings do not match cm: handle CM for SDR content with cm=hdr, cm_sdr_eotf=2 #12127
- SDR
- Better internal format (FP16?) FP16 support #10558 Experimental FP16 #11000
- Handle icc profiles
- Optimize CM shader Use precomputed primaries conversion #9814
- don't use math for global constants
- use pre-calculated matrices for primaries conversion and luminances
- borders are delayed #9795 opengl: add missing skipcm if case #10888
- Utilize drm properties
- (DE)GAMMA_LUT
- CTM Fix CM for DS and SDR passthrough #11503
- Handle YCC
- Decode to linear renderer: implement wp-color-management-v1 transfer functions #11084
- SRGB
- GAMMA22
- GAMMA28
- ST2084_PQ
- HLG
- BT1886
- ST240
- LOG_100
- LOG_316
- XVYCC
- ST428
- Encode from linear (check drm properties and monitor capabilities, everything supported by the hw might be covered already) renderer: implement wp-color-management-v1 transfer functions #11084
- SRGB
- GAMMA22
- GAMMA28
- ST2084_PQ
- HLG
- BT1886
- ST240
- LOG_100
- LOG_316
- XVYCC
- ST428
- Proper proto error handling Handle inert CM outputs #11916
- Better inverse tonemapping Renderer: High quality inverse tonemapping for SDR on HDR. #11341 cm: higher-quality tonemapping #12204
- Handle mastering primaries
- Correctly handle color values outside 0.0 - 1.0 range