Commit 9b90891e authored by Miguel Casas's avatar Miguel Casas Committed by Commit Bot

wire EDID data to DisplayUnitInfo Chrome api

This CL wires 3 display/monitor fields from EDID parsing
to the Chrome private API where they surface, as described
in the DD [1], namely:
1- manufacturer id
2- product id
3- year of manufacture.

(Note that ToT Ozone DRM already parses this list's 1 and 2;
this CL adds code to parse 3). A diagram of the touched areas
is in the DD [1] extracted for quick access in:
  https://i.imgur.com/yx8H0R3.jpg (also [2]).
but in a nutshell: Ozone DRM creates a DisplaySnapshot from
the EDID, and passes it to Browser Process via Mojo and/or IPC
(being migrated); in Browser DisplayChangeObserver transforms that
snapshot into a ManagedDisplayInfo, and in turn passes it to the
DisplayManager that creates a Display that is used later on upon
request by DisplayInfoProviderChromeOS to fill in the JS data struct.

There's a bit of confusion on ToT between product_id and
product_code, so this CL follows the spec and aligns them all,
i.e. EDID parser produces a |product_code|, which is a pack of
the manufacturer id and product id.

Unittests extended, tested on soraka+simplechrome.

[1] go/js-edid-chromeos
[2] https://imgur.com/a/aqNDD

