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 "components/display_compositor/compositor_overlay_candidate_validator_o zone.h" | 5 #include "components/display_compositor/compositor_overlay_candidate_validator_o zone.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 21 // Templated function used to create an OverlayProcessor::Strategy | 21 // Templated function used to create an OverlayProcessor::Strategy |
| 22 // of type |S|. | 22 // of type |S|. |
| 23 template <typename S> | 23 template <typename S> |
| 24 std::unique_ptr<cc::OverlayProcessor::Strategy> MakeOverlayStrategy( | 24 std::unique_ptr<cc::OverlayProcessor::Strategy> MakeOverlayStrategy( |
| 25 CompositorOverlayCandidateValidatorOzone* capability_checker) { | 25 CompositorOverlayCandidateValidatorOzone* capability_checker) { |
| 26 return base::MakeUnique<S>(capability_checker); | 26 return base::MakeUnique<S>(capability_checker); |
| 27 } | 27 } |
| 28 | 28 |
| 29 } // namespace | 29 } // namespace |
| 30 | 30 |
| 31 static gfx::BufferFormat GetBufferFormat(cc::ResourceFormat overlay_format) { | |
| 32 switch (overlay_format) { | |
| 33 // TODO(dshwang): overlay video still uses RGBA_8888. | |
| 34 case cc::RGBA_8888: | |
| 35 case cc::BGRA_8888: | |
| 36 return gfx::BufferFormat::BGRA_8888; | |
| 37 default: | |
| 38 NOTREACHED(); | |
| 39 return gfx::BufferFormat::BGRA_8888; | |
| 40 } | |
| 41 } | |
| 42 | |
| 43 // |overlay_candidates| is an object used to answer questions about possible | 31 // |overlay_candidates| is an object used to answer questions about possible |
| 44 // overlays configuarations. | 32 // overlays configuarations. |
| 45 // |strategies_string| is a comma-separated string containing all the overaly | 33 // |strategies_string| is a comma-separated string containing all the overaly |
| 46 // strategies that should be returned by GetStrategies. | 34 // strategies that should be returned by GetStrategies. |
| 47 // If |strategies_string| is empty "single-on-top,underlay" will be used as | 35 // If |strategies_string| is empty "single-on-top,underlay" will be used as |
| 48 // default. | 36 // default. |
| 49 CompositorOverlayCandidateValidatorOzone:: | 37 CompositorOverlayCandidateValidatorOzone:: |
| 50 CompositorOverlayCandidateValidatorOzone( | 38 CompositorOverlayCandidateValidatorOzone( |
| 51 std::unique_ptr<ui::OverlayCandidatesOzone> overlay_candidates, | 39 std::unique_ptr<ui::OverlayCandidatesOzone> overlay_candidates, |
| 52 std::string strategies_string) | 40 std::string strategies_string) |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 96 } | 84 } |
| 97 return; | 85 return; |
| 98 } | 86 } |
| 99 | 87 |
| 100 DCHECK_GE(2U, surfaces->size()); | 88 DCHECK_GE(2U, surfaces->size()); |
| 101 ui::OverlayCandidatesOzone::OverlaySurfaceCandidateList ozone_surface_list; | 89 ui::OverlayCandidatesOzone::OverlaySurfaceCandidateList ozone_surface_list; |
| 102 ozone_surface_list.resize(surfaces->size()); | 90 ozone_surface_list.resize(surfaces->size()); |
| 103 | 91 |
| 104 for (size_t i = 0; i < surfaces->size(); i++) { | 92 for (size_t i = 0; i < surfaces->size(); i++) { |
| 105 ozone_surface_list.at(i).transform = surfaces->at(i).transform; | 93 ozone_surface_list.at(i).transform = surfaces->at(i).transform; |
| 106 ozone_surface_list.at(i).format = GetBufferFormat(surfaces->at(i).format); | 94 ozone_surface_list.at(i).format = surfaces->at(i).format; |
|
Daniele Castagna
2017/02/08 18:59:48
This would now pass the format even if it's not an
dshwang
2017/02/09 00:03:54
Yes, DrmOverlayManager::CheckOverlaySupport() chec
| |
| 107 ozone_surface_list.at(i).display_rect = surfaces->at(i).display_rect; | 95 ozone_surface_list.at(i).display_rect = surfaces->at(i).display_rect; |
| 108 ozone_surface_list.at(i).crop_rect = surfaces->at(i).uv_rect; | 96 ozone_surface_list.at(i).crop_rect = surfaces->at(i).uv_rect; |
| 109 ozone_surface_list.at(i).quad_rect_in_target_space = | 97 ozone_surface_list.at(i).quad_rect_in_target_space = |
| 110 surfaces->at(i).quad_rect_in_target_space; | 98 surfaces->at(i).quad_rect_in_target_space; |
| 111 ozone_surface_list.at(i).clip_rect = surfaces->at(i).clip_rect; | 99 ozone_surface_list.at(i).clip_rect = surfaces->at(i).clip_rect; |
| 112 ozone_surface_list.at(i).is_clipped = surfaces->at(i).is_clipped; | 100 ozone_surface_list.at(i).is_clipped = surfaces->at(i).is_clipped; |
| 113 ozone_surface_list.at(i).plane_z_order = surfaces->at(i).plane_z_order; | 101 ozone_surface_list.at(i).plane_z_order = surfaces->at(i).plane_z_order; |
| 114 ozone_surface_list.at(i).buffer_size = | 102 ozone_surface_list.at(i).buffer_size = |
| 115 surfaces->at(i).resource_size_in_pixels; | 103 surfaces->at(i).resource_size_in_pixels; |
| 116 } | 104 } |
| 117 | 105 |
| 118 overlay_candidates_->CheckOverlaySupport(&ozone_surface_list); | 106 overlay_candidates_->CheckOverlaySupport(&ozone_surface_list); |
| 119 DCHECK_EQ(surfaces->size(), ozone_surface_list.size()); | 107 DCHECK_EQ(surfaces->size(), ozone_surface_list.size()); |
| 120 | 108 |
| 121 for (size_t i = 0; i < surfaces->size(); i++) { | 109 for (size_t i = 0; i < surfaces->size(); i++) { |
| 122 surfaces->at(i).overlay_handled = ozone_surface_list.at(i).overlay_handled; | 110 surfaces->at(i).overlay_handled = ozone_surface_list.at(i).overlay_handled; |
| 123 surfaces->at(i).display_rect = ozone_surface_list.at(i).display_rect; | 111 surfaces->at(i).display_rect = ozone_surface_list.at(i).display_rect; |
| 124 } | 112 } |
| 125 } | 113 } |
| 126 | 114 |
| 127 void CompositorOverlayCandidateValidatorOzone::SetSoftwareMirrorMode( | 115 void CompositorOverlayCandidateValidatorOzone::SetSoftwareMirrorMode( |
| 128 bool enabled) { | 116 bool enabled) { |
| 129 software_mirror_active_ = enabled; | 117 software_mirror_active_ = enabled; |
| 130 } | 118 } |
| 131 | 119 |
| 132 } // namespace display_compositor | 120 } // namespace display_compositor |
| OLD | NEW |