Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(34)

Side by Side Diff: ui/ozone/platform/drm/gpu/hardware_display_plane_manager.cc

Issue 1438343002: Remove deprecated ScopedVector usage from ui/ozone and ui/events/ozone (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove HDCI stuff Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_fourcc.h> 7 #include <drm_fourcc.h>
8 8
9 #include <set> 9 #include <set>
10 10
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 CreatePlane(resources->crtcs[i] - 1, (1 << i))); 123 CreatePlane(resources->crtcs[i] - 1, (1 << i)));
124 if (dummy_plane->Initialize(drm, std::vector<uint32_t>(), true, 124 if (dummy_plane->Initialize(drm, std::vector<uint32_t>(), true,
125 false)) { 125 false)) {
126 planes_.push_back(dummy_plane.Pass()); 126 planes_.push_back(dummy_plane.Pass());
127 } 127 }
128 } 128 }
129 } 129 }
130 } 130 }
131 131
132 std::sort(planes_.begin(), planes_.end(), 132 std::sort(planes_.begin(), planes_.end(),
133 [](HardwareDisplayPlane* l, HardwareDisplayPlane* r) { 133 [](const scoped_ptr<HardwareDisplayPlane>& l,
134 const scoped_ptr<HardwareDisplayPlane>& r) {
134 return l->plane_id() < r->plane_id(); 135 return l->plane_id() < r->plane_id();
135 }); 136 });
136 return true; 137 return true;
137 } 138 }
138 139
139 scoped_ptr<HardwareDisplayPlane> HardwareDisplayPlaneManager::CreatePlane( 140 scoped_ptr<HardwareDisplayPlane> HardwareDisplayPlaneManager::CreatePlane(
140 uint32_t plane_id, 141 uint32_t plane_id,
141 uint32_t possible_crtcs) { 142 uint32_t possible_crtcs) {
142 return scoped_ptr<HardwareDisplayPlane>( 143 return scoped_ptr<HardwareDisplayPlane>(
143 new HardwareDisplayPlane(plane_id, possible_crtcs)); 144 new HardwareDisplayPlane(plane_id, possible_crtcs));
144 } 145 }
145 146
146 HardwareDisplayPlane* HardwareDisplayPlaneManager::FindNextUnusedPlane( 147 HardwareDisplayPlane* HardwareDisplayPlaneManager::FindNextUnusedPlane(
147 size_t* index, 148 size_t* index,
148 uint32_t crtc_index, 149 uint32_t crtc_index,
149 const OverlayPlane& overlay) const { 150 const OverlayPlane& overlay) const {
150 for (size_t i = *index; i < planes_.size(); ++i) { 151 for (size_t i = *index; i < planes_.size(); ++i) {
151 auto plane = planes_[i]; 152 auto plane = planes_[i].get();
152 if (!plane->in_use() && IsCompatible(plane, overlay, crtc_index)) { 153 if (!plane->in_use() && IsCompatible(plane, overlay, crtc_index)) {
153 *index = i + 1; 154 *index = i + 1;
154 return plane; 155 return plane;
155 } 156 }
156 } 157 }
157 return nullptr; 158 return nullptr;
158 } 159 }
159 160
160 int HardwareDisplayPlaneManager::LookupCrtcIndex(uint32_t crtc_id) const { 161 int HardwareDisplayPlaneManager::LookupCrtcIndex(uint32_t crtc_id) const {
161 for (size_t i = 0; i < crtcs_.size(); ++i) 162 for (size_t i = 0; i < crtcs_.size(); ++i)
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 HardwareDisplayPlaneManager::GetCompatibleHardwarePlaneIds( 283 HardwareDisplayPlaneManager::GetCompatibleHardwarePlaneIds(
283 const OverlayPlane& plane, 284 const OverlayPlane& plane,
284 uint32_t crtc_id) const { 285 uint32_t crtc_id) const {
285 int crtc_index = LookupCrtcIndex(crtc_id); 286 int crtc_index = LookupCrtcIndex(crtc_id);
286 if (crtc_index < 0) { 287 if (crtc_index < 0) {
287 LOG(ERROR) << "Cannot find crtc " << crtc_id; 288 LOG(ERROR) << "Cannot find crtc " << crtc_id;
288 return std::vector<uint32_t>(); 289 return std::vector<uint32_t>();
289 } 290 }
290 291
291 std::vector<uint32_t> plane_ids; 292 std::vector<uint32_t> plane_ids;
292 for (auto* hardware_plane : planes_) { 293 for (const auto& hardware_plane : planes_) {
293 if (IsCompatible(hardware_plane, plane, crtc_index)) 294 if (IsCompatible(hardware_plane.get(), plane, crtc_index))
294 plane_ids.push_back(hardware_plane->plane_id()); 295 plane_ids.push_back(hardware_plane->plane_id());
295 } 296 }
296 297
297 return plane_ids; 298 return plane_ids;
298 } 299 }
299 300
300 } // namespace ui 301 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698