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

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: 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
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 14 matching lines...) Expand all
25 drm_->plane_manager()->planes(); 25 drm_->plane_manager()->planes();
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 SignalPageFlipRequest(); 35 SignalPageFlipRequest(gfx::SwapResult::SWAP_ACK);
36 } 36 }
37 } 37 }
38 38
39 bool CrtcController::Modeset(const OverlayPlane& plane, drmModeModeInfo mode) { 39 bool CrtcController::Modeset(const OverlayPlane& plane, drmModeModeInfo mode) {
40 if (!drm_->SetCrtc(crtc_, plane.buffer->GetFramebufferId(), 40 if (!drm_->SetCrtc(crtc_, plane.buffer->GetFramebufferId(),
41 std::vector<uint32_t>(1, connector_), &mode)) { 41 std::vector<uint32_t>(1, connector_), &mode)) {
42 PLOG(ERROR) << "Failed to modeset: crtc=" << crtc_ 42 PLOG(ERROR) << "Failed to modeset: crtc=" << crtc_
43 << " connector=" << connector_ 43 << " connector=" << connector_
44 << " framebuffer_id=" << plane.buffer->GetFramebufferId() 44 << " framebuffer_id=" << plane.buffer->GetFramebufferId()
45 << " mode=" << mode.hdisplay << "x" << mode.vdisplay << "@" 45 << " mode=" << mode.hdisplay << "x" << mode.vdisplay << "@"
(...skipping 19 matching lines...) Expand all
65 } 65 }
66 66
67 bool CrtcController::Disable() { 67 bool CrtcController::Disable() {
68 if (is_disabled_) 68 if (is_disabled_)
69 return true; 69 return true;
70 70
71 is_disabled_ = true; 71 is_disabled_ = true;
72 return drm_->DisableCrtc(crtc_); 72 return drm_->DisableCrtc(crtc_);
73 } 73 }
74 74
75 bool CrtcController::SchedulePageFlip( 75 bool CrtcController::SchedulePageFlip(
spang 2015/10/29 20:59:20 Still two statuses being returned here.
76 HardwareDisplayPlaneList* plane_list, 76 HardwareDisplayPlaneList* plane_list,
77 const OverlayPlaneList& overlays, 77 const OverlayPlaneList& overlays,
78 bool test_only, 78 bool test_only,
79 scoped_refptr<PageFlipRequest> page_flip_request) { 79 scoped_refptr<PageFlipRequest> page_flip_request) {
80 DCHECK(!page_flip_request_.get() || test_only); 80 DCHECK(!page_flip_request_.get() || test_only);
81 DCHECK(!is_disabled_); 81 DCHECK(!is_disabled_);
82 const OverlayPlane* primary = OverlayPlane::GetPrimaryPlane(overlays); 82 const OverlayPlane* primary = OverlayPlane::GetPrimaryPlane(overlays);
83 if (!primary) { 83 if (!primary) {
84 LOG(ERROR) << "No primary plane to display on crtc " << crtc_; 84 LOG(ERROR) << "No primary plane to display on crtc " << crtc_;
85 page_flip_request->Signal(gfx::SwapResult::SWAP_ACK); 85 page_flip_request->Signal(gfx::SwapResult::SWAP_ACK);
(...skipping 25 matching lines...) Expand all
111 } 111 }
112 112
113 return true; 113 return true;
114 } 114 }
115 115
116 std::vector<uint32_t> CrtcController::GetCompatibleHardwarePlaneIds( 116 std::vector<uint32_t> CrtcController::GetCompatibleHardwarePlaneIds(
117 const OverlayPlane& plane) const { 117 const OverlayPlane& plane) const {
118 return drm_->plane_manager()->GetCompatibleHardwarePlaneIds(plane, crtc_); 118 return drm_->plane_manager()->GetCompatibleHardwarePlaneIds(plane, crtc_);
119 } 119 }
120 120
121 void CrtcController::PageFlipFailed() {
122 pending_planes_.clear();
123 SignalPageFlipRequest();
124 }
125
126 void CrtcController::OnPageFlipEvent(unsigned int frame, 121 void CrtcController::OnPageFlipEvent(unsigned int frame,
127 unsigned int seconds, 122 unsigned int seconds,
128 unsigned int useconds) { 123 unsigned int useconds) {
129 time_of_last_flip_ = 124 time_of_last_flip_ =
130 static_cast<uint64_t>(seconds) * base::Time::kMicrosecondsPerSecond + 125 static_cast<uint64_t>(seconds) * base::Time::kMicrosecondsPerSecond +
131 useconds; 126 useconds;
132 127
133 current_planes_.clear(); 128 current_planes_.clear();
134 current_planes_.swap(pending_planes_); 129 current_planes_.swap(pending_planes_);
spang 2015/10/29 20:59:20 I think it should be moved to SignalPageFlipReques
dnicoara 2015/10/30 14:59:31 Acknowledged.
135 130
136 SignalPageFlipRequest(); 131 SignalPageFlipRequest(gfx::SwapResult::SWAP_ACK);
137 } 132 }
138 133
139 bool CrtcController::SetCursor(const scoped_refptr<ScanoutBuffer>& buffer) { 134 bool CrtcController::SetCursor(const scoped_refptr<ScanoutBuffer>& buffer) {
140 DCHECK(!is_disabled_ || !buffer); 135 DCHECK(!is_disabled_ || !buffer);
141 cursor_buffer_ = buffer; 136 cursor_buffer_ = buffer;
142 137
143 return ResetCursor(); 138 return ResetCursor();
144 } 139 }
145 140
146 bool CrtcController::MoveCursor(const gfx::Point& location) { 141 bool CrtcController::MoveCursor(const gfx::Point& location) {
(...skipping 13 matching lines...) Expand all
160 bool status = drm_->SetCursor(crtc_, handle, size); 155 bool status = drm_->SetCursor(crtc_, handle, size);
161 if (!status) { 156 if (!status) {
162 PLOG(ERROR) << "drmModeSetCursor: device " << drm_->device_path().value() 157 PLOG(ERROR) << "drmModeSetCursor: device " << drm_->device_path().value()
163 << " crtc " << crtc_ << " handle " << handle << " size " 158 << " crtc " << crtc_ << " handle " << handle << " size "
164 << size.ToString(); 159 << size.ToString();
165 } 160 }
166 161
167 return status; 162 return status;
168 } 163 }
169 164
170 void CrtcController::SignalPageFlipRequest() { 165 void CrtcController::SignalPageFlipRequest(gfx::SwapResult result) {
166 pending_planes_.clear();
171 if (page_flip_request_.get()) { 167 if (page_flip_request_.get()) {
spang 2015/10/29 20:59:20 When is this false?
dnicoara 2015/10/30 14:59:31 This was needed when HDC::SchedulePageFlip() was r
dnicoara 2015/10/30 17:21:59 Actually, sorry, you're right, it shouldn't be pos
172 // If another frame is queued up and available immediately, calling Signal() 168 // If another frame is queued up and available immediately, calling Signal()
173 // may result in a call to SchedulePageFlip(), which will override 169 // may result in a call to SchedulePageFlip(), which will override
174 // page_flip_request_ and possibly release the ref. Stash previous request 170 // page_flip_request_ and possibly release the ref. Stash previous request
175 // locally to avoid deleting the object we are making a call on. 171 // locally to avoid deleting the object we are making a call on.
176 scoped_refptr<PageFlipRequest> last_request; 172 scoped_refptr<PageFlipRequest> last_request;
177 last_request.swap(page_flip_request_); 173 last_request.swap(page_flip_request_);
178 last_request->Signal(gfx::SwapResult::SWAP_ACK); 174 last_request->Signal(result);
179 } 175 }
180 } 176 }
181 177
182 } // namespace ui 178 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698