Commit d68aa151 authored by Drew Davenport's avatar Drew Davenport Committed by Commit Bot

ozone/drm: Don't EnableController unnecessarily

In UpdateControllerToWindowMapping, EnableController only needs to
be called if the window is moving from one controller to another. Check
if the window was not associated with a controller, and do not call
EnableController in that case.

BUG=888561

Change-Id: Ie077c13c804dbbce9315c75b6ad22a3ec4d6c8d8
Reviewed-on: https://chromium-review.googlesource.com/c/1263415Reviewed-by: default avatarDaniel Nicoara <dnicoara@chromium.org>
Commit-Queue: Drew Davenport <ddavenport@chromium.org>
Cr-Commit-Position: refs/heads/master@{#597234}
parent dd47fd6d
...@@ -341,8 +341,8 @@ void ScreenManager::UpdateControllerToWindowMapping() { ...@@ -341,8 +341,8 @@ void ScreenManager::UpdateControllerToWindowMapping() {
if (it != window_to_controller_map.end()) if (it != window_to_controller_map.end())
controller = it->second; controller = it->second;
bool should_enable = bool should_enable = controller && pair.second->GetController() &&
controller && pair.second->GetController() != controller; pair.second->GetController() != controller;
pair.second->SetController(controller); pair.second->SetController(controller);
// If we're moving windows between controllers modeset the controller // If we're moving windows between controllers modeset the controller
......
...@@ -572,6 +572,26 @@ TEST_F(ScreenManagerTest, DISABLED_RejectBufferWithIncompatibleModifiers) { ...@@ -572,6 +572,26 @@ TEST_F(ScreenManagerTest, DISABLED_RejectBufferWithIncompatibleModifiers) {
window->Shutdown(); window->Shutdown();
} }
TEST_F(ScreenManagerTest, ConfigureDisplayControllerShouldModesetOnce) {
std::unique_ptr<ui::DrmWindow> window(
new ui::DrmWindow(1, device_manager_.get(), screen_manager_.get()));
window->Initialize();
window->SetBounds(GetPrimaryBounds());
screen_manager_->AddWindow(1, std::move(window));
screen_manager_->AddDisplayController(drm_, kPrimaryCrtc, kPrimaryConnector);
screen_manager_->ConfigureDisplayController(
drm_, kPrimaryCrtc, kPrimaryConnector, GetPrimaryBounds().origin(),
kDefaultMode);
// When a window that had no controller becomes associated with a new
// controller, expect the crtc to be modeset once.
EXPECT_EQ(drm_->get_set_crtc_call_count(), 1);
window = screen_manager_->RemoveWindow(1);
window->Shutdown();
}
TEST(ScreenManagerTest2, ShouldNotHardwareMirrorDifferentDrmDevices) { TEST(ScreenManagerTest2, ShouldNotHardwareMirrorDifferentDrmDevices) {
auto gbm_device1 = std::make_unique<MockGbmDevice>(); auto gbm_device1 = std::make_unique<MockGbmDevice>();
auto drm_device1 = auto drm_device1 =
......
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