| 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" |
| 11 #include "ui/ozone/platform/drm/gpu/scanout_buffer.h" | 11 #include "ui/ozone/platform/drm/gpu/scanout_buffer.h" |
| 12 | 12 |
| 13 namespace ui { | 13 namespace ui { |
| 14 | 14 |
| 15 CrtcController::CrtcController(const scoped_refptr<DrmDevice>& drm, | 15 CrtcController::CrtcController(const scoped_refptr<DrmDevice>& drm, |
| 16 uint32_t crtc, | 16 uint32_t crtc, |
| 17 uint32_t connector) | 17 uint32_t connector) |
| 18 : drm_(drm), | 18 : drm_(drm), |
| 19 overlay_plane_manager_(nullptr), | 19 overlay_plane_manager_(nullptr), |
| 20 crtc_(crtc), | 20 crtc_(crtc), |
| 21 connector_(connector) {} | 21 connector_(connector) {} |
| 22 | 22 |
| 23 CrtcController::~CrtcController() { | 23 CrtcController::~CrtcController() { |
| 24 if (!is_disabled_) { | 24 if (!is_disabled_) { |
| 25 const ScopedVector<HardwareDisplayPlane>& all_planes = |
| 26 drm_->plane_manager()->planes(); |
| 27 for (auto* plane : all_planes) { |
| 28 if (plane->owning_crtc() == crtc_) { |
| 29 plane->set_owning_crtc(0); |
| 30 plane->set_in_use(false); |
| 31 } |
| 32 } |
| 33 |
| 25 SetCursor(nullptr); | 34 SetCursor(nullptr); |
| 26 drm_->DisableCrtc(crtc_); | 35 drm_->DisableCrtc(crtc_); |
| 27 SignalPageFlipRequest(); | 36 SignalPageFlipRequest(); |
| 28 } | 37 } |
| 29 } | 38 } |
| 30 | 39 |
| 31 bool CrtcController::Modeset(const OverlayPlane& plane, drmModeModeInfo mode) { | 40 bool CrtcController::Modeset(const OverlayPlane& plane, drmModeModeInfo mode) { |
| 32 if (!drm_->SetCrtc(crtc_, plane.buffer->GetFramebufferId(), | 41 if (!drm_->SetCrtc(crtc_, plane.buffer->GetFramebufferId(), |
| 33 std::vector<uint32_t>(1, connector_), &mode)) { | 42 std::vector<uint32_t>(1, connector_), &mode)) { |
| 34 PLOG(ERROR) << "Failed to modeset: crtc=" << crtc_ | 43 PLOG(ERROR) << "Failed to modeset: crtc=" << crtc_ |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 // may result in a call to SchedulePageFlip(), which will override | 169 // may result in a call to SchedulePageFlip(), which will override |
| 161 // page_flip_request_ and possibly release the ref. Stash previous request | 170 // page_flip_request_ and possibly release the ref. Stash previous request |
| 162 // 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. |
| 163 scoped_refptr<PageFlipRequest> last_request; | 172 scoped_refptr<PageFlipRequest> last_request; |
| 164 last_request.swap(page_flip_request_); | 173 last_request.swap(page_flip_request_); |
| 165 last_request->Signal(gfx::SwapResult::SWAP_ACK); | 174 last_request->Signal(gfx::SwapResult::SWAP_ACK); |
| 166 } | 175 } |
| 167 } | 176 } |
| 168 | 177 |
| 169 } // namespace ui | 178 } // namespace ui |
| OLD | NEW |