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/hardware_display_plane_manager.h" | 5 #include "ui/ozone/platform/drm/gpu/hardware_display_plane_manager.h" |
6 | 6 |
7 #include <drm.h> | 7 #include <drm.h> |
8 #include <xf86drm.h> | 8 #include <xf86drm.h> |
9 | 9 |
10 #include <set> | 10 #include <set> |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 ScopedDrmPlanePtr drm_plane( | 102 ScopedDrmPlanePtr drm_plane( |
103 drmModeGetPlane(drm->get_fd(), plane_resources->planes[i])); | 103 drmModeGetPlane(drm->get_fd(), plane_resources->planes[i])); |
104 if (!drm_plane) { | 104 if (!drm_plane) { |
105 PLOG(ERROR) << "Failed to get plane " << i; | 105 PLOG(ERROR) << "Failed to get plane " << i; |
106 return false; | 106 return false; |
107 } | 107 } |
108 plane_ids.insert(drm_plane->plane_id); | 108 plane_ids.insert(drm_plane->plane_id); |
109 scoped_ptr<HardwareDisplayPlane> plane( | 109 scoped_ptr<HardwareDisplayPlane> plane( |
110 CreatePlane(drm_plane->plane_id, drm_plane->possible_crtcs)); | 110 CreatePlane(drm_plane->plane_id, drm_plane->possible_crtcs)); |
111 if (plane->Initialize(drm)) | 111 if (plane->Initialize(drm)) |
112 planes_.push_back(plane.release()); | 112 planes_.push_back(plane.Pass()); |
113 } | 113 } |
114 | 114 |
115 // crbug.com/464085: if driver reports no primary planes for a crtc, create a | 115 // crbug.com/464085: if driver reports no primary planes for a crtc, create a |
116 // dummy plane for which we can assign exactly one overlay. | 116 // dummy plane for which we can assign exactly one overlay. |
117 // TODO(dnicoara): refactor this to simplify AssignOverlayPlanes and move | 117 // TODO(dnicoara): refactor this to simplify AssignOverlayPlanes and move |
118 // this workaround into HardwareDisplayPlaneLegacy. | 118 // this workaround into HardwareDisplayPlaneLegacy. |
119 if (!has_universal_planes) { | 119 if (!has_universal_planes) { |
120 for (int i = 0; i < resources->count_crtcs; ++i) { | 120 for (int i = 0; i < resources->count_crtcs; ++i) { |
121 if (plane_ids.find(resources->crtcs[i] - 1) == plane_ids.end()) { | 121 if (plane_ids.find(resources->crtcs[i] - 1) == plane_ids.end()) { |
122 scoped_ptr<HardwareDisplayPlane> dummy_plane( | 122 scoped_ptr<HardwareDisplayPlane> dummy_plane( |
123 CreatePlane(resources->crtcs[i] - 1, (1 << i))); | 123 CreatePlane(resources->crtcs[i] - 1, (1 << i))); |
124 dummy_plane->set_is_dummy(true); | 124 dummy_plane->set_is_dummy(true); |
125 if (dummy_plane->Initialize(drm)) | 125 if (dummy_plane->Initialize(drm)) |
126 planes_.push_back(dummy_plane.release()); | 126 planes_.push_back(dummy_plane.Pass()); |
127 } | 127 } |
128 } | 128 } |
129 } | 129 } |
130 | 130 |
131 std::sort(planes_.begin(), planes_.end(), | 131 std::sort(planes_.begin(), planes_.end(), |
132 [](HardwareDisplayPlane* l, HardwareDisplayPlane* r) { | 132 [](HardwareDisplayPlane* l, HardwareDisplayPlane* r) { |
133 return l->plane_id() < r->plane_id(); | 133 return l->plane_id() < r->plane_id(); |
134 }); | 134 }); |
135 return true; | 135 return true; |
136 } | 136 } |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 if (plane->owning_crtc() == crtc_id) { | 227 if (plane->owning_crtc() == crtc_id) { |
228 plane->set_owning_crtc(0); | 228 plane->set_owning_crtc(0); |
229 plane->set_in_use(false); | 229 plane->set_in_use(false); |
230 } else { | 230 } else { |
231 plane_list->old_plane_list.push_back(plane); | 231 plane_list->old_plane_list.push_back(plane); |
232 } | 232 } |
233 } | 233 } |
234 } | 234 } |
235 | 235 |
236 } // namespace ui | 236 } // namespace ui |
OLD | NEW |