Set IOSurface color space to sRGB
Categories
(Core :: Graphics, enhancement)
Tracking
()
People
(Reporter: jrmuizel, Assigned: jrmuizel)
References
(Blocks 1 open bug, Regressed 1 open bug)
Details
Attachments
(1 file)
This should get us working color management basically for free.
Assignee | ||
Comment 1•4 years ago
|
||
From: https://bugs.chromium.org/p/chromium/issues/detail?id=417150#c34
"To summarize the above rambling:
If you tag an IOSurface with a Colorspace then you get the following behavior
changes:
- If you use the IOSurface as the contents of a CALayer, then the on-screen
result will be color-corrected from the IOSurface's ColorSpace to the
display's ColorSpace. - If you use the IOSurface in OpenGL, its behavior is unaffected (so, we don't
get color conversion in OpenGL for free).
If you tag an IOSurface with a ColorSpace then you get the following power
changes:
- If you tag an IOSurface with the ColorSpace of the monitor that it will
appear on then there is no additional GPU power usage. It is equivalent to
not having specified a ColorSpace- There is a slight increase in CPU power usage because of some
bookkeeping looking up the ColorSpace (roughly one call to
CGColorSpaceCreateWithICCProfile per newly-rastered quad)
- There is a slight increase in CPU power usage because of some
- If you tag an IOSurface with any other ColorSpace (e.g, RGB or SRGB), then
there is a nontrivial-but-not-excessive cost in terms of GPU power usage
that you incur every time you draw a frame."
Assignee | ||
Comment 2•4 years ago
|
||
So here's an interesting tidbit about what Chrome does:
https://source.chromium.org/chromium/chromium/src/+/master:ui/gfx/mac/display_icc_profiles.cc;l=73;drc=3930cf3f0e2404a517b4580b21e598a3fc648ff0
"If the ICC profile isn't accurately parametrically approximated, then don't store its data (we will assign the best parametric fit to IOSurfaces, and rely on the system compositor to do conversion to the display profile)."
Assignee | ||
Comment 3•4 years ago
|
||
Here's where Chrome decides on an output space:
https://source.chromium.org/chromium/chromium/src/+/master:cc/trees/layer_tree_host_impl.cc;l=1786;drc=624b5fe84610fa05852203a2bcb0c0c995dd99dd
It uses color spaces decided here:
https://source.chromium.org/chromium/chromium/src/+/master:ui/display/mac/screen_mac.mm;l=58;drc=d29aea5fe2e3cafa6a84fda198d2e4c4ac5b1832
It detects HDR with:
// Examine the presence of HDR.
bool enable_hdr = false;
if (@available(macOS 10.15, *)) {
if ([screen maximumPotentialExtendedDynamicRangeColorComponentValue] >
1.0) {
enable_hdr = true;
}
}
And determines the rasterization colorspace here:
https://source.chromium.org/chromium/chromium/src/+/master:cc/trees/layer_tree_host_impl.cc;l=1786;drc=624b5fe84610fa05852203a2bcb0c0c995dd99dd
For example, if I set my laptop to an Adobe RGB profile, hdr is still detected and I end up with my IOSurfaces tagged with P3 because of this check:
if (result.IsHDR() && content_color_usage != gfx::ContentColorUsage::kHDR)
return gfx::ColorSpace::CreateDisplayP3D65();
Assignee | ||
Comment 4•4 years ago
|
||
I'm pretty sure I was previously able to get Chrome to tag with a colorspace other than P3 but I can't seem to make that happen anymore.
Assignee | ||
Comment 5•4 years ago
|
||
QuartzCore seems to use CGColorSpaceUsesExtendedRange when deciding about whether to use 16bpc or 8bpc
Assignee | ||
Comment 6•4 years ago
|
||
This lets the WindowServer do all of the color correction for us
including WebGL and 2D canvas.
There's some concern that this will increase GPU usage as
reported in https://bugs.chromium.org/p/chromium/issues/detail?id=417150#c34.
However, the alernative of doing everything in device space isn't very
attractive because we'd have to color manage canvas and webgl ourselves.
Further, Chrome doesn't seem to be using the device space and it seems
like there's typically already a mix of color spaces in use so hopefully
the GPU increase is not high.
Updated•4 years ago
|
Comment 8•4 years ago
|
||
bugherder |
Assignee | ||
Comment 9•4 years ago
|
||
Release Note Request (optional, but appreciated)
[Why is this notable]: Colors in Firefox on macOS will no longer be saturated on wide gamut displays, untagged images are properly treated as sRGB, and colors in images tagged as sRGB will now match css colors.
[Affects Firefox for Android]: Nope
[Suggested wording]: I'm not sure.
[Links (documentation, blog post, etc)]: None yet.
Updated•4 years ago
|
Comment 10•4 years ago
|
||
Added to nightly release notes with the text explaining the change:
Colors in Firefox on macOS will no longer be saturated on wide gamut displays, untagged images are properly treated as sRGB, and colors in images tagged as sRGB will now match css colors.
Comment 11•4 years ago
|
||
This is in our 89 beta notes and should be in our final notes managed by our comms team.
Description
•