<br><br>On April 17, 2019 12:38:15 PM GMT+02:00, Erwin Burema <e.burema@gmail.com> wrote:<br>>On Wed, 17 Apr 2019 at 11:32, Pekka Paalanen <ppaalanen@gmail.com><br>>wrote:<br>>><br>>> On Tue, 16 Apr 2019 23:42:30 +0200<br>>> Erwin Burema <e.burema@gmail.com> wrote:<br>>><br>>> > On Tue, 16 Apr 2019 at 17:03, Pekka Paalanen <ppaalanen@gmail.com><br>>wrote:<br>>> > ><br>>> > > On Tue, 16 Apr 2019 13:33:02 +0000<br>>> > > Erwin Burema <e.burema@gmail.com> wrote:<br>>> > ><br>>> > > > On Tuesday, 16 April 2019, Pekka Paalanen wrote:<br>>> > > > > On Tue, 16 Apr 2019 13:11:06 +0200<br>>> > > > > Erwin Burema <e.burema@gmail.com> wrote:<br>>> > > > ><br>>> > > > > > On Tue, 16 Apr 2019 at 12:45, Pekka Paalanen<br>><ppaalanen@gmail.com> wrote:<br>>> > > > > > ><br>>> > > > > > > On Sun, 14 Apr 2019 12:57:47 +0200<br>>> > > > > > > Erwin Burema <e.burema@gmail.com> wrote:<br>>> > > > > > ><br>>> > > > > > > > Without a way to calibrate/profile screens an color<br>>management<br>>> > > > > > > > protocol looses a lot of its value. So to add this<br>>missing feature I<br>>> > > > > > > > wrote the following protocol.<br>>> > > > > > > ><br>>> > > > > > > > The idea is that the calibration/profiling SW only sets<br>>the RGB<br>>> > > > > > > > triplet and then the compositor is responsible to draw<br>>a rectanglular<br>>> > > > > > > > region on the selected output screen, since not all<br>>calibration tools<br>>> > > > > > > > will be at the center of the screen a user should be<br>>able to modify<br>>> > > > > > > > the placement of this rectanglular region. Unless<br>>specified the<br>>> > > > > > > > monitor profile (if any) should not be applied but the<br>>GPU curve<br>>> > > > > > > > should, currently to set a new curve the calibration<br>>tool should<br>>> > > > > > > > generate a new ICC profile with the wanted curve in the<br>>VCGT tag (I<br>>> > > > > > > > am not sure if this is the best option but would make<br>>the most<br>>> > > > > > > > universal one). In the end after profiling the last<br>>uploaded ICC<br>>> > > > > > > > could then be saved (although a compositor is not<br>>required to honor<br>>> > > > > > > > the request in that case it should send the not saved<br>>error). If the<br>>> > > > > > > > compositor doesn't save or the connection with this<br>>protocol is<br>>> > > > > > > > broken the compositor should restore previous settings.<br>>> > > > > > ><br>>> > > > > > > Hi,<br>>> > > > > > ><br>>> > > > > > > I only took a very quick glance, but I do like where this<br>>design is<br>>> > > > > > > going. I'll refrain from commenting on wl_surface vs. not<br>>for now<br>>> > > > > > > though.<br>>> > > > > > ><br>>> > > > > > > Forgive me my ignorance, but why is the "GPU curve"<br>>needed to be a<br>>> > > > > > > custom curve provided by the client?<br>>> > ><br>>> > > Hi,<br>>> > ><br>>> > > ok, below we are finally getting to the point.<br>>> > ><br>>> > > > > Ok, you start with an identity curve and iterate. Why only<br>>the "GPU<br>>> > > > > curve" instead of a "full" color correction transformation?<br>>> > > > ><br>>> > > ><br>>> > > > Since we are trying to setup the "GPU curve" in this case a<br>>full<br>>> > > > transform would only get in the way.<br>>> > ><br>>> > > Why?<br>>> > ><br>>> ><br>>> > Good question!<br>>><br>>> Hi Erwin,<br>>><br>>> there seems to be two very different cases, and below we discuss one<br>>or<br>>> the other paragraph by paragraph, which might be confusing.<br>>><br>>><br>>>         Case 1: Calibrating and/or profiling the monitor only<br>>><br>>> This case is what I see as controlling the pixel values on the wire,<br>>> and the identity LUT instead of "GPU curve" access. I explain why no<br>>> "GPU curve" in my opinion further below.<br>>><br>>><br>>>         Case 2: Calibrating and/or profiling the full color pipeline<br>>>                 from application to a specific monitor<br>>><br>>> This would be using the normal compositor color mapping pipeline and<br>>> adjusting the full output calibration and profile to achieve a<br>>desired<br>>> color reproduction.<br>>><br>><br>>Case 2 does not exists you do NOT calibrate a specific application to<br>>monitor. Once you have an output profile you do NOT need to calibrate<br>>every application individual you just use a color management system to<br>>map an input profile to an output profile. Case 2 won't work for the<br>>same reason you can't calibrate/profile HDR screens that don't support<br>>direct access (via something like a Freesync2_Gamma22 display mode),<br>>it is hard to predict what the whole colormanager is going to do so<br>>making profiles that way is a bad idea.<br><br>I think he means the way you do profiling on X. simply writing values to a surface and measure the output. It measures not the display but the whole pipeline from the surface to the output. This is what Graeme wants.<br><br>Its not a bad idea if you have a single static pipeline but we want to use all resource we have available and pipelines change depending on what is being shown. If there is an error in one pipeline and it wasn't used when profiling this has gained you nothing. I think the only  reasonable thin to do is profile the actual monitor. Applying a lut at the end or not is another topic.<br><br>>><br>>> These two are mutually exclusive approaches, so they have independent<br>>> rationales and protocol requirements. I am still not sure which one<br>>you<br>>> want. In some old discussions with Graeme I think he advocated for<br>>Case<br>>> 2, so that a user will actually get what he wants even with a faulty<br>>> compositor.<br>>><br>>> While Case 2 might be good for the end user, it also aims to hide any<br>>> compositor bugs in their color pipelines, and makes the resulting<br>>> profile potentially invalid for other compositors.<br>>><br>>> I'm arguing a lot in the below. It's not so much that I think the<br>>> proposal is wrong, I'm not knowledgeable enough to fully judge that.<br>>My<br>>> aim is to avoid blindly repeating the design of X11-based software<br>>> stacks in case there might be a better design now that we have a<br>>> display server that is expected to participate in color management<br>>and<br>>> do color mapping on behalf of apps. With X11 that was not really<br>>> possible until the advent of X11 compositing managers. It is such a<br>>> fundamental design change, that I really want to prod people to try<br>>to<br>>> see the new possibilities. I just hope I don't become a "difficult<br>>> person" because of that. :-)<br>>><br>><br>>The thing is the introduction of compositors doesn't really change<br>>anything color wise, it makes things a bit more complicated and might<br>>give an opportunity to not load the calibration curve in the videocard<br>>LUT which will give some interesting options with regard to hardware<br>>planes but that is about it. From this side it is not really a game<br>>changer.<br>><br>>> > > The goal is to create a full color transform from some client<br>>chosen<br>>> > > color space into the output color space, so that we can determine<br>>the<br>>> > > color profile of the output. You might iterate only on the curve<br>>at<br>>> > > first, but do you not then iterate on the full transform as well<br>>to<br>>> > > ensure you get the result you want, at least to check once? How<br>>will do<br>>> > > that with your extension?<br>>> > ><br>>> ><br>>> > No here we are not interested in the full transform that would be<br>>to<br>>> > limited we are only interested in the output part, especially we<br>>are<br>>> > interested in how a certain RGB triplet send to the display maps to<br>>> > X'Y'Z' (which is an absolute color space used as one of the two<br>>> > options for the color connection space in the icc profile) the<br>>X'Y'Z'<br>>> > triplet will be provided by the colorimeter/spectrometer which<br>>measure<br>>> > the patch. This of course means that before we have a profile we<br>>have<br>>> > to iterate over many patches. My extension is meant to be able for<br>>> > calibration software to set a certain RGB triplet for the patch<br>>after<br>>> > which the software will read out the X'Y'Z' value from the<br>>calibration<br>>> > tool (most likely via USB these days, although serial is also an<br>>> > option)<br>>><br>>> This sounds like Case 1. In other words, you want to be able to set<br>>the<br>>> pixel values directly on the wire, so that only the monitor will<br>>affect<br>>> the measurement results.<br>>><br>><br>>Yes indeed<br>><br>>> > The above is what is called characterization or profiling, another<br>>> > step that (optionally) happens before this is called calibration<br>>and<br>>> > is where we use the screen settings and the video card LUT to setup<br>>> > the display in a preferred state with a nice response if we have a<br>>> > really nice screen we might be able to get away with only<br>>calibrating<br>>> > and telling software it is sRGB/AdobeRGB in practice we need both<br>>> > (especially on cheaper screens).<br>>><br>>> Screen hardware knobs sure, but the video card LUT I do not<br>>understand<br>>> why that (or the equivalent in case the compositor implements it with<br>>> code instead of hardware configuration) has to be controlled or<br>>> non-identity. See my further comments to the article by Elle Stone<br>>> explaining why I do not see the LUT as calibration.<br>>><br>>> If you need to apply a curve for measurement purposes, why not do<br>>that<br>>> in the client before sending the pixel values to the compositor?<br>>><br>><br>>Traditionally it has always been seen as calibration for the exact<br>>reason you would probably need to ask Graeme since this is quite<br>>complex and I see that I haven't explained it well but don't really<br>>know how to explain it better.<br><br>Its obvious that it is calibration because it actually changes the color space. Its also obvious that its not calibrating the output.<br><br>IMO the vcgt tag solves an ux problem. You have to calibrate the output to get e.g. your desired white-point. Doing so by changing knobs on the output getting feedback, changing the knobs some more, etc, is not good ux. Ideally the computer would do that for us but it's not possible (apparently some monitors have some proprietary means to do so but realistically the computer can't) so as a workaround o improve the ux we just pretend that the vcgt is part of the output.<br><br>I don't think the vcgt tag is a problem. We create a pipeline with the two profiles and just add a lut to the end. Mapping he pipeline to actual hardware is still under compositor control.<br>><br>>> > > Or asking in other words: why do you need the compositor to<br>>implement a<br>>> > > special-case path where it applies only a part of an ICC profile?<br>>> > ><br>>> ><br>>> > We are skipping the whole ICC profile, or at least the parts that<br>>will<br>>> > be actually used for color management, the VCGT tag is an optional<br>>> > non-standard extension useful to keep calibration and profiling<br>>> > information for a screen together. Color management will work fine<br>>> > without it (just need another way to store calibration information<br>>but<br>>> > that is a solvable problem)<br>>><br>>> Yes. It is a special-case path. Usually the VCGT and the profile are<br>>> both applied by a compositor. This is very much the opposite of how<br>>X11<br>>> worked, and I believe the reasons why things on X11 worked like they<br>>do<br>>> is that there simply was no concept of the display server doing any<br>>> kind of color mapping. But on Wayland, we want the compositor to do<br>>the<br>>> color mapping and be good at it.<br>>><br>><br>>Except we are not working around anything at all and in fact this is<br>>the way MacOS X (which already has full screen color management build<br>>in) works! For wayland to be good at color management we need good<br>>output profiles for that we need this special-case path.<br>><br>>> > > Why not let the compositor apply the output profile you submit in<br>>full,<br>>> > > and be smart about what you put in that profile?<br>>> > ><br>>> ><br>>> > Since we don't have an output profile yet? And this is all about<br>>> > creating one (+ calibration)<br>>><br>>> Assuming you wanted to do full calibration and color profiling, I<br>>would<br>>> imagine:<br>>><br>>> 1. Choose a base color profile in which you send you test patch color<br>>>    to the compositor.<br>>><br>>> 2. Initialize the output color profile to the same profile as in step<br>>>    1. This will result in identity pass-through in the compositor.<br>>><br>>> 3. Measure a set of colors.<br>>><br>>> 4. Correct the output color profile according to measurement results.<br>>><br>>> 5. If error between desired and actual measurement results is too<br>>>    large, go to step 3.<br>>><br>>> What is wrong with this general idea?<br>>><br>><br>>If step 2 is a true identity transform (as it should be) it will work<br>>but adds a lot of extra complexity that we don't need for<br>>profiling/calibration. The iterative element would only be needed for<br>>calibration since nothing since characterization will be finished<br>>after measuring.<br>><br>>> You can use it for all of calibrating, profiling, and verifying.<br>>><br>>> Just that it is not characterising only the monitor, it will optimize<br>>> the output profile for a particular compositor in case the compositor<br>>> does something unexpected. It is Case 2.<br>>><br>><br>>Besides breaking the color management contract the whole resulting<br>>profile will be useless since the compositor is changing stuff under<br>>our feet it means we can't be sure if we profiled the whole display or<br>>not, or if things will be stable over time. It is the same reason why<br>>we can't profile/calibrate HDR screens without something like a direct<br>>access display mode.<br>><br>>> However, if you leave out the iterative refinement, you'd get more or<br>>> less Case 1.<br>>><br>>><br>>> > > Are you trying to avoid having to tag the test color with a color<br>>> > > profile?<br>>> > ><br>>> ><br>>> > No, although making that optionally possible might be nice for<br>>verification.<br>>><br>>> I think any verification should be done through the normal color<br>>> pipeline, as in, the public color management protocol interface used<br>>by<br>>> normal apps. But that requires using a wl_surface.<br>>><br>><br>>Probably true<br>><br>>> > > To me it would make most sense if you picked one or the other:<br>>either<br>>> > > pass the test color values to the wire directly, which means you<br>>do not<br>>> > > play with the "GPU curve" as it will be identity; or use the full<br>>> > > existing color correction pipeline just like normal apps do, tag<br>>your<br>>> > > test color with a suitably manufactured color profile which<br>>results in<br>>> > > an identity transformation on the first iteration, and iterate on<br>>the<br>>> > > output profile you set.<br>>> > ><br>>> ><br>>> > But the calibration curve is strictly speaking not part of the<br>>profile<br>>> > and some screens really need that to create an at least somewhat<br>>> > usable profile, after setting the videocard LUT we of course need<br>>to<br>>> > characterize the output but as I said for that we don't need an<br>>input<br>>> > profile (just raw RGB triplets to the screen).<br>>><br>>> Here is something very fundamental I just do not seem to understand.<br>>><br>><br>>And that is probably the reason why the rest is also quite hard to<br>>follow, since this is about the core idea. I just don't know how the<br>>explain it better then I already did :(<br>><br>>> > > I think this is something Graeme tried to explain to me: using a<br>>> > > special path that does half of the operations is prone to bugs<br>>because<br>>> > > it does non-trivial things, affects the result of measurements,<br>>but is<br>>> > > normally not used. Although I think he would also object to the<br>>"pass<br>>> > > directly to the wire" mode as well, because that also is a<br>>special path<br>>> > > not used normally.<br>>> > ><br>>> ><br>>> > Graemme also said the following as author of Argyll:<br>>> > <a href="https://www.argyllcms.com/doc/calvschar.html">https://www.argyllcms.com/doc/calvschar.html</a><br>>><br>>> Ok, I understand that difference between calibration and<br>>> characterization, and I also note that calibration is often<br>>> additionally stored in a profile file that characterizes a device.<br>>><br>>> > Another good description comes from Elle Stone<br>>> ><br>>https://ninedegreesbelow.com/photography/monitor-profile-calibrate-confuse.html<br>>><br>>> This one raises my point: "Altering the video card LUTs doesn't do<br>>> anything at all to the monitor itself."<br>>><br>>> Therefore I do not consider the "GPU curve" as calibration. It is<br>>> something the computer software stack chooses, not something inherent<br>>> to or adjustable in the monitor hardware.<br>>><br>><br>>It is a bit of a workaround for "cheap" monitors that don't support<br>>internal LUTs, in an expensive (for example Eizo) monitor the LUT<br>>would be stored in the display.<br>><br>>> In Wayland, the video card LUT is just a tool for the compositor to<br>>> change and use any way it wants at any time to achieve whatever the<br>>> compositor wants to do. It is not fixed by "calibration". Instead, it<br>>> will be used as part of the color transformation computed from input<br>>> and output color profiles. This idea is supported by video cards no<br>>> longer having a single LUT, but more complex color processing<br>>> pipelines, e.g. LUT-matrix-LUT. We want compositors to be able to use<br>>> that hardware instead of reserve it for "monitor calibration" or for<br>>> users to explicitly set.<br>>><br>>> Elle's section A4 point 2 is relevant here.<br>>><br>>> Is this idea of mine wrong?<br>>><br>><br>>Yes the more complex operations will be done in the actual GPU, the<br>>video card LUT is generally part of a CRTC and can't do anything more<br>>complex then apply 3 1D LUTS (one for each color channel) so all the<br>>complex stuff will happen before that. (In KMS terminology it is the<br>>GAMMA_LUT)<br>><br>>> Is a monitor color profile, VCGT tag excluded, not capable of<br>>> describing a monitor in such way that one can compute the necessary<br>>> "GPU curve" just from the input and output color profiles and pixel<br>>> encodings?<br>>><br>><br>>Sort of yes, it is not really the right question tough, you could set<br>>the videocard LUT to identity and profile the screen that way, this<br>>will create a profile that effectively includes the "GPU Curve", and<br>>this can be used with any input profile without problems. Generally<br>>speaking it will be a lot less nice and would probably be a pretty<br>>large LUT based profile (since it isn't well behaved).<br>><br>>> Why is the VCGT tag not simply a part of the color transformation<br>>> between PCS and the device color space? It seems like it is some<br>>> strange side-track that is arbitrarily used to mangle the color<br>>pipeline<br>>> output. A short-hand for something I'd expect would be computed from<br>>> the color profiles instead.<br>>><br>><br>>It was later unofficially added by I believe Apple who didn't want to<br>>deal with all kind of proprietary formats for so called "LUT loaders"<br>>(ArgyllCMS dispwin for example), theoretically you could make it part<br>>of the color transform (apply it after all the other color management<br>>stuff and then push the pixels to the screen) but even then according<br>>to the official terminology it would still be calibration (since it is<br>>still not part of the actual profile).<br>><br>>> ><br>>> > So yes we do need a special direct pass and pass via video card LUT<br>>> > modes, and is another reason I prefer to not use a wl_surface for<br>>> > this, that would be to easily abused.<br>>><br>>> I don't think it would not be any more easily "abused" that anything<br>>> else. The more complexity there is in a compositor, the more likely<br>>it<br>>> is to have bugs, if that is the "abuse". Adding a special pixel path<br>>in<br>>> addition to a normal pixel path is strictly increasing complexity.<br>>><br>><br>>Abuse in the sense of "placing a window in a weird location on tiling<br>>window managers", "bypassing color management", etc; so not so much<br>>about bugs but more that people can't use it for unintended use cases<br>>that might be detrimental to the experience.<br>><br>>> > > > > > > Is the reason to use the "GPU curve" that you assume<br>>there is a<br>>> > > > > > > 8 bits per channel framebuffer and you need to use the<br>>hardware<br>>> > > > > > > LUT to choose which 8 bits wide range of the possibly 14<br>>bits<br>>> > > > > > > channel you want to address? (Currently a client cannot<br>>know if<br>>> > > > > > > the framebuffer is 8 bits or less or more.)<br>>> > > > > > ><br>>> > > > > ><br>>> > > > > > Currently not assuming anything about the curves bitnes, so<br>>not<br>>> > > > > > sure where you got that from? The curve should be set with<br>>the<br>>> > > > > > ICC vcgt tag I am pretty sure that supports higher bit<br>>depths<br>>> > > > > > then 8, if you have a better idea to be able to set the<br>>video<br>>> > > > > > card LUT I would like to hear that.<br>>> > > > ><br>>> > > > > If you do not assume anything about bitness, why does the<br>>protocol<br>>> > > > > spec have bitdepth? Is it the per-channel bitdepth of the<br>>> > > > > framebuffer, the wire, the monitor, the minimum for the whole<br>>pixel<br>>> > > > > pipeline, or?<br>>> > > ><br>>> > > > Maximum of whole pixel pipeline<br>>> > ><br>>> > > I don't see how that could be useful.<br>>> > ><br>>> ><br>>> > I think we have a bit of a misunderstanding going on here, and<br>>> > actually meant the same thing namely MIN( MAX(screen), MAX(GPU),<br>>> > MAX(communication) ), is that right?<br>>><br>>> Right, so the minimum bit depth over the currently established pixel<br>>> path. Not sure taking the max of what each component might support is<br>>> more useful compared to what's actually used.<br>>><br>><br>>Ah yes of course.<br>><br>>> > > > I tried to specified that the with a n-bit pipeline only the n<br>>least<br>>> > > > significant bits of the uint should be used. The intent is to<br>>only<br>>> > > > send 8 bit data over an 8 bit piline and the same for 10, 12 or<br>>14<br>>> > > > bits<br>>> > ><br>>> > > Oh, so the bitdepth value in the event is really just a scaling<br>>factor<br>>> > > for the test color values?<br>>> > ><br>>> ><br>>> > Sort of? 8bit would be sent as 0...0xxxxxxxx (so 24 zeroes followed<br>>by<br>>> > the actual 8 bit value), 10 bit would be 0...0xxxxxxxxxx (22 zeroes<br>>> > followed by 10 bit value), etc. I don't think that is scalling?<br>>><br>>> Numerically it's just scaling, but let's call it encoding then.<br>>><br>>> > > Ok, that explains why it is so vaguely defined and quite<br>>arbitrary.<br>>> > ><br>>> > > Why not use the full 32 bits mapping to [0.0, 1.0] always, let<br>>the<br>>> > > compositor convert it to whatever format the framebuffer uses,<br>>and<br>>> > > remove the event?<br>>> > ><br>>> ><br>>> > Will need to inspect the code of Argyll or get an answer from<br>>Graemme<br>>> > because this is a bit of an assumption of mine that we would need<br>>the<br>>> > actual display bitdepth, if we don't we can just as well do what<br>>you<br>>> > propose here.<br>>><br>>> Right. If it's only a value encoding thing for the protocol, just use<br>>> 32 bits. If it is actually needed for the algorithms aside from<br>>simple<br>>> value encoding, then it will be needed for the algorithms, but the<br>>> protocol could still use just 32 bits. That would make the protocol<br>>> simpler to specify and understand.<br>>><br>><br>>Ah, I think I see what you mean now, yes that would work.<br>><br>>><br>>> Thanks,<br>>> pq<br>>_______________________________________________<br>>wayland-devel mailing list<br>>wayland-devel@lists.freedesktop.org<br>>https://lists.freedesktop.org/mailman/listinfo/wayland-devel<br><br>-- <br>Sent from my Android device with K-9 Mail. Please excuse my brevity.<br>-- <br>Sent from my Android device with K-9 Mail. Please excuse my brevity.