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_plane_manager_legacy.h" | 5 #include "ui/ozone/platform/dri/hardware_display_plane_manager_legacy.h" |
6 | 6 |
| 7 #include "base/bind.h" |
7 #include "ui/ozone/platform/dri/crtc_controller.h" | 8 #include "ui/ozone/platform/dri/crtc_controller.h" |
8 #include "ui/ozone/platform/dri/dri_wrapper.h" | 9 #include "ui/ozone/platform/dri/dri_wrapper.h" |
9 #include "ui/ozone/platform/dri/scanout_buffer.h" | 10 #include "ui/ozone/platform/dri/scanout_buffer.h" |
10 | 11 |
11 namespace ui { | 12 namespace ui { |
12 | 13 |
13 HardwareDisplayPlaneManagerLegacy::HardwareDisplayPlaneManagerLegacy() { | 14 HardwareDisplayPlaneManagerLegacy::HardwareDisplayPlaneManagerLegacy() { |
14 } | 15 } |
15 | 16 |
16 HardwareDisplayPlaneManagerLegacy::~HardwareDisplayPlaneManagerLegacy() { | 17 HardwareDisplayPlaneManagerLegacy::~HardwareDisplayPlaneManagerLegacy() { |
17 } | 18 } |
18 | 19 |
19 bool HardwareDisplayPlaneManagerLegacy::Commit( | 20 bool HardwareDisplayPlaneManagerLegacy::Commit( |
20 HardwareDisplayPlaneList* plane_list) { | 21 HardwareDisplayPlaneList* plane_list) { |
21 if (plane_list->plane_list.empty()) // No assigned planes, nothing to do. | 22 if (plane_list->plane_list.empty()) // No assigned planes, nothing to do. |
22 return true; | 23 return true; |
23 bool ret = true; | 24 bool ret = true; |
24 plane_list->plane_list.swap(plane_list->old_plane_list); | 25 plane_list->plane_list.swap(plane_list->old_plane_list); |
25 plane_list->plane_list.clear(); | 26 plane_list->plane_list.clear(); |
26 for (const auto& flip : plane_list->legacy_page_flips) { | 27 for (const auto& flip : plane_list->legacy_page_flips) { |
27 // Permission Denied is a legitimate error | 28 // Permission Denied is a legitimate error |
28 if (!drm_->PageFlip(flip.crtc_id, flip.framebuffer, flip.crtc)) { | 29 if (!drm_->PageFlip(flip.crtc_id, flip.framebuffer, |
| 30 base::Bind(&CrtcController::OnPageFlipEvent, |
| 31 flip.crtc->AsWeakPtr()))) { |
29 if (errno != EACCES) { | 32 if (errno != EACCES) { |
30 LOG(ERROR) << "Cannot page flip: error='" << strerror(errno) << "'" | 33 LOG(ERROR) << "Cannot page flip: error='" << strerror(errno) << "'" |
31 << " crtc=" << flip.crtc_id | 34 << " crtc=" << flip.crtc_id |
32 << " framebuffer=" << flip.framebuffer; | 35 << " framebuffer=" << flip.framebuffer; |
33 LOG(ERROR) << "Failed to commit planes"; | 36 LOG(ERROR) << "Failed to commit planes"; |
34 ret = false; | 37 ret = false; |
35 } | 38 } |
36 flip.crtc->PageFlipFailed(); | 39 flip.crtc->PageFlipFailed(); |
37 } else { | 40 } else { |
38 for (const auto& plane : flip.planes) { | 41 for (const auto& plane : flip.planes) { |
(...skipping 28 matching lines...) Expand all Loading... |
67 } else { | 70 } else { |
68 plane_list->legacy_page_flips.back().planes.push_back( | 71 plane_list->legacy_page_flips.back().planes.push_back( |
69 HardwareDisplayPlaneList::PageFlipInfo::Plane( | 72 HardwareDisplayPlaneList::PageFlipInfo::Plane( |
70 hw_plane->plane_id(), overlay.buffer->GetFramebufferId(), | 73 hw_plane->plane_id(), overlay.buffer->GetFramebufferId(), |
71 overlay.display_bounds, src_rect)); | 74 overlay.display_bounds, src_rect)); |
72 } | 75 } |
73 return true; | 76 return true; |
74 } | 77 } |
75 | 78 |
76 } // namespace ui | 79 } // namespace ui |
OLD | NEW |