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

Side by Side Diff: ui/ozone/platform/drm/common/drm_util.cc

Issue 2825853002: Improvements to uses of base::SmallMap (Closed)
Patch Set: Created 3 years, 8 months 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
« ui/latency/latency_info.h ('K') | « ui/latency/latency_info.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/common/drm_util.h" 5 #include "ui/ozone/platform/drm/common/drm_util.h"
6 6
7 #include <drm_fourcc.h> 7 #include <drm_fourcc.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <stdlib.h> 9 #include <stdlib.h>
10 #include <sys/mman.h> 10 #include <sys/mman.h>
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 for (int i = 0; i < resources->count_connectors; ++i) { 229 for (int i = 0; i < resources->count_connectors; ++i) {
230 ScopedDrmConnectorPtr connector( 230 ScopedDrmConnectorPtr connector(
231 drmModeGetConnector(fd, resources->connectors[i])); 231 drmModeGetConnector(fd, resources->connectors[i]));
232 connectors.push_back(connector.get()); 232 connectors.push_back(connector.get());
233 233
234 if (connector && connector->connection == DRM_MODE_CONNECTED && 234 if (connector && connector->connection == DRM_MODE_CONNECTED &&
235 connector->count_modes != 0) 235 connector->count_modes != 0)
236 available_connectors.push_back(std::move(connector)); 236 available_connectors.push_back(std::move(connector));
237 } 237 }
238 238
239 base::SmallMap<std::map<ScopedDrmConnectorPtr::element_type*, int>> 239 base::small_map<std::map<ScopedDrmConnectorPtr::element_type*, int>>
danakj 2017/04/18 21:35:50 almost certainly there are few enough monitors tha
brettw 2017/04/19 16:29:48 Hopefully someday I can have so many monitors this
240 connector_crtcs; 240 connector_crtcs;
241 for (auto& c : available_connectors) { 241 for (auto& c : available_connectors) {
242 uint32_t possible_crtcs = 0; 242 uint32_t possible_crtcs = 0;
243 for (int i = 0; i < c->count_encoders; ++i) { 243 for (int i = 0; i < c->count_encoders; ++i) {
244 ScopedDrmEncoderPtr encoder(drmModeGetEncoder(fd, c->encoders[i])); 244 ScopedDrmEncoderPtr encoder(drmModeGetEncoder(fd, c->encoders[i]));
245 if (!encoder) 245 if (!encoder)
246 continue; 246 continue;
247 possible_crtcs |= encoder->possible_crtcs; 247 possible_crtcs |= encoder->possible_crtcs;
248 } 248 }
249 connector_crtcs[c.get()] = possible_crtcs; 249 connector_crtcs[c.get()] = possible_crtcs;
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 case gfx::BufferFormat::YUV_420_BIPLANAR: 434 case gfx::BufferFormat::YUV_420_BIPLANAR:
435 return DRM_FORMAT_NV12; 435 return DRM_FORMAT_NV12;
436 case gfx::BufferFormat::YVU_420: 436 case gfx::BufferFormat::YVU_420:
437 return DRM_FORMAT_YVU420; 437 return DRM_FORMAT_YVU420;
438 default: 438 default:
439 NOTREACHED(); 439 NOTREACHED();
440 return 0; 440 return 0;
441 } 441 }
442 } 442 }
443 } // namespace ui 443 } // namespace ui
OLDNEW
« ui/latency/latency_info.h ('K') | « ui/latency/latency_info.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698