Commit 61d47273 authored by Christopher Cameron's avatar Christopher Cameron Committed by Commit Bot

Remove uses of kCGColorSpaceITUR_2020_PQ_EOTF/HLG

We use IOSurfaceSetColorSpace's return value to determine
if an IOSurface can be an overlay. Continue to return true
for these formats, because the HDRCopier will be used
to composite them (https://crbug.com/1101041).

Bug: 1108627
Change-Id: I06d5282bc508ec61698112f58a1c5f18efe68ebf
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2363950Reviewed-by: default avatarMark Mentovai <mark@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
Commit-Queue: ccameron <ccameron@chromium.org>
Cr-Commit-Position: refs/heads/master@{#799427}
parent 9205f8f8
...@@ -19,22 +19,6 @@ ...@@ -19,22 +19,6 @@
#include "ui/gfx/buffer_format_util.h" #include "ui/gfx/buffer_format_util.h"
#include "ui/gfx/icc_profile.h" #include "ui/gfx/icc_profile.h"
#if defined(__MAC_11_0) && __MAC_OS_X_VERSION_MAX_ALLOWED >= __MAC_10_16
// https://crbug.com/1108561: This is supposed to be deprecated (but available)
// through 10.15.4, but the macOS 11.0 20A5323l SDK from Xcode 12b3 12A8169g
// doesn’t declare it at all when the SDK version is 10.16 or later, which of
// course it always is. It’s a bug in the SDK. Work around it with the
// declaration that’s hidden.
//
// TODO(https://crbug.com/1108627): remove this workaround if and when the SDK
// bug is fixed.
CG_EXTERN const CFStringRef kCGColorSpaceITUR_2020_PQ_EOTF
CG_AVAILABLE_BUT_DEPRECATED(10.14.6, 10.15.4, 12.6, 13.4);
CG_EXTERN const CFStringRef kCGColorSpaceITUR_2020_HLG
CG_AVAILABLE_BUT_DEPRECATED(10.14.6, 10.15.4, 12.6, 13.4);
#endif
namespace gfx { namespace gfx {
namespace { namespace {
...@@ -160,24 +144,25 @@ bool IOSurfaceSetColorSpace(IOSurfaceRef io_surface, ...@@ -160,24 +144,25 @@ bool IOSurfaceSetColorSpace(IOSurfaceRef io_surface,
color_space_name = kCGColorSpaceExtendedLinearSRGB; color_space_name = kCGColorSpaceExtendedLinearSRGB;
} }
} }
// The symbols kCGColorSpaceITUR_2020_PQ_EOTF and kCGColorSpaceITUR_2020_HLG
// have been deprecated. Claim that we were able to set the color space,
// because the path that will render these color spaces will use the
// HDRCopier, which will manually convert them to a non-deprecated format.
// https://crbug.com/1108627: Bug wherein these symbols are deprecated and
// also not available in some SDK versions.
// https://crbug.com/1101041: Introduces the HDR copier.
// https://crbug.com/1061723: Discussion of issues related to HLG.
if (__builtin_available(macos 10.15, *)) { if (__builtin_available(macos 10.15, *)) {
if (color_space == ColorSpace(ColorSpace::PrimaryID::BT2020, if (color_space == ColorSpace(ColorSpace::PrimaryID::BT2020,
ColorSpace::TransferID::SMPTEST2084, ColorSpace::TransferID::SMPTEST2084,
ColorSpace::MatrixID::BT2020_NCL, ColorSpace::MatrixID::BT2020_NCL,
ColorSpace::RangeID::LIMITED)) { ColorSpace::RangeID::LIMITED)) {
color_space_name = kCGColorSpaceITUR_2020_PQ_EOTF; return true;
} else if (color_space == ColorSpace(ColorSpace::PrimaryID::BT2020, } else if (color_space == ColorSpace(ColorSpace::PrimaryID::BT2020,
ColorSpace::TransferID::ARIB_STD_B67, ColorSpace::TransferID::ARIB_STD_B67,
ColorSpace::MatrixID::BT2020_NCL, ColorSpace::MatrixID::BT2020_NCL,
ColorSpace::RangeID::LIMITED)) { ColorSpace::RangeID::LIMITED)) {
// The CGColorSpace kCGColorSpaceITUR_2020_HLG cannot be used to display return true;
// an IOSurface directly, because it expects that "pixel values should be
// between 0.0 and 12.0", while Chrome uses pixel values between 0.0 and
// 1.0. That said, because we use the HDRCopier for this content, we can
// perform the color conversion ourselves.
// https://crbug.com/1061723 (for the HLG issue).
// https://crbug.com/1101041 (for the HDR copier).
color_space_name = kCGColorSpaceITUR_2020_HLG;
} }
} }
if (color_space_name) { if (color_space_name) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment