This patch adds some basic color management by using the lcms2 library. I first tried to use the higher-level libplacebo but integration was a mess. The changes to the shaders is pretty simple, so it was easier to just do it manually.
- The compositor can assign ICC profiles to wlr_surface and wlr_renderer. They are used when rendering textures and rectangles.
- The default is a built-in sRGB profile.
- If the input and output profiles match, the conversion is skipped.
- Currently it depends on some OpenGL extensions.
- GL_EXT_texture_norm16 - this is required for 16-bit integer color lookup table. We could fallback to 8-bit ints or even floats without much trouble.
- GL_OES_texture_3D - this is used to create the 3D CLUT. It could be done with a 1D or 2D lookup also - I don't know if there are performance considerations. If this doesn't exist, the color conversion is just skipped. However I do use glTexImage3D from the gl32.h header.
- I wasn't sure if we need to stick to ES 2.0. ES 3.0 is 8 years old now.
- It doesn't seem to affect full-screen apps.
I did some benchmarks - with color conversion turned on during a almost fullscreen movie, my iGPU uses about 0.1W more and runs a few Mhz higher. glmark2 scores go down by about 5%. When color conversion is turned off, the difference was negligible from current master.
See also #1378 (closed).