| 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/host/drm_overlay_candidates_host.h" | 5 #include "ui/ozone/platform/drm/host/drm_overlay_candidates_host.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "ui/gfx/geometry/rect_conversions.h" | 9 #include "ui/gfx/geometry/rect_conversions.h" |
| 10 #include "ui/ozone/common/gpu/ozone_gpu_messages.h" | 10 #include "ui/ozone/common/gpu/ozone_gpu_messages.h" |
| 11 #include "ui/ozone/platform/drm/host/drm_gpu_platform_support_host.h" | 11 #include "ui/ozone/platform/drm/host/drm_gpu_platform_support_host.h" |
| 12 #include "ui/ozone/platform/drm/host/drm_window_host.h" | 12 #include "ui/ozone/platform/drm/host/drm_window_host.h" |
| 13 | 13 |
| 14 namespace ui { | 14 namespace ui { |
| 15 | 15 |
| 16 namespace { | 16 namespace { |
| 17 const size_t kMaxCacheSize = 100; | 17 const size_t kMaxCacheSize = 100; |
| 18 // Optimal format for rendering on overlay. |
| 19 const gfx::BufferFormat kOverlayRenderFormat = gfx::BufferFormat::UYVY_422; |
| 18 } // namespace | 20 } // namespace |
| 19 | 21 |
| 20 bool DrmOverlayCandidatesHost::OverlayCompare::operator()( | 22 bool DrmOverlayCandidatesHost::OverlayCompare::operator()( |
| 21 const OverlayCheck_Params& l, | 23 const OverlayCheck_Params& l, |
| 22 const OverlayCheck_Params& r) const { | 24 const OverlayCheck_Params& r) const { |
| 23 if (l.plane_z_order < r.plane_z_order) | 25 if (l.plane_z_order < r.plane_z_order) |
| 24 return true; | 26 return true; |
| 25 if (l.plane_z_order > r.plane_z_order) | 27 if (l.plane_z_order > r.plane_z_order) |
| 26 return false; | 28 return false; |
| 27 if (l.display_rect < r.display_rect) | 29 if (l.display_rect < r.display_rect) |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 for (auto& candidate : *candidates) { | 76 for (auto& candidate : *candidates) { |
| 75 if (!CanHandleCandidate(candidate)) | 77 if (!CanHandleCandidate(candidate)) |
| 76 continue; | 78 continue; |
| 77 | 79 |
| 78 OverlayCheck_Params lookup(candidate); | 80 OverlayCheck_Params lookup(candidate); |
| 79 if (!force_validation) { | 81 if (!force_validation) { |
| 80 CompatibleParams::const_iterator last_iter = | 82 CompatibleParams::const_iterator last_iter = |
| 81 in_use_compatible_params_.find(lookup); | 83 in_use_compatible_params_.find(lookup); |
| 82 if (last_iter != in_use_compatible_params_.end()) { | 84 if (last_iter != in_use_compatible_params_.end()) { |
| 83 candidate.overlay_handled = last_iter->second; | 85 candidate.overlay_handled = last_iter->second; |
| 86 // TODO(kalyank): Figure out the optimal render format for overlay. We |
| 87 // should get this from GPU process side. See http://crbug.com/553264. |
| 88 if (candidate.plane_z_order > 0) { |
| 89 candidate.format = kOverlayRenderFormat; |
| 90 candidate.handle_scaling = true; |
| 91 } |
| 92 |
| 84 compatible_candidates++; | 93 compatible_candidates++; |
| 85 if (candidate.overlay_handled) | 94 if (candidate.overlay_handled) |
| 86 planes_in_use++; | 95 planes_in_use++; |
| 87 | 96 |
| 88 continue; | 97 continue; |
| 89 } | 98 } |
| 90 } | 99 } |
| 91 | 100 |
| 92 auto iter = cache_.Get(lookup); | 101 auto iter = cache_.Get(lookup); |
| 93 if (iter == cache_.end()) { | 102 if (iter == cache_.end()) { |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 break; | 310 break; |
| 302 } | 311 } |
| 303 | 312 |
| 304 // We dont have any free hardware resources. | 313 // We dont have any free hardware resources. |
| 305 if (!available_overlays) | 314 if (!available_overlays) |
| 306 break; | 315 break; |
| 307 } | 316 } |
| 308 } | 317 } |
| 309 | 318 |
| 310 } // namespace ui | 319 } // namespace ui |
| OLD | NEW |