Commit 72cc58ad authored by yutak's avatar yutak Committed by Commit bot

Revert of cc: Plumb the monitor color profile to renderer for rasterization...

Revert of cc: Plumb the monitor color profile to renderer for rasterization (patchset #6 id:100001 of https://codereview.chromium.org/2325773003/ )

Reason for revert:
Suspected cause of the following MSAN failure.

https://build.chromium.org/p/chromium.webkit/builders/WebKit%20Linux%20MSAN/builds/12218

19:03:27.700 29717   ==4==WARNING: MemorySanitizer: use-of-uninitialized-value
19:03:27.700 29717       #0 0x7853dbe in computeTypeMask third_party/skia/src/core/SkMatrix44.cpp:59:23
19:03:27.700 29717       #1 0x7858825 in getType third_party/skia/include/core/SkMatrix44.h:208:31
19:03:27.700 29717       #2 0x7858825 in setConcat third_party/skia/src/core/SkMatrix44.cpp:378:0
19:03:27.700 29717       #3 0x76f8840 in operator*= ui/gfx/transform.h:253:5
19:03:27.700 29717       #4 0x76f8840 in ColorSpaceToColorSpaceTransform ui/gfx/color_transform.cc:563:0
19:03:27.700 29717       #5 0x76f78de in NewColorTransform ui/gfx/color_transform.cc:703:15
19:03:27.700 29717       #6 0x767f315 in GetColorSpace ui/gfx/icc_profile.cc:142:45
19:03:27.700 29717       #7 0xb2263ae in initializeLayerTreeView content/renderer/render_widget.cc:1141:61
19:03:27.700 29717       #8 0xb1e68fd in initializeLayerTreeView content/renderer/render_view_impl.cc:1956:17
19:03:27.700 29717       #9 0xc1c6b06 in initializeLayerTreeView third_party/WebKit/Source/web/WebViewImpl.cpp:4341:19
19:03:27.700 29717       #10 0xc1c57bf in WebViewImpl third_party/WebKit/Source/web/WebViewImpl.cpp:471:5
19:03:27.700 29717       #11 0xc1c29ff in create third_party/WebKit/Source/web/WebViewImpl.cpp:342:25
19:03:27.700 29717       #12 0xc1c29ff in create third_party/WebKit/Source/web/WebViewImpl.cpp:336:0
19:03:27.700 29717       #13 0xb19b457 in Initialize content/renderer/render_view_impl.cc:717:7
<snip>

Original issue's description:
> cc: Plumb the monitor color profile to renderer for rasterization
>
> This adds the output device color profile to display::Display, and
> populates it correctly on Mac. We will want to do this for all
> platforms.
>
> The color profile is then plumbed through the same IPCs that take
> the device scale factor, to get to the renderer process'
> RenderWidgetCompositor.
>
> Note that we are sending the full ICCProfile this far. This is
> important, because the renderer process will be setting the ICCProfile
> of its rasterized IOSurfaces, and there is a power impact of even slight
> differences between the monitor profile and the IOSurface profile.
>
> The ICCProfile is then sent as a gfx::ColorProfile (which internally
> references the ICCProfile, for the above purpose) to the
> RenderWidgetCompositor, from where it will be pushed to cc.
>
> In the next step, we will (under a flag) specify the color space
> for rasterization.
>
> BUG=44872
> CQ_INCLUDE_TRYBOTS=master.tryserver.blink:linux_precise_blink_rel
>
> Committed: https://crrev.com/f1fef7489c29deeee2a29c41ce4851e9ad1bd67b
> Cr-Commit-Position: refs/heads/master@{#418422}

TBR=enne@chromium.org,clamy@chromium.org,dcheng@chromium.org,ellyjones@chromium.org,ccameron@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=44872

Review-Url: https://codereview.chromium.org/2336113003
Cr-Commit-Position: refs/heads/master@{#418490}
parent d21e9163
......@@ -42,7 +42,7 @@ void WebContentsView::GetDefaultScreenInfo(ScreenInfo* results) {
gfx::DeviceDisplayInfo info;
results->depth = display.color_depth();
results->depth_per_component = display.depth_per_component();
results->is_monochrome = display.is_monochrome();
results->is_monochrome = (results->depth_per_component == 0);
}
WebContentsView* CreateWebContentsView(
......
......@@ -652,7 +652,6 @@ void GetScreenInfoForWindow(ScreenInfo* results,
// TODO(derat|oshima): Don't hardcode this. Get this from display object.
results->depth = 24;
results->depth_per_component = 8;
results->is_monochrome = false;
results->device_scale_factor = display.device_scale_factor();
// The Display rotation and the ScreenInfo orientation are not the same
......
......@@ -82,12 +82,15 @@ content::ScreenInfo GetNSViewScreenInfo(NSView* view) {
display::Display display =
display::Screen::GetScreen()->GetDisplayNearestWindow(view);
NSScreen* screen = [NSScreen deepestScreen];
content::ScreenInfo results;
results.device_scale_factor = static_cast<int>(display.device_scale_factor());
results.icc_profile = display.icc_profile();
results.depth = display.color_depth();
results.depth_per_component = display.depth_per_component();
results.is_monochrome = display.is_monochrome();
results.depth = NSBitsPerPixelFromDepth([screen depth]);
results.depth_per_component = NSBitsPerSampleFromDepth([screen depth]);
results.is_monochrome =
[[screen colorSpace] colorSpaceModel] == NSGrayColorSpaceModel;
results.rect = display.bounds();
results.available_rect = display.work_area();
results.orientation_angle = display.RotationAsDegree();
......
......@@ -167,7 +167,6 @@ IPC_STRUCT_TRAITS_END()
IPC_STRUCT_TRAITS_BEGIN(content::ScreenInfo)
IPC_STRUCT_TRAITS_MEMBER(device_scale_factor)
IPC_STRUCT_TRAITS_MEMBER(icc_profile)
IPC_STRUCT_TRAITS_MEMBER(depth)
IPC_STRUCT_TRAITS_MEMBER(depth_per_component)
IPC_STRUCT_TRAITS_MEMBER(is_monochrome)
......
......@@ -6,13 +6,8 @@
namespace content {
ScreenInfo::ScreenInfo() = default;
ScreenInfo::ScreenInfo(const ScreenInfo& other) = default;
ScreenInfo::~ScreenInfo() = default;
bool ScreenInfo::operator==(const ScreenInfo& other) const {
return device_scale_factor == other.device_scale_factor &&
icc_profile == other.icc_profile &&
depth == other.depth &&
depth_per_component == other.depth_per_component &&
is_monochrome == other.is_monochrome &&
......
......@@ -5,27 +5,18 @@
#ifndef CONTENT_PUBLIC_COMMON_SCREEN_INFO_H_
#define CONTENT_PUBLIC_COMMON_SCREEN_INFO_H_
#include "content/common/content_export.h"
#include "content/public/common/screen_orientation_values.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/icc_profile.h"
namespace content {
// Information about the screen on which a RenderWidget is being displayed. This
// is the content counterpart to WebScreenInfo in blink.
struct CONTENT_EXPORT ScreenInfo {
ScreenInfo();
ScreenInfo(const ScreenInfo& other);
~ScreenInfo();
struct ScreenInfo {
// Device scale factor. Specifies the ratio between physical and logical
// pixels.
float device_scale_factor = 1.f;
// The ICC profile of the output display.
gfx::ICCProfile icc_profile;
// The screen depth in bits per pixel
uint32_t depth = 0;
......
......@@ -1137,9 +1137,4 @@ void RenderWidgetCompositor::SetPaintedDeviceScaleFactor(
layer_tree_host_->GetLayerTree()->SetPaintedDeviceScaleFactor(device_scale);
}
void RenderWidgetCompositor::SetDeviceColorSpace(
const gfx::ColorSpace& color_space) {
// TODO(ccameron): Plumb this to the cc compositor.
}
} // namespace content
......@@ -38,10 +38,6 @@ class CompositorMessage;
}
}
namespace gfx {
class ColorSpace;
}
namespace ui {
class LatencyInfo;
}
......@@ -104,7 +100,6 @@ class CONTENT_EXPORT RenderWidgetCompositor
void SetSurfaceClientId(uint32_t surface_id_namespace);
void OnHandleCompositorProto(const std::vector<uint8_t>& proto);
void SetPaintedDeviceScaleFactor(float device_scale);
void SetDeviceColorSpace(const gfx::ColorSpace& color_space);
// WebLayerTreeView implementation.
void setRootLayer(const blink::WebLayer& layer) override;
......
......@@ -1057,7 +1057,6 @@ void RenderWidget::Resize(const ResizeParams& params) {
if (compositor_) {
compositor_->setViewportSize(params.physical_backing_size);
compositor_->setBottomControlsHeight(params.bottom_controls_height);
compositor_->SetDeviceColorSpace(screen_info_.icc_profile.GetColorSpace());
}
visible_viewport_size_ = params.visible_viewport_size;
......@@ -1140,7 +1139,6 @@ void RenderWidget::initializeLayerTreeView() {
compositor_deps_);
compositor_->setViewportSize(physical_backing_size_);
OnDeviceScaleFactorChanged();
compositor_->SetDeviceColorSpace(screen_info_.icc_profile.GetColorSpace());
// For background pages and certain tests, we don't want to trigger
// OutputSurface creation.
if (compositor_never_visible_ || !RenderThreadImpl::current())
......
......@@ -77,10 +77,6 @@ component("display") {
defines = [ "DISPLAY_IMPLEMENTATION" ]
public_deps = [
"//ui/gfx:gfx",
]
deps = [
"//base",
"//ui/display/types",
......
......@@ -49,7 +49,6 @@ class ScreenAndroid : public Screen {
display.SetRotationAsDegree(device_info.GetRotationDegrees());
display.set_color_depth(device_info.GetBitsPerPixel());
display.set_depth_per_component(device_info.GetBitsPerComponent());
display.set_is_monochrome(device_info.GetBitsPerComponent() == 0);
return display;
}
......
......@@ -82,8 +82,7 @@ Display::Display()
rotation_(ROTATE_0),
touch_support_(TOUCH_SUPPORT_UNKNOWN),
color_depth_(DEFAULT_BITS_PER_PIXEL),
depth_per_component_(DEFAULT_BITS_PER_COMPONENT),
is_monochrome_(false) {}
depth_per_component_(DEFAULT_BITS_PER_COMPONENT) {}
Display::Display(const Display& other) = default;
......
......@@ -10,7 +10,6 @@
#include "base/compiler_specific.h"
#include "ui/display/display_export.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/icc_profile.h"
#if !defined(OS_IOS)
#include "mojo/public/cpp/bindings/struct_traits.h" // nogncheck
......@@ -165,32 +164,16 @@ class DISPLAY_EXPORT Display final {
maximum_cursor_size_ = size;
}
// The full ICC profile of the display.
gfx::ICCProfile icc_profile() const { return icc_profile_; }
void set_icc_profile(const gfx::ICCProfile& icc_profile) {
icc_profile_ = icc_profile;
}
// The number of bits per pixel. Used by media query APIs.
int color_depth() const { return color_depth_; }
void set_color_depth(int color_depth) {
color_depth_ = color_depth;
}
// The number of bits per color component (all color components are assumed to
// have the same number of bits). Used by media query APIs.
int depth_per_component() const { return depth_per_component_; }
void set_depth_per_component(int depth_per_component) {
depth_per_component_ = depth_per_component;
}
// True if this is a monochrome display (e.g, for accessiblity). Used by media
// query APIs.
bool is_monochrome() const { return is_monochrome_; }
void set_is_monochrome(bool is_monochrome) {
is_monochrome_ = is_monochrome;
}
private:
int64_t id_;
gfx::Rect bounds_;
......@@ -199,10 +182,8 @@ class DISPLAY_EXPORT Display final {
Rotation rotation_;
TouchSupport touch_support_;
gfx::Size maximum_cursor_size_;
gfx::ICCProfile icc_profile_;
int color_depth_;
int depth_per_component_;
bool is_monochrome_;
#if !defined(OS_IOS)
friend struct mojo::StructTraits<display::mojom::DisplayDataView,
......
......@@ -19,10 +19,6 @@
#include "ui/display/display_change_notifier.h"
#include "ui/gfx/mac/coordinate_conversion.h"
extern "C" {
Boolean CGDisplayUsesForceToGray(void);
}
namespace display {
namespace {
......@@ -75,13 +71,6 @@ Display GetDisplayForScreen(NSScreen* screen) {
scale = Display::GetForcedDeviceScaleFactor();
display.set_device_scale_factor(scale);
display.set_icc_profile(
gfx::ICCProfile::FromCGColorSpace([[screen colorSpace] CGColorSpace]));
display.set_color_depth(NSBitsPerPixelFromDepth([screen depth]));
display.set_depth_per_component(NSBitsPerSampleFromDepth([screen depth]));
display.set_is_monochrome(CGDisplayUsesForceToGray());
// CGDisplayRotation returns a double. Display::SetRotationAsDegree will
// handle the unexpected situations were the angle is not a multiple of 90.
display.SetRotationAsDegree(static_cast<int>(CGDisplayRotation(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