OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/gpu/drm_overlay_validator.h" | 5 #include "ui/ozone/platform/drm/gpu/drm_overlay_validator.h" |
6 | 6 |
7 #include <drm_fourcc.h> | 7 #include <drm_fourcc.h> |
8 | 8 |
9 #include "ui/gfx/geometry/size_conversions.h" | 9 #include "ui/gfx/geometry/size_conversions.h" |
10 #include "ui/ozone/platform/drm/common/drm_util.h" | 10 #include "ui/ozone/platform/drm/common/drm_util.h" |
11 #include "ui/ozone/platform/drm/gpu/drm_device.h" | 11 #include "ui/ozone/platform/drm/gpu/drm_device.h" |
12 #include "ui/ozone/platform/drm/gpu/drm_window.h" | 12 #include "ui/ozone/platform/drm/gpu/drm_window.h" |
13 #include "ui/ozone/platform/drm/gpu/hardware_display_controller.h" | 13 #include "ui/ozone/platform/drm/gpu/hardware_display_controller.h" |
14 #include "ui/ozone/platform/drm/gpu/scanout_buffer.h" | 14 #include "ui/ozone/platform/drm/gpu/scanout_buffer.h" |
15 | 15 |
16 namespace ui { | 16 namespace ui { |
17 | 17 |
18 namespace { | 18 namespace { |
19 | 19 |
20 const size_t kMaxCacheSize = 200; | 20 const size_t kMaxCacheSize = 200; |
21 | 21 |
22 bool NeedsAlphaComposition(uint32_t format) { | 22 bool NeedsAlphaComposition(uint32_t format) { |
23 switch (format) { | 23 switch (format) { |
24 case DRM_FORMAT_XRGB8888: | 24 case DRM_FORMAT_XRGB8888: |
25 case DRM_FORMAT_UYVY: | 25 case DRM_FORMAT_UYVY: |
| 26 case DRM_FORMAT_YUYV: |
26 return false; | 27 return false; |
27 default: | 28 default: |
28 return true; | 29 return true; |
29 } | 30 } |
30 } | 31 } |
31 | 32 |
32 scoped_refptr<ScanoutBuffer> GetBufferForPageFlipTest( | 33 scoped_refptr<ScanoutBuffer> GetBufferForPageFlipTest( |
33 const scoped_refptr<DrmDevice>& drm_device, | 34 const scoped_refptr<DrmDevice>& drm_device, |
34 const gfx::Size& size, | 35 const gfx::Size& size, |
35 uint32_t format, | 36 uint32_t format, |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 // what was used during Modeset on non atomic kernels. There is no | 81 // what was used during Modeset on non atomic kernels. There is no |
81 // definitive way to query this. | 82 // definitive way to query this. |
82 force_primary_format = true; | 83 force_primary_format = true; |
83 #endif | 84 #endif |
84 } | 85 } |
85 | 86 |
86 if (force_primary_format) | 87 if (force_primary_format) |
87 return DRM_FORMAT_XRGB8888; | 88 return DRM_FORMAT_XRGB8888; |
88 | 89 |
89 // YUV is preferable format if supported. | 90 // YUV is preferable format if supported. |
90 if (controller->IsFormatSupported(DRM_FORMAT_UYVY, z_order)) { | 91 if (controller->IsFormatSupported(DRM_FORMAT_YUYV, z_order)) { |
| 92 return DRM_FORMAT_YUYV; |
| 93 } else if (controller->IsFormatSupported(DRM_FORMAT_UYVY, z_order)) { |
91 return DRM_FORMAT_UYVY; | 94 return DRM_FORMAT_UYVY; |
92 } else if (controller->IsFormatSupported(DRM_FORMAT_XRGB8888, z_order)) { | 95 } else if (controller->IsFormatSupported(DRM_FORMAT_XRGB8888, z_order)) { |
93 return DRM_FORMAT_XRGB8888; | 96 return DRM_FORMAT_XRGB8888; |
94 } | 97 } |
95 | 98 |
96 return original_format; | 99 return original_format; |
97 } | 100 } |
98 | 101 |
99 } // namespace | 102 } // namespace |
100 | 103 |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 | 276 |
274 // Make sure we dont hold reference to buffer when caching this plane list. | 277 // Make sure we dont hold reference to buffer when caching this plane list. |
275 plane.buffer = nullptr; | 278 plane.buffer = nullptr; |
276 } | 279 } |
277 | 280 |
278 DCHECK(hints_plane_list.size() == overlay_hints.size()); | 281 DCHECK(hints_plane_list.size() == overlay_hints.size()); |
279 overlay_hints_cache_.Put(hints_plane_list, overlay_hints); | 282 overlay_hints_cache_.Put(hints_plane_list, overlay_hints); |
280 } | 283 } |
281 | 284 |
282 } // namespace ui | 285 } // namespace ui |
OLD | NEW |