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

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

Issue 1041823002: [Ozone-Drm] Pick pending buffer over current buffer when modesetting (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years, 8 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/hardware_display_controller.h ('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/hardware_display_controller.h" 5 #include "ui/ozone/platform/drm/gpu/hardware_display_controller.h"
6 6
7 #include <drm.h> 7 #include <drm.h>
8 #include <string.h> 8 #include <string.h>
9 #include <xf86drm.h> 9 #include <xf86drm.h>
10 10
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 TRACE_EVENT0("drm", "HDC::Modeset"); 49 TRACE_EVENT0("drm", "HDC::Modeset");
50 DCHECK(primary.buffer.get()); 50 DCHECK(primary.buffer.get());
51 bool status = true; 51 bool status = true;
52 for (size_t i = 0; i < crtc_controllers_.size(); ++i) 52 for (size_t i = 0; i < crtc_controllers_.size(); ++i)
53 status &= crtc_controllers_[i]->Modeset(primary, mode); 53 status &= crtc_controllers_[i]->Modeset(primary, mode);
54 54
55 is_disabled_ = false; 55 is_disabled_ = false;
56 mode_ = mode; 56 mode_ = mode;
57 57
58 current_planes_ = std::vector<OverlayPlane>(1, primary); 58 current_planes_ = std::vector<OverlayPlane>(1, primary);
59 pending_planes_.clear();
60 ClearPendingRequests(); 59 ClearPendingRequests();
61 60
62 // Because a page flip is pending we need to leave some state for the 61 // Because a page flip is pending we need to leave some state for the
63 // callback. We use the modeset state since it is the only valid state. 62 // callback. We use the modeset state since it is the only valid state.
64 if (HasPendingPageFlips()) 63 if (HasPendingPageFlips())
65 requests_.push_back( 64 requests_.push_back(
66 PageFlipRequest(current_planes_, false, base::Bind(&base::DoNothing))); 65 PageFlipRequest(current_planes_, false, base::Bind(&base::DoNothing)));
67 66
68 return status; 67 return status;
69 } 68 }
70 69
71 bool HardwareDisplayController::Enable() { 70 bool HardwareDisplayController::Enable() {
72 TRACE_EVENT0("drm", "HDC::Enable"); 71 TRACE_EVENT0("drm", "HDC::Enable");
73 DCHECK(!current_planes_.empty()); 72 DCHECK(!current_planes_.empty());
74 const OverlayPlane* primary = OverlayPlane::GetPrimaryPlane(current_planes_); 73
74 const OverlayPlane* primary = nullptr;
75 // Use the last scheduled buffer to modeset to preserve request order.
76 if (!requests_.empty())
77 primary = OverlayPlane::GetPrimaryPlane(requests_.back().planes);
78 else
79 primary = OverlayPlane::GetPrimaryPlane(current_planes_);
75 80
76 return Modeset(*primary, mode_); 81 return Modeset(*primary, mode_);
77 } 82 }
78 83
79 void HardwareDisplayController::Disable() { 84 void HardwareDisplayController::Disable() {
80 TRACE_EVENT0("drm", "HDC::Disable"); 85 TRACE_EVENT0("drm", "HDC::Disable");
81 for (size_t i = 0; i < crtc_controllers_.size(); ++i) 86 for (size_t i = 0; i < crtc_controllers_.size(); ++i)
82 crtc_controllers_[i]->Disable(); 87 crtc_controllers_[i]->Disable();
83 88
84 is_disabled_ = true; 89 is_disabled_ = true;
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 323
319 void HardwareDisplayController::ClearPendingRequests() { 324 void HardwareDisplayController::ClearPendingRequests() {
320 while (!requests_.empty()) { 325 while (!requests_.empty()) {
321 PageFlipRequest request = requests_.front(); 326 PageFlipRequest request = requests_.front();
322 requests_.pop_front(); 327 requests_.pop_front();
323 request.callback.Run(); 328 request.callback.Run();
324 } 329 }
325 } 330 }
326 331
327 } // namespace ui 332 } // namespace ui
OLDNEW
« no previous file with comments | « ui/ozone/platform/drm/gpu/hardware_display_controller.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698