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 | 69 |
70 bool CrtcController::SchedulePageFlip( | 70 bool CrtcController::SchedulePageFlip( |
71 HardwareDisplayPlaneList* plane_list, | 71 HardwareDisplayPlaneList* plane_list, |
72 const OverlayPlaneList& overlays, | 72 const OverlayPlaneList& overlays, |
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(); | 79 page_flip_request->Signal(gfx::SwapAck); |
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(); | 89 page_flip_request->Signal(gfx::SwapAck); |
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(); | 96 page_flip_request->Signal(gfx::SwapFailed); |
97 return false; | 97 return false; |
98 } | 98 } |
99 | 99 |
100 pending_planes_ = overlays; | 100 pending_planes_ = overlays; |
101 page_flip_request_ = page_flip_request; | 101 page_flip_request_ = page_flip_request; |
102 | 102 |
103 return true; | 103 return true; |
104 } | 104 } |
105 | 105 |
106 void CrtcController::PageFlipFailed() { | 106 void CrtcController::PageFlipFailed() { |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 } | 153 } |
154 | 154 |
155 void CrtcController::SignalPageFlipRequest() { | 155 void CrtcController::SignalPageFlipRequest() { |
156 if (page_flip_request_.get()) { | 156 if (page_flip_request_.get()) { |
157 // If another frame is queued up and available immediately, calling Signal() | 157 // If another frame is queued up and available immediately, calling Signal() |
158 // may result in a call to SchedulePageFlip(), which will override | 158 // may result in a call to SchedulePageFlip(), which will override |
159 // page_flip_request_ and possibly release the ref. Stash previous request | 159 // page_flip_request_ and possibly release the ref. Stash previous request |
160 // locally to avoid deleting the object we are making a call on. | 160 // locally to avoid deleting the object we are making a call on. |
161 scoped_refptr<PageFlipRequest> last_request; | 161 scoped_refptr<PageFlipRequest> last_request; |
162 last_request.swap(page_flip_request_); | 162 last_request.swap(page_flip_request_); |
163 last_request->Signal(); | 163 last_request->Signal(gfx::SwapAck); |
164 } | 164 } |
165 } | 165 } |
166 | 166 |
167 } // namespace ui | 167 } // namespace ui |
OLD | NEW |