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/flat_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/types/display_mode.h" | 18 #include "ui/display/types/display_mode.h" |
19 #include "ui/display/types/display_snapshot_mojo.h" | 19 #include "ui/display/types/display_snapshot_mojo.h" |
20 #include "ui/display/util/edid_parser.h" | 20 #include "ui/display/util/edid_parser.h" |
21 #include "ui/ozone/common/display_snapshot_proxy.h" | 21 #include "ui/ozone/common/display_snapshot_proxy.h" |
22 | 22 |
| 23 #if !defined(DRM_FORMAT_R16) |
| 24 // TODO(riju): crbug.com/733703 |
| 25 #define DRM_FORMAT_R16 fourcc_code('R', '1', '6', ' ') |
| 26 #endif |
| 27 |
23 namespace ui { | 28 namespace ui { |
24 | 29 |
25 namespace { | 30 namespace { |
26 | 31 |
27 static const size_t kDefaultCursorWidth = 64; | 32 static const size_t kDefaultCursorWidth = 64; |
28 static const size_t kDefaultCursorHeight = 64; | 33 static const size_t kDefaultCursorHeight = 64; |
29 | 34 |
30 bool IsCrtcInUse( | 35 bool IsCrtcInUse( |
31 uint32_t crtc, | 36 uint32_t crtc, |
32 const std::vector<std::unique_ptr<HardwareDisplayControllerInfo>>& | 37 const std::vector<std::unique_ptr<HardwareDisplayControllerInfo>>& |
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 | 432 |
428 params.push_back(p); | 433 params.push_back(p); |
429 } | 434 } |
430 return params; | 435 return params; |
431 } | 436 } |
432 | 437 |
433 int GetFourCCFormatFromBufferFormat(gfx::BufferFormat format) { | 438 int GetFourCCFormatFromBufferFormat(gfx::BufferFormat format) { |
434 switch (format) { | 439 switch (format) { |
435 case gfx::BufferFormat::R_8: | 440 case gfx::BufferFormat::R_8: |
436 return DRM_FORMAT_R8; | 441 return DRM_FORMAT_R8; |
| 442 case gfx::BufferFormat::R_16: |
| 443 return DRM_FORMAT_R16; |
437 case gfx::BufferFormat::RG_88: | 444 case gfx::BufferFormat::RG_88: |
438 return DRM_FORMAT_GR88; | 445 return DRM_FORMAT_GR88; |
439 case gfx::BufferFormat::RGBA_8888: | 446 case gfx::BufferFormat::RGBA_8888: |
440 return DRM_FORMAT_ABGR8888; | 447 return DRM_FORMAT_ABGR8888; |
441 case gfx::BufferFormat::RGBX_8888: | 448 case gfx::BufferFormat::RGBX_8888: |
442 return DRM_FORMAT_XBGR8888; | 449 return DRM_FORMAT_XBGR8888; |
443 case gfx::BufferFormat::BGRA_8888: | 450 case gfx::BufferFormat::BGRA_8888: |
444 return DRM_FORMAT_ARGB8888; | 451 return DRM_FORMAT_ARGB8888; |
445 case gfx::BufferFormat::BGRX_8888: | 452 case gfx::BufferFormat::BGRX_8888: |
446 return DRM_FORMAT_XRGB8888; | 453 return DRM_FORMAT_XRGB8888; |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
513 | 520 |
514 MovableDisplaySnapshots CreateMovableDisplaySnapshotsFromParams( | 521 MovableDisplaySnapshots CreateMovableDisplaySnapshotsFromParams( |
515 const std::vector<DisplaySnapshot_Params>& displays) { | 522 const std::vector<DisplaySnapshot_Params>& displays) { |
516 MovableDisplaySnapshots snapshots; | 523 MovableDisplaySnapshots snapshots; |
517 for (const auto& d : displays) | 524 for (const auto& d : displays) |
518 snapshots.push_back(base::MakeUnique<DisplaySnapshotProxy>(d)); | 525 snapshots.push_back(base::MakeUnique<DisplaySnapshotProxy>(d)); |
519 return snapshots; | 526 return snapshots; |
520 } | 527 } |
521 | 528 |
522 } // namespace ui | 529 } // namespace ui |
OLD | NEW |