| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/ozone/platform/drm/gpu/screen_manager.h" | 5 #include "ui/ozone/platform/drm/gpu/screen_manager.h" |
| 6 | 6 |
| 7 #include <xf86drmMode.h> | 7 #include <xf86drmMode.h> |
| 8 | 8 |
| 9 #include "third_party/skia/include/core/SkCanvas.h" | 9 #include "third_party/skia/include/core/SkCanvas.h" |
| 10 #include "ui/gfx/geometry/point.h" | 10 #include "ui/gfx/geometry/point.h" |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 gfx::Rect(controller->origin(), controller->GetModeSize())); | 307 gfx::Rect(controller->origin(), controller->GetModeSize())); |
| 308 if (!window) | 308 if (!window) |
| 309 continue; | 309 continue; |
| 310 | 310 |
| 311 window_to_controller_map[window] = controller; | 311 window_to_controller_map[window] = controller; |
| 312 } | 312 } |
| 313 | 313 |
| 314 // Apply the new mapping to all windows. | 314 // Apply the new mapping to all windows. |
| 315 for (auto pair : window_map_) { | 315 for (auto pair : window_map_) { |
| 316 auto it = window_to_controller_map.find(pair.second); | 316 auto it = window_to_controller_map.find(pair.second); |
| 317 HardwareDisplayController* controller = nullptr; |
| 317 if (it != window_to_controller_map.end()) | 318 if (it != window_to_controller_map.end()) |
| 318 pair.second->SetController(it->second); | 319 controller = it->second; |
| 319 else | 320 |
| 320 pair.second->SetController(nullptr); | 321 bool should_enable = |
| 322 controller && pair.second->GetController() != controller; |
| 323 pair.second->SetController(controller); |
| 324 |
| 325 // If we're moving windows between controllers modeset the controller |
| 326 // otherwise the controller may be waiting for a page flip while the window |
| 327 // tries to schedule another buffer. |
| 328 if (should_enable) |
| 329 EnableController(controller); |
| 321 } | 330 } |
| 322 } | 331 } |
| 323 | 332 |
| 324 OverlayPlane ScreenManager::GetModesetBuffer( | 333 OverlayPlane ScreenManager::GetModesetBuffer( |
| 325 HardwareDisplayController* controller, | 334 HardwareDisplayController* controller, |
| 326 const gfx::Rect& bounds) { | 335 const gfx::Rect& bounds) { |
| 327 DrmWindow* window = FindWindowAt(bounds); | 336 DrmWindow* window = FindWindowAt(bounds); |
| 328 if (window) { | 337 if (window) { |
| 329 const OverlayPlane* primary = window->GetLastModesetBuffer(); | 338 const OverlayPlane* primary = window->GetLastModesetBuffer(); |
| 330 if (primary && primary->buffer->GetSize() == bounds.size()) | 339 if (primary && primary->buffer->GetSize() == bounds.size()) |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 DrmWindow* ScreenManager::FindWindowAt(const gfx::Rect& bounds) const { | 384 DrmWindow* ScreenManager::FindWindowAt(const gfx::Rect& bounds) const { |
| 376 for (auto pair : window_map_) { | 385 for (auto pair : window_map_) { |
| 377 if (pair.second->bounds() == bounds) | 386 if (pair.second->bounds() == bounds) |
| 378 return pair.second; | 387 return pair.second; |
| 379 } | 388 } |
| 380 | 389 |
| 381 return nullptr; | 390 return nullptr; |
| 382 } | 391 } |
| 383 | 392 |
| 384 } // namespace ui | 393 } // namespace ui |
| OLD | NEW |