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

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

Issue 2825853002: Improvements to uses of base::SmallMap (Closed)
Patch Set: Review comments 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
« no previous file with comments | « 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>
11 #include <xf86drm.h> 11 #include <xf86drm.h>
12 #include <xf86drmMode.h> 12 #include <xf86drmMode.h>
13 #include <algorithm> 13 #include <algorithm>
14 #include <utility> 14 #include <utility>
15 15
16 #include "base/containers/small_map.h" 16 #include "base/containers/flat_map.h"
17 #include "base/memory/ptr_util.h" 17 #include "base/memory/ptr_util.h"
18 #include "ui/display/util/edid_parser.h" 18 #include "ui/display/util/edid_parser.h"
19 19
20 namespace ui { 20 namespace ui {
21 21
22 namespace { 22 namespace {
23 23
24 static const size_t kDefaultCursorWidth = 64; 24 static const size_t kDefaultCursorWidth = 64;
25 static const size_t kDefaultCursorHeight = 64; 25 static const size_t kDefaultCursorHeight = 64;
26 26
(...skipping 202 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::flat_map<ScopedDrmConnectorPtr::element_type*, int> connector_crtcs;
240 connector_crtcs;
241 for (auto& c : available_connectors) { 240 for (auto& c : available_connectors) {
242 uint32_t possible_crtcs = 0; 241 uint32_t possible_crtcs = 0;
243 for (int i = 0; i < c->count_encoders; ++i) { 242 for (int i = 0; i < c->count_encoders; ++i) {
244 ScopedDrmEncoderPtr encoder(drmModeGetEncoder(fd, c->encoders[i])); 243 ScopedDrmEncoderPtr encoder(drmModeGetEncoder(fd, c->encoders[i]));
245 if (!encoder) 244 if (!encoder)
246 continue; 245 continue;
247 possible_crtcs |= encoder->possible_crtcs; 246 possible_crtcs |= encoder->possible_crtcs;
248 } 247 }
249 connector_crtcs[c.get()] = possible_crtcs; 248 connector_crtcs[c.get()] = possible_crtcs;
250 } 249 }
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 case gfx::BufferFormat::YUV_420_BIPLANAR: 433 case gfx::BufferFormat::YUV_420_BIPLANAR:
435 return DRM_FORMAT_NV12; 434 return DRM_FORMAT_NV12;
436 case gfx::BufferFormat::YVU_420: 435 case gfx::BufferFormat::YVU_420:
437 return DRM_FORMAT_YVU420; 436 return DRM_FORMAT_YVU420;
438 default: 437 default:
439 NOTREACHED(); 438 NOTREACHED();
440 return 0; 439 return 0;
441 } 440 }
442 } 441 }
443 } // namespace ui 442 } // namespace ui
OLDNEW
« no previous file with comments | « ui/latency/latency_info.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698