Commit c71f15ab authored by Mason Freed's avatar Mason Freed Committed by Commit Bot

[CI] Adding a force-raster-color-profile flag, to get OOPIF mode tests to pass

With this change, there are now two color-profile related switches:
 --force-color-profile - forces the DISPLAY color profile to the desired setting.
                         Note that the name of the flag didn't change, for
                         backwards-compatibility. But it now refers to the
                         display surface only.
 --force-raster-color-profile - forces the rasterization to happen in the
                                provided color space.

The exotic-color-space virtual test suite now sets the raster color profile to
the ColorSpin profile, and the display color profile to sRGB. All other tests
(by default) set both color profiles to sRGB.


Bug: 875942, 667551
Change-Id: I66445cea5ed8dcc259a8f0bda2141350bcf66458
Reviewed-on: https://chromium-review.googlesource.com/1205713
Commit-Queue: Mason Freed <masonfreed@chromium.org>
Reviewed-by: default avatarccameron <ccameron@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#589948}
parent 8fc94ef2
...@@ -802,14 +802,14 @@ const FeatureEntry::Choice kEnableAudioFocusChoices[] = { ...@@ -802,14 +802,14 @@ const FeatureEntry::Choice kEnableAudioFocusChoices[] = {
const FeatureEntry::Choice kForceColorProfileChoices[] = { const FeatureEntry::Choice kForceColorProfileChoices[] = {
{flags_ui::kGenericExperimentChoiceDefault, "", ""}, {flags_ui::kGenericExperimentChoiceDefault, "", ""},
{flag_descriptions::kForceColorProfileSRGB, switches::kForceColorProfile, {flag_descriptions::kForceColorProfileSRGB,
"srgb"}, switches::kForceDisplayColorProfile, "srgb"},
{flag_descriptions::kForceColorProfileP3, switches::kForceColorProfile, {flag_descriptions::kForceColorProfileP3,
"display-p3-d65"}, switches::kForceDisplayColorProfile, "display-p3-d65"},
{flag_descriptions::kForceColorProfileColorSpin, {flag_descriptions::kForceColorProfileColorSpin,
switches::kForceColorProfile, "color-spin-gamma24"}, switches::kForceDisplayColorProfile, "color-spin-gamma24"},
{flag_descriptions::kForceColorProfileHdr, switches::kForceColorProfile, {flag_descriptions::kForceColorProfileHdr,
"scrgb-linear"}, switches::kForceDisplayColorProfile, "scrgb-linear"},
}; };
const FeatureEntry::FeatureParam kAutofillPreviewStyleBlackOnBlue050[] = { const FeatureEntry::FeatureParam kAutofillPreviewStyleBlackOnBlue050[] = {
......
...@@ -260,7 +260,7 @@ void InProcessBrowserTest::SetUpDefaultCommandLine( ...@@ -260,7 +260,7 @@ void InProcessBrowserTest::SetUpDefaultCommandLine(
// Use an sRGB color profile to ensure that the machine's color profile does // Use an sRGB color profile to ensure that the machine's color profile does
// not affect the results. // not affect the results.
command_line->AppendSwitchASCII(switches::kForceColorProfile, "srgb"); command_line->AppendSwitchASCII(switches::kForceDisplayColorProfile, "srgb");
// TODO(pkotwicz): Investigate if we can remove this switch. // TODO(pkotwicz): Investigate if we can remove this switch.
if (exit_when_last_browser_closes_) if (exit_when_last_browser_closes_)
......
...@@ -2999,7 +2999,7 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer( ...@@ -2999,7 +2999,7 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer(
switches::kEnableWebVR, switches::kEnableWebVR,
switches::kExplicitlyAllowedPorts, switches::kExplicitlyAllowedPorts,
switches::kFileUrlPathAlias, switches::kFileUrlPathAlias,
switches::kForceColorProfile, switches::kForceDisplayColorProfile,
switches::kForceDeviceScaleFactor, switches::kForceDeviceScaleFactor,
switches::kForceGpuMemAvailableMb, switches::kForceGpuMemAvailableMb,
switches::kForceGpuRasterization, switches::kForceGpuRasterization,
......
...@@ -1602,6 +1602,9 @@ void RenderWidgetHostImpl::GetScreenInfo(ScreenInfo* result) { ...@@ -1602,6 +1602,9 @@ void RenderWidgetHostImpl::GetScreenInfo(ScreenInfo* result) {
else else
DisplayUtil::GetDefaultScreenInfo(result); DisplayUtil::GetDefaultScreenInfo(result);
if (display::Display::HasForceRasterColorProfile())
result->color_space = display::Display::GetForcedRasterColorProfile();
// TODO(sievers): find a way to make this done another way so the method // TODO(sievers): find a way to make this done another way so the method
// can be const. // can be const.
if (IsUseZoomForDSFEnabled()) if (IsUseZoomForDSFEnabled())
......
...@@ -245,7 +245,7 @@ void BrowserTestBase::SetUp() { ...@@ -245,7 +245,7 @@ void BrowserTestBase::SetUp() {
// Use an sRGB color profile to ensure that the machine's color profile does // Use an sRGB color profile to ensure that the machine's color profile does
// not affect the results. // not affect the results.
command_line->AppendSwitchASCII(switches::kForceColorProfile, "srgb"); command_line->AppendSwitchASCII(switches::kForceDisplayColorProfile, "srgb");
// Disable compositor Ukm in browser tests until crbug.com/761524 is resolved. // Disable compositor Ukm in browser tests until crbug.com/761524 is resolved.
command_line->AppendSwitch(switches::kDisableCompositorUkmForTests); command_line->AppendSwitch(switches::kDisableCompositorUkmForTests);
......
...@@ -266,9 +266,12 @@ bool ShellMainDelegate::BasicStartupComplete(int* exit_code) { ...@@ -266,9 +266,12 @@ bool ShellMainDelegate::BasicStartupComplete(int* exit_code) {
command_line.AppendSwitch(switches::kDisableGpuRasterization); command_line.AppendSwitch(switches::kDisableGpuRasterization);
} }
// If the virtual test suite didn't specify a color space, then force sRGB. // If the virtual test suite didn't specify a display color space, then
if (!command_line.HasSwitch(switches::kForceColorProfile)) // force sRGB.
command_line.AppendSwitchASCII(switches::kForceColorProfile, "srgb"); if (!command_line.HasSwitch(switches::kForceDisplayColorProfile)) {
command_line.AppendSwitchASCII(switches::kForceDisplayColorProfile,
"srgb");
}
// We want stable/baseline results when running layout tests. // We want stable/baseline results when running layout tests.
command_line.AppendSwitch(switches::kDisableSkiaRuntimeOpts); command_line.AppendSwitch(switches::kDisableSkiaRuntimeOpts);
......
...@@ -501,7 +501,7 @@ gfx::ColorSpace GetTestingColorSpace(const std::string& name) { ...@@ -501,7 +501,7 @@ gfx::ColorSpace GetTestingColorSpace(const std::string& name) {
} else if (name == "adobeRGB") { } else if (name == "adobeRGB") {
return gfx::ICCProfileForTestingAdobeRGB().GetColorSpace(); return gfx::ICCProfileForTestingAdobeRGB().GetColorSpace();
} else if (name == "reset") { } else if (name == "reset") {
return display::Display::GetForcedColorProfile(); return display::Display::GetForcedDisplayColorProfile();
} }
return gfx::ColorSpace(); return gfx::ColorSpace();
} }
......
...@@ -105,7 +105,8 @@ ...@@ -105,7 +105,8 @@
{ {
"prefix": "exotic-color-space", "prefix": "exotic-color-space",
"base": "images", "base": "images",
"args": ["--force-color-profile=color-spin-gamma24"] "args": ["--force-color-profile=srgb",
"--force-raster-color-profile=color-spin-gamma24"]
}, },
{ {
"prefix": "stable", "prefix": "stable",
......
...@@ -89,7 +89,7 @@ void DisplayAndroidManager::UpdateDisplay( ...@@ -89,7 +89,7 @@ void DisplayAndroidManager::UpdateDisplay(
display::Display display(sdkDisplayId, bounds_in_dip); display::Display display(sdkDisplayId, bounds_in_dip);
if (!Display::HasForceDeviceScaleFactor()) if (!Display::HasForceDeviceScaleFactor())
display.set_device_scale_factor(dipScale); display.set_device_scale_factor(dipScale);
if (!Display::HasForceColorProfile()) { if (!Display::HasForceDisplayColorProfile()) {
// TODO(ccameron): Use CreateDisplayP3D65 if isWideColorGamut is true, once // TODO(ccameron): Use CreateDisplayP3D65 if isWideColorGamut is true, once
// the feature is ready to use. // the feature is ready to use.
display.set_color_space(gfx::ColorSpace::CreateSRGB()); display.set_color_space(gfx::ColorSpace::CreateSRGB());
......
...@@ -58,6 +58,33 @@ float GetForcedDeviceScaleFactorImpl() { ...@@ -58,6 +58,33 @@ float GetForcedDeviceScaleFactorImpl() {
int64_t internal_display_id_ = -1; int64_t internal_display_id_ = -1;
gfx::ColorSpace ForcedColorProfileStringToColorSpace(const std::string& value) {
if (value == "srgb")
return gfx::ColorSpace::CreateSRGB();
if (value == "display-p3-d65")
return gfx::ColorSpace::CreateDisplayP3D65();
if (value == "scrgb-linear")
return gfx::ColorSpace::CreateSCRGBLinear();
if (value == "extended-srgb")
return gfx::ColorSpace::CreateExtendedSRGB();
if (value == "generic-rgb") {
return gfx::ColorSpace(gfx::ColorSpace::PrimaryID::APPLE_GENERIC_RGB,
gfx::ColorSpace::TransferID::GAMMA18);
}
if (value == "color-spin-gamma24") {
// Run this color profile through an ICC profile. The resulting color space
// is slightly different from the input color space, and removing the ICC
// profile would require rebaselineing many layout tests.
gfx::ColorSpace color_space(
gfx::ColorSpace::PrimaryID::WIDE_GAMUT_COLOR_SPIN,
gfx::ColorSpace::TransferID::GAMMA24);
return gfx::ICCProfile::FromParametricColorSpace(color_space)
.GetColorSpace();
}
LOG(ERROR) << "Invalid forced color profile: \"" << value << "\"";
return gfx::ColorSpace::CreateSRGB();
}
} // namespace } // namespace
bool CompareDisplayIds(int64_t id1, int64_t id2) { bool CompareDisplayIds(int64_t id1, int64_t id2) {
...@@ -103,42 +130,33 @@ void Display::SetForceDeviceScaleFactor(double dsf) { ...@@ -103,42 +130,33 @@ void Display::SetForceDeviceScaleFactor(double dsf) {
} }
// static // static
gfx::ColorSpace Display::GetForcedColorProfile() { gfx::ColorSpace Display::GetForcedDisplayColorProfile() {
DCHECK(HasForceColorProfile()); DCHECK(HasForceDisplayColorProfile());
std::string value = std::string value =
base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
switches::kForceColorProfile); switches::kForceDisplayColorProfile);
if (value == "srgb") { return ForcedColorProfileStringToColorSpace(value);
return gfx::ColorSpace::CreateSRGB();
} else if (value == "display-p3-d65") {
return gfx::ColorSpace::CreateDisplayP3D65();
} else if (value == "scrgb-linear") {
return gfx::ColorSpace::CreateSCRGBLinear();
} else if (value == "extended-srgb") {
return gfx::ColorSpace::CreateExtendedSRGB();
} else if (value == "generic-rgb") {
return gfx::ColorSpace(gfx::ColorSpace::PrimaryID::APPLE_GENERIC_RGB,
gfx::ColorSpace::TransferID::GAMMA18);
} else if (value == "color-spin-gamma24") {
// Run this color profile through an ICC profile. The resulting color space
// is slightly different from the input color space, and removing the ICC
// profile would require rebaselineing many layout tests.
gfx::ColorSpace color_space(
gfx::ColorSpace::PrimaryID::WIDE_GAMUT_COLOR_SPIN,
gfx::ColorSpace::TransferID::GAMMA24);
return gfx::ICCProfile::FromParametricColorSpace(color_space)
.GetColorSpace();
}
LOG(ERROR) << "Invalid forced color profile";
return gfx::ColorSpace::CreateSRGB();
} }
// static // static
bool Display::HasForceColorProfile() { bool Display::HasForceDisplayColorProfile() {
static bool has_force_color_profile = return base::CommandLine::ForCurrentProcess()->HasSwitch(
base::CommandLine::ForCurrentProcess()->HasSwitch( switches::kForceDisplayColorProfile);
switches::kForceColorProfile); }
return has_force_color_profile;
// static
gfx::ColorSpace Display::GetForcedRasterColorProfile() {
DCHECK(HasForceRasterColorProfile());
std::string value =
base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
switches::kForceRasterColorProfile);
return ForcedColorProfileStringToColorSpace(value);
}
// static
bool Display::HasForceRasterColorProfile() {
return base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kForceRasterColorProfile);
} }
// static // static
...@@ -196,8 +214,8 @@ Display::Display(int64_t id, const gfx::Rect& bounds) ...@@ -196,8 +214,8 @@ Display::Display(int64_t id, const gfx::Rect& bounds)
color_space_(gfx::ColorSpace::CreateSRGB()), color_space_(gfx::ColorSpace::CreateSRGB()),
color_depth_(DEFAULT_BITS_PER_PIXEL), color_depth_(DEFAULT_BITS_PER_PIXEL),
depth_per_component_(DEFAULT_BITS_PER_COMPONENT) { depth_per_component_(DEFAULT_BITS_PER_COMPONENT) {
if (HasForceColorProfile()) if (HasForceDisplayColorProfile())
SetColorSpaceAndDepth(GetForcedColorProfile()); SetColorSpaceAndDepth(GetForcedDisplayColorProfile());
#if defined(USE_AURA) #if defined(USE_AURA)
SetScaleAndBounds(device_scale_factor_, bounds); SetScaleAndBounds(device_scale_factor_, bounds);
#endif #endif
......
...@@ -94,11 +94,19 @@ class DISPLAY_EXPORT Display final { ...@@ -94,11 +94,19 @@ class DISPLAY_EXPORT Display final {
// Returns the forced display color profile, which is given by // Returns the forced display color profile, which is given by
// "--force-color-profile". // "--force-color-profile".
static gfx::ColorSpace GetForcedColorProfile(); static gfx::ColorSpace GetForcedDisplayColorProfile();
// Indicates if a display color profile is being explicitly enforced from the // Indicates if a display color profile is being explicitly enforced from the
// command line via "--force-color-profile". // command line via "--force-color-profile".
static bool HasForceColorProfile(); static bool HasForceDisplayColorProfile();
// Returns the forced raster color profile, which is given by
// "--force-raster-color-profile".
static gfx::ColorSpace GetForcedRasterColorProfile();
// Indicates if a raster color profile is being explicitly enforced from the
// command line via "--force-raster-color-profile".
static bool HasForceRasterColorProfile();
// Indicates if the display color profile being forced should be ensured to // Indicates if the display color profile being forced should be ensured to
// be in use by the operating system as well. // be in use by the operating system as well.
......
...@@ -25,7 +25,11 @@ const char kEnsureForcedColorProfile[] = "ensure-forced-color-profile"; ...@@ -25,7 +25,11 @@ const char kEnsureForcedColorProfile[] = "ensure-forced-color-profile";
// Force all monitors to be treated as though they have the specified color // Force all monitors to be treated as though they have the specified color
// profile. Accepted values are "srgb" and "generic-rgb" (currently used by Mac // profile. Accepted values are "srgb" and "generic-rgb" (currently used by Mac
// layout tests) and "color-spin-gamma24" (used by layout tests). // layout tests) and "color-spin-gamma24" (used by layout tests).
const char kForceColorProfile[] = "force-color-profile"; const char kForceDisplayColorProfile[] = "force-color-profile";
// Force rastering to take place in the specified color profile. Accepted values
// are the same as for the kForceDisplayColorProfile case above.
const char kForceRasterColorProfile[] = "force-raster-color-profile";
// Overrides the device scale factor for the browser UI and the contents. // Overrides the device scale factor for the browser UI and the contents.
const char kForceDeviceScaleFactor[] = "force-device-scale-factor"; const char kForceDeviceScaleFactor[] = "force-device-scale-factor";
......
...@@ -16,8 +16,9 @@ namespace switches { ...@@ -16,8 +16,9 @@ namespace switches {
DISPLAY_EXPORT extern const char kDisableMultiMirroring[]; DISPLAY_EXPORT extern const char kDisableMultiMirroring[];
DISPLAY_EXPORT extern const char kEnableSoftwareMirroring[]; DISPLAY_EXPORT extern const char kEnableSoftwareMirroring[];
DISPLAY_EXPORT extern const char kEnsureForcedColorProfile[]; DISPLAY_EXPORT extern const char kEnsureForcedColorProfile[];
DISPLAY_EXPORT extern const char kForceColorProfile[];
DISPLAY_EXPORT extern const char kForceDeviceScaleFactor[]; DISPLAY_EXPORT extern const char kForceDeviceScaleFactor[];
DISPLAY_EXPORT extern const char kForceDisplayColorProfile[];
DISPLAY_EXPORT extern const char kForceRasterColorProfile[];
// TODO(kylechar): This overlaps with --screen-config. Unify flags and remove. // TODO(kylechar): This overlaps with --screen-config. Unify flags and remove.
DISPLAY_EXPORT extern const char kHostWindowBounds[]; DISPLAY_EXPORT extern const char kHostWindowBounds[];
DISPLAY_EXPORT extern const char kScreenConfig[]; DISPLAY_EXPORT extern const char kScreenConfig[];
......
...@@ -93,7 +93,7 @@ Display BuildDisplayForScreen(NSScreen* screen) { ...@@ -93,7 +93,7 @@ Display BuildDisplayForScreen(NSScreen* screen) {
} }
icc_profile.HistogramDisplay(display.id()); icc_profile.HistogramDisplay(display.id());
gfx::ColorSpace screen_color_space = icc_profile.GetColorSpace(); gfx::ColorSpace screen_color_space = icc_profile.GetColorSpace();
if (Display::HasForceColorProfile()) { if (Display::HasForceDisplayColorProfile()) {
if (Display::HasEnsureForcedColorProfile()) { if (Display::HasEnsureForcedColorProfile()) {
CHECK_EQ(screen_color_space, display.color_space()) CHECK_EQ(screen_color_space, display.color_space())
<< "The display's color space does not match the color space that " << "The display's color space does not match the color space that "
......
...@@ -153,7 +153,7 @@ Display CreateDisplayFromDisplayInfo(const DisplayInfo& display_info, ...@@ -153,7 +153,7 @@ Display CreateDisplayFromDisplayInfo(const DisplayInfo& display_info,
display.set_bounds(gfx::ScaleToEnclosingRect(display_info.screen_rect(), display.set_bounds(gfx::ScaleToEnclosingRect(display_info.screen_rect(),
1.0f / scale_factor)); 1.0f / scale_factor));
display.set_rotation(display_info.rotation()); display.set_rotation(display_info.rotation());
if (!Display::HasForceColorProfile()) { if (!Display::HasForceDisplayColorProfile()) {
if (hdr_enabled) { if (hdr_enabled) {
display.SetColorSpaceAndDepth( display.SetColorSpaceAndDepth(
gfx::ColorSpace::CreateSCRGBLinear().GetScaledColorSpace( gfx::ColorSpace::CreateSCRGBLinear().GetScaledColorSpace(
......
...@@ -450,7 +450,7 @@ std::vector<display::Display> DesktopScreenX11::BuildDisplaysFromXRandRInfo() { ...@@ -450,7 +450,7 @@ std::vector<display::Display> DesktopScreenX11::BuildDisplaysFromXRandRInfo() {
if (monitor_iter != output_to_monitor.end() && monitor_iter->second == 0) if (monitor_iter != output_to_monitor.end() && monitor_iter->second == 0)
monitor_order_primary_display_index = displays.size(); monitor_order_primary_display_index = displays.size();
if (!display::Display::HasForceColorProfile()) { if (!display::Display::HasForceDisplayColorProfile()) {
gfx::ICCProfile icc_profile = GetICCProfileForMonitor( gfx::ICCProfile icc_profile = GetICCProfileForMonitor(
monitor_iter == output_to_monitor.end() ? 0 : monitor_iter->second); monitor_iter == output_to_monitor.end() ? 0 : monitor_iter->second);
icc_profile.HistogramDisplay(display.id()); icc_profile.HistogramDisplay(display.id());
......
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