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

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

Issue 1418503012: [Ozone-DRM] Remove bool return value for SchedulePageFlip call (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased & updated Created 5 years, 1 month 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/crtc_controller.h ('k') | ui/ozone/platform/drm/gpu/drm_window.cc » ('j') | 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/crtc_controller.h" 5 #include "ui/ozone/platform/drm/gpu/crtc_controller.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/time/time.h" 8 #include "base/time/time.h"
9 #include "ui/ozone/platform/drm/gpu/drm_device.h" 9 #include "ui/ozone/platform/drm/gpu/drm_device.h"
10 #include "ui/ozone/platform/drm/gpu/page_flip_request.h" 10 #include "ui/ozone/platform/drm/gpu/page_flip_request.h"
(...skipping 15 matching lines...) Expand all
26 for (auto* plane : all_planes) { 26 for (auto* plane : all_planes) {
27 if (plane->owning_crtc() == crtc_) { 27 if (plane->owning_crtc() == crtc_) {
28 plane->set_owning_crtc(0); 28 plane->set_owning_crtc(0);
29 plane->set_in_use(false); 29 plane->set_in_use(false);
30 } 30 }
31 } 31 }
32 32
33 SetCursor(nullptr); 33 SetCursor(nullptr);
34 drm_->DisableCrtc(crtc_); 34 drm_->DisableCrtc(crtc_);
35 if (page_flip_request_) 35 if (page_flip_request_)
36 SignalPageFlipRequest(); 36 SignalPageFlipRequest(gfx::SwapResult::SWAP_ACK);
37 } 37 }
38 } 38 }
39 39
40 bool CrtcController::Modeset(const OverlayPlane& plane, drmModeModeInfo mode) { 40 bool CrtcController::Modeset(const OverlayPlane& plane, drmModeModeInfo mode) {
41 if (!drm_->SetCrtc(crtc_, plane.buffer->GetFramebufferId(), 41 if (!drm_->SetCrtc(crtc_, plane.buffer->GetFramebufferId(),
42 std::vector<uint32_t>(1, connector_), &mode)) { 42 std::vector<uint32_t>(1, connector_), &mode)) {
43 PLOG(ERROR) << "Failed to modeset: crtc=" << crtc_ 43 PLOG(ERROR) << "Failed to modeset: crtc=" << crtc_
44 << " connector=" << connector_ 44 << " connector=" << connector_
45 << " framebuffer_id=" << plane.buffer->GetFramebufferId() 45 << " framebuffer_id=" << plane.buffer->GetFramebufferId()
46 << " mode=" << mode.hdisplay << "x" << mode.vdisplay << "@" 46 << " mode=" << mode.hdisplay << "x" << mode.vdisplay << "@"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 } 112 }
113 113
114 return true; 114 return true;
115 } 115 }
116 116
117 std::vector<uint32_t> CrtcController::GetCompatibleHardwarePlaneIds( 117 std::vector<uint32_t> CrtcController::GetCompatibleHardwarePlaneIds(
118 const OverlayPlane& plane) const { 118 const OverlayPlane& plane) const {
119 return drm_->plane_manager()->GetCompatibleHardwarePlaneIds(plane, crtc_); 119 return drm_->plane_manager()->GetCompatibleHardwarePlaneIds(plane, crtc_);
120 } 120 }
121 121
122 void CrtcController::PageFlipFailed() {
123 pending_planes_.clear();
124 SignalPageFlipRequest();
125 }
126
127 void CrtcController::OnPageFlipEvent(unsigned int frame, 122 void CrtcController::OnPageFlipEvent(unsigned int frame,
128 unsigned int seconds, 123 unsigned int seconds,
129 unsigned int useconds) { 124 unsigned int useconds) {
130 time_of_last_flip_ = 125 time_of_last_flip_ =
131 static_cast<uint64_t>(seconds) * base::Time::kMicrosecondsPerSecond + 126 static_cast<uint64_t>(seconds) * base::Time::kMicrosecondsPerSecond +
132 useconds; 127 useconds;
133 128
134 current_planes_.clear(); 129 SignalPageFlipRequest(gfx::SwapResult::SWAP_ACK);
135 current_planes_.swap(pending_planes_);
136
137 SignalPageFlipRequest();
138 } 130 }
139 131
140 bool CrtcController::SetCursor(const scoped_refptr<ScanoutBuffer>& buffer) { 132 bool CrtcController::SetCursor(const scoped_refptr<ScanoutBuffer>& buffer) {
141 DCHECK(!is_disabled_ || !buffer); 133 DCHECK(!is_disabled_ || !buffer);
142 cursor_buffer_ = buffer; 134 cursor_buffer_ = buffer;
143 135
144 return ResetCursor(); 136 return ResetCursor();
145 } 137 }
146 138
147 bool CrtcController::MoveCursor(const gfx::Point& location) { 139 bool CrtcController::MoveCursor(const gfx::Point& location) {
(...skipping 13 matching lines...) Expand all
161 bool status = drm_->SetCursor(crtc_, handle, size); 153 bool status = drm_->SetCursor(crtc_, handle, size);
162 if (!status) { 154 if (!status) {
163 PLOG(ERROR) << "drmModeSetCursor: device " << drm_->device_path().value() 155 PLOG(ERROR) << "drmModeSetCursor: device " << drm_->device_path().value()
164 << " crtc " << crtc_ << " handle " << handle << " size " 156 << " crtc " << crtc_ << " handle " << handle << " size "
165 << size.ToString(); 157 << size.ToString();
166 } 158 }
167 159
168 return status; 160 return status;
169 } 161 }
170 162
171 void CrtcController::SignalPageFlipRequest() { 163 void CrtcController::SignalPageFlipRequest(gfx::SwapResult result) {
164 if (result == gfx::SwapResult::SWAP_ACK)
165 current_planes_.swap(pending_planes_);
166
167 pending_planes_.clear();
168
172 scoped_refptr<PageFlipRequest> request; 169 scoped_refptr<PageFlipRequest> request;
173 request.swap(page_flip_request_); 170 request.swap(page_flip_request_);
174 request->Signal(gfx::SwapResult::SWAP_ACK); 171 request->Signal(result);
175 } 172 }
176 173
177 } // namespace ui 174 } // namespace ui
OLDNEW
« no previous file with comments | « ui/ozone/platform/drm/gpu/crtc_controller.h ('k') | ui/ozone/platform/drm/gpu/drm_window.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698