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/dri/hardware_display_controller.h" | 5 #include "ui/ozone/platform/dri/hardware_display_controller.h" |
6 | 6 |
7 #include <drm.h> | 7 #include <drm.h> |
8 #include <errno.h> | 8 #include <errno.h> |
9 #include <string.h> | 9 #include <string.h> |
10 #include <xf86drm.h> | 10 #include <xf86drm.h> |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
112 TRACE_EVENT0("dri", "HDC::WaitForPageFlipEvent"); | 112 TRACE_EVENT0("dri", "HDC::WaitForPageFlipEvent"); |
113 | 113 |
114 drmEventContext drm_event; | 114 drmEventContext drm_event; |
115 drm_event.version = DRM_EVENT_CONTEXT_VERSION; | 115 drm_event.version = DRM_EVENT_CONTEXT_VERSION; |
116 drm_event.page_flip_handler = HandlePageFlipEvent; | 116 drm_event.page_flip_handler = HandlePageFlipEvent; |
117 drm_event.vblank_handler = NULL; | 117 drm_event.vblank_handler = NULL; |
118 | 118 |
119 bool has_pending_page_flips = false; | 119 bool has_pending_page_flips = false; |
120 // Wait for the page-flips to complete. | 120 // Wait for the page-flips to complete. |
121 for (size_t i = 0; i < crtc_controllers_.size(); ++i) { | 121 for (size_t i = 0; i < crtc_controllers_.size(); ++i) { |
122 if (crtc_controllers_[i]->page_flip_pending()) { | 122 // Messages do not come in any particular order so we need to make sure the |
alexst (slow to review)
2014/10/09 20:54:40
This deals with messages from multiple monitors on
dnicoara
2014/10/10 13:54:00
Actually, it can be multiple CRTCs in mirror mode.
alexst (slow to review)
2014/10/10 15:50:55
Right, I actually like your response better than t
| |
123 // flip for the current controller has been processed. | |
124 while (crtc_controllers_[i]->page_flip_pending()) { | |
123 has_pending_page_flips = true; | 125 has_pending_page_flips = true; |
124 crtc_controllers_[i]->drm()->HandleEvent(drm_event); | 126 crtc_controllers_[i]->drm()->HandleEvent(drm_event); |
125 } | 127 } |
126 } | 128 } |
127 | 129 |
128 // In case there are no pending pageflips do not replace the current planes | 130 // In case there are no pending pageflips do not replace the current planes |
129 // since they are still being used. | 131 // since they are still being used. |
130 if (has_pending_page_flips) | 132 if (has_pending_page_flips) |
131 current_planes_.swap(pending_planes_); | 133 current_planes_.swap(pending_planes_); |
132 | 134 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
207 uint64_t HardwareDisplayController::GetTimeOfLastFlip() const { | 209 uint64_t HardwareDisplayController::GetTimeOfLastFlip() const { |
208 uint64_t time = 0; | 210 uint64_t time = 0; |
209 for (size_t i = 0; i < crtc_controllers_.size(); ++i) | 211 for (size_t i = 0; i < crtc_controllers_.size(); ++i) |
210 if (time < crtc_controllers_[i]->time_of_last_flip()) | 212 if (time < crtc_controllers_[i]->time_of_last_flip()) |
211 time = crtc_controllers_[i]->time_of_last_flip(); | 213 time = crtc_controllers_[i]->time_of_last_flip(); |
212 | 214 |
213 return time; | 215 return time; |
214 } | 216 } |
215 | 217 |
216 } // namespace ui | 218 } // namespace ui |
OLD | NEW |