| 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)) { |
| 91 return DRM_FORMAT_UYVY; | 92 return DRM_FORMAT_YUYV; |
| 92 } else if (controller->IsFormatSupported(DRM_FORMAT_XRGB8888, z_order)) { | 93 } else if (controller->IsFormatSupported(DRM_FORMAT_XRGB8888, z_order)) { |
| 93 return DRM_FORMAT_XRGB8888; | 94 return DRM_FORMAT_XRGB8888; |
| 94 } | 95 } |
| 95 | 96 |
| 96 return original_format; | 97 return original_format; |
| 97 } | 98 } |
| 98 | 99 |
| 99 } // namespace | 100 } // namespace |
| 100 | 101 |
| 101 DrmOverlayValidator::OverlayHints::OverlayHints(uint32_t format, | 102 DrmOverlayValidator::OverlayHints::OverlayHints(uint32_t format, |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 | 273 |
| 273 // Make sure we dont hold reference to buffer when caching this plane list. | 274 // Make sure we dont hold reference to buffer when caching this plane list. |
| 274 plane.buffer = nullptr; | 275 plane.buffer = nullptr; |
| 275 } | 276 } |
| 276 | 277 |
| 277 DCHECK(hints_plane_list.size() == overlay_hints.size()); | 278 DCHECK(hints_plane_list.size() == overlay_hints.size()); |
| 278 overlay_hints_cache_.Put(hints_plane_list, overlay_hints); | 279 overlay_hints_cache_.Put(hints_plane_list, overlay_hints); |
| 279 } | 280 } |
| 280 | 281 |
| 281 } // namespace ui | 282 } // namespace ui |
| OLD | NEW |