diff options
Diffstat (limited to 'chromium/components/viz')
3 files changed, 3 insertions, 88 deletions
diff --git a/chromium/components/viz/service/display/overlay_strategy_single_on_top.cc b/chromium/components/viz/service/display/overlay_strategy_single_on_top.cc index 937350aa3dd..03e711880c0 100644 --- a/chromium/components/viz/service/display/overlay_strategy_single_on_top.cc +++ b/chromium/components/viz/service/display/overlay_strategy_single_on_top.cc @@ -35,15 +35,6 @@ bool OverlayStrategySingleOnTop::Attempt( if (OverlayCandidate::FromDrawQuad(resource_provider, output_color_matrix, *it, &candidate) && !OverlayCandidate::IsOccluded(candidate, quad_list->cbegin(), it)) { - // If the candidate has been promoted previously and has not changed - // (resource ID is the same) for 3 frames, do not use it as Overlay as - // flattening it to the main fb will be more power efficient when the - // contents don't change. - if (candidate.resource_id == previous_frame_resource_id_ && - ++same_resource_id_frames_count_ > - kMaxFrameCandidateWithSameResourceId) { - continue; - } if (candidate.display_rect.size().GetArea() > best_candidate.display_rect.size().GetArea()) { best_candidate = candidate; @@ -54,17 +45,10 @@ bool OverlayStrategySingleOnTop::Attempt( if (best_quad_it == quad_list->end()) return false; - if (TryOverlay(quad_list, candidate_list, best_candidate, best_quad_it)) { - if (previous_frame_resource_id_ != best_candidate.resource_id) { - previous_frame_resource_id_ = best_candidate.resource_id; - same_resource_id_frames_count_ = 1; - } + if (TryOverlay(quad_list, candidate_list, best_candidate, best_quad_it)) return true; - } else { - previous_frame_resource_id_ = kInvalidResourceId; - same_resource_id_frames_count_ = 0; - return false; - } + + return false; } bool OverlayStrategySingleOnTop::TryOverlay( diff --git a/chromium/components/viz/service/display/overlay_strategy_single_on_top.h b/chromium/components/viz/service/display/overlay_strategy_single_on_top.h index a7ad251e4d1..dd9f28e12d3 100644 --- a/chromium/components/viz/service/display/overlay_strategy_single_on_top.h +++ b/chromium/components/viz/service/display/overlay_strategy_single_on_top.h @@ -31,8 +31,6 @@ class VIZ_SERVICE_EXPORT OverlayStrategySingleOnTop OverlayStrategy GetUMAEnum() const override; private: - static constexpr size_t kMaxFrameCandidateWithSameResourceId = 3; - bool TryOverlay(QuadList* quad_list, OverlayCandidateList* candidate_list, const OverlayCandidate& candidate, @@ -40,9 +38,6 @@ class VIZ_SERVICE_EXPORT OverlayStrategySingleOnTop OverlayCandidateValidator* capability_checker_; // Weak. - ResourceId previous_frame_resource_id_ = kInvalidResourceId; - size_t same_resource_id_frames_count_ = 0; - DISALLOW_COPY_AND_ASSIGN(OverlayStrategySingleOnTop); }; diff --git a/chromium/components/viz/service/display/overlay_unittest.cc b/chromium/components/viz/service/display/overlay_unittest.cc index dbdd22a7647..5d307e68a5a 100644 --- a/chromium/components/viz/service/display/overlay_unittest.cc +++ b/chromium/components/viz/service/display/overlay_unittest.cc @@ -1564,70 +1564,6 @@ TEST_F(SingleOverlayOnTopTest, RejectTransparentColorOnTopWithoutBlending) { EXPECT_EQ(0U, candidate_list.size()); } -TEST_F(SingleOverlayOnTopTest, DoNotPromoteIfContentsDontChange) { - // Resource ID for the repeated quads. Value should be equivalent to - // OverlayStrategySingleOnTop::kMaxFrameCandidateWithSameResourceId. - constexpr size_t kFramesSkippedBeforeNotPromoting = 3; - ResourceId previous_resource_id; - - for (size_t i = 0; i < 3 + kFramesSkippedBeforeNotPromoting; ++i) { - std::unique_ptr<RenderPass> pass = CreateRenderPass(); - RenderPass* main_pass = pass.get(); - - ResourceId resource_id; - if (i == 0 || i == 1) { - // Create a unique resource only for the first 2 frames. - resource_id = CreateResource( - resource_provider_.get(), child_resource_provider_.get(), - child_provider_.get(), pass->output_rect.size(), - true /*is_overlay_candidate*/); - previous_resource_id = resource_id; - } else { - // Starting the 3rd frame, they should have the same resource ID. - resource_id = previous_resource_id; - } - - // Create a quad with the resource ID selected above. - TextureDrawQuad* original_quad = - main_pass->CreateAndAppendDrawQuad<TextureDrawQuad>(); - float vertex_opacity[4] = {1.0f, 1.0f, 1.0f, 1.0f}; - original_quad->SetNew( - pass->shared_quad_state_list.back(), pass->output_rect, - pass->output_rect, false /*needs_blending*/, resource_id, - false /*premultiplied_alpha*/, kUVTopLeft, kUVBottomRight, - SK_ColorTRANSPARENT, vertex_opacity, false /*flipped*/, - false /*nearest_neighbor*/, false /*secure_output_only*/, - ui::ProtectedVideoType::kClear); - original_quad->set_resource_size_in_pixels(pass->output_rect.size()); - - // Add something behind it. - CreateFullscreenOpaqueQuad(resource_provider_.get(), - pass->shared_quad_state_list.back(), main_pass); - - // Check for potential candidates. - OverlayCandidateList candidate_list; - OverlayProcessor::FilterOperationsMap render_pass_filters; - OverlayProcessor::FilterOperationsMap render_pass_backdrop_filters; - RenderPassList pass_list; - pass_list.push_back(std::move(pass)); - overlay_processor_->ProcessForOverlays( - resource_provider_.get(), &pass_list, GetIdentityColorMatrix(), - render_pass_filters, render_pass_backdrop_filters, &candidate_list, - nullptr, nullptr, &damage_rect_, &content_bounds_); - - if (i <= kFramesSkippedBeforeNotPromoting) { - EXPECT_EQ(1U, candidate_list.size()); - // Check that the right resource id got extracted. - EXPECT_EQ(resource_id, candidate_list.back().resource_id); - // Check that the quad is gone. - EXPECT_EQ(1U, main_pass->quad_list.size()); - } else { - // Check nothing has been promoted. - EXPECT_EQ(2U, main_pass->quad_list.size()); - } - } -} - TEST_F(UnderlayTest, OverlayLayerUnderMainLayer) { output_surface_->GetOverlayCandidateValidator()->AddExpectedRect( gfx::RectF(kOverlayBottomRightRect)); |