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/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 Loading... |
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 if (page_flip_request_) |
| 36 SignalPageFlipRequest(); |
36 } | 37 } |
37 } | 38 } |
38 | 39 |
39 bool CrtcController::Modeset(const OverlayPlane& plane, drmModeModeInfo mode) { | 40 bool CrtcController::Modeset(const OverlayPlane& plane, drmModeModeInfo mode) { |
40 if (!drm_->SetCrtc(crtc_, plane.buffer->GetFramebufferId(), | 41 if (!drm_->SetCrtc(crtc_, plane.buffer->GetFramebufferId(), |
41 std::vector<uint32_t>(1, connector_), &mode)) { | 42 std::vector<uint32_t>(1, connector_), &mode)) { |
42 PLOG(ERROR) << "Failed to modeset: crtc=" << crtc_ | 43 PLOG(ERROR) << "Failed to modeset: crtc=" << crtc_ |
43 << " connector=" << connector_ | 44 << " connector=" << connector_ |
44 << " framebuffer_id=" << plane.buffer->GetFramebufferId() | 45 << " framebuffer_id=" << plane.buffer->GetFramebufferId() |
45 << " mode=" << mode.hdisplay << "x" << mode.vdisplay << "@" | 46 << " mode=" << mode.hdisplay << "x" << mode.vdisplay << "@" |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 if (!status) { | 162 if (!status) { |
162 PLOG(ERROR) << "drmModeSetCursor: device " << drm_->device_path().value() | 163 PLOG(ERROR) << "drmModeSetCursor: device " << drm_->device_path().value() |
163 << " crtc " << crtc_ << " handle " << handle << " size " | 164 << " crtc " << crtc_ << " handle " << handle << " size " |
164 << size.ToString(); | 165 << size.ToString(); |
165 } | 166 } |
166 | 167 |
167 return status; | 168 return status; |
168 } | 169 } |
169 | 170 |
170 void CrtcController::SignalPageFlipRequest() { | 171 void CrtcController::SignalPageFlipRequest() { |
171 if (page_flip_request_.get()) { | 172 scoped_refptr<PageFlipRequest> request; |
172 // If another frame is queued up and available immediately, calling Signal() | 173 request.swap(page_flip_request_); |
173 // may result in a call to SchedulePageFlip(), which will override | 174 request->Signal(gfx::SwapResult::SWAP_ACK); |
174 // page_flip_request_ and possibly release the ref. Stash previous request | |
175 // locally to avoid deleting the object we are making a call on. | |
176 scoped_refptr<PageFlipRequest> last_request; | |
177 last_request.swap(page_flip_request_); | |
178 last_request->Signal(gfx::SwapResult::SWAP_ACK); | |
179 } | |
180 } | 175 } |
181 | 176 |
182 } // namespace ui | 177 } // namespace ui |
OLD | NEW |