-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for DisplayCapabilities. #110
Conversation
Note that this PR addresses issue #10 (hopefully). |
@jernoble This looks good to me, except that there is some ambiguity around whether the color gamut field is referring to the capability to interpret pixel data encoded in that gamut or the capability to render (most of the) colors within that gamut. The ambiguity I think comes mostly from the phrase "describes the approximate range of color supported", which suggests the second interpretation. I think we are most interested in the first interpretation, although we would obviously like it to be the case that devices can in fact render most of the colors within any gamut that they advertise support for. Perhaps the definition should be "describes the color gamut encodings supported" and we should add somewhere that "devices should not advertise support for P3 or rec.2020 color gamut encoding unless they support accurate rendering of at least some colors not included within sRGB." |
For Is there a use case for having both pieces of information available? E.g., is it useful to know that the device understands Rec.2020 but can only display sRGB? Would you really want to deliver Rec.2020 content to such a display and have it clip unrenderable colors? If so, I think we could convey that information in the DisplayCapabilitiesInfo with something like (strawmanning) { supported: true, color: 'clipped' }. |
@mwatson2 I tried to address some of your feedback in a second commit. PTAL. |
The changes looks good, although I would say "accurately render" since someone might argue that aggressive clipping is still "rendering". I may be worrying about something that is too obvious to need clarification, but I think it should be clear that if a UA advertises a given gamut then it must be able to interpret data encoded that way. As written, theoretically, a device could advertise P3 here, because that is the gamut closest to its physical rendering capability, but may only be able to interpret data encoded as 2020. This of course would be odd. Separately, it's easy to imagine a scenario where a device can interpret 2020 but only render sRGB (new P3-capable laptop connected to sRGB external display). I can only think of two reasons why a site might deliver 2020 content to this device: (1) is arguably the site's problem for only providing a version of the content supported on a small % of devices So based on the above, I don't think UAs should advertise gamuts they can interpret but not render usefully. |
Thanks for working on this! Give me a few days to review - I'm looping in some folks who know color better than I do and some player authors to assess how it serves their use case. |
Thanks for tackling this @jernoble ! :) Like @chcunningham I do not have the cycles just now to do a full review but after a quick look at the change, I wonder why this had to be Similarly, I wonder if we could simply use the color gamut we have in CSS and simply expose it on the |
Having this API on Having a simple accessor for |
Haven't forgotten about this! I'm meeting with some color folks tomorrow. Will post feedback this week. |
Thanks for waiting! Apologies for the formatting - hopefully its at least orderly :) 1] 2] 3] 4] Screen comes with the benefit that it already solves the "which screen" in multiple display scenarios (and I suspect it will be augmented for upcoming cases like VR etc) and it's already the home for colorDepth.
This is a compelling reason to group the properties with eotf, but, I've so far not been able to confirm this dependency exists in practice. It definitely doesn't exist in Chrome. There was some worry that it might be true for hw backed devices (e.g. Chromecast), but so far I've not found that to be the case. Do we have examples of this in the wild?
This may not matter in practice. As proposed, each set is a superset of the other (srgb < p3 < rec2020). If we put it on Screen it might be fair to return the highest supported. 5]
This resonates with me (admittedly not a color expert).
Hubbe@chromium (color expert) pointed out that we may (eventually) desire a way to signal that we don't really have a capable display, but we can do better than clipping (via some clever scaling such that HDR appears as SDR). He was ambivalent about how/if the UA should expose this to web authors. I'm not really making a proposal - just opening up discussion on the idea. |
Forgot this point...
I generally agree - but maybe there are workarounds. Even if we put this in displayInfo(), we need a means of deciding which screen to describe in multi screen circumstances. Perhaps this is the screen of the script that spawned the worker (going up to root if need be). Technically this approach could also work for Screen - not sure what ergonomics folks (e.g. TAG) would prefer (e.g. maybe this is a lesser evil vs duplicating things between APIs). For SharedWorkers, I think neither Screen nor displayInfo has a way to say "which screen" to describe (no notion of a root window). |
@chcunningham The reason for having the various color volume / transfer function attributes here, separately from CSS Screen, is that a devices video rendering capabilities may be different from its graphics (CCS) rendering capabilities. This is the case for all web devices that can render HDR video today (laptops, ChromeCast, CastTV) since there is no HDR in CSS and yet that render HDR video. It will remain the case for the foreseeable future for devices based on TV SoCs as (AFAIK) noone has very advanced plans for HDR or wide color graphics support on those devices. But of course they all support HDR / wide color video. |
This is coming back to #25 which we can try to resolve but if we want, we should probably also handle the size as today one would most likely use This said, even if moving outside of the |
@mounir, I am becoming convinced that the Display Capabilities part of this spec should move to Screen. Should the entire MediaCapabilities object move to screen? And if so, should we define a more limited MediaCapabilities object exposed to Worker? |
Moving it to Screen is fine for me. I am just concerned that we have the ability to distinguish graphics from video capabilities, so my point is that the existing fields on Screen are not a replacement for this Display Capabilities aspect. Even on devices that have HDR graphics capabilities, they may not be exposed to the web except for video. This is the current situation on laptops today and I'm rather losing hope that CSS will ever add HDR support so we may be living with it for some time to come, even on laptops. |
@jernoble the decoding info part of Media Capabilities doesn't depend on the active screen so it can be in @mwatson2 I understand the concern and I'm fine with having this API be specific for video but instead of having this new API for video rendering only and the rest of the platform being generally oriented for graphics rendering, I wonder if we should try to see how this would fit into a larger design. |
In that vein, here's a strawman
Or perhaps a dedicated video subsection is better? Are there other properties (e.g. width && height) that need this treatment?
Still thinking about EOTF |
@chcunningham, Display color gamut capabilities may depend on transfer function and color depth. (I.e., "you only get 'rec2020' with '8 bit' color depth, and 'p3' with '10 bit'.) So static accessors aren't capable of conveying that nuance. (In the previous i.e., you'd get 'rec2020' and '10' for the screen.colorGamut and screen.colorDepth properties, but if you tried to display 10-bit 'rec2020' content, it'd look wrong.) Also, if your screen.videoColorDepth is '10', does that mean the screen supports 1-bit color? Does it support 9-bit color? (Probably not.) IOW, the point of a query-based API is the same here for display capabilities as it is for decoder capabilities; static properties can't cover all the edge cases. |
That said, I don’t object to adding a property to Screen exposing the current gamut and color depth. |
Somehow this request got closed; I'd like it re-opened if possible. |
See the modified version of the spec here: https://jernoble.github.io/media-capabilities/
This pull request adds support for interrogation-style queries for display capabilities through a new method on MediaCapabilities:
displayInfo()
, similar to the existingdecodingInfo()
andencodingInfo()
methods. This newdisplayInfo()
method takes aDisplayConfiguration
dictionary, containing three values: colorGamut (as per CSS and the existing spec), transferFunction, and colorDepth.Justification:
What we found in our own HDR playback investigations was that screen luminance was not sufficient in determining whether HDR playback was supported on a given device. For example, some devices may support one kind of transfer function but not the other, so specifying the transfer function used by the variant in question is necessary. Also, some devices may support 10-bit color but not 12-bit, making that query may be necessary as well.
What we have also found is that, between color gamut, transfer function, and color depth, we no longer require accurate information about the device luminance in order to answer whether HDR playback is supported. Eliminating device device luminance has the benefit of reducing the fingerprinting surface by reducing the entropy to four additional bits: two for the 'pq' and 'hlg'
transferFunction
parameters and two for the values of 10-bit and 12-bitcolorDepth
.The new
displayInfo()
method returns aPromise<DisplayCapabilitiesInfo>
, which will resolve to a dictionary with a singlesupported
parameter. This dictionary can be extended in the future to add additional parameters (such aspowerEfficient
) if that becomes necessary.Preview | Diff