Bug: 821393
Change-Id: Ia219b4eeb92cf3eae3e58046340f1b81c34c9ea2
Reviewed-on: https://chromium-review.googlesource.com/959547
Commit-Queue: Miguel Casas <mcasas@chromium.org>
Reviewed-by: default avatarIstiaque Ahmed <lazyboy@chromium.org>
Reviewed-by: default avatarAhmed Fakhry <afakhry@chromium.org>
Reviewed-by: default avatarMitsuru Oshima <oshima@chromium.org>
Reviewed-by: default avatarDaniele Castagna <dcastagna@chromium.org>
Reviewed-by: default avatarDaniel Nicoara <dnicoara@chromium.org>
Reviewed-by: default avatarRobert Sesek <rsesek@chromium.org>
Cr-Commit-Position: refs/heads/master@{#543512}
parent b27ebb71
...@@ -186,14 +186,16 @@ void DisplayColorManager::OnDisplayModeChanged( ...@@ -186,14 +186,16 @@ void DisplayColorManager::OnDisplayModeChanged(
UMA_HISTOGRAM_BOOLEAN("Ash.DisplayColorManager.HasColorCorrectionMatrix", UMA_HISTOGRAM_BOOLEAN("Ash.DisplayColorManager.HasColorCorrectionMatrix",
state->has_color_correction_matrix()); state->has_color_correction_matrix());
if (calibration_map_[state->product_id()]) { if (calibration_map_[state->product_code()]) {
ApplyDisplayColorCalibration(state->display_id(), state->product_id()); ApplyDisplayColorCalibration(state->display_id(), state->product_code());
} else { } else {
const bool valid_product_id = const bool valid_product_code =
state->product_id() != display::DisplaySnapshot::kInvalidProductID; state->product_code() !=
display::DisplaySnapshot::kInvalidProductCode;
// TODO(mcasas): correct UMA s/Id/Code/, https://crbug.com/821393.
UMA_HISTOGRAM_BOOLEAN("Ash.DisplayColorManager.ValidProductId", UMA_HISTOGRAM_BOOLEAN("Ash.DisplayColorManager.ValidProductId",
valid_product_id); valid_product_code);
if (valid_product_id) if (valid_product_code)
LoadCalibrationForDisplay(state); LoadCalibrationForDisplay(state);
} }
} }
...@@ -225,11 +227,11 @@ void DisplayColorManager::LoadCalibrationForDisplay( ...@@ -225,11 +227,11 @@ void DisplayColorManager::LoadCalibrationForDisplay(
return; return;
quirks::QuirksManager::Get()->RequestIccProfilePath( quirks::QuirksManager::Get()->RequestIccProfilePath(
display->product_id(), display->display_name(), display->product_code(), display->display_name(),
base::Bind(&DisplayColorManager::FinishLoadCalibrationForDisplay, base::Bind(&DisplayColorManager::FinishLoadCalibrationForDisplay,
weak_ptr_factory_.GetWeakPtr(), display->display_id(), weak_ptr_factory_.GetWeakPtr(), display->display_id(),
display->product_id(), display->has_color_correction_matrix(), display->product_code(),
display->type())); display->has_color_correction_matrix(), display->type()));
} }
void DisplayColorManager::FinishLoadCalibrationForDisplay( void DisplayColorManager::FinishLoadCalibrationForDisplay(
......
...@@ -35,6 +35,7 @@ std::unique_ptr<display::DisplaySnapshot> CreateTestDisplaySnapshot( ...@@ -35,6 +35,7 @@ std::unique_ptr<display::DisplaySnapshot> CreateTestDisplaySnapshot(
display::DisplaySnapshot::DisplayModeList() /* modes */, display::DisplaySnapshot::DisplayModeList() /* modes */,
std::vector<uint8_t>() /* edid */, nullptr /* current_mode */, std::vector<uint8_t>() /* edid */, nullptr /* current_mode */,
nullptr /* native_mode */, 0 /* product_id */, nullptr /* native_mode */, 0 /* product_id */,
display::kInvalidYearOfManufacture,
gfx::Size() /* maximum_cursor_size */); gfx::Size() /* maximum_cursor_size */);
} }
......
...@@ -782,6 +782,23 @@ void DisplayInfoProviderChromeOS::UpdateDisplayUnitInfoForPlatform( ...@@ -782,6 +782,23 @@ void DisplayInfoProviderChromeOS::UpdateDisplayUnitInfoForPlatform(
} }
} }
const display::ManagedDisplayInfo& display_info =
display_manager->GetDisplayInfo(display.id());
if (!display_info.manufacturer_id().empty() ||
!display_info.product_id().empty() ||
(display_info.year_of_manufacture() !=
display::kInvalidYearOfManufacture)) {
unit->edid = std::make_unique<system_display::Edid>();
if (!display_info.manufacturer_id().empty())
unit->edid->manufacturer_id = display_info.manufacturer_id();
if (!display_info.product_id().empty())
unit->edid->product_id = display_info.product_id();
if (display_info.year_of_manufacture() !=
display::kInvalidYearOfManufacture) {
unit->edid->year_of_manufacture = display_info.year_of_manufacture();
}
}
unit->display_zoom_factor = unit->display_zoom_factor =
display_manager->GetZoomFactorForDisplay(display.id()); display_manager->GetZoomFactorForDisplay(display.id());
display::ManagedDisplayMode active_mode; display::ManagedDisplayMode active_mode;
...@@ -793,8 +810,6 @@ void DisplayInfoProviderChromeOS::UpdateDisplayUnitInfoForPlatform( ...@@ -793,8 +810,6 @@ void DisplayInfoProviderChromeOS::UpdateDisplayUnitInfoForPlatform(
display_manager->GetZoomFactorForDisplay(display.id())); display_manager->GetZoomFactorForDisplay(display.id()));
} }
const display::ManagedDisplayInfo& display_info =
display_manager->GetDisplayInfo(display.id());
const float device_dpi = display_info.device_dpi(); const float device_dpi = display_info.device_dpi();
unit->dpi_x = device_dpi * display.size().width() / unit->dpi_x = device_dpi * display.size().width() /
display_info.bounds_in_native().width(); display_info.bounds_in_native().width();
......
...@@ -1948,5 +1948,28 @@ TEST_F(DisplayInfoProviderChromeosTest, SetMIXEDMode) { ...@@ -1948,5 +1948,28 @@ TEST_F(DisplayInfoProviderChromeosTest, SetMIXEDMode) {
} }
} }
TEST_F(DisplayInfoProviderChromeosTest, GetEdid) {
UpdateDisplay("500x600, 400x200");
const char* kManufacturerId = "GOO";
const char* kProductId = "GL";
constexpr int32_t kYearOfManufacture = 2018;
display::ManagedDisplayInfo info(
GetDisplayManager()->active_display_list()[0].id(), "",
false /* has_overscan */);
info.SetBounds(gfx::Rect(0, 0, 500, 600));
info.set_manufacturer_id(kManufacturerId);
info.set_product_id(kProductId);
info.set_year_of_manufacture(kYearOfManufacture);
GetDisplayManager()->OnNativeDisplaysChanged({info});
DisplayUnitInfoList result = GetAllDisplaysInfo();
ASSERT_EQ(1u, result.size());
ASSERT_TRUE(result[0].edid);
EXPECT_EQ(kManufacturerId, result[0].edid->manufacturer_id);
EXPECT_EQ(kProductId, result[0].edid->product_id);
EXPECT_EQ(kYearOfManufacture, result[0].edid->year_of_manufacture);
}
} // namespace } // namespace
} // namespace extensions } // namespace extensions
...@@ -111,6 +111,21 @@ namespace system.display { ...@@ -111,6 +111,21 @@ namespace system.display {
long offset; long offset;
}; };
// EDID extracted parameters. Field description refers to "VESA ENHANCED
// EXTENDED DISPLAY IDENTIFICATION DATA STANDARD (Defines EDID Structure
// Version 1, Revision 4)" Release A, Revision 2 September 25, 2006.
// https://www.vesa.org/vesa-standards
dictionary Edid {
// 3 character manufacturer code. See Sec. 3.4.1 page 21. Required in v1.4.
DOMString manufacturerId;
// 2 byte manufacturer-assigned code, Sec. 3.4.2 page 21. Required in v1.4.
DOMString productId;
// Year of manufacturer, Sec. 3.4.4 page 22. Required in v1.4.
long yearOfManufacture;
};
dictionary DisplayUnitInfo { dictionary DisplayUnitInfo {
// The unique identifier of the display. // The unique identifier of the display.
DOMString id; DOMString id;
...@@ -118,6 +133,9 @@ namespace system.display { ...@@ -118,6 +133,9 @@ namespace system.display {
// The user-friendly name (e.g. "HP LCD monitor"). // The user-friendly name (e.g. "HP LCD monitor").
DOMString name; DOMString name;
// NOTE: This is only available to Chrome OS Kiosk apps and Web UI.
Edid? edid;
// Chrome OS only. Identifier of the display that is being mirrored if // Chrome OS only. Identifier of the display that is being mirrored if
// mirroring is enabled, otherwise empty. This will be set for all displays // mirroring is enabled, otherwise empty. This will be set for all displays
// (including the display being mirrored). // (including the display being mirrored).
......
...@@ -268,7 +268,7 @@ gfx::Size Display::GetSizeInPixel() const { ...@@ -268,7 +268,7 @@ gfx::Size Display::GetSizeInPixel() const {
std::string Display::ToString() const { std::string Display::ToString() const {
return base::StringPrintf( return base::StringPrintf(
"Display[%lld] bounds=%s, workarea=%s, scale=%g, %s", "Display[%lld] bounds=[%s], workarea=[%s], scale=%g, %s.",
static_cast<long long int>(id_), bounds_.ToString().c_str(), static_cast<long long int>(id_), bounds_.ToString().c_str(),
work_area_.ToString().c_str(), device_scale_factor_, work_area_.ToString().c_str(), device_scale_factor_,
IsInternal() ? "internal" : "external"); IsInternal() ? "internal" : "external");
......
...@@ -220,9 +220,7 @@ class DISPLAY_EXPORT Display final { ...@@ -220,9 +220,7 @@ class DISPLAY_EXPORT Display final {
// True if this is a monochrome display (e.g, for accessiblity). Used by media // True if this is a monochrome display (e.g, for accessiblity). Used by media
// query APIs. // query APIs.
bool is_monochrome() const { return is_monochrome_; } bool is_monochrome() const { return is_monochrome_; }
void set_is_monochrome(bool is_monochrome) { void set_is_monochrome(bool is_monochrome) { is_monochrome_ = is_monochrome; }
is_monochrome_ = is_monochrome;
}
bool operator==(const Display& rhs) const; bool operator==(const Display& rhs) const;
bool operator!=(const Display& rhs) const { return !(*this == rhs); } bool operator!=(const Display& rhs) const { return !(*this == rhs); }
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include "ui/display/types/display_mode.h" #include "ui/display/types/display_mode.h"
#include "ui/display/types/display_snapshot.h" #include "ui/display/types/display_snapshot.h"
#include "ui/display/util/display_util.h" #include "ui/display/util/display_util.h"
#include "ui/display/util/edid_parser.h"
#include "ui/events/devices/input_device_manager.h" #include "ui/events/devices/input_device_manager.h"
#include "ui/events/devices/touchscreen_device.h" #include "ui/events/devices/touchscreen_device.h"
#include "ui/strings/grit/ui_strings.h" #include "ui/strings/grit/ui_strings.h"
...@@ -265,21 +266,21 @@ void DisplayChangeObserver::UpdateInternalDisplay( ...@@ -265,21 +266,21 @@ void DisplayChangeObserver::UpdateInternalDisplay(
} }
ManagedDisplayInfo DisplayChangeObserver::CreateManagedDisplayInfo( ManagedDisplayInfo DisplayChangeObserver::CreateManagedDisplayInfo(
const DisplaySnapshot* state, const DisplaySnapshot* snapshot,
const DisplayMode* mode_info) { const DisplayMode* mode_info) {
float device_scale_factor = 1.0f; float device_scale_factor = 1.0f;
// Sets dpi only if the screen size is not blacklisted. // Sets dpi only if the screen size is not blacklisted.
float dpi = IsDisplaySizeBlackListed(state->physical_size()) float dpi = IsDisplaySizeBlackListed(snapshot->physical_size())
? 0 ? 0
: kInchInMm * mode_info->size().width() / : kInchInMm * mode_info->size().width() /
state->physical_size().width(); snapshot->physical_size().width();
if (state->type() == DISPLAY_CONNECTION_TYPE_INTERNAL) { if (snapshot->type() == DISPLAY_CONNECTION_TYPE_INTERNAL) {
if (dpi) if (dpi)
device_scale_factor = FindDeviceScaleFactor(dpi); device_scale_factor = FindDeviceScaleFactor(dpi);
} else { } else {
ManagedDisplayMode mode; ManagedDisplayMode mode;
if (display_manager_->GetSelectedModeForDisplayId(state->display_id(), if (display_manager_->GetSelectedModeForDisplayId(snapshot->display_id(),
&mode)) { &mode)) {
device_scale_factor = mode.device_scale_factor(); device_scale_factor = mode.device_scale_factor();
} else { } else {
...@@ -288,8 +289,8 @@ ManagedDisplayInfo DisplayChangeObserver::CreateManagedDisplayInfo( ...@@ -288,8 +289,8 @@ ManagedDisplayInfo DisplayChangeObserver::CreateManagedDisplayInfo(
// from the value of |k2xThreshouldSizeSquaredFor4KInMm| // from the value of |k2xThreshouldSizeSquaredFor4KInMm|
const int k2xThreshouldSizeSquaredFor4KInMm = const int k2xThreshouldSizeSquaredFor4KInMm =
(40 * 40 * kInchInMm * kInchInMm) - 100; (40 * 40 * kInchInMm * kInchInMm) - 100;
gfx::Vector2d size_in_vec(state->physical_size().width(), gfx::Vector2d size_in_vec(snapshot->physical_size().width(),
state->physical_size().height()); snapshot->physical_size().height());
if (size_in_vec.LengthSquared() > k2xThreshouldSizeSquaredFor4KInMm && if (size_in_vec.LengthSquared() > k2xThreshouldSizeSquaredFor4KInMm &&
mode_info->size().width() >= kMinimumWidthFor4K) { mode_info->size().width() >= kMinimumWidthFor4K) {
// Make sure that additional device scale factors table has 2x. // Make sure that additional device scale factors table has 2x.
...@@ -299,35 +300,46 @@ ManagedDisplayInfo DisplayChangeObserver::CreateManagedDisplayInfo( ...@@ -299,35 +300,46 @@ ManagedDisplayInfo DisplayChangeObserver::CreateManagedDisplayInfo(
} }
} }
std::string name = (state->type() == DISPLAY_CONNECTION_TYPE_INTERNAL) std::string name = (snapshot->type() == DISPLAY_CONNECTION_TYPE_INTERNAL)
? l10n_util::GetStringUTF8(IDS_DISPLAY_NAME_INTERNAL) ? l10n_util::GetStringUTF8(IDS_DISPLAY_NAME_INTERNAL)
: state->display_name(); : snapshot->display_name();
if (name.empty()) if (name.empty())
name = l10n_util::GetStringUTF8(IDS_DISPLAY_NAME_UNKNOWN); name = l10n_util::GetStringUTF8(IDS_DISPLAY_NAME_UNKNOWN);
const bool has_overscan = state->has_overscan(); const bool has_overscan = snapshot->has_overscan();
const int64_t id = state->display_id(); const int64_t id = snapshot->display_id();
ManagedDisplayInfo new_info = ManagedDisplayInfo(id, name, has_overscan); ManagedDisplayInfo new_info = ManagedDisplayInfo(id, name, has_overscan);
new_info.set_sys_path(state->sys_path());
if (snapshot->product_code() != DisplaySnapshot::kInvalidProductCode) {
uint16_t manufacturer_id = 0;
uint16_t product_id = 0;
SplitProductCodeInManufacturerIdAndProductId(snapshot->product_code(),
&manufacturer_id, &product_id);
new_info.set_manufacturer_id(ManufacturerIdToString(manufacturer_id));
new_info.set_product_id(ProductIdToString(product_id));
}
new_info.set_year_of_manufacture(snapshot->year_of_manufacture());
new_info.set_sys_path(snapshot->sys_path());
new_info.set_device_scale_factor(device_scale_factor); new_info.set_device_scale_factor(device_scale_factor);
const gfx::Rect display_bounds(state->origin(), mode_info->size()); const gfx::Rect display_bounds(snapshot->origin(), mode_info->size());
new_info.SetBounds(display_bounds); new_info.SetBounds(display_bounds);
new_info.set_native(true); new_info.set_native(true);
new_info.set_is_aspect_preserving_scaling( new_info.set_is_aspect_preserving_scaling(
state->is_aspect_preserving_scaling()); snapshot->is_aspect_preserving_scaling());
if (dpi) if (dpi)
new_info.set_device_dpi(dpi); new_info.set_device_dpi(dpi);
new_info.set_color_space(state->color_space()); new_info.set_color_space(snapshot->color_space());
ManagedDisplayInfo::ManagedDisplayModeList display_modes = ManagedDisplayInfo::ManagedDisplayModeList display_modes =
(state->type() == DISPLAY_CONNECTION_TYPE_INTERNAL) (snapshot->type() == DISPLAY_CONNECTION_TYPE_INTERNAL)
? GetInternalManagedDisplayModeList(new_info, *state) ? GetInternalManagedDisplayModeList(new_info, *snapshot)
: GetExternalManagedDisplayModeList(*state); : GetExternalManagedDisplayModeList(*snapshot);
new_info.SetManagedDisplayModes(display_modes); new_info.SetManagedDisplayModes(display_modes);
new_info.set_maximum_cursor_size(state->maximum_cursor_size()); new_info.set_maximum_cursor_size(snapshot->maximum_cursor_size());
return new_info; return new_info;
} }
......
...@@ -64,7 +64,7 @@ class DISPLAY_MANAGER_EXPORT DisplayChangeObserver ...@@ -64,7 +64,7 @@ class DISPLAY_MANAGER_EXPORT DisplayChangeObserver
void UpdateInternalDisplay( void UpdateInternalDisplay(
const DisplayConfigurator::DisplayStateList& display_states); const DisplayConfigurator::DisplayStateList& display_states);
ManagedDisplayInfo CreateManagedDisplayInfo(const DisplaySnapshot* state, ManagedDisplayInfo CreateManagedDisplayInfo(const DisplaySnapshot* snapshot,
const DisplayMode* mode_info); const DisplayMode* mode_info);
// Both |display_configurator_| and |display_manager_| are not owned and must // Both |display_configurator_| and |display_manager_| are not owned and must
......
...@@ -308,6 +308,7 @@ FakeDisplaySnapshot::FakeDisplaySnapshot(int64_t display_id, ...@@ -308,6 +308,7 @@ FakeDisplaySnapshot::FakeDisplaySnapshot(int64_t display_id,
current_mode, current_mode,
native_mode, native_mode,
product_id, product_id,
2018 /*year_of_manufacture */,
maximum_cursor_size) {} maximum_cursor_size) {}
FakeDisplaySnapshot::~FakeDisplaySnapshot() {} FakeDisplaySnapshot::~FakeDisplaySnapshot() {}
......
...@@ -85,7 +85,7 @@ class DISPLAY_MANAGER_EXPORT FakeDisplaySnapshot : public DisplaySnapshot { ...@@ -85,7 +85,7 @@ class DISPLAY_MANAGER_EXPORT FakeDisplaySnapshot : public DisplaySnapshot {
bool has_overscan_ = false; bool has_overscan_ = false;
bool has_color_correction_matrix_ = false; bool has_color_correction_matrix_ = false;
std::string name_; std::string name_;
int64_t product_id_ = DisplaySnapshot::kInvalidProductID; int64_t product_id_ = DisplaySnapshot::kInvalidProductCode;
gfx::Size maximum_cursor_size_ = gfx::Size(64, 64); gfx::Size maximum_cursor_size_ = gfx::Size(64, 64);
DisplayModeList modes_; DisplayModeList modes_;
const DisplayMode* current_mode_ = nullptr; const DisplayMode* current_mode_ = nullptr;
......
...@@ -260,6 +260,7 @@ ManagedDisplayInfo ManagedDisplayInfo::CreateFromSpecWithID( ...@@ -260,6 +260,7 @@ ManagedDisplayInfo ManagedDisplayInfo::CreateFromSpecWithID(
ManagedDisplayInfo::ManagedDisplayInfo() ManagedDisplayInfo::ManagedDisplayInfo()
: id_(kInvalidDisplayId), : id_(kInvalidDisplayId),
year_of_manufacture_(kInvalidYearOfManufacture),
has_overscan_(false), has_overscan_(false),
active_rotation_source_(Display::RotationSource::UNKNOWN), active_rotation_source_(Display::RotationSource::UNKNOWN),
touch_support_(Display::TouchSupport::UNKNOWN), touch_support_(Display::TouchSupport::UNKNOWN),
...@@ -276,6 +277,7 @@ ManagedDisplayInfo::ManagedDisplayInfo(int64_t id, ...@@ -276,6 +277,7 @@ ManagedDisplayInfo::ManagedDisplayInfo(int64_t id,
bool has_overscan) bool has_overscan)
: id_(id), : id_(id),
name_(name), name_(name),
year_of_manufacture_(kInvalidYearOfManufacture),
has_overscan_(has_overscan), has_overscan_(has_overscan),
active_rotation_source_(Display::RotationSource::UNKNOWN), active_rotation_source_(Display::RotationSource::UNKNOWN),
touch_support_(Display::TouchSupport::UNKNOWN), touch_support_(Display::TouchSupport::UNKNOWN),
...@@ -312,6 +314,9 @@ Display::Rotation ManagedDisplayInfo::GetRotation( ...@@ -312,6 +314,9 @@ Display::Rotation ManagedDisplayInfo::GetRotation(
void ManagedDisplayInfo::Copy(const ManagedDisplayInfo& native_info) { void ManagedDisplayInfo::Copy(const ManagedDisplayInfo& native_info) {
DCHECK(id_ == native_info.id_); DCHECK(id_ == native_info.id_);
manufacturer_id_ = native_info.manufacturer_id_;
product_id_ = native_info.product_id_;
year_of_manufacture_ = native_info.year_of_manufacture_;
name_ = native_info.name_; name_ = native_info.name_;
has_overscan_ = native_info.has_overscan_; has_overscan_ = native_info.has_overscan_;
......
...@@ -253,6 +253,15 @@ class DISPLAY_MANAGER_EXPORT ManagedDisplayInfo { ...@@ -253,6 +253,15 @@ class DISPLAY_MANAGER_EXPORT ManagedDisplayInfo {
maximum_cursor_size_ = size; maximum_cursor_size_ = size;
} }
const std::string& manufacturer_id() const { return manufacturer_id_; }
void set_manufacturer_id(const std::string& id) { manufacturer_id_ = id; }
const std::string& product_id() const { return product_id_; }
void set_product_id(const std::string& id) { product_id_ = id; }
int32_t year_of_manufacture() const { return year_of_manufacture_; }
void set_year_of_manufacture(int32_t year) { year_of_manufacture_ = year; }
// Returns a string representation of the ManagedDisplayInfo, excluding // Returns a string representation of the ManagedDisplayInfo, excluding
// display modes. // display modes.
std::string ToString() const; std::string ToString() const;
...@@ -264,6 +273,9 @@ class DISPLAY_MANAGER_EXPORT ManagedDisplayInfo { ...@@ -264,6 +273,9 @@ class DISPLAY_MANAGER_EXPORT ManagedDisplayInfo {
private: private:
int64_t id_; int64_t id_;
std::string name_; std::string name_;
std::string manufacturer_id_;
std::string product_id_;
int32_t year_of_manufacture_;
base::FilePath sys_path_; base::FilePath sys_path_;
bool has_overscan_; bool has_overscan_;
std::map<Display::RotationSource, Display::Rotation> rotations_; std::map<Display::RotationSource, Display::Rotation> rotations_;
......
...@@ -28,6 +28,8 @@ struct DisplaySnapshot { ...@@ -28,6 +28,8 @@ struct DisplaySnapshot {
bool has_current_mode; bool has_current_mode;
uint64 native_mode_index; uint64 native_mode_index;
bool has_native_mode; bool has_native_mode;
int64 product_id; // |product_code| is a combination of the manufacturer id and the product id.
int64 product_code;
int32 year_of_manufacture;
gfx.mojom.Size maximum_cursor_size; gfx.mojom.Size maximum_cursor_size;
}; };
...@@ -132,7 +132,7 @@ bool StructTraits<display::mojom::DisplaySnapshotDataView, ...@@ -132,7 +132,7 @@ bool StructTraits<display::mojom::DisplaySnapshotDataView,
data.is_aspect_preserving_scaling(), data.has_overscan(), data.is_aspect_preserving_scaling(), data.has_overscan(),
data.has_color_correction_matrix(), color_space, display_name, file_path, data.has_color_correction_matrix(), color_space, display_name, file_path,
std::move(modes), std::move(edid), current_mode, native_mode, std::move(modes), std::move(edid), current_mode, native_mode,
data.product_id(), maximum_cursor_size); data.product_code(), data.year_of_manufacture(), maximum_cursor_size);
return true; return true;
} }
......
...@@ -93,9 +93,14 @@ struct StructTraits<display::mojom::DisplaySnapshotDataView, ...@@ -93,9 +93,14 @@ struct StructTraits<display::mojom::DisplaySnapshotDataView,
return snapshot->native_mode() != nullptr; return snapshot->native_mode() != nullptr;
} }
static int64_t product_id( static int64_t product_code(
const std::unique_ptr<display::DisplaySnapshot>& snapshot) { const std::unique_ptr<display::DisplaySnapshot>& snapshot) {
return snapshot->product_id(); return snapshot->product_code();
}
static int32_t year_of_manufacture(
const std::unique_ptr<display::DisplaySnapshot>& snapshot) {
return snapshot->year_of_manufacture();
} }
static const gfx::Size& maximum_cursor_size( static const gfx::Size& maximum_cursor_size(
......
...@@ -83,7 +83,7 @@ void CheckDisplaySnapShotMojoEqual(const DisplaySnapshot& input, ...@@ -83,7 +83,7 @@ void CheckDisplaySnapShotMojoEqual(const DisplaySnapshot& input,
output.has_color_correction_matrix()); output.has_color_correction_matrix());
EXPECT_EQ(input.display_name(), output.display_name()); EXPECT_EQ(input.display_name(), output.display_name());
EXPECT_EQ(input.sys_path(), output.sys_path()); EXPECT_EQ(input.sys_path(), output.sys_path());
EXPECT_EQ(input.product_id(), output.product_id()); EXPECT_EQ(input.product_code(), output.product_code());
EXPECT_EQ(input.modes().size(), output.modes().size()); EXPECT_EQ(input.modes().size(), output.modes().size());
for (size_t i = 0; i < input.modes().size(); i++) for (size_t i = 0; i < input.modes().size(); i++)
...@@ -252,7 +252,8 @@ TEST(DisplayStructTraitsTest, DisplaySnapshotCurrentAndNativeModesNull) { ...@@ -252,7 +252,8 @@ TEST(DisplayStructTraitsTest, DisplaySnapshotCurrentAndNativeModesNull) {
const gfx::ColorSpace display_color_space = gfx::ColorSpace::CreateREC709(); const gfx::ColorSpace display_color_space = gfx::ColorSpace::CreateREC709();
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_id = 19; const int64_t product_code = 19;
const int32_t year_of_manufacture = 1776;
const DisplayMode display_mode(gfx::Size(13, 11), true, 40.0f); const DisplayMode display_mode(gfx::Size(13, 11), true, 40.0f);
...@@ -267,7 +268,7 @@ TEST(DisplayStructTraitsTest, DisplaySnapshotCurrentAndNativeModesNull) { ...@@ -267,7 +268,7 @@ TEST(DisplayStructTraitsTest, DisplaySnapshotCurrentAndNativeModesNull) {
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, display_color_space, has_overscan, has_color_correction_matrix, display_color_space,
display_name, sys_path, std::move(modes), edid, current_mode, native_mode, display_name, sys_path, std::move(modes), edid, current_mode, native_mode,
product_id, maximum_cursor_size); product_code, year_of_manufacture, maximum_cursor_size);
std::unique_ptr<DisplaySnapshot> output; std::unique_ptr<DisplaySnapshot> output;
SerializeAndDeserialize<mojom::DisplaySnapshot>(input->Clone(), &output); SerializeAndDeserialize<mojom::DisplaySnapshot>(input->Clone(), &output);
...@@ -289,7 +290,8 @@ TEST(DisplayStructTraitsTest, DisplaySnapshotCurrentModeNull) { ...@@ -289,7 +290,8 @@ TEST(DisplayStructTraitsTest, DisplaySnapshotCurrentModeNull) {
const gfx::ColorSpace display_color_space = gfx::ColorSpace::CreateREC709(); const gfx::ColorSpace display_color_space = gfx::ColorSpace::CreateREC709();
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_id = 9; const int64_t product_code = 9;
const int32_t year_of_manufacture = 1776;
const DisplayMode display_mode(gfx::Size(13, 11), true, 50.0f); const DisplayMode display_mode(gfx::Size(13, 11), true, 50.0f);
...@@ -304,7 +306,7 @@ TEST(DisplayStructTraitsTest, DisplaySnapshotCurrentModeNull) { ...@@ -304,7 +306,7 @@ TEST(DisplayStructTraitsTest, DisplaySnapshotCurrentModeNull) {
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, display_color_space, has_overscan, has_color_correction_matrix, display_color_space,
display_name, sys_path, std::move(modes), edid, current_mode, native_mode, display_name, sys_path, std::move(modes), edid, current_mode, native_mode,
product_id, maximum_cursor_size); product_code, year_of_manufacture, maximum_cursor_size);
std::unique_ptr<DisplaySnapshot> output; std::unique_ptr<DisplaySnapshot> output;
SerializeAndDeserialize<mojom::DisplaySnapshot>(input->Clone(), &output); SerializeAndDeserialize<mojom::DisplaySnapshot>(input->Clone(), &output);
...@@ -326,7 +328,8 @@ TEST(DisplayStructTraitsTest, DisplaySnapshotExternal) { ...@@ -326,7 +328,8 @@ TEST(DisplayStructTraitsTest, DisplaySnapshotExternal) {
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 base::FilePath sys_path = base::FilePath::FromUTF8Unsafe("a/cb"); const base::FilePath sys_path = base::FilePath::FromUTF8Unsafe("a/cb");
const int64_t product_id = 139; const int64_t product_code = 139;
const int32_t year_of_manufacture = 2018;
const DisplayMode display_mode(gfx::Size(1024, 768), false, 60.0f); const DisplayMode display_mode(gfx::Size(1024, 768), false, 60.0f);
const DisplayMode display_current_mode(gfx::Size(1440, 900), false, 59.89f); const DisplayMode display_current_mode(gfx::Size(1440, 900), false, 59.89f);
...@@ -345,7 +348,7 @@ TEST(DisplayStructTraitsTest, DisplaySnapshotExternal) { ...@@ -345,7 +348,7 @@ TEST(DisplayStructTraitsTest, DisplaySnapshotExternal) {
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, display_color_space, has_overscan, has_color_correction_matrix, display_color_space,
display_name, sys_path, std::move(modes), edid, current_mode, native_mode, display_name, sys_path, std::move(modes), edid, current_mode, native_mode,
product_id, maximum_cursor_size); product_code, year_of_manufacture, maximum_cursor_size);
std::unique_ptr<DisplaySnapshot> output; std::unique_ptr<DisplaySnapshot> output;
SerializeAndDeserialize<mojom::DisplaySnapshot>(input->Clone(), &output); SerializeAndDeserialize<mojom::DisplaySnapshot>(input->Clone(), &output);
...@@ -367,7 +370,8 @@ TEST(DisplayStructTraitsTest, DisplaySnapshotInternal) { ...@@ -367,7 +370,8 @@ TEST(DisplayStructTraitsTest, DisplaySnapshotInternal) {
gfx::ColorSpace::CreateDisplayP3D65(); gfx::ColorSpace::CreateDisplayP3D65();
const std::string display_name(""); const std::string display_name("");
const base::FilePath sys_path; const base::FilePath sys_path;
const int64_t product_id = 139; const int64_t product_code = 139;
const int32_t year_of_manufacture = 2018;
const DisplayMode display_mode(gfx::Size(2560, 1700), false, 95.96f); const DisplayMode display_mode(gfx::Size(2560, 1700), false, 95.96f);
...@@ -382,7 +386,7 @@ TEST(DisplayStructTraitsTest, DisplaySnapshotInternal) { ...@@ -382,7 +386,7 @@ TEST(DisplayStructTraitsTest, DisplaySnapshotInternal) {
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, display_color_space, has_overscan, has_color_correction_matrix, display_color_space,
display_name, sys_path, std::move(modes), edid, current_mode, native_mode, display_name, sys_path, std::move(modes), edid, current_mode, native_mode,
product_id, maximum_cursor_size); product_code, year_of_manufacture, maximum_cursor_size);
std::unique_ptr<DisplaySnapshot> output; std::unique_ptr<DisplaySnapshot> output;
SerializeAndDeserialize<mojom::DisplaySnapshot>(input->Clone(), &output); SerializeAndDeserialize<mojom::DisplaySnapshot>(input->Clone(), &output);
......
...@@ -16,6 +16,9 @@ constexpr int64_t kInvalidDisplayId = -1; ...@@ -16,6 +16,9 @@ constexpr int64_t kInvalidDisplayId = -1;
// Display ID for a virtual display assigned to a unified desktop. // Display ID for a virtual display assigned to a unified desktop.
constexpr int64_t kUnifiedDisplayId = -10; constexpr int64_t kUnifiedDisplayId = -10;
// Invalid year of manufacture of the display.
constexpr int32_t kInvalidYearOfManufacture = -1;
// Used to describe the state of a multi-display configuration. // Used to describe the state of a multi-display configuration.
enum MultipleDisplayState { enum MultipleDisplayState {
MULTIPLE_DISPLAY_STATE_INVALID, MULTIPLE_DISPLAY_STATE_INVALID,
......
...@@ -74,7 +74,8 @@ DisplaySnapshot::DisplaySnapshot(int64_t display_id, ...@@ -74,7 +74,8 @@ DisplaySnapshot::DisplaySnapshot(int64_t display_id,
const std::vector<uint8_t>& edid, const std::vector<uint8_t>& edid,
const DisplayMode* current_mode, const DisplayMode* current_mode,
const DisplayMode* native_mode, const DisplayMode* native_mode,
int64_t product_id, int64_t product_code,
int32_t year_of_manufacture,
const gfx::Size& maximum_cursor_size) const gfx::Size& maximum_cursor_size)
: display_id_(display_id), : display_id_(display_id),
origin_(origin), origin_(origin),
...@@ -90,7 +91,8 @@ DisplaySnapshot::DisplaySnapshot(int64_t display_id, ...@@ -90,7 +91,8 @@ DisplaySnapshot::DisplaySnapshot(int64_t display_id,
edid_(edid), edid_(edid),
current_mode_(current_mode), current_mode_(current_mode),
native_mode_(native_mode), native_mode_(native_mode),
product_id_(product_id), product_code_(product_code),
year_of_manufacture_(year_of_manufacture),
maximum_cursor_size_(maximum_cursor_size) { maximum_cursor_size_(maximum_cursor_size) {
// We must explicitly clear out the bytes that represent the serial number. // We must explicitly clear out the bytes that represent the serial number.
const size_t end = const size_t end =
...@@ -122,20 +124,21 @@ std::unique_ptr<DisplaySnapshot> DisplaySnapshot::Clone() { ...@@ -122,20 +124,21 @@ std::unique_ptr<DisplaySnapshot> DisplaySnapshot::Clone() {
is_aspect_preserving_scaling_, has_overscan_, is_aspect_preserving_scaling_, has_overscan_,
has_color_correction_matrix_, color_space_, display_name_, sys_path_, has_color_correction_matrix_, color_space_, display_name_, sys_path_,
std::move(clone_modes), edid_, cloned_current_mode, cloned_native_mode, std::move(clone_modes), edid_, cloned_current_mode, cloned_native_mode,
product_id_, maximum_cursor_size_); product_code_, year_of_manufacture_, maximum_cursor_size_);
} }
std::string DisplaySnapshot::ToString() const { std::string DisplaySnapshot::ToString() const {
return base::StringPrintf( return base::StringPrintf(
"id=%" PRId64 "id=%" PRId64
" current_mode=%s native_mode=%s origin=%s" " current_mode=%s native_mode=%s origin=%s"
" physical_size=%s, type=%s name=\"%s\" modes=(%s)", " physical_size=%s, type=%s name=\"%s\" (year:%d) "
"modes=(%s)",
display_id_, display_id_,
current_mode_ ? current_mode_->ToString().c_str() : "nullptr", current_mode_ ? current_mode_->ToString().c_str() : "nullptr",
native_mode_ ? native_mode_->ToString().c_str() : "nullptr", native_mode_ ? native_mode_->ToString().c_str() : "nullptr",
origin_.ToString().c_str(), physical_size_.ToString().c_str(), origin_.ToString().c_str(), physical_size_.ToString().c_str(),
DisplayConnectionTypeString(type_).c_str(), display_name_.c_str(), DisplayConnectionTypeString(type_).c_str(), display_name_.c_str(),
ModeListString(modes_).c_str()); year_of_manufacture_, ModeListString(modes_).c_str());
} }
// static // static
......
...@@ -43,7 +43,8 @@ class DISPLAY_TYPES_EXPORT DisplaySnapshot { ...@@ -43,7 +43,8 @@ class DISPLAY_TYPES_EXPORT DisplaySnapshot {
const std::vector<uint8_t>& edid, const std::vector<uint8_t>& edid,
const DisplayMode* current_mode, const DisplayMode* current_mode,
const DisplayMode* native_mode, const DisplayMode* native_mode,
int64_t product_id, int64_t product_code,
int32_t year_of_manufacture,
const gfx::Size& maximum_cursor_size); const gfx::Size& maximum_cursor_size);
virtual ~DisplaySnapshot(); virtual ~DisplaySnapshot();
...@@ -67,7 +68,8 @@ class DISPLAY_TYPES_EXPORT DisplaySnapshot { ...@@ -67,7 +68,8 @@ class DISPLAY_TYPES_EXPORT DisplaySnapshot {
const DisplayMode* current_mode() const { return current_mode_; } const DisplayMode* current_mode() const { return current_mode_; }
void set_current_mode(const DisplayMode* mode) { current_mode_ = mode; } void set_current_mode(const DisplayMode* mode) { current_mode_ = mode; }
const DisplayMode* native_mode() const { return native_mode_; } const DisplayMode* native_mode() const { return native_mode_; }
int64_t product_id() const { return product_id_; } int64_t product_code() const { return product_code_; }
int32_t year_of_manufacture() const { return year_of_manufacture_; }
const gfx::Size& maximum_cursor_size() const { return maximum_cursor_size_; } const gfx::Size& maximum_cursor_size() const { return maximum_cursor_size_; }
void add_mode(const DisplayMode* mode) { modes_.push_back(mode->Clone()); } void add_mode(const DisplayMode* mode) { modes_.push_back(mode->Clone()); }
...@@ -78,8 +80,8 @@ class DISPLAY_TYPES_EXPORT DisplaySnapshot { ...@@ -78,8 +80,8 @@ class DISPLAY_TYPES_EXPORT DisplaySnapshot {
// Returns a textual representation of this display state. // Returns a textual representation of this display state.
std::string ToString() const; std::string ToString() const;
// Used when no product id known. // Used when no |product_code_| known.
static const int64_t kInvalidProductID = -1; static const int64_t kInvalidProductCode = -1;
// Returns the buffer format to be used for the primary plane buffer. // Returns the buffer format to be used for the primary plane buffer.
static gfx::BufferFormat PrimaryFormat(); static gfx::BufferFormat PrimaryFormat();
...@@ -120,8 +122,10 @@ class DISPLAY_TYPES_EXPORT DisplaySnapshot { ...@@ -120,8 +122,10 @@ class DISPLAY_TYPES_EXPORT DisplaySnapshot {
// "Best" mode supported by the output. // "Best" mode supported by the output.
const DisplayMode* const native_mode_; const DisplayMode* const native_mode_;
// Combination of manufacturer and product code. // Combination of manufacturer id and product id.
const int64_t product_id_; const int64_t product_code_;
const int32_t year_of_manufacture_;
// Maximum supported cursor size on this display. // Maximum supported cursor size on this display.
const gfx::Size maximum_cursor_size_; const gfx::Size maximum_cursor_size_;
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "base/hash.h" #include "base/hash.h"
#include "base/strings/string_util.h" #include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/sys_byteorder.h" #include "base/sys_byteorder.h"
#include "third_party/skia/include/core/SkColorSpace.h" #include "third_party/skia/include/core/SkColorSpace.h"
#include "ui/display/util/display_util.h" #include "ui/display/util/display_util.h"
...@@ -20,10 +21,10 @@ namespace display { ...@@ -20,10 +21,10 @@ namespace display {
namespace { namespace {
// Returns a 32-bit identifier for this model of display, using // Returns a 32-bit identifier for this model of display, using
// |manufacturer_id| and |product_code|. // |manufacturer_id| and |product_id|.
uint32_t GetProductID(uint16_t manufacturer_id, uint16_t product_code) { uint32_t GetProductCode(uint16_t manufacturer_id, uint16_t product_id) {
return ((static_cast<uint32_t>(manufacturer_id) << 16) | return ((static_cast<uint32_t>(manufacturer_id) << 16) |
(static_cast<uint32_t>(product_code))); (static_cast<uint32_t>(product_id)));
} }
} // namespace } // namespace
...@@ -31,13 +32,13 @@ uint32_t GetProductID(uint16_t manufacturer_id, uint16_t product_code) { ...@@ -31,13 +32,13 @@ uint32_t GetProductID(uint16_t manufacturer_id, uint16_t product_code) {
bool GetDisplayIdFromEDID(const std::vector<uint8_t>& edid, bool GetDisplayIdFromEDID(const std::vector<uint8_t>& edid,
uint8_t output_index, uint8_t output_index,
int64_t* display_id_out, int64_t* display_id_out,
int64_t* product_id_out) { int64_t* product_code_out) {
uint16_t manufacturer_id = 0; uint16_t manufacturer_id = 0;
uint16_t product_code = 0; uint16_t product_id = 0;
std::string product_name; std::string product_name;
// ParseOutputDeviceData fails if it doesn't have product_name. // ParseOutputDeviceData fails if it doesn't have product_name.
ParseOutputDeviceData(edid, &manufacturer_id, &product_code, &product_name, ParseOutputDeviceData(edid, &manufacturer_id, &product_id, &product_name,
nullptr, nullptr); nullptr, nullptr);
if (manufacturer_id == 0) if (manufacturer_id == 0)
...@@ -50,16 +51,16 @@ bool GetDisplayIdFromEDID(const std::vector<uint8_t>& edid, ...@@ -50,16 +51,16 @@ bool GetDisplayIdFromEDID(const std::vector<uint8_t>& edid,
// An ID based on display's index will be assigned later if this call fails. // An ID based on display's index will be assigned later if this call fails.
*display_id_out = *display_id_out =
GenerateDisplayID(manufacturer_id, product_code_hash, output_index); GenerateDisplayID(manufacturer_id, product_code_hash, output_index);
// |product_id_out| is 64-bit signed so it can store -1 as kInvalidProductID // |product_code_out| is 64-bit signed so it can store -1 as kInvalidProductID
// and not match a valid product id which will all be in the lowest 32-bits. // and not match a valid product id which will all be in the lowest 32-bits.
if (product_id_out) if (product_code_out)
*product_id_out = GetProductID(manufacturer_id, product_code); *product_code_out = GetProductCode(manufacturer_id, product_id);
return true; return true;
} }
bool ParseOutputDeviceData(const std::vector<uint8_t>& edid, bool ParseOutputDeviceData(const std::vector<uint8_t>& edid,
uint16_t* manufacturer_id, uint16_t* manufacturer_id,
uint16_t* product_code, uint16_t* product_id,
std::string* human_readable_name, std::string* human_readable_name,
gfx::Size* active_pixel_out, gfx::Size* active_pixel_out,
gfx::Size* physical_display_size_out) { gfx::Size* physical_display_size_out) {
...@@ -71,8 +72,8 @@ bool ParseOutputDeviceData(const std::vector<uint8_t>& edid, ...@@ -71,8 +72,8 @@ bool ParseOutputDeviceData(const std::vector<uint8_t>& edid,
// the display name. // the display name.
constexpr size_t kManufacturerOffset = 8; constexpr size_t kManufacturerOffset = 8;
constexpr size_t kManufacturerLength = 2; constexpr size_t kManufacturerLength = 2;
constexpr size_t kProductCodeOffset = 10; constexpr size_t kProductIdOffset = 10;
constexpr size_t kProductCodeLength = 2; constexpr size_t kProductIdLength = 2;
constexpr size_t kDescriptorOffset = 54; constexpr size_t kDescriptorOffset = 54;
constexpr size_t kNumDescriptors = 4; constexpr size_t kNumDescriptors = 4;
constexpr size_t kDescriptorLength = 18; constexpr size_t kDescriptorLength = 18;
...@@ -91,14 +92,13 @@ bool ParseOutputDeviceData(const std::vector<uint8_t>& edid, ...@@ -91,14 +92,13 @@ bool ParseOutputDeviceData(const std::vector<uint8_t>& edid,
(edid[kManufacturerOffset] << 8) + edid[kManufacturerOffset + 1]; (edid[kManufacturerOffset] << 8) + edid[kManufacturerOffset + 1];
} }
if (product_code) { if (product_id) {
if (edid.size() < kProductCodeOffset + kProductCodeLength) { if (edid.size() < kProductIdOffset + kProductIdLength) {
LOG(ERROR) << "Too short EDID data: manufacturer product code"; LOG(ERROR) << "Too short EDID data: product id";
return false; return false;
} }
*product_code = *product_id = (edid[kProductIdOffset] << 8) + edid[kProductIdOffset + 1];
(edid[kProductCodeOffset] << 8) + edid[kProductCodeOffset + 1];
} }
if (human_readable_name) if (human_readable_name)
...@@ -186,6 +186,44 @@ bool ParseOutputDeviceData(const std::vector<uint8_t>& edid, ...@@ -186,6 +186,44 @@ bool ParseOutputDeviceData(const std::vector<uint8_t>& edid,
return true; return true;
} }
void SplitProductCodeInManufacturerIdAndProductId(int64_t product_code,
uint16_t* manufacturer_id,
uint16_t* product_id) {
DCHECK(manufacturer_id);
DCHECK(product_id);
// Undo GetProductCode() packing.
*product_id = product_code & 0xFFFF;
*manufacturer_id = (product_code >> 16) & 0xFFFF;
}
std::string ManufacturerIdToString(uint16_t manufacturer_id) {
// Constants are taken from "VESA Enhanced EDID Standard" Release A, Revision
// 2, Sep 2006, Sec 3.4.1 "ID Manufacturer Name: 2 Bytes". Essentially these
// are 3 5-bit ASCII characters packed in 2 bytes, where 1 means 'A', etc.
constexpr uint8_t kFiveBitAsciiMask = 0x1F;
constexpr char kFiveBitToAsciiOffset = 'A' - 1;
constexpr size_t kSecondLetterOffset = 5;
constexpr size_t kFirstLetterOffset = 10;
char out[4] = {};
out[2] = (manufacturer_id & kFiveBitAsciiMask) + kFiveBitToAsciiOffset;
out[1] = ((manufacturer_id >> kSecondLetterOffset) & kFiveBitAsciiMask) +
kFiveBitToAsciiOffset;
out[0] = ((manufacturer_id >> kFirstLetterOffset) & kFiveBitAsciiMask) +
kFiveBitToAsciiOffset;
return out;
}
std::string ProductIdToString(uint16_t product_id) {
// From "VESA Enhanced EDID Standard" Release A, Revision 2, Sep 2006, Sec
// 3.4.2 "ID Product Code: 2 Bytes": "The ID product code field, [...]
// contains a 2-byte manufacturer assigned product code. [...] The 2 byte
// number is stored in hex with the least significant byte listed first."
uint8_t lower_char = (product_id >> 8) & 0xFF;
uint8_t upper_char = product_id & 0xFF;
return base::StringPrintf("%02X%02X", upper_char, lower_char);
}
bool ParseOutputOverscanFlag(const std::vector<uint8_t>& edid, bool* flag) { bool ParseOutputOverscanFlag(const std::vector<uint8_t>& edid, bool* flag) {
// See http://en.wikipedia.org/wiki/Extended_display_identification_data // See http://en.wikipedia.org/wiki/Extended_display_identification_data
// for the extension format of EDID. Also see EIA/CEA-861 spec for // for the extension format of EDID. Also see EIA/CEA-861 spec for
...@@ -254,6 +292,28 @@ bool ParseOutputOverscanFlag(const std::vector<uint8_t>& edid, bool* flag) { ...@@ -254,6 +292,28 @@ bool ParseOutputOverscanFlag(const std::vector<uint8_t>& edid, bool* flag) {
return false; return false;
} }
DISPLAY_UTIL_EXPORT bool ParseYearOfManufacture(
const std::vector<uint8_t>& edid,
int32_t* year) {
// Constants are taken from "VESA Enhanced EDID Standard" Release A, Revision
// 2, Sep 2006, Sec 3.4.4 "Week and Year of Manufacture or Model Year: 2
// Bytes".
constexpr size_t kYearOfManufactureOffset = 17;
constexpr uint32_t kValidValueLowerBound = 0x10;
constexpr int32_t kYearOffset = 1990;
if (edid.size() < kYearOfManufactureOffset + 1) {
LOG(ERROR) << "Too short EDID data: year of manufacture";
return false;
}
const uint8_t byte_data = edid[kYearOfManufactureOffset];
if (byte_data < kValidValueLowerBound)
return false;
DCHECK(year);
*year = byte_data + kYearOffset;
return true;
}
bool ParseChromaticityCoordinates(const std::vector<uint8_t>& edid, bool ParseChromaticityCoordinates(const std::vector<uint8_t>& edid,
SkColorSpacePrimaries* primaries) { SkColorSpacePrimaries* primaries) {
DCHECK(primaries); DCHECK(primaries);
......
...@@ -25,15 +25,15 @@ struct SkColorSpacePrimaries; ...@@ -25,15 +25,15 @@ struct SkColorSpacePrimaries;
namespace display { namespace display {
// Generates the display id and product id for the pair of |edid| and |index|, // Generates the display id and product id for the pair of |edid| and |index|,
// and store in |display_id_out| and |product_id_out|. Returns true if the // and store in |display_id_out| and |product_code_out|. Returns true if the
// display id is successfully generated, or false otherwise. // display id is successfully generated, or false otherwise.
DISPLAY_UTIL_EXPORT bool GetDisplayIdFromEDID(const std::vector<uint8_t>& edid, DISPLAY_UTIL_EXPORT bool GetDisplayIdFromEDID(const std::vector<uint8_t>& edid,
uint8_t index, uint8_t index,
int64_t* display_id_out, int64_t* display_id_out,
int64_t* product_id_out); int64_t* product_code_out);
// Parses |edid| as EDID data and stores extracted data into |manufacturer_id|, // Parses |edid| as EDID data and stores extracted data into |manufacturer_id|,
// |product_code|, |human_readable_name|, |active_pixel_out| and // |product_id|, |human_readable_name|, |active_pixel_out| and
// |physical_display_size_out|, then returns true. nullptr can be passed for // |physical_display_size_out|, then returns true. nullptr can be passed for
// unwanted output parameters. Some devices (especially internal displays) may // unwanted output parameters. Some devices (especially internal displays) may
// not have the field for |human_readable_name|, and it will return true in // not have the field for |human_readable_name|, and it will return true in
...@@ -41,15 +41,33 @@ DISPLAY_UTIL_EXPORT bool GetDisplayIdFromEDID(const std::vector<uint8_t>& edid, ...@@ -41,15 +41,33 @@ DISPLAY_UTIL_EXPORT bool GetDisplayIdFromEDID(const std::vector<uint8_t>& edid,
DISPLAY_UTIL_EXPORT bool ParseOutputDeviceData( DISPLAY_UTIL_EXPORT bool ParseOutputDeviceData(
const std::vector<uint8_t>& edid, const std::vector<uint8_t>& edid,
uint16_t* manufacturer_id, uint16_t* manufacturer_id,
uint16_t* product_code, uint16_t* product_id,
std::string* human_readable_name, std::string* human_readable_name,
gfx::Size* active_pixel_out, gfx::Size* active_pixel_out,
gfx::Size* physical_display_size_out); gfx::Size* physical_display_size_out);
// Splits the |product_code| (as returned by GetDisplayIdFromEDID()) into its
// constituents |manufacturer_id| and |product_id|.
DISPLAY_UTIL_EXPORT void SplitProductCodeInManufacturerIdAndProductId(
int64_t product_code,
uint16_t* manufacturer_id,
uint16_t* product_id);
// Extracts the three letter Manufacturer ID out of |manufacturer_id|.
DISPLAY_UTIL_EXPORT std::string ManufacturerIdToString(
uint16_t manufacturer_id);
// Extracts the 2 Byte Product ID as hex out of |product_id|.
DISPLAY_UTIL_EXPORT std::string ProductIdToString(uint16_t product_id);
DISPLAY_UTIL_EXPORT bool ParseOutputOverscanFlag( DISPLAY_UTIL_EXPORT bool ParseOutputOverscanFlag(
const std::vector<uint8_t>& edid, const std::vector<uint8_t>& edid,
bool* flag); bool* flag);
DISPLAY_UTIL_EXPORT bool ParseYearOfManufacture(
const std::vector<uint8_t>& edid,
int32_t* year);
// Extracts from |edid| the |primaries| chromaticity coordinates (CIE xy // Extracts from |edid| the |primaries| chromaticity coordinates (CIE xy
// coordinates for Red, Green and Blue channels and for the White Point). // coordinates for Red, Green and Blue channels and for the White Point).
DISPLAY_UTIL_EXPORT bool ParseChromaticityCoordinates( DISPLAY_UTIL_EXPORT bool ParseChromaticityCoordinates(
......
...@@ -27,11 +27,13 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { ...@@ -27,11 +27,13 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
std::string human_readable_name; std::string human_readable_name;
gfx::Size active_pixel_size, physical_display_size; gfx::Size active_pixel_size, physical_display_size;
bool overscan; bool overscan;
int32_t year_of_manufacture;
display::ParseOutputDeviceData(edid, &manufacturer_id, &product_code, display::ParseOutputDeviceData(edid, &manufacturer_id, &product_code,
&human_readable_name, &active_pixel_size, &human_readable_name, &active_pixel_size,
&physical_display_size); &physical_display_size);
display::ParseOutputOverscanFlag(edid, &overscan); display::ParseOutputOverscanFlag(edid, &overscan);
display::ParseYearOfManufacture(edid, &year_of_manufacture);
return 0; return 0;
} }
...@@ -241,6 +241,8 @@ TEST(EDIDParserTest, ParseEDID) { ...@@ -241,6 +241,8 @@ TEST(EDIDParserTest, ParseEDID) {
EXPECT_EQ("HP ZR30w", human_readable_name); EXPECT_EQ("HP ZR30w", human_readable_name);
EXPECT_EQ("2560x1600", pixel.ToString()); EXPECT_EQ("2560x1600", pixel.ToString());
EXPECT_EQ("641x400", size.ToString()); EXPECT_EQ("641x400", size.ToString());
EXPECT_EQ(ManufacturerIdToString(manufacturer_id), "HWP");
EXPECT_EQ(ProductIdToString(product_code), "286C");
manufacturer_id = 0; manufacturer_id = 0;
product_code = 0; product_code = 0;
...@@ -255,6 +257,8 @@ TEST(EDIDParserTest, ParseEDID) { ...@@ -255,6 +257,8 @@ TEST(EDIDParserTest, ParseEDID) {
EXPECT_EQ("", human_readable_name); EXPECT_EQ("", human_readable_name);
EXPECT_EQ("1280x800", pixel.ToString()); EXPECT_EQ("1280x800", pixel.ToString());
EXPECT_EQ("261x163", size.ToString()); EXPECT_EQ("261x163", size.ToString());
EXPECT_EQ(ManufacturerIdToString(manufacturer_id), "SEC");
EXPECT_EQ(ProductIdToString(product_code), "3142");
// Internal display doesn't have name. // Internal display doesn't have name.
EXPECT_TRUE(ParseOutputDeviceData(edid, nullptr, nullptr, EXPECT_TRUE(ParseOutputDeviceData(edid, nullptr, nullptr,
...@@ -273,6 +277,38 @@ TEST(EDIDParserTest, ParseEDID) { ...@@ -273,6 +277,38 @@ TEST(EDIDParserTest, ParseEDID) {
EXPECT_EQ("SAMSUNG", human_readable_name); EXPECT_EQ("SAMSUNG", human_readable_name);
EXPECT_EQ("1920x1080", pixel.ToString()); EXPECT_EQ("1920x1080", pixel.ToString());
EXPECT_EQ("160x90", size.ToString()); EXPECT_EQ("160x90", size.ToString());
EXPECT_EQ(ManufacturerIdToString(manufacturer_id), "SAM");
EXPECT_EQ(ProductIdToString(product_code), "08FE");
manufacturer_id = 0;
product_code = 0;
human_readable_name.clear();
Reset(&pixel, &size);
edid.assign(kSamus, kSamus + charsize(kSamus));
EXPECT_TRUE(ParseOutputDeviceData(edid, &manufacturer_id, &product_code,
nullptr, &pixel, &size));
EXPECT_EQ(0x30E4u, manufacturer_id);
EXPECT_EQ(0x2E04u, product_code);
EXPECT_EQ("", human_readable_name);
EXPECT_EQ("2560x1700", pixel.ToString());
EXPECT_EQ("272x181", size.ToString());
EXPECT_EQ(ManufacturerIdToString(manufacturer_id), "LGD");
EXPECT_EQ(ProductIdToString(product_code), "042E");
manufacturer_id = 0;
product_code = 0;
human_readable_name.clear();
Reset(&pixel, &size);
edid.assign(kEve, kEve + charsize(kEve));
EXPECT_TRUE(ParseOutputDeviceData(edid, &manufacturer_id, &product_code,
nullptr, &pixel, &size));
EXPECT_EQ(0x4D10u, manufacturer_id);
EXPECT_EQ(0x8A14u, product_code);
EXPECT_EQ("", human_readable_name);
EXPECT_EQ("2400x1600", pixel.ToString());
EXPECT_EQ("259x173", size.ToString());
EXPECT_EQ(ManufacturerIdToString(manufacturer_id), "SHP");
EXPECT_EQ(ProductIdToString(product_code), "148A");
} }
TEST(EDIDParserTest, ParseBrokenEDID) { TEST(EDIDParserTest, ParseBrokenEDID) {
...@@ -398,6 +434,37 @@ TEST(EDIDParserTest, ParseChromaticityCoordinates) { ...@@ -398,6 +434,37 @@ TEST(EDIDParserTest, ParseChromaticityCoordinates) {
kEvePrimaries); kEvePrimaries);
} }
TEST(EDIDParserTest, ParseYearOfManufacture) {
const std::vector<uint8_t> edid_normal_display(
kNormalDisplay, kNormalDisplay + charsize(kNormalDisplay));
int32_t edid_normal_display_year = 0;
EXPECT_TRUE(
ParseYearOfManufacture(edid_normal_display, &edid_normal_display_year));
EXPECT_EQ(2012, edid_normal_display_year);
const std::vector<uint8_t> edid_internal_display(
kInternalDisplay, kInternalDisplay + charsize(kInternalDisplay));
int32_t edid_internal_display_year = 0;
EXPECT_TRUE(ParseYearOfManufacture(edid_internal_display,
&edid_internal_display_year));
EXPECT_EQ(2011, edid_internal_display_year);
const std::vector<uint8_t> edid_hpz32x(kHPz32x, kHPz32x + charsize(kHPz32x));
int32_t edid_hpz32x_year = 0;
EXPECT_TRUE(ParseYearOfManufacture(edid_hpz32x, &edid_hpz32x_year));
EXPECT_EQ(2017, edid_hpz32x_year);
const std::vector<uint8_t> edid_samus(kSamus, kSamus + charsize(kSamus));
int32_t edid_samus_year = 0;
EXPECT_TRUE(ParseYearOfManufacture(edid_samus, &edid_samus_year));
EXPECT_EQ(2014, edid_samus_year);
const std::vector<uint8_t> edid_eve(kEve, kEve + charsize(kEve));
int32_t edid_eve_year = 0;
EXPECT_TRUE(ParseYearOfManufacture(edid_eve, &edid_eve_year));
EXPECT_EQ(2017, edid_eve_year);
}
TEST(EDIDParserTest, ParseGammaValue) { TEST(EDIDParserTest, ParseGammaValue) {
const std::vector<uint8_t> edid_normal_display( const std::vector<uint8_t> edid_normal_display(
kNormalDisplay, kNormalDisplay + charsize(kNormalDisplay)); kNormalDisplay, kNormalDisplay + charsize(kNormalDisplay));
......
...@@ -53,7 +53,8 @@ struct DisplaySnapshot_Params { ...@@ -53,7 +53,8 @@ struct DisplaySnapshot_Params {
DisplayMode_Params current_mode; DisplayMode_Params current_mode;
bool has_native_mode = false; bool has_native_mode = false;
DisplayMode_Params native_mode; DisplayMode_Params native_mode;
int64_t product_id = 0; int64_t product_code = 0;
int32_t year_of_manufacture = display::kInvalidYearOfManufacture;
gfx::Size maximum_cursor_size; gfx::Size maximum_cursor_size;
}; };
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
// Multiply-included message file, hence no include guard here, but see below // Multiply-included message file, hence no include guard here, but see below
// for a much smaller-than-usual include guard section. // for a much smaller-than-usual include guard section.
// no-include-guard-because-multiply-included
#include <stdint.h> #include <stdint.h>
...@@ -62,7 +63,8 @@ IPC_STRUCT_TRAITS_BEGIN(ui::DisplaySnapshot_Params) ...@@ -62,7 +63,8 @@ IPC_STRUCT_TRAITS_BEGIN(ui::DisplaySnapshot_Params)
IPC_STRUCT_TRAITS_MEMBER(current_mode) IPC_STRUCT_TRAITS_MEMBER(current_mode)
IPC_STRUCT_TRAITS_MEMBER(has_native_mode) IPC_STRUCT_TRAITS_MEMBER(has_native_mode)
IPC_STRUCT_TRAITS_MEMBER(native_mode) IPC_STRUCT_TRAITS_MEMBER(native_mode)
IPC_STRUCT_TRAITS_MEMBER(product_id) IPC_STRUCT_TRAITS_MEMBER(product_code)
IPC_STRUCT_TRAITS_MEMBER(year_of_manufacture)
IPC_STRUCT_TRAITS_MEMBER(maximum_cursor_size) IPC_STRUCT_TRAITS_MEMBER(maximum_cursor_size)
IPC_STRUCT_TRAITS_END() IPC_STRUCT_TRAITS_END()
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include "base/containers/flat_map.h" #include "base/containers/flat_map.h"
#include "base/memory/ptr_util.h" #include "base/memory/ptr_util.h"
#include "ui/display/types/display_constants.h"
#include "ui/display/types/display_mode.h" #include "ui/display/types/display_mode.h"
#include "ui/display/util/edid_parser.h" #include "ui/display/util/edid_parser.h"
...@@ -393,7 +394,8 @@ std::unique_ptr<display::DisplaySnapshot> CreateDisplaySnapshot( ...@@ -393,7 +394,8 @@ std::unique_ptr<display::DisplaySnapshot> CreateDisplaySnapshot(
std::vector<uint8_t> edid; std::vector<uint8_t> edid;
std::string display_name; std::string display_name;
int64_t product_id = display::DisplaySnapshot::kInvalidProductID; int64_t product_code = display::DisplaySnapshot::kInvalidProductCode;
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;
...@@ -407,10 +409,13 @@ std::unique_ptr<display::DisplaySnapshot> CreateDisplaySnapshot( ...@@ -407,10 +409,13 @@ std::unique_ptr<display::DisplaySnapshot> CreateDisplaySnapshot(
edid.assign(static_cast<uint8_t*>(edid_blob->data), edid.assign(static_cast<uint8_t*>(edid_blob->data),
static_cast<uint8_t*>(edid_blob->data) + edid_blob->length); static_cast<uint8_t*>(edid_blob->data) + edid_blob->length);
display::GetDisplayIdFromEDID(edid, display_id, &display_id, &product_id); // TODO(mcasas): GetDisplayIdFromEDID() calls ParseOutputDeviceData(), clean
// up the code and add UMA for EDID errors, https://crbug.com/821393. Also
// handle correctly the parsing failures of the following functions.
display::GetDisplayIdFromEDID(edid, display_id, &display_id, &product_code);
display::ParseOutputDeviceData(edid, nullptr, nullptr, &display_name, display::ParseOutputDeviceData(edid, nullptr, nullptr, &display_name,
&active_pixel_size, nullptr); &active_pixel_size, nullptr);
display::ParseYearOfManufacture(edid, &year_of_manufacture);
display::ParseOutputOverscanFlag(edid, &has_overscan); display::ParseOutputOverscanFlag(edid, &has_overscan);
display_color_space = GetColorSpaceFromEdid(edid); display_color_space = GetColorSpaceFromEdid(edid);
...@@ -428,7 +433,7 @@ std::unique_ptr<display::DisplaySnapshot> CreateDisplaySnapshot( ...@@ -428,7 +433,7 @@ std::unique_ptr<display::DisplaySnapshot> CreateDisplaySnapshot(
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, display_color_space, has_overscan, has_color_correction_matrix, display_color_space,
display_name, sys_path, std::move(modes), edid, current_mode, native_mode, display_name, sys_path, std::move(modes), edid, current_mode, native_mode,
product_id, maximum_cursor_size); 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.
...@@ -464,7 +469,8 @@ std::vector<DisplaySnapshot_Params> CreateDisplaySnapshotParams( ...@@ -464,7 +469,8 @@ std::vector<DisplaySnapshot_Params> CreateDisplaySnapshotParams(
if (d->native_mode()) if (d->native_mode())
p.native_mode = GetDisplayModeParams(*d->native_mode()); p.native_mode = GetDisplayModeParams(*d->native_mode());
p.product_id = d->product_id(); p.product_code = d->product_code();
p.year_of_manufacture = d->year_of_manufacture();
p.maximum_cursor_size = d->maximum_cursor_size(); p.maximum_cursor_size = d->maximum_cursor_size();
params.push_back(p); params.push_back(p);
...@@ -490,7 +496,8 @@ std::unique_ptr<display::DisplaySnapshot> CreateDisplaySnapshot( ...@@ -490,7 +496,8 @@ 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.color_space, params.has_color_correction_matrix, params.color_space,
params.display_name, params.sys_path, std::move(modes), params.edid, params.display_name, params.sys_path, std::move(modes), params.edid,
current_mode, native_mode, params.product_id, params.maximum_cursor_size); current_mode, native_mode, params.product_code,
params.year_of_manufacture, params.maximum_cursor_size);
} }
int GetFourCCFormatFromBufferFormat(gfx::BufferFormat format) { int GetFourCCFormatFromBufferFormat(gfx::BufferFormat format) {
......
...@@ -114,7 +114,8 @@ bool operator==(const ui::DisplaySnapshot_Params& a, ...@@ -114,7 +114,8 @@ bool operator==(const ui::DisplaySnapshot_Params& a,
a.has_current_mode == b.has_current_mode && a.has_current_mode == b.has_current_mode &&
a.current_mode == b.current_mode && a.current_mode == b.current_mode &&
a.has_native_mode == b.has_native_mode && a.has_native_mode == b.has_native_mode &&
a.native_mode == b.native_mode && a.product_id == b.product_id && a.native_mode == b.native_mode && a.product_code == b.product_code &&
a.year_of_manufacture == b.year_of_manufacture &&
a.maximum_cursor_size == b.maximum_cursor_size; a.maximum_cursor_size == b.maximum_cursor_size;
} }
...@@ -146,7 +147,8 @@ void DetailedCompare(const ui::DisplaySnapshot_Params& a, ...@@ -146,7 +147,8 @@ void DetailedCompare(const ui::DisplaySnapshot_Params& a,
EXPECT_EQ(a.current_mode, b.current_mode); EXPECT_EQ(a.current_mode, b.current_mode);
EXPECT_EQ(a.has_native_mode, b.has_native_mode); EXPECT_EQ(a.has_native_mode, b.has_native_mode);
EXPECT_EQ(a.native_mode, b.native_mode); EXPECT_EQ(a.native_mode, b.native_mode);
EXPECT_EQ(a.product_id, b.product_id); EXPECT_EQ(a.product_code, b.product_code);
EXPECT_EQ(a.year_of_manufacture, b.year_of_manufacture);
EXPECT_EQ(a.maximum_cursor_size, b.maximum_cursor_size); EXPECT_EQ(a.maximum_cursor_size, b.maximum_cursor_size);
} }
...@@ -187,7 +189,8 @@ TEST_F(DrmUtilTest, RoundTripDisplaySnapshot) { ...@@ -187,7 +189,8 @@ TEST_F(DrmUtilTest, RoundTripDisplaySnapshot) {
fp.current_mode = MakeDisplay(1.2); fp.current_mode = MakeDisplay(1.2);
fp.has_native_mode = true; fp.has_native_mode = true;
fp.native_mode = MakeDisplay(1.1); fp.native_mode = MakeDisplay(1.1);
fp.product_id = 7; fp.product_code = 7;
fp.year_of_manufacture = 1776;
fp.maximum_cursor_size = gfx::Size(103, 44); fp.maximum_cursor_size = gfx::Size(103, 44);
sp.display_id = 1002; sp.display_id = 1002;
...@@ -206,7 +209,8 @@ TEST_F(DrmUtilTest, RoundTripDisplaySnapshot) { ...@@ -206,7 +209,8 @@ TEST_F(DrmUtilTest, RoundTripDisplaySnapshot) {
sp.has_current_mode = false; sp.has_current_mode = false;
sp.has_native_mode = true; sp.has_native_mode = true;
sp.native_mode = MakeDisplay(500.2); sp.native_mode = MakeDisplay(500.2);
sp.product_id = 8; sp.product_code = 8;
sp.year_of_manufacture = 2018;
sp.maximum_cursor_size = gfx::Size(500, 44); sp.maximum_cursor_size = gfx::Size(500, 44);
ep.display_id = 2002; ep.display_id = 2002;
...@@ -225,7 +229,8 @@ TEST_F(DrmUtilTest, RoundTripDisplaySnapshot) { ...@@ -225,7 +229,8 @@ TEST_F(DrmUtilTest, RoundTripDisplaySnapshot) {
ep.has_current_mode = true; ep.has_current_mode = true;
ep.current_mode = MakeDisplay(1000.2); ep.current_mode = MakeDisplay(1000.2);
ep.has_native_mode = false; ep.has_native_mode = false;
ep.product_id = 9; ep.product_code = 9;
ep.year_of_manufacture = 2000;
ep.maximum_cursor_size = gfx::Size(1000, 44); ep.maximum_cursor_size = gfx::Size(1000, 44);
orig_params.push_back(fp); orig_params.push_back(fp);
......
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