Commit 7f1ee85f authored by dnicoara's avatar dnicoara Committed by Commit bot

Treat displays with and without EDID the same way

Treating displays without EDID specially results in exiting mirror mode
every time a display configuration operation happens.

BUG=413278

Review URL: https://codereview.chromium.org/667753002

Cr-Commit-Position: refs/heads/master@{#300694}
parent e904389b
...@@ -579,15 +579,14 @@ void DisplayConfigurator::UpdateCachedDisplays() { ...@@ -579,15 +579,14 @@ void DisplayConfigurator::UpdateCachedDisplays() {
// Set |selected_mode| fields. // Set |selected_mode| fields.
for (size_t i = 0; i < cached_displays_.size(); ++i) { for (size_t i = 0; i < cached_displays_.size(); ++i) {
DisplayState* display_state = &cached_displays_[i]; DisplayState* display_state = &cached_displays_[i];
if (display_state->display->has_proper_display_id()) { gfx::Size size;
gfx::Size size; if (state_controller_ &&
if (state_controller_ && state_controller_->GetResolutionForDisplayId(
state_controller_->GetResolutionForDisplayId( display_state->display->display_id(), &size)) {
display_state->display->display_id(), &size)) { display_state->selected_mode =
display_state->selected_mode = FindDisplayModeMatchingSize(*display_state->display, size);
FindDisplayModeMatchingSize(*display_state->display, size);
}
} }
// Fall back to native mode. // Fall back to native mode.
if (!display_state->selected_mode) if (!display_state->selected_mode)
display_state->selected_mode = display_state->display->native_mode(); display_state->selected_mode = display_state->display->native_mode();
...@@ -960,12 +959,9 @@ MultipleDisplayState DisplayConfigurator::ChooseDisplayState( ...@@ -960,12 +959,9 @@ MultipleDisplayState DisplayConfigurator::ChooseDisplayState(
// With either both displays on or both displays off, use one of the // With either both displays on or both displays off, use one of the
// dual modes. // dual modes.
std::vector<int64_t> display_ids; std::vector<int64_t> display_ids;
for (size_t i = 0; i < cached_displays_.size(); ++i) { for (size_t i = 0; i < cached_displays_.size(); ++i)
// If display id isn't available, switch to extended mode.
if (!cached_displays_[i].display->has_proper_display_id())
return MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED;
display_ids.push_back(cached_displays_[i].display->display_id()); display_ids.push_back(cached_displays_[i].display->display_id());
}
return state_controller_->GetStateForDisplayIds(display_ids); return state_controller_->GetStateForDisplayIds(display_ids);
} }
} }
......
...@@ -359,7 +359,6 @@ class DisplayConfiguratorTest : public testing::Test { ...@@ -359,7 +359,6 @@ class DisplayConfiguratorTest : public testing::Test {
o->set_type(DISPLAY_CONNECTION_TYPE_INTERNAL); o->set_type(DISPLAY_CONNECTION_TYPE_INTERNAL);
o->set_is_aspect_preserving_scaling(true); o->set_is_aspect_preserving_scaling(true);
o->set_display_id(123); o->set_display_id(123);
o->set_has_proper_display_id(true);
o = &outputs_[1]; o = &outputs_[1];
o->set_current_mode(&big_mode_); o->set_current_mode(&big_mode_);
...@@ -369,7 +368,6 @@ class DisplayConfiguratorTest : public testing::Test { ...@@ -369,7 +368,6 @@ class DisplayConfiguratorTest : public testing::Test {
o->set_type(DISPLAY_CONNECTION_TYPE_HDMI); o->set_type(DISPLAY_CONNECTION_TYPE_HDMI);
o->set_is_aspect_preserving_scaling(true); o->set_is_aspect_preserving_scaling(true);
o->set_display_id(456); o->set_display_id(456);
o->set_has_proper_display_id(true);
UpdateOutputs(2, false); UpdateOutputs(2, false);
} }
...@@ -1004,18 +1002,7 @@ TEST_F(DisplayConfiguratorTest, InvalidMultipleDisplayStates) { ...@@ -1004,18 +1002,7 @@ TEST_F(DisplayConfiguratorTest, InvalidMultipleDisplayStates) {
EXPECT_EQ(2, observer_.num_failures()); EXPECT_EQ(2, observer_.num_failures());
} }
TEST_F(DisplayConfiguratorTest, GetMultipleDisplayStateForDisplaysWithoutId) { TEST_F(DisplayConfiguratorTest, GetMultipleDisplayStateForMirroredDisplays) {
outputs_[0].set_has_proper_display_id(false);
UpdateOutputs(2, false);
configurator_.Init(false);
state_controller_.set_state(MULTIPLE_DISPLAY_STATE_DUAL_MIRROR);
configurator_.ForceInitialConfigure(0);
EXPECT_EQ(MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED,
configurator_.display_state());
}
TEST_F(DisplayConfiguratorTest, GetMultipleDisplayStateForDisplaysWithId) {
outputs_[0].set_has_proper_display_id(true);
UpdateOutputs(2, false); UpdateOutputs(2, false);
configurator_.Init(false); configurator_.Init(false);
state_controller_.set_state(MULTIPLE_DISPLAY_STATE_DUAL_MIRROR); state_controller_.set_state(MULTIPLE_DISPLAY_STATE_DUAL_MIRROR);
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
namespace ui { namespace ui {
TestDisplaySnapshot::TestDisplaySnapshot() TestDisplaySnapshot::TestDisplaySnapshot()
: DisplaySnapshot(0, : DisplaySnapshot(0,
false,
gfx::Point(0, 0), gfx::Point(0, 0),
gfx::Size(0, 0), gfx::Size(0, 0),
DISPLAY_CONNECTION_TYPE_UNKNOWN, DISPLAY_CONNECTION_TYPE_UNKNOWN,
...@@ -20,7 +19,6 @@ TestDisplaySnapshot::TestDisplaySnapshot() ...@@ -20,7 +19,6 @@ TestDisplaySnapshot::TestDisplaySnapshot()
TestDisplaySnapshot::TestDisplaySnapshot( TestDisplaySnapshot::TestDisplaySnapshot(
int64_t display_id, int64_t display_id,
bool has_proper_display_id,
const gfx::Point& origin, const gfx::Point& origin,
const gfx::Size& physical_size, const gfx::Size& physical_size,
DisplayConnectionType type, DisplayConnectionType type,
...@@ -29,7 +27,6 @@ TestDisplaySnapshot::TestDisplaySnapshot( ...@@ -29,7 +27,6 @@ TestDisplaySnapshot::TestDisplaySnapshot(
const DisplayMode* current_mode, const DisplayMode* current_mode,
const DisplayMode* native_mode) const DisplayMode* native_mode)
: DisplaySnapshot(display_id, : DisplaySnapshot(display_id,
has_proper_display_id,
origin, origin,
physical_size, physical_size,
type, type,
......
...@@ -14,7 +14,6 @@ class DISPLAY_EXPORT TestDisplaySnapshot : public DisplaySnapshot { ...@@ -14,7 +14,6 @@ class DISPLAY_EXPORT TestDisplaySnapshot : public DisplaySnapshot {
public: public:
TestDisplaySnapshot(); TestDisplaySnapshot();
TestDisplaySnapshot(int64_t display_id, TestDisplaySnapshot(int64_t display_id,
bool has_proper_display_id,
const gfx::Point& origin, const gfx::Point& origin,
const gfx::Size& physical_size, const gfx::Size& physical_size,
DisplayConnectionType type, DisplayConnectionType type,
...@@ -34,9 +33,6 @@ class DISPLAY_EXPORT TestDisplaySnapshot : public DisplaySnapshot { ...@@ -34,9 +33,6 @@ class DISPLAY_EXPORT TestDisplaySnapshot : public DisplaySnapshot {
is_aspect_preserving_scaling_ = state; is_aspect_preserving_scaling_ = state;
} }
void set_display_id(int64_t id) { display_id_ = id; } void set_display_id(int64_t id) { display_id_ = id; }
void set_has_proper_display_id(bool has_display_id) {
has_proper_display_id_ = has_display_id;
}
// DisplaySnapshot overrides: // DisplaySnapshot overrides:
virtual std::string ToString() const override; virtual std::string ToString() const override;
......
...@@ -11,7 +11,6 @@ namespace ui { ...@@ -11,7 +11,6 @@ namespace ui {
DisplaySnapshotX11::DisplaySnapshotX11( DisplaySnapshotX11::DisplaySnapshotX11(
int64_t display_id, int64_t display_id,
bool has_proper_display_id,
const gfx::Point& origin, const gfx::Point& origin,
const gfx::Size& physical_size, const gfx::Size& physical_size,
DisplayConnectionType type, DisplayConnectionType type,
...@@ -25,7 +24,6 @@ DisplaySnapshotX11::DisplaySnapshotX11( ...@@ -25,7 +24,6 @@ DisplaySnapshotX11::DisplaySnapshotX11(
RRCrtc crtc, RRCrtc crtc,
int index) int index)
: DisplaySnapshot(display_id, : DisplaySnapshot(display_id,
has_proper_display_id,
origin, origin,
physical_size, physical_size,
type, type,
......
...@@ -18,7 +18,6 @@ namespace ui { ...@@ -18,7 +18,6 @@ namespace ui {
class DISPLAY_EXPORT DisplaySnapshotX11 : public DisplaySnapshot { class DISPLAY_EXPORT DisplaySnapshotX11 : public DisplaySnapshot {
public: public:
DisplaySnapshotX11(int64_t display_id, DisplaySnapshotX11(int64_t display_id,
bool has_proper_display_id,
const gfx::Point& origin, const gfx::Point& origin,
const gfx::Size& physical_size, const gfx::Size& physical_size,
DisplayConnectionType type, DisplayConnectionType type,
......
...@@ -308,8 +308,8 @@ DisplaySnapshotX11* NativeDisplayDelegateX11::InitDisplaySnapshot( ...@@ -308,8 +308,8 @@ DisplaySnapshotX11* NativeDisplayDelegateX11::InitDisplaySnapshot(
RRCrtc* last_used_crtc, RRCrtc* last_used_crtc,
int index) { int index) {
int64_t display_id = 0; int64_t display_id = 0;
bool has_display_id = GetDisplayId( if (!GetDisplayId(output, static_cast<uint8_t>(index), &display_id))
output, static_cast<uint8_t>(index), &display_id); display_id = index;
bool has_overscan = false; bool has_overscan = false;
GetOutputOverscanFlag(output, &has_overscan); GetOutputOverscanFlag(output, &has_overscan);
...@@ -318,17 +318,6 @@ DisplaySnapshotX11* NativeDisplayDelegateX11::InitDisplaySnapshot( ...@@ -318,17 +318,6 @@ DisplaySnapshotX11* NativeDisplayDelegateX11::InitDisplaySnapshot(
if (type == DISPLAY_CONNECTION_TYPE_UNKNOWN) if (type == DISPLAY_CONNECTION_TYPE_UNKNOWN)
LOG(ERROR) << "Unknown link type: " << info->name; LOG(ERROR) << "Unknown link type: " << info->name;
// Use the index as a valid display ID even if the internal
// display doesn't have valid EDID because the index
// will never change.
if (!has_display_id) {
if (type == DISPLAY_CONNECTION_TYPE_INTERNAL)
has_display_id = true;
// Fallback to output index.
display_id = index;
}
RRMode native_mode_id = GetOutputNativeMode(info); RRMode native_mode_id = GetOutputNativeMode(info);
RRMode current_mode_id = None; RRMode current_mode_id = None;
gfx::Point origin; gfx::Point origin;
...@@ -369,7 +358,6 @@ DisplaySnapshotX11* NativeDisplayDelegateX11::InitDisplaySnapshot( ...@@ -369,7 +358,6 @@ DisplaySnapshotX11* NativeDisplayDelegateX11::InitDisplaySnapshot(
DisplaySnapshotX11* display_snapshot = DisplaySnapshotX11* display_snapshot =
new DisplaySnapshotX11(display_id, new DisplaySnapshotX11(display_id,
has_display_id,
origin, origin,
gfx::Size(info->mm_width, info->mm_height), gfx::Size(info->mm_width, info->mm_height),
type, type,
......
...@@ -24,7 +24,6 @@ DisplaySnapshotX11* CreateOutput(RROutput output, RRCrtc crtc) { ...@@ -24,7 +24,6 @@ DisplaySnapshotX11* CreateOutput(RROutput output, RRCrtc crtc) {
DisplaySnapshotX11* snapshot = new DisplaySnapshotX11( DisplaySnapshotX11* snapshot = new DisplaySnapshotX11(
0, 0,
false,
gfx::Point(0, 0), gfx::Point(0, 0),
gfx::Size(0, 0), gfx::Size(0, 0),
DISPLAY_CONNECTION_TYPE_UNKNOWN, DISPLAY_CONNECTION_TYPE_UNKNOWN,
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
namespace ui { namespace ui {
DisplaySnapshot::DisplaySnapshot(int64_t display_id, DisplaySnapshot::DisplaySnapshot(int64_t display_id,
bool has_proper_display_id,
const gfx::Point& origin, const gfx::Point& origin,
const gfx::Size& physical_size, const gfx::Size& physical_size,
DisplayConnectionType type, DisplayConnectionType type,
...@@ -18,7 +17,6 @@ DisplaySnapshot::DisplaySnapshot(int64_t display_id, ...@@ -18,7 +17,6 @@ DisplaySnapshot::DisplaySnapshot(int64_t display_id,
const DisplayMode* current_mode, const DisplayMode* current_mode,
const DisplayMode* native_mode) const DisplayMode* native_mode)
: display_id_(display_id), : display_id_(display_id),
has_proper_display_id_(has_proper_display_id),
origin_(origin), origin_(origin),
physical_size_(physical_size), physical_size_(physical_size),
type_(type), type_(type),
......
...@@ -20,7 +20,6 @@ namespace ui { ...@@ -20,7 +20,6 @@ namespace ui {
class DISPLAY_TYPES_EXPORT DisplaySnapshot { class DISPLAY_TYPES_EXPORT DisplaySnapshot {
public: public:
DisplaySnapshot(int64_t display_id, DisplaySnapshot(int64_t display_id,
bool has_proper_display_id,
const gfx::Point& origin, const gfx::Point& origin,
const gfx::Size& physical_size, const gfx::Size& physical_size,
DisplayConnectionType type, DisplayConnectionType type,
...@@ -42,7 +41,6 @@ class DISPLAY_TYPES_EXPORT DisplaySnapshot { ...@@ -42,7 +41,6 @@ class DISPLAY_TYPES_EXPORT DisplaySnapshot {
std::string display_name() const { return display_name_; } std::string display_name() const { return display_name_; }
int64_t display_id() const { return display_id_; } int64_t display_id() const { return display_id_; }
bool has_proper_display_id() const { return has_proper_display_id_; }
const DisplayMode* current_mode() const { return current_mode_; } const DisplayMode* current_mode() const { return current_mode_; }
const DisplayMode* native_mode() const { return native_mode_; } const DisplayMode* native_mode() const { return native_mode_; }
...@@ -59,7 +57,6 @@ class DISPLAY_TYPES_EXPORT DisplaySnapshot { ...@@ -59,7 +57,6 @@ class DISPLAY_TYPES_EXPORT DisplaySnapshot {
protected: protected:
// Display id for this output. // Display id for this output.
int64_t display_id_; int64_t display_id_;
bool has_proper_display_id_;
// Display's origin on the framebuffer. // Display's origin on the framebuffer.
gfx::Point origin_; gfx::Point origin_;
......
...@@ -20,7 +20,6 @@ bool SameModes(const DisplayMode_Params& lhs, const DisplayMode_Params& rhs) { ...@@ -20,7 +20,6 @@ bool SameModes(const DisplayMode_Params& lhs, const DisplayMode_Params& rhs) {
DisplaySnapshotProxy::DisplaySnapshotProxy(const DisplaySnapshot_Params& params) DisplaySnapshotProxy::DisplaySnapshotProxy(const DisplaySnapshot_Params& params)
: DisplaySnapshot(params.display_id, : DisplaySnapshot(params.display_id,
params.has_proper_display_id,
params.origin, params.origin,
params.physical_size, params.physical_size,
params.type, params.type,
......
...@@ -22,7 +22,6 @@ DisplaySnapshot_Params GetDisplaySnapshotParams( ...@@ -22,7 +22,6 @@ DisplaySnapshot_Params GetDisplaySnapshotParams(
const DisplaySnapshot& display) { const DisplaySnapshot& display) {
DisplaySnapshot_Params params; DisplaySnapshot_Params params;
params.display_id = display.display_id(); params.display_id = display.display_id();
params.has_proper_display_id = display.has_proper_display_id();
params.origin = display.origin(); params.origin = display.origin();
params.physical_size = display.physical_size(); params.physical_size = display.physical_size();
params.type = display.type(); params.type = display.type();
......
...@@ -13,7 +13,6 @@ DisplayMode_Params::~DisplayMode_Params() {} ...@@ -13,7 +13,6 @@ DisplayMode_Params::~DisplayMode_Params() {}
DisplaySnapshot_Params::DisplaySnapshot_Params() DisplaySnapshot_Params::DisplaySnapshot_Params()
: display_id(0), : display_id(0),
has_proper_display_id(false),
origin(), origin(),
physical_size(), physical_size(),
type(ui::DISPLAY_CONNECTION_TYPE_NONE), type(ui::DISPLAY_CONNECTION_TYPE_NONE),
......
...@@ -28,7 +28,6 @@ struct DisplaySnapshot_Params { ...@@ -28,7 +28,6 @@ struct DisplaySnapshot_Params {
~DisplaySnapshot_Params(); ~DisplaySnapshot_Params();
int64_t display_id; int64_t display_id;
bool has_proper_display_id;
gfx::Point origin; gfx::Point origin;
gfx::Size physical_size; gfx::Size physical_size;
DisplayConnectionType type; DisplayConnectionType type;
......
...@@ -32,7 +32,6 @@ IPC_STRUCT_TRAITS_END() ...@@ -32,7 +32,6 @@ IPC_STRUCT_TRAITS_END()
IPC_STRUCT_TRAITS_BEGIN(ui::DisplaySnapshot_Params) IPC_STRUCT_TRAITS_BEGIN(ui::DisplaySnapshot_Params)
IPC_STRUCT_TRAITS_MEMBER(display_id) IPC_STRUCT_TRAITS_MEMBER(display_id)
IPC_STRUCT_TRAITS_MEMBER(has_proper_display_id)
IPC_STRUCT_TRAITS_MEMBER(origin) IPC_STRUCT_TRAITS_MEMBER(origin)
IPC_STRUCT_TRAITS_MEMBER(physical_size) IPC_STRUCT_TRAITS_MEMBER(physical_size)
IPC_STRUCT_TRAITS_MEMBER(type) IPC_STRUCT_TRAITS_MEMBER(type)
......
...@@ -67,7 +67,6 @@ DisplaySnapshotDri::DisplaySnapshotDri(DriWrapper* drm, ...@@ -67,7 +67,6 @@ DisplaySnapshotDri::DisplaySnapshotDri(DriWrapper* drm,
drmModeCrtc* crtc, drmModeCrtc* crtc,
uint32_t index) uint32_t index)
: DisplaySnapshot(index, : DisplaySnapshot(index,
false,
gfx::Point(crtc->x, crtc->y), gfx::Point(crtc->x, crtc->y),
gfx::Size(connector->mmWidth, connector->mmHeight), gfx::Size(connector->mmWidth, connector->mmHeight),
GetDisplayType(connector), GetDisplayType(connector),
...@@ -91,7 +90,9 @@ DisplaySnapshotDri::DisplaySnapshotDri(DriWrapper* drm, ...@@ -91,7 +90,9 @@ DisplaySnapshotDri::DisplaySnapshotDri(DriWrapper* drm,
static_cast<uint8_t*>(edid_blob->data), 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);
has_proper_display_id_ = GetDisplayIdFromEDID(edid, index, &display_id_); if (!GetDisplayIdFromEDID(edid, index, &display_id_))
display_id_ = index;
ParseOutputDeviceData(edid, NULL, &display_name_); ParseOutputDeviceData(edid, NULL, &display_name_);
ParseOutputOverscanFlag(edid, &overscan_flag_); ParseOutputOverscanFlag(edid, &overscan_flag_);
} else { } else {
......
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