[RFC 0/1] Color manager calibration protocol v1

Pekka Paalanen ppaalanen at gmail.com
Tue Apr 16 15:03:08 UTC 2019

On Tue, 16 Apr 2019 13:33:02 +0000
Erwin Burema <e.burema at gmail.com> wrote:

> On Tuesday, 16 April 2019, Pekka Paalanen wrote:
> > On Tue, 16 Apr 2019 13:11:06 +0200
> > Erwin Burema <e.burema at gmail.com> wrote:
> >   
> > > On Tue, 16 Apr 2019 at 12:45, Pekka Paalanen <ppaalanen at gmail.com> wrote:  
> > > >
> > > > On Sun, 14 Apr 2019 12:57:47 +0200
> > > > Erwin Burema <e.burema at gmail.com> wrote:
> > > >    
> > > > > Without a way to calibrate/profile screens an color management
> > > > > protocol looses a lot of its value. So to add this missing feature I
> > > > > wrote the following protocol.
> > > > >
> > > > > The idea is that the calibration/profiling SW only sets the RGB
> > > > > triplet and then the compositor is responsible to draw a rectanglular
> > > > > region on the selected output screen, since not all calibration tools
> > > > > will be at the center of the screen a user should be able to modify
> > > > > the placement of this rectanglular region. Unless specified the
> > > > > monitor profile (if any) should not be applied but the GPU curve
> > > > > should, currently to set a new curve the calibration tool should
> > > > > generate a new ICC profile with the wanted curve in the VCGT tag (I
> > > > > am not sure if this is the best option but would make the most
> > > > > universal one). In the end after profiling the last uploaded ICC
> > > > > could then be saved (although a compositor is not required to honor
> > > > > the request in that case it should send the not saved error). If the
> > > > > compositor doesn't save or the connection with this protocol is
> > > > > broken the compositor should restore previous settings.    
> > > >
> > > > Hi,
> > > >
> > > > I only took a very quick glance, but I do like where this design is
> > > > going. I'll refrain from commenting on wl_surface vs. not for now
> > > > though.
> > > >
> > > > Forgive me my ignorance, but why is the "GPU curve" needed to be a
> > > > custom curve provided by the client?


ok, below we are finally getting to the point.

> > Ok, you start with an identity curve and iterate. Why only the "GPU
> > curve" instead of a "full" color correction transformation?
> >  
> Since we are trying to setup the "GPU curve" in this case a full
> transform would only get in the way. 


The goal is to create a full color transform from some client chosen
color space into the output color space, so that we can determine the
color profile of the output. You might iterate only on the curve at
first, but do you not then iterate on the full transform as well to
ensure you get the result you want, at least to check once? How will do
that with your extension?

Or asking in other words: why do you need the compositor to implement a
special-case path where it applies only a part of an ICC profile?

Why not let the compositor apply the output profile you submit in full,
and be smart about what you put in that profile?

Are you trying to avoid having to tag the test color with a color

To me it would make most sense if you picked one or the other: either
pass the test color values to the wire directly, which means you do not
play with the "GPU curve" as it will be identity; or use the full
existing color correction pipeline just like normal apps do, tag your
test color with a suitably manufactured color profile which results in
an identity transformation on the first iteration, and iterate on the
output profile you set.

I think this is something Graeme tried to explain to me: using a
special path that does half of the operations is prone to bugs because
it does non-trivial things, affects the result of measurements, but is
normally not used. Although I think he would also object to the "pass
directly to the wire" mode as well, because that also is a special path
not used normally.

