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/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 Loading... |
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 Loading... |
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 |
OLD | NEW |