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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 bool CrtcController::SchedulePageFlip( | 69 bool CrtcController::SchedulePageFlip( |
70 HardwareDisplayPlaneList* plane_list, | 70 HardwareDisplayPlaneList* plane_list, |
71 const OverlayPlaneList& overlays, | 71 const OverlayPlaneList& overlays, |
72 bool test_only, | 72 bool test_only, |
73 scoped_refptr<PageFlipRequest> page_flip_request) { | 73 scoped_refptr<PageFlipRequest> page_flip_request) { |
74 DCHECK(!page_flip_request_.get()); | 74 DCHECK(!page_flip_request_.get()); |
75 DCHECK(!is_disabled_); | 75 DCHECK(!is_disabled_); |
76 const OverlayPlane* primary = OverlayPlane::GetPrimaryPlane(overlays); | 76 const OverlayPlane* primary = OverlayPlane::GetPrimaryPlane(overlays); |
77 if (!primary) { | 77 if (!primary) { |
78 LOG(ERROR) << "No primary plane to display on crtc " << crtc_; | 78 LOG(ERROR) << "No primary plane to display on crtc " << crtc_; |
79 page_flip_request->Signal(gfx::SwapResult::SWAP_ACK); | 79 page_flip_request->Signal(); |
80 return true; | 80 return true; |
81 } | 81 } |
82 DCHECK(primary->buffer.get()); | 82 DCHECK(primary->buffer.get()); |
83 | 83 |
84 if (primary->buffer->GetSize() != gfx::Size(mode_.hdisplay, mode_.vdisplay)) { | 84 if (primary->buffer->GetSize() != gfx::Size(mode_.hdisplay, mode_.vdisplay)) { |
85 VLOG(2) << "Trying to pageflip a buffer with the wrong size. Expected " | 85 VLOG(2) << "Trying to pageflip a buffer with the wrong size. Expected " |
86 << mode_.hdisplay << "x" << mode_.vdisplay << " got " | 86 << mode_.hdisplay << "x" << mode_.vdisplay << " got " |
87 << primary->buffer->GetSize().ToString() << " for" | 87 << primary->buffer->GetSize().ToString() << " for" |
88 << " crtc=" << crtc_ << " connector=" << connector_; | 88 << " crtc=" << crtc_ << " connector=" << connector_; |
89 page_flip_request->Signal(gfx::SwapResult::SWAP_ACK); | 89 page_flip_request->Signal(); |
90 return true; | 90 return true; |
91 } | 91 } |
92 | 92 |
93 if (!drm_->plane_manager()->AssignOverlayPlanes(plane_list, overlays, crtc_, | 93 if (!drm_->plane_manager()->AssignOverlayPlanes(plane_list, overlays, crtc_, |
94 this)) { | 94 this)) { |
95 PLOG(ERROR) << "Failed to assign overlay planes for crtc " << crtc_; | 95 PLOG(ERROR) << "Failed to assign overlay planes for crtc " << crtc_; |
96 page_flip_request->Signal(gfx::SwapResult::SWAP_FAILED); | 96 page_flip_request->Signal(); |
97 return false; | 97 return false; |
98 } | 98 } |
99 | 99 |
100 if (test_only) { | 100 if (test_only) { |
101 page_flip_request->Signal(gfx::SwapResult::SWAP_ACK); | 101 page_flip_request->Signal(); |
102 } else { | 102 } else { |
103 pending_planes_ = overlays; | 103 pending_planes_ = overlays; |
104 page_flip_request_ = page_flip_request; | 104 page_flip_request_ = page_flip_request; |
105 } | 105 } |
106 | 106 |
107 return true; | 107 return true; |
108 } | 108 } |
109 | 109 |
110 void CrtcController::PageFlipFailed() { | 110 void CrtcController::PageFlipFailed() { |
111 pending_planes_.clear(); | 111 pending_planes_.clear(); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 } | 157 } |
158 | 158 |
159 void CrtcController::SignalPageFlipRequest() { | 159 void CrtcController::SignalPageFlipRequest() { |
160 if (page_flip_request_.get()) { | 160 if (page_flip_request_.get()) { |
161 // If another frame is queued up and available immediately, calling Signal() | 161 // If another frame is queued up and available immediately, calling Signal() |
162 // may result in a call to SchedulePageFlip(), which will override | 162 // may result in a call to SchedulePageFlip(), which will override |
163 // page_flip_request_ and possibly release the ref. Stash previous request | 163 // page_flip_request_ and possibly release the ref. Stash previous request |
164 // locally to avoid deleting the object we are making a call on. | 164 // locally to avoid deleting the object we are making a call on. |
165 scoped_refptr<PageFlipRequest> last_request; | 165 scoped_refptr<PageFlipRequest> last_request; |
166 last_request.swap(page_flip_request_); | 166 last_request.swap(page_flip_request_); |
167 last_request->Signal(gfx::SwapResult::SWAP_ACK); | 167 last_request->Signal(); |
168 } | 168 } |
169 } | 169 } |
170 | 170 |
171 } // namespace ui | 171 } // namespace ui |
OLD | NEW |