Chromium Code Reviews| 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/util/edid_parser.h" | 18 #include "ui/display/util/edid_parser.h" |
| 19 | 19 |
| 20 #if !defined(DRM_FORMAT_R16) | |
| 21 // TODO(riju): after libdrm has this definition, remove it. | |
| 22 #define DRM_FORMAT_R16 fourcc_code('R', '1', '6', ' ') | |
|
reveman
2017/06/14 17:47:22
upstream seems to have this. can we instead just u
riju_
2017/06/20 13:21:31
Created bug: https://bugs.chromium.org/p/chromium/
| |
| 23 #endif | |
| 24 | |
| 20 namespace ui { | 25 namespace ui { |
| 21 | 26 |
| 22 namespace { | 27 namespace { |
| 23 | 28 |
| 24 static const size_t kDefaultCursorWidth = 64; | 29 static const size_t kDefaultCursorWidth = 64; |
| 25 static const size_t kDefaultCursorHeight = 64; | 30 static const size_t kDefaultCursorHeight = 64; |
| 26 | 31 |
| 27 bool IsCrtcInUse( | 32 bool IsCrtcInUse( |
| 28 uint32_t crtc, | 33 uint32_t crtc, |
| 29 const std::vector<std::unique_ptr<HardwareDisplayControllerInfo>>& | 34 const std::vector<std::unique_ptr<HardwareDisplayControllerInfo>>& |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 356 params.native_mode = params.modes.front(); | 361 params.native_mode = params.modes.front(); |
| 357 } | 362 } |
| 358 | 363 |
| 359 return params; | 364 return params; |
| 360 } | 365 } |
| 361 | 366 |
| 362 int GetFourCCFormatFromBufferFormat(gfx::BufferFormat format) { | 367 int GetFourCCFormatFromBufferFormat(gfx::BufferFormat format) { |
| 363 switch (format) { | 368 switch (format) { |
| 364 case gfx::BufferFormat::R_8: | 369 case gfx::BufferFormat::R_8: |
| 365 return DRM_FORMAT_R8; | 370 return DRM_FORMAT_R8; |
| 371 case gfx::BufferFormat::R_16: | |
| 372 return DRM_FORMAT_R16; | |
| 366 case gfx::BufferFormat::RG_88: | 373 case gfx::BufferFormat::RG_88: |
| 367 return DRM_FORMAT_GR88; | 374 return DRM_FORMAT_GR88; |
| 368 case gfx::BufferFormat::RGBA_8888: | 375 case gfx::BufferFormat::RGBA_8888: |
| 369 return DRM_FORMAT_ABGR8888; | 376 return DRM_FORMAT_ABGR8888; |
| 370 case gfx::BufferFormat::RGBX_8888: | 377 case gfx::BufferFormat::RGBX_8888: |
| 371 return DRM_FORMAT_XBGR8888; | 378 return DRM_FORMAT_XBGR8888; |
| 372 case gfx::BufferFormat::BGRA_8888: | 379 case gfx::BufferFormat::BGRA_8888: |
| 373 return DRM_FORMAT_ARGB8888; | 380 return DRM_FORMAT_ARGB8888; |
| 374 case gfx::BufferFormat::BGRX_8888: | 381 case gfx::BufferFormat::BGRX_8888: |
| 375 return DRM_FORMAT_XRGB8888; | 382 return DRM_FORMAT_XRGB8888; |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 433 case gfx::BufferFormat::YUV_420_BIPLANAR: | 440 case gfx::BufferFormat::YUV_420_BIPLANAR: |
| 434 return DRM_FORMAT_NV12; | 441 return DRM_FORMAT_NV12; |
| 435 case gfx::BufferFormat::YVU_420: | 442 case gfx::BufferFormat::YVU_420: |
| 436 return DRM_FORMAT_YVU420; | 443 return DRM_FORMAT_YVU420; |
| 437 default: | 444 default: |
| 438 NOTREACHED(); | 445 NOTREACHED(); |
| 439 return 0; | 446 return 0; |
| 440 } | 447 } |
| 441 } | 448 } |
| 442 } // namespace ui | 449 } // namespace ui |
| OLD | NEW |