Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(240)

Side by Side Diff: ui/ozone/platform/drm/gpu/drm_overlay_validator.cc

Issue 2684993005: (NotForReview) Enable YUV video overlay on Skylake ChromeOS.
Patch Set: rebase to ToT (Mar/27) Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 uint32_t z_order = plane_z_order; 72 uint32_t z_order = plane_z_order;
72 // If Overlay completely covers primary and isn't transparent, try to find 73 // If Overlay completely covers primary and isn't transparent, try to find
73 // optimal format w.r.t primary plane. This guarantees that optimal format 74 // optimal format w.r.t primary plane. This guarantees that optimal format
74 // would not fail page flip when plane manager/CC collapses planes. 75 // would not fail page flip when plane manager/CC collapses planes.
75 if (plane_bounds == window_bounds && 76 if (plane_bounds == window_bounds &&
76 !NeedsAlphaComposition(original_format)) { 77 !NeedsAlphaComposition(original_format)) {
77 z_order = 0; 78 z_order = 0;
78 } 79 }
79 80
80 // YUV is preferable format if supported. 81 // YUV is preferable format if supported.
81 if (controller->IsFormatSupported(DRM_FORMAT_UYVY, z_order)) { 82 if (controller->IsFormatSupported(DRM_FORMAT_YUYV, z_order)) {
82 return DRM_FORMAT_UYVY; 83 return DRM_FORMAT_YUYV;
83 } else if (controller->IsFormatSupported(DRM_FORMAT_XRGB8888, z_order)) { 84 } else if (controller->IsFormatSupported(DRM_FORMAT_XRGB8888, z_order)) {
84 return DRM_FORMAT_XRGB8888; 85 return DRM_FORMAT_XRGB8888;
85 } 86 }
86 87
87 return original_format; 88 return original_format;
88 } 89 }
89 90
90 } // namespace 91 } // namespace
91 92
92 DrmOverlayValidator::OverlayHints::OverlayHints(uint32_t format, 93 DrmOverlayValidator::OverlayHints::OverlayHints(uint32_t format,
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 265
265 // Make sure we dont hold reference to buffer when caching this plane list. 266 // Make sure we dont hold reference to buffer when caching this plane list.
266 plane.buffer = nullptr; 267 plane.buffer = nullptr;
267 } 268 }
268 269
269 DCHECK(hints_plane_list.size() == overlay_hints.size()); 270 DCHECK(hints_plane_list.size() == overlay_hints.size());
270 overlay_hints_cache_.Put(hints_plane_list, overlay_hints); 271 overlay_hints_cache_.Put(hints_plane_list, overlay_hints);
271 } 272 }
272 273
273 } // namespace ui 274 } // namespace ui
OLDNEW
« no previous file with comments | « ui/ozone/platform/drm/common/drm_util.cc ('k') | ui/ozone/platform/drm/gpu/drm_overlay_validator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698