> > > > Is the reason to use the "GPU curve" that you assume there is a
> > > > 8 bits per channel framebuffer and you need to use the hardware
> > > > LUT to choose which 8 bits wide range of the possibly 14 bits
> > > > channel you want to address? (Currently a client cannot know if
> > > > the framebuffer is 8 bits or less or more.)
> > > >    
> > > 
> > > Currently not assuming anything about the curves bitnes, so not
> > > sure where you got that from? The curve should be set with the
> > > ICC vcgt tag I am pretty sure that supports higher bit depths
> > > then 8, if you have a better idea to be able to set the video
> > > card LUT I would like to hear that.  
> > 
> > If you do not assume anything about bitness, why does the protocol
> > spec have bitdepth? Is it the per-channel bitdepth of the
> > framebuffer, the wire, the monitor, the minimum for the whole pixel
> > pipeline, or? 
> Maximum of whole pixel pipeline

I don't see how that could be useful.

> I tried to specified that the with a n-bit pipeline only the n least
> significant bits of the uint should be used. The intent is to only
> send 8 bit data over an 8 bit piline and the same for 10, 12 or 14
> bits 

Oh, so the bitdepth value in the event is really just a scaling factor
for the test color values?

Ok, that explains why it is so vaguely defined and quite arbitrary.

Why not use the full 32 bits mapping to [0.0, 1.0] always, let the
compositor convert it to whatever format the framebuffer uses, and
remove the event?

> > off except the final "GPU curve" LUT, the framebuffer value will be
> > converted into a LUT input value, a LUT output value is looked up
> > and maybe interpolated, then truncated back to LUT output bitness.
> > Then it gets pushed into the wire which has its own bitness, before
> > it reaches the monitor, which may convert that again to anything
> > from 5 to 14 bits per channel for the panel and maybe dither.
> > 
> > The precision you will get is the lowest bitness found in that path.
> > Except, depending on at which step the "GPU curve" is applied, you
> > might be able to use that to address more bits than what the lowest
> > bitness along the path allows, as long as the lowest bitness occurs
> > before the LUT.
> > 
> > Do you mean that calibration measurement tools do not use nor expect
> > such tricks?
> >  
> Dithering yes most tools integrate, some of the other tricks are
> compensated for in software 

Sorry, I didn't mean compensating. I meant that the measurement program
could leverage modifying the LUT to access more values on the wire than
it could with an identity LUT.

An example:

The display pipeline only accepts values [0, 255], it has a LUT where
input values can be [0, 255] and output values are [0, 1023]. The
output value gets fed into the wire, the transport is using 10 bits per

If you program an identity LUT and nothing else, you'll cover the [0,
1023] range with 256 points, so you miss in precision.

If you program the LUT to map [0, 255] to [0, 255], then you can cover
the lowest quarter of the output space in full precision. Then you
program the LUT again to map [0, 255] to [256, 511], and you can cover
another sub-range in full precision, and so on.

This is what I assumed you wanted to do, when you needed direct access
to the LUT.

> > We know the bitdepth of the framebuffer since the compositor picks
> > that.
> > 
> > I do not recall seeing anything about the wire, but I also never
> > really looked. Display hardware (in the computer) probably has at
> > least the same precision as the wire, if not more, at least in
> > identity transformation.
> > 
> > Note, that parsing EDID might tell you the bitness of the monitor
> > somehow, but it will not tell you the bitness of the wire, because I
> > think different transports (HDMI, DP, DVI-D, ...) each might support
> > more than one bitness. Unless the monitor only supports one bitness.
> > 
> > But at least with YUV on the HDMI wire, I recall there being
> > different pixel formats. Less bits, more fps.
> >  
> Mmh that complicates things, although this kind of stuff should
> mostly be used for RGB signals. I think directly pushing YUV over the
> cable is mostly for HW media players. 

Yeah, YUV was a stretch, but I used it to prove that different
transport formats do exist. Someone might want to measure a TV that
only takes YUV420 for 4k at 60Hz or whatever.

But even with RGB, I would assume that some wires can carry both 8 and
10 bit channels, at least.

However, since the bitdepth does not seem to be needed at all, there is
no problem. I only assumed bitdepth would be crucial for the
measurements itself, not just to define a test color.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/wayland-devel/attachments/20190416/6a90a7ca/attachment.sig>

More information about the wayland-devel mailing list