Closed Bug 1872892 Opened 9 months ago Closed 4 months ago

macOS Youtube HDR colours washed out with "Ambient mode" enabled

Categories

(Core :: Audio/Video: Playback, defect, P2)

Unspecified
macOS
defect

Tracking

()

VERIFIED FIXED
128 Branch
Tracking Status
firefox128 --- verified

People

(Reporter: nika, Assigned: bradwerth)

References

(Blocks 1 open bug)

Details

Attachments

(3 files)

It appears that on macOS, Youtube incorrectly renders HDR video to appear washed out when "Ambient mode" option (in the gear menu) is enabled, as well as when end-of-video suggestions are hovered. If ambient mode is disabled, or the video is placed in "theatre mode", the issue appears to not occur unless suggestions are hovered. I noticed this specifically on https://www.youtube.com/watch?v=siPpOwrorm4.

It seems somewhat likely that this is an issue which is happening when we try to composite a semi-transparent element (e.g. the dark overlay when hovering end-of-video suggestions or the coloured glow for ambient mode), we end up collapsing the HDR content to SDR, and the video becomes noticeably de-saturated.

This issue doesn't occur on Chrome, and Safari appears to not offer HDR quality settings on the video. At time of writing I am using Nightly 123.0a1 (2024-01-01).

Leaving a ni? for :bradwerth who might know what's going on.

Flags: needinfo?(bwerth)
Severity: -- → S3
OS: Unspecified → macOS
Priority: -- → P3

I'll figure this out.

Assignee: nobody → bwerth
Flags: needinfo?(bwerth)

Confirmed that I can reproduce.

For me, the problem only reproduces in default mode, not theater mode, not fullscreen.

(In reply to Brad Werth [:bradwerth] from comment #5)

For me, the problem only reproduces in default mode, not theater mode, not fullscreen.

This also matches my experience as described in comment 0 - The ambient mode glow effect is not applied in theatre mode nor fullscreen.

Yes, confirmed that Ambient Mode is preventing the video from being handled as an external/native texture, which is a requirement of isolating it into an HDR-capable video layer. This is certainly related to the work in Bug 1849680. Bug 1855573 is open to fix this issue for an in-tree test. I'll make this Bug blocked on that.

Depends on: 1855573
See Also: → 1849680

Skipping this check on underlays is sufficient to fix the issue. I'll check with Glenn on what this check is attempting to accomplish and how should it be modified (rather than skipped entirely).

The issue here is that we don't detect the ambient canvas as being opaque (thus the opaque backdrop check fails), so we don't promote it. Promoting the surface on a transparent slice will cause the rounding of the underlay cutout to not work. In this case, we're being overly conservative (the ambient canvas pixels are opaque, but we don't detect that, and it's difficult to efficiently detect that). One solution would be to merge the picture cache slices and move the underlay prior.

See Also: → 1883525
Blocks: wr-promotion

i can confirm this is happening on a 2017 MacBookPro 13 4 thunderbolt ports that does not even have an HDR display, with that said it looks good once this bug is out of the way but i also noticed this bug which initially lead to me just wanting to turn HDR off, which i cant do.

for me, if i use the cinema view then shrink the window i can watch the colours switch from being good to washed out.

Dull Image on normal player - https://imgur.com/a/Tt77tFf

Full Screen (colours look correct) - https://imgur.com/X5M8N55

Priority: P3 → P2

(In reply to Glenn Watson [:gw] from comment #9)

The issue here is that we don't detect the ambient canvas as being opaque (thus the opaque backdrop check fails), so we don't promote it.

I'm trying to visualize the bad outcome if we promote this as an underlay when self.backdrop.kind.is_none(). We know the surface itself is opaque, because all YuvImage which seek promotion are opaque. The clip chain is applied on top of it, so we don't care what that looks like. Why do we care about the presence of the backdrop? The underlay certainly still appears underneath the clip. Why do we care about the rest of the slice?

Flags: needinfo?(gwatson)

Well, this issue can be fixed by ignoring the presence of the backdrop, and by prioritizing the promotion of the YuvImage prims before any of the Image prims. I'll upload a patch that does this and we'll work it out in reviews.

This patch makes two changes:

  1. Underlays with masks will allow promotion even if there is no
    backdrop on the current slice.

  2. Image prims will not promote until all of the promotable YuvImage
    prims have been considered for promotion. This is similar to the
    original implementation of underlays in Bug 1849680, where the presence
    of any YuvImage prim would prevent all overlay promotion (which is the
    only type considered for Image prims). The new behavior will allow Image
    prims to be promoted as long as all the YuvImages have been processed.

(In reply to Glenn Watson [:gw] from comment #9)

The issue here is that we don't detect the ambient canvas as being opaque (thus the opaque backdrop check fails), so we don't promote it.

Looks like at least in this case, the problem is that when we calculate the visible_local_rect of the TileCacheInstance, we are using the local_rect, when we should be using the local_clip_rect. This is preventing spanning backdrops from covering the visible area, and therefore the backdrop isn't eligible and the promotion later fails.

I have a vague feeling that selecting a spanning backdrop based on the local clip can cause issues that we've had previously. However, I can't recall what those were (maybe I'm thinking of something else). Let's land it with that change and see how it goes.

Flags: needinfo?(gwatson)
Pushed by bwerth@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/e0ef7889e164 Allow YuvImage underlays in more circumstances. r=gw
Pushed by bwerth@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/5886d166601b Allow YuvImage underlays in more circumstances. r=gw
Status: NEW → RESOLVED
Closed: 4 months ago
Resolution: --- → FIXED
Target Milestone: --- → 128 Branch
Blocks: 1899898
Duplicate of this bug: 1893467
Flags: needinfo?(bwerth)
Flags: qe-verify+

I've replicated this issue using Nightly 123.0a1 on macOS 13 following the STR from Comment 0.
Verified as fixed in the latest Firefox 128.0b9 version under the same configuration, as the issue no longer occurs.

Status: RESOLVED → VERIFIED
Flags: qe-verify+
See Also: → 1891974
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: