| Index: ui/gfx/mac/io_surface.cc
|
| diff --git a/ui/gfx/mac/io_surface.cc b/ui/gfx/mac/io_surface.cc
|
| index 867643a4fcf53250cb2edb6f0d1355104f3ad1cd..c4a30c13c56c17fc0374e38c71a96f292f6783ab 100644
|
| --- a/ui/gfx/mac/io_surface.cc
|
| +++ b/ui/gfx/mac/io_surface.cc
|
| @@ -177,15 +177,28 @@ IOSurfaceRef CreateIOSurface(const gfx::Size& size, gfx::BufferFormat format) {
|
| DCHECK_EQ(kIOReturnSuccess, r);
|
| }
|
|
|
| + bool force_system_color_space = false;
|
| +
|
| // Displaying an IOSurface that does not have a color space using an
|
| // AVSampleBufferDisplayLayer can result in a black screen. Specify the
|
| // main display's color profile by default, which will result in no color
|
| // correction being done for the main monitor (which is the behavior of not
|
| // specifying a color space).
|
| // https://crbug.com/608879
|
| - if (format == gfx::BufferFormat::YUV_420_BIPLANAR) {
|
| - base::ScopedCFTypeRef<CGColorSpaceRef> color_space(
|
| - CGDisplayCopyColorSpace(CGMainDisplayID()));
|
| + if (format == gfx::BufferFormat::YUV_420_BIPLANAR)
|
| + force_system_color_space = true;
|
| +
|
| + // On Sierra, all IOSurfaces are color corrected as though they are in sRGB
|
| + // color space by default. Prior to Sierra, IOSurfaces were not color
|
| + // corrected (they were treated as though they were in the display color
|
| + // space). Override this by defaulting IOSurfaces to be in the main display
|
| + // color space.
|
| + // https://crbug.com/654488
|
| + if (base::mac::IsAtLeastOS10_12())
|
| + force_system_color_space = true;
|
| +
|
| + if (force_system_color_space) {
|
| + CGColorSpaceRef color_space = base::mac::GetSystemColorSpace();
|
| base::ScopedCFTypeRef<CFDataRef> color_space_icc(
|
| CGColorSpaceCopyICCProfile(color_space));
|
| // Note that nullptr is an acceptable input to IOSurfaceSetValue.
|
|
|