Commit b9fe49e9 authored by Miguel Casas's avatar Miguel Casas Committed by Commit Bot

ui/display: wire EDID's bits per channel

This CL wires EDID's bits per channel indication to DisplaySnapshot,
ManagedDisplayInfo, and DisplayManager.  This is needed as a first
step to create 10 bit per component/30 bit depth framebuffers for
monitors that support it such as [1] or HP z32x.

[1] https://paste.googleplex.com/4515759143256064

Bug: 949260
Change-Id: Ic30c34099da68f9ec9a7e099e5136b945aab6879
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1733887
Commit-Queue: Miguel Casas <mcasas@chromium.org>
Reviewed-by: default avatarJames Cook <jamescook@chromium.org>
Reviewed-by: default avatarRobert Sesek <rsesek@chromium.org>
Reviewed-by: default avatarMichael Spang <spang@chromium.org>
Reviewed-by: default avatarDaniel Nicoara <dnicoara@chromium.org>
Cr-Commit-Position: refs/heads/master@{#689131}
parent 05c0f59c
...@@ -94,9 +94,14 @@ uint32_t DisplayList::UpdateDisplay(const Display& display, Type type) { ...@@ -94,9 +94,14 @@ uint32_t DisplayList::UpdateDisplay(const Display& display, Type type) {
changed_values |= DisplayObserver::DISPLAY_METRIC_DEVICE_SCALE_FACTOR; changed_values |= DisplayObserver::DISPLAY_METRIC_DEVICE_SCALE_FACTOR;
} }
if (local_display->color_space() != display.color_space() || if (local_display->color_space() != display.color_space() ||
local_display->sdr_white_level() != display.sdr_white_level()) { local_display->sdr_white_level() != display.sdr_white_level() ||
local_display->color_depth() != display.color_depth()) {
const int32_t color_depth = display.color_depth();
const int32_t depth_per_component = display.depth_per_component();
local_display->SetColorSpaceAndDepth(display.color_space(), local_display->SetColorSpaceAndDepth(display.color_space(),
display.sdr_white_level()); display.sdr_white_level());
local_display->set_depth_per_component(depth_per_component);
local_display->set_color_depth(color_depth);
changed_values |= DisplayObserver::DISPLAY_METRIC_COLOR_SPACE; changed_values |= DisplayObserver::DISPLAY_METRIC_COLOR_SPACE;
} }
if (should_notify_observers()) { if (should_notify_observers()) {
......
...@@ -308,6 +308,7 @@ FakeDisplaySnapshot::FakeDisplaySnapshot(int64_t display_id, ...@@ -308,6 +308,7 @@ FakeDisplaySnapshot::FakeDisplaySnapshot(int64_t display_id,
has_color_correction_matrix, has_color_correction_matrix,
color_correction_in_linear_space, color_correction_in_linear_space,
gfx::ColorSpace(), gfx::ColorSpace(),
8u /* bits_per_channel */,
display_name, display_name,
base::FilePath(), base::FilePath(),
std::move(modes), std::move(modes),
......
...@@ -331,6 +331,7 @@ ManagedDisplayInfo DisplayChangeObserver::CreateManagedDisplayInfo( ...@@ -331,6 +331,7 @@ ManagedDisplayInfo DisplayChangeObserver::CreateManagedDisplayInfo(
if (dpi) if (dpi)
new_info.set_device_dpi(dpi); new_info.set_device_dpi(dpi);
new_info.set_color_space(snapshot->color_space()); new_info.set_color_space(snapshot->color_space());
new_info.set_bits_per_channel(snapshot->bits_per_channel());
new_info.set_refresh_rate(mode_info->refresh_rate()); new_info.set_refresh_rate(mode_info->refresh_rate());
new_info.set_is_interlaced(mode_info->is_interlaced()); new_info.set_is_interlaced(mode_info->is_interlaced());
......
...@@ -2096,6 +2096,13 @@ Display DisplayManager::CreateDisplayFromDisplayInfoById(int64_t id) { ...@@ -2096,6 +2096,13 @@ Display DisplayManager::CreateDisplayFromDisplayInfoById(int64_t id) {
new_display.set_touch_support(display_info.touch_support()); new_display.set_touch_support(display_info.touch_support());
new_display.set_maximum_cursor_size(display_info.maximum_cursor_size()); new_display.set_maximum_cursor_size(display_info.maximum_cursor_size());
new_display.SetColorSpaceAndDepth(display_info.color_space()); new_display.SetColorSpaceAndDepth(display_info.color_space());
constexpr uint32_t kNormalBitDepthNumBitsPerChannel = 8u;
if (display_info.bits_per_channel() > kNormalBitDepthNumBitsPerChannel) {
new_display.set_depth_per_component(display_info.bits_per_channel());
constexpr uint32_t kRGBNumChannels = 3u;
new_display.set_color_depth(display_info.bits_per_channel() *
kRGBNumChannels);
}
new_display.set_display_frequency(display_info.refresh_rate()); new_display.set_display_frequency(display_info.refresh_rate());
if (internal_display_has_accelerometer_ && Display::IsInternalDisplayId(id)) { if (internal_display_has_accelerometer_ && Display::IsInternalDisplayId(id)) {
......
...@@ -353,6 +353,7 @@ void ManagedDisplayInfo::Copy(const ManagedDisplayInfo& native_info) { ...@@ -353,6 +353,7 @@ void ManagedDisplayInfo::Copy(const ManagedDisplayInfo& native_info) {
display_modes_ = native_info.display_modes_; display_modes_ = native_info.display_modes_;
maximum_cursor_size_ = native_info.maximum_cursor_size_; maximum_cursor_size_ = native_info.maximum_cursor_size_;
color_space_ = native_info.color_space_; color_space_ = native_info.color_space_;
bits_per_channel_ = native_info.bits_per_channel_;
refresh_rate_ = native_info.refresh_rate_; refresh_rate_ = native_info.refresh_rate_;
is_interlaced_ = native_info.is_interlaced_; is_interlaced_ = native_info.is_interlaced_;
......
...@@ -251,6 +251,11 @@ class DISPLAY_MANAGER_EXPORT ManagedDisplayInfo { ...@@ -251,6 +251,11 @@ class DISPLAY_MANAGER_EXPORT ManagedDisplayInfo {
color_space_ = color_space; color_space_ = color_space;
} }
uint32_t bits_per_channel() const { return bits_per_channel_; }
void set_bits_per_channel(uint32_t bits_per_channel) {
bits_per_channel_ = bits_per_channel;
}
bool is_aspect_preserving_scaling() const { bool is_aspect_preserving_scaling() const {
return is_aspect_preserving_scaling_; return is_aspect_preserving_scaling_;
} }
...@@ -347,6 +352,9 @@ class DISPLAY_MANAGER_EXPORT ManagedDisplayInfo { ...@@ -347,6 +352,9 @@ class DISPLAY_MANAGER_EXPORT ManagedDisplayInfo {
// Colorimetry information of the Display (if IsValid()), including e.g. // Colorimetry information of the Display (if IsValid()), including e.g.
// transfer and primaries information, retrieved from its EDID. // transfer and primaries information, retrieved from its EDID.
gfx::ColorSpace color_space_; gfx::ColorSpace color_space_;
// Bit depth of every channel, extracted from its EDID, usually 8, but can be
// 0 if EDID says so or if the EDID (retrieval) was faulty.
uint32_t bits_per_channel_;
// If you add a new member, you need to update Copy(). // If you add a new member, you need to update Copy().
}; };
......
...@@ -258,6 +258,7 @@ TEST(DisplayStructTraitsTest, DisplaySnapshotCurrentAndNativeModesNull) { ...@@ -258,6 +258,7 @@ TEST(DisplayStructTraitsTest, DisplaySnapshotCurrentAndNativeModesNull) {
const bool has_color_correction_matrix = true; const bool has_color_correction_matrix = true;
const bool color_correction_in_linear_space = true; const bool color_correction_in_linear_space = true;
const gfx::ColorSpace display_color_space = gfx::ColorSpace::CreateREC709(); const gfx::ColorSpace display_color_space = gfx::ColorSpace::CreateREC709();
const int32_t bits_per_channel = 8;
const std::string display_name("whatever display_name"); const std::string display_name("whatever display_name");
const base::FilePath sys_path = base::FilePath::FromUTF8Unsafe("a/cb"); const base::FilePath sys_path = base::FilePath::FromUTF8Unsafe("a/cb");
const int64_t product_code = 19; const int64_t product_code = 19;
...@@ -275,8 +276,8 @@ TEST(DisplayStructTraitsTest, DisplaySnapshotCurrentAndNativeModesNull) { ...@@ -275,8 +276,8 @@ TEST(DisplayStructTraitsTest, DisplaySnapshotCurrentAndNativeModesNull) {
std::unique_ptr<DisplaySnapshot> input = std::make_unique<DisplaySnapshot>( std::unique_ptr<DisplaySnapshot> input = std::make_unique<DisplaySnapshot>(
display_id, origin, physical_size, type, is_aspect_preserving_scaling, display_id, origin, physical_size, type, is_aspect_preserving_scaling,
has_overscan, has_color_correction_matrix, has_overscan, has_color_correction_matrix,
color_correction_in_linear_space, display_color_space, display_name, color_correction_in_linear_space, display_color_space, bits_per_channel,
sys_path, std::move(modes), display::PanelOrientation::kNormal, edid, display_name, sys_path, std::move(modes), PanelOrientation::kNormal, edid,
current_mode, native_mode, product_code, year_of_manufacture, current_mode, native_mode, product_code, year_of_manufacture,
maximum_cursor_size); maximum_cursor_size);
...@@ -299,6 +300,7 @@ TEST(DisplayStructTraitsTest, DisplaySnapshotCurrentModeNull) { ...@@ -299,6 +300,7 @@ TEST(DisplayStructTraitsTest, DisplaySnapshotCurrentModeNull) {
const bool has_color_correction_matrix = true; const bool has_color_correction_matrix = true;
const bool color_correction_in_linear_space = true; const bool color_correction_in_linear_space = true;
const gfx::ColorSpace display_color_space = gfx::ColorSpace::CreateREC709(); const gfx::ColorSpace display_color_space = gfx::ColorSpace::CreateREC709();
const uint32_t bits_per_channel = 8u;
const std::string display_name("whatever display_name"); const std::string display_name("whatever display_name");
const base::FilePath sys_path = base::FilePath::FromUTF8Unsafe("z/b"); const base::FilePath sys_path = base::FilePath::FromUTF8Unsafe("z/b");
const int64_t product_code = 9; const int64_t product_code = 9;
...@@ -316,8 +318,8 @@ TEST(DisplayStructTraitsTest, DisplaySnapshotCurrentModeNull) { ...@@ -316,8 +318,8 @@ TEST(DisplayStructTraitsTest, DisplaySnapshotCurrentModeNull) {
std::unique_ptr<DisplaySnapshot> input = std::make_unique<DisplaySnapshot>( std::unique_ptr<DisplaySnapshot> input = std::make_unique<DisplaySnapshot>(
display_id, origin, physical_size, type, is_aspect_preserving_scaling, display_id, origin, physical_size, type, is_aspect_preserving_scaling,
has_overscan, has_color_correction_matrix, has_overscan, has_color_correction_matrix,
color_correction_in_linear_space, display_color_space, display_name, color_correction_in_linear_space, display_color_space, bits_per_channel,
sys_path, std::move(modes), display::PanelOrientation::kNormal, edid, display_name, sys_path, std::move(modes), PanelOrientation::kNormal, edid,
current_mode, native_mode, product_code, year_of_manufacture, current_mode, native_mode, product_code, year_of_manufacture,
maximum_cursor_size); maximum_cursor_size);
...@@ -341,6 +343,7 @@ TEST(DisplayStructTraitsTest, DisplaySnapshotExternal) { ...@@ -341,6 +343,7 @@ TEST(DisplayStructTraitsTest, DisplaySnapshotExternal) {
const bool color_correction_in_linear_space = false; const bool color_correction_in_linear_space = false;
const std::string display_name("HP Z24i"); const std::string display_name("HP Z24i");
const gfx::ColorSpace display_color_space = gfx::ColorSpace::CreateSRGB(); const gfx::ColorSpace display_color_space = gfx::ColorSpace::CreateSRGB();
const uint32_t bits_per_channel = 8u;
const base::FilePath sys_path = base::FilePath::FromUTF8Unsafe("a/cb"); const base::FilePath sys_path = base::FilePath::FromUTF8Unsafe("a/cb");
const int64_t product_code = 139; const int64_t product_code = 139;
const int32_t year_of_manufacture = 2018; const int32_t year_of_manufacture = 2018;
...@@ -361,8 +364,8 @@ TEST(DisplayStructTraitsTest, DisplaySnapshotExternal) { ...@@ -361,8 +364,8 @@ TEST(DisplayStructTraitsTest, DisplaySnapshotExternal) {
std::unique_ptr<DisplaySnapshot> input = std::make_unique<DisplaySnapshot>( std::unique_ptr<DisplaySnapshot> input = std::make_unique<DisplaySnapshot>(
display_id, origin, physical_size, type, is_aspect_preserving_scaling, display_id, origin, physical_size, type, is_aspect_preserving_scaling,
has_overscan, has_color_correction_matrix, has_overscan, has_color_correction_matrix,
color_correction_in_linear_space, display_color_space, display_name, color_correction_in_linear_space, display_color_space, bits_per_channel,
sys_path, std::move(modes), display::PanelOrientation::kLeftUp, edid, display_name, sys_path, std::move(modes), PanelOrientation::kLeftUp, edid,
current_mode, native_mode, product_code, year_of_manufacture, current_mode, native_mode, product_code, year_of_manufacture,
maximum_cursor_size); maximum_cursor_size);
...@@ -385,6 +388,7 @@ TEST(DisplayStructTraitsTest, DisplaySnapshotInternal) { ...@@ -385,6 +388,7 @@ TEST(DisplayStructTraitsTest, DisplaySnapshotInternal) {
const bool color_correction_in_linear_space = false; const bool color_correction_in_linear_space = false;
const gfx::ColorSpace display_color_space = const gfx::ColorSpace display_color_space =
gfx::ColorSpace::CreateDisplayP3D65(); gfx::ColorSpace::CreateDisplayP3D65();
const uint32_t bits_per_channel = 9u;
const std::string display_name(""); const std::string display_name("");
const base::FilePath sys_path; const base::FilePath sys_path;
const int64_t product_code = 139; const int64_t product_code = 139;
...@@ -402,9 +406,9 @@ TEST(DisplayStructTraitsTest, DisplaySnapshotInternal) { ...@@ -402,9 +406,9 @@ TEST(DisplayStructTraitsTest, DisplaySnapshotInternal) {
std::unique_ptr<DisplaySnapshot> input = std::make_unique<DisplaySnapshot>( std::unique_ptr<DisplaySnapshot> input = std::make_unique<DisplaySnapshot>(
display_id, origin, physical_size, type, is_aspect_preserving_scaling, display_id, origin, physical_size, type, is_aspect_preserving_scaling,
has_overscan, has_color_correction_matrix, has_overscan, has_color_correction_matrix,
color_correction_in_linear_space, display_color_space, display_name, color_correction_in_linear_space, display_color_space, bits_per_channel,
sys_path, std::move(modes), display::PanelOrientation::kRightUp, edid, display_name, sys_path, std::move(modes), PanelOrientation::kRightUp,
current_mode, native_mode, product_code, year_of_manufacture, edid, current_mode, native_mode, product_code, year_of_manufacture,
maximum_cursor_size); maximum_cursor_size);
std::unique_ptr<DisplaySnapshot> output; std::unique_ptr<DisplaySnapshot> output;
......
...@@ -21,6 +21,7 @@ struct DisplaySnapshot { ...@@ -21,6 +21,7 @@ struct DisplaySnapshot {
bool has_color_correction_matrix; bool has_color_correction_matrix;
bool color_correction_in_linear_space; bool color_correction_in_linear_space;
gfx.mojom.ColorSpace color_space; gfx.mojom.ColorSpace color_space;
uint32 bits_per_channel;
string display_name; string display_name;
mojo_base.mojom.FilePath sys_path; mojo_base.mojom.FilePath sys_path;
array<display.mojom.DisplayMode> modes; array<display.mojom.DisplayMode> modes;
......
...@@ -137,10 +137,10 @@ bool StructTraits<display::mojom::DisplaySnapshotDataView, ...@@ -137,10 +137,10 @@ bool StructTraits<display::mojom::DisplaySnapshotDataView,
data.display_id(), origin, physical_size, type, data.display_id(), origin, physical_size, type,
data.is_aspect_preserving_scaling(), data.has_overscan(), data.is_aspect_preserving_scaling(), data.has_overscan(),
data.has_color_correction_matrix(), data.has_color_correction_matrix(),
data.color_correction_in_linear_space(), color_space, display_name, data.color_correction_in_linear_space(), color_space,
file_path, std::move(modes), panel_orientation, std::move(edid), data.bits_per_channel(), display_name, file_path, std::move(modes),
current_mode, native_mode, data.product_code(), panel_orientation, std::move(edid), current_mode, native_mode,
data.year_of_manufacture(), maximum_cursor_size); data.product_code(), data.year_of_manufacture(), maximum_cursor_size);
return true; return true;
} }
......
...@@ -69,6 +69,11 @@ struct StructTraits<display::mojom::DisplaySnapshotDataView, ...@@ -69,6 +69,11 @@ struct StructTraits<display::mojom::DisplaySnapshotDataView,
return snapshot->color_space(); return snapshot->color_space();
} }
static uint32_t bits_per_channel(
const std::unique_ptr<display::DisplaySnapshot>& snapshot) {
return snapshot->bits_per_channel();
}
static std::string display_name( static std::string display_name(
const std::unique_ptr<display::DisplaySnapshot>& snapshot) { const std::unique_ptr<display::DisplaySnapshot>& snapshot) {
return snapshot->display_name(); return snapshot->display_name();
......
...@@ -69,6 +69,7 @@ DisplaySnapshot::DisplaySnapshot(int64_t display_id, ...@@ -69,6 +69,7 @@ DisplaySnapshot::DisplaySnapshot(int64_t display_id,
bool has_color_correction_matrix, bool has_color_correction_matrix,
bool color_correction_in_linear_space, bool color_correction_in_linear_space,
const gfx::ColorSpace& color_space, const gfx::ColorSpace& color_space,
uint32_t bits_per_channel,
std::string display_name, std::string display_name,
const base::FilePath& sys_path, const base::FilePath& sys_path,
DisplayModeList modes, DisplayModeList modes,
...@@ -88,6 +89,7 @@ DisplaySnapshot::DisplaySnapshot(int64_t display_id, ...@@ -88,6 +89,7 @@ DisplaySnapshot::DisplaySnapshot(int64_t display_id,
has_color_correction_matrix_(has_color_correction_matrix), has_color_correction_matrix_(has_color_correction_matrix),
color_correction_in_linear_space_(color_correction_in_linear_space), color_correction_in_linear_space_(color_correction_in_linear_space),
color_space_(color_space), color_space_(color_space),
bits_per_channel_(bits_per_channel),
display_name_(display_name), display_name_(display_name),
sys_path_(sys_path), sys_path_(sys_path),
modes_(std::move(modes)), modes_(std::move(modes)),
...@@ -127,9 +129,10 @@ std::unique_ptr<DisplaySnapshot> DisplaySnapshot::Clone() { ...@@ -127,9 +129,10 @@ std::unique_ptr<DisplaySnapshot> DisplaySnapshot::Clone() {
display_id_, origin_, physical_size_, type_, display_id_, origin_, physical_size_, type_,
is_aspect_preserving_scaling_, has_overscan_, is_aspect_preserving_scaling_, has_overscan_,
has_color_correction_matrix_, color_correction_in_linear_space_, has_color_correction_matrix_, color_correction_in_linear_space_,
color_space_, display_name_, sys_path_, std::move(clone_modes), color_space_, bits_per_channel_, display_name_, sys_path_,
panel_orientation_, edid_, cloned_current_mode, cloned_native_mode, std::move(clone_modes), panel_orientation_, edid_, cloned_current_mode,
product_code_, year_of_manufacture_, maximum_cursor_size_); cloned_native_mode, product_code_, year_of_manufacture_,
maximum_cursor_size_);
} }
std::string DisplaySnapshot::ToString() const { std::string DisplaySnapshot::ToString() const {
......
...@@ -38,6 +38,7 @@ class DISPLAY_TYPES_EXPORT DisplaySnapshot { ...@@ -38,6 +38,7 @@ class DISPLAY_TYPES_EXPORT DisplaySnapshot {
bool has_color_correction_matrix, bool has_color_correction_matrix,
bool color_correction_in_linear_space, bool color_correction_in_linear_space,
const gfx::ColorSpace& color_space, const gfx::ColorSpace& color_space,
uint32_t bits_per_channel,
std::string display_name, std::string display_name,
const base::FilePath& sys_path, const base::FilePath& sys_path,
DisplayModeList modes, DisplayModeList modes,
...@@ -67,6 +68,7 @@ class DISPLAY_TYPES_EXPORT DisplaySnapshot { ...@@ -67,6 +68,7 @@ class DISPLAY_TYPES_EXPORT DisplaySnapshot {
} }
const gfx::ColorSpace& color_space() const { return color_space_; } const gfx::ColorSpace& color_space() const { return color_space_; }
void reset_color_space() { color_space_ = gfx::ColorSpace(); } void reset_color_space() { color_space_ = gfx::ColorSpace(); }
uint32_t bits_per_channel() const { return bits_per_channel_; }
const std::string& display_name() const { return display_name_; } const std::string& display_name() const { return display_name_; }
const base::FilePath& sys_path() const { return sys_path_; } const base::FilePath& sys_path() const { return sys_path_; }
const DisplayModeList& modes() const { return modes_; } const DisplayModeList& modes() const { return modes_; }
...@@ -116,6 +118,8 @@ class DISPLAY_TYPES_EXPORT DisplaySnapshot { ...@@ -116,6 +118,8 @@ class DISPLAY_TYPES_EXPORT DisplaySnapshot {
gfx::ColorSpace color_space_; gfx::ColorSpace color_space_;
uint32_t bits_per_channel_;
const std::string display_name_; const std::string display_name_;
const base::FilePath sys_path_; const base::FilePath sys_path_;
......
...@@ -46,6 +46,7 @@ struct DisplaySnapshot_Params { ...@@ -46,6 +46,7 @@ struct DisplaySnapshot_Params {
bool has_color_correction_matrix = false; bool has_color_correction_matrix = false;
bool color_correction_in_linear_space = false; bool color_correction_in_linear_space = false;
gfx::ColorSpace color_space; gfx::ColorSpace color_space;
uint32_t bits_per_channel = 0;
std::string display_name; std::string display_name;
base::FilePath sys_path; base::FilePath sys_path;
std::vector<DisplayMode_Params> modes; std::vector<DisplayMode_Params> modes;
......
...@@ -59,6 +59,7 @@ IPC_STRUCT_TRAITS_BEGIN(ui::DisplaySnapshot_Params) ...@@ -59,6 +59,7 @@ IPC_STRUCT_TRAITS_BEGIN(ui::DisplaySnapshot_Params)
IPC_STRUCT_TRAITS_MEMBER(has_color_correction_matrix) IPC_STRUCT_TRAITS_MEMBER(has_color_correction_matrix)
IPC_STRUCT_TRAITS_MEMBER(color_correction_in_linear_space) IPC_STRUCT_TRAITS_MEMBER(color_correction_in_linear_space)
IPC_STRUCT_TRAITS_MEMBER(color_space) IPC_STRUCT_TRAITS_MEMBER(color_space)
IPC_STRUCT_TRAITS_MEMBER(bits_per_channel)
IPC_STRUCT_TRAITS_MEMBER(display_name) IPC_STRUCT_TRAITS_MEMBER(display_name)
IPC_STRUCT_TRAITS_MEMBER(sys_path) IPC_STRUCT_TRAITS_MEMBER(sys_path)
IPC_STRUCT_TRAITS_MEMBER(modes) IPC_STRUCT_TRAITS_MEMBER(modes)
......
...@@ -455,6 +455,7 @@ std::unique_ptr<display::DisplaySnapshot> CreateDisplaySnapshot( ...@@ -455,6 +455,7 @@ std::unique_ptr<display::DisplaySnapshot> CreateDisplaySnapshot(
int32_t year_of_manufacture = display::kInvalidYearOfManufacture; int32_t year_of_manufacture = display::kInvalidYearOfManufacture;
bool has_overscan = false; bool has_overscan = false;
gfx::ColorSpace display_color_space; gfx::ColorSpace display_color_space;
uint32_t bits_per_channel = 8u;
// Active pixels size from the first detailed timing descriptor in the EDID. // Active pixels size from the first detailed timing descriptor in the EDID.
gfx::Size active_pixel_size; gfx::Size active_pixel_size;
...@@ -476,6 +477,7 @@ std::unique_ptr<display::DisplaySnapshot> CreateDisplaySnapshot( ...@@ -476,6 +477,7 @@ std::unique_ptr<display::DisplaySnapshot> CreateDisplaySnapshot(
has_overscan = has_overscan =
edid_parser.has_overscan_flag() && edid_parser.overscan_flag(); edid_parser.has_overscan_flag() && edid_parser.overscan_flag();
display_color_space = GetColorSpaceFromEdid(edid_parser); display_color_space = GetColorSpaceFromEdid(edid_parser);
bits_per_channel = std::max(edid_parser.bits_per_channel(), 0);
} else { } else {
VLOG(1) << "Failed to get EDID blob for connector " VLOG(1) << "Failed to get EDID blob for connector "
<< info->connector()->connector_id; << info->connector()->connector_id;
...@@ -489,9 +491,10 @@ std::unique_ptr<display::DisplaySnapshot> CreateDisplaySnapshot( ...@@ -489,9 +491,10 @@ std::unique_ptr<display::DisplaySnapshot> CreateDisplaySnapshot(
return std::make_unique<display::DisplaySnapshot>( return std::make_unique<display::DisplaySnapshot>(
display_id, origin, physical_size, type, is_aspect_preserving_scaling, display_id, origin, physical_size, type, is_aspect_preserving_scaling,
has_overscan, has_color_correction_matrix, has_overscan, has_color_correction_matrix,
color_correction_in_linear_space, display_color_space, display_name, color_correction_in_linear_space, display_color_space, bits_per_channel,
sys_path, std::move(modes), panel_orientation, edid, current_mode, display_name, sys_path, std::move(modes), panel_orientation, edid,
native_mode, product_code, year_of_manufacture, maximum_cursor_size); current_mode, native_mode, product_code, year_of_manufacture,
maximum_cursor_size);
} }
// TODO(rjkroege): Remove in a subsequent CL once Mojo IPC is used everywhere. // TODO(rjkroege): Remove in a subsequent CL once Mojo IPC is used everywhere.
...@@ -510,6 +513,7 @@ std::vector<DisplaySnapshot_Params> CreateDisplaySnapshotParams( ...@@ -510,6 +513,7 @@ std::vector<DisplaySnapshot_Params> CreateDisplaySnapshotParams(
p.has_color_correction_matrix = d->has_color_correction_matrix(); p.has_color_correction_matrix = d->has_color_correction_matrix();
p.color_correction_in_linear_space = d->color_correction_in_linear_space(); p.color_correction_in_linear_space = d->color_correction_in_linear_space();
p.color_space = d->color_space(); p.color_space = d->color_space();
p.bits_per_channel = d->bits_per_channel();
p.display_name = d->display_name(); p.display_name = d->display_name();
p.sys_path = d->sys_path(); p.sys_path = d->sys_path();
...@@ -556,9 +560,9 @@ std::unique_ptr<display::DisplaySnapshot> CreateDisplaySnapshot( ...@@ -556,9 +560,9 @@ std::unique_ptr<display::DisplaySnapshot> CreateDisplaySnapshot(
params.is_aspect_preserving_scaling, params.has_overscan, params.is_aspect_preserving_scaling, params.has_overscan,
params.has_color_correction_matrix, params.has_color_correction_matrix,
params.color_correction_in_linear_space, params.color_space, params.color_correction_in_linear_space, params.color_space,
params.display_name, params.sys_path, std::move(modes), params.bits_per_channel, params.display_name, params.sys_path,
params.panel_orientation, params.edid, current_mode, native_mode, std::move(modes), params.panel_orientation, params.edid, current_mode,
params.product_code, params.year_of_manufacture, native_mode, params.product_code, params.year_of_manufacture,
params.maximum_cursor_size); params.maximum_cursor_size);
} }
......
...@@ -155,6 +155,7 @@ void DetailedCompare(const ui::DisplaySnapshot_Params& a, ...@@ -155,6 +155,7 @@ void DetailedCompare(const ui::DisplaySnapshot_Params& a,
EXPECT_EQ(a.has_overscan, b.has_overscan); EXPECT_EQ(a.has_overscan, b.has_overscan);
EXPECT_EQ(a.has_color_correction_matrix, b.has_color_correction_matrix); EXPECT_EQ(a.has_color_correction_matrix, b.has_color_correction_matrix);
EXPECT_EQ(a.color_space, b.color_space); EXPECT_EQ(a.color_space, b.color_space);
EXPECT_EQ(a.bits_per_channel, b.bits_per_channel);
EXPECT_EQ(a.display_name, b.display_name); EXPECT_EQ(a.display_name, b.display_name);
EXPECT_EQ(a.sys_path, b.sys_path); EXPECT_EQ(a.sys_path, b.sys_path);
EXPECT_EQ(a.modes, b.modes); EXPECT_EQ(a.modes, b.modes);
...@@ -196,6 +197,7 @@ TEST_F(DrmUtilTest, RoundTripDisplaySnapshot) { ...@@ -196,6 +197,7 @@ TEST_F(DrmUtilTest, RoundTripDisplaySnapshot) {
fp.has_overscan = true; fp.has_overscan = true;
fp.has_color_correction_matrix = true; fp.has_color_correction_matrix = true;
fp.color_space = gfx::ColorSpace::CreateREC709(); fp.color_space = gfx::ColorSpace::CreateREC709();
fp.bits_per_channel = 8u;
fp.display_name = "bending glass"; fp.display_name = "bending glass";
fp.sys_path = base::FilePath("/bending"); fp.sys_path = base::FilePath("/bending");
fp.modes = fp.modes =
...@@ -217,6 +219,7 @@ TEST_F(DrmUtilTest, RoundTripDisplaySnapshot) { ...@@ -217,6 +219,7 @@ TEST_F(DrmUtilTest, RoundTripDisplaySnapshot) {
sp.has_overscan = true; sp.has_overscan = true;
sp.has_color_correction_matrix = true; sp.has_color_correction_matrix = true;
sp.color_space = gfx::ColorSpace::CreateExtendedSRGB(); sp.color_space = gfx::ColorSpace::CreateExtendedSRGB();
sp.bits_per_channel = 8u;
sp.display_name = "rigid glass"; sp.display_name = "rigid glass";
sp.sys_path = base::FilePath("/bending"); sp.sys_path = base::FilePath("/bending");
sp.modes = sp.modes =
...@@ -237,6 +240,7 @@ TEST_F(DrmUtilTest, RoundTripDisplaySnapshot) { ...@@ -237,6 +240,7 @@ TEST_F(DrmUtilTest, RoundTripDisplaySnapshot) {
ep.has_overscan = false; ep.has_overscan = false;
ep.has_color_correction_matrix = false; ep.has_color_correction_matrix = false;
ep.color_space = gfx::ColorSpace::CreateDisplayP3D65(); ep.color_space = gfx::ColorSpace::CreateDisplayP3D65();
sp.bits_per_channel = 9u;
ep.display_name = "fluted glass"; ep.display_name = "fluted glass";
ep.sys_path = base::FilePath("/bending"); ep.sys_path = base::FilePath("/bending");
ep.modes = std::vector<DisplayMode_Params>( ep.modes = std::vector<DisplayMode_Params>(
......
...@@ -40,8 +40,8 @@ void HeadlessNativeDisplayDelegate::Initialize() { ...@@ -40,8 +40,8 @@ void HeadlessNativeDisplayDelegate::Initialize() {
current_snapshot_ = std::make_unique<display::DisplaySnapshot>( current_snapshot_ = std::make_unique<display::DisplaySnapshot>(
next_display_id(), gfx::Point(0, 0), kDefaultWindowSize, next_display_id(), gfx::Point(0, 0), kDefaultWindowSize,
display::DisplayConnectionType::DISPLAY_CONNECTION_TYPE_NONE, false, display::DisplayConnectionType::DISPLAY_CONNECTION_TYPE_NONE, false,
false, false, false, gfx::ColorSpace(), "", base::FilePath(), false, false, false, gfx::ColorSpace(), 8u /* bits_per_channel*/, "",
std::move(modes), display::PanelOrientation::kNormal, base::FilePath(), std::move(modes), display::PanelOrientation::kNormal,
std::vector<uint8_t>(), mode, mode, 0, 0, gfx::Size()); std::vector<uint8_t>(), mode, mode, 0, 0, gfx::Size());
for (display::NativeDisplayObserver& observer : observers_) for (display::NativeDisplayObserver& observer : observers_)
......
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