Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(388)

Side by Side Diff: ui/ozone/platform/drm/gpu/screen_manager.cc

Issue 1327413003: [Ozone-DRM] Modeset when re-mapping windows to controllers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@fix-scanout2
Patch Set: fixed unittests Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/ozone/platform/drm/gpu/drm_window_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 gfx::Rect(controller->origin(), controller->GetModeSize())); 285 gfx::Rect(controller->origin(), controller->GetModeSize()));
286 if (!window) 286 if (!window)
287 continue; 287 continue;
288 288
289 window_to_controller_map[window] = controller; 289 window_to_controller_map[window] = controller;
290 } 290 }
291 291
292 // Apply the new mapping to all windows. 292 // Apply the new mapping to all windows.
293 for (auto pair : window_map_) { 293 for (auto pair : window_map_) {
294 auto it = window_to_controller_map.find(pair.second); 294 auto it = window_to_controller_map.find(pair.second);
295 HardwareDisplayController* controller = nullptr;
295 if (it != window_to_controller_map.end()) 296 if (it != window_to_controller_map.end())
296 pair.second->SetController(it->second); 297 controller = it->second;
297 else 298
298 pair.second->SetController(nullptr); 299 bool should_enable =
300 controller && pair.second->GetController() != controller;
301 pair.second->SetController(controller);
302
303 // If we're moving windows between controllers modeset the controller
304 // otherwise the controller may be waiting for a page flip while the window
305 // tries to schedule another buffer.
306 if (should_enable)
307 EnableController(controller, controller->origin(),
308 controller->get_mode());
299 } 309 }
300 } 310 }
301 311
302 bool ScreenManager::EnableController(HardwareDisplayController* controller, 312 bool ScreenManager::EnableController(HardwareDisplayController* controller,
303 const gfx::Point& origin, 313 const gfx::Point& origin,
304 const drmModeModeInfo& mode) { 314 const drmModeModeInfo& mode) {
305 DCHECK(!controller->crtc_controllers().empty()); 315 DCHECK(!controller->crtc_controllers().empty());
306 gfx::Rect rect(origin, gfx::Size(mode.hdisplay, mode.vdisplay)); 316 gfx::Rect rect(origin, gfx::Size(mode.hdisplay, mode.vdisplay));
307 controller->set_origin(origin); 317 controller->set_origin(origin);
308 318
(...skipping 30 matching lines...) Expand all
339 DrmWindow* ScreenManager::FindWindowAt(const gfx::Rect& bounds) const { 349 DrmWindow* ScreenManager::FindWindowAt(const gfx::Rect& bounds) const {
340 for (auto pair : window_map_) { 350 for (auto pair : window_map_) {
341 if (pair.second->bounds() == bounds) 351 if (pair.second->bounds() == bounds)
342 return pair.second; 352 return pair.second;
343 } 353 }
344 354
345 return nullptr; 355 return nullptr;
346 } 356 }
347 357
348 } // namespace ui 358 } // namespace ui
OLDNEW
« no previous file with comments | « ui/ozone/platform/drm/gpu/drm_window_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698