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

Side by Side Diff: cc/trees/layer_tree_host_unittest.cc

Issue 2654993004: Move GPU blacklist calculation to GPU proc (Closed)
Patch Set: fix win clang build Created 3 years, 10 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 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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 "cc/trees/layer_tree_host.h" 5 #include "cc/trees/layer_tree_host.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 SetAggressivelyFreeResources(false)); 460 SetAggressivelyFreeResources(false));
461 EXPECT_CALL(*mock_worker_context_support_, 461 EXPECT_CALL(*mock_worker_context_support_,
462 SetAggressivelyFreeResources(false)); 462 SetAggressivelyFreeResources(false));
463 463
464 return LayerTreeHostTest::CreateCompositorFrameSink( 464 return LayerTreeHostTest::CreateCompositorFrameSink(
465 std::move(test_main_context_provider), 465 std::move(test_main_context_provider),
466 std::move(test_worker_context_provider)); 466 std::move(test_worker_context_provider));
467 } 467 }
468 468
469 void InitializeSettings(LayerTreeSettings* settings) override { 469 void InitializeSettings(LayerTreeSettings* settings) override {
470 settings->gpu_rasterization_enabled = true;
471 settings->gpu_rasterization_forced = true; 470 settings->gpu_rasterization_forced = true;
472 } 471 }
473 472
474 void BeginTest() override {} 473 void BeginTest() override {}
475 void AfterTest() override {} 474 void AfterTest() override {}
476 475
477 protected: 476 protected:
478 class MockContextSupport : public TestContextSupport { 477 class MockContextSupport : public TestContextSupport {
479 public: 478 public:
480 MockContextSupport() {} 479 MockContextSupport() {}
(...skipping 1171 matching lines...) Expand 10 before | Expand all | Expand 10 after
1652 root_layer_->SetTransform(transform); 1651 root_layer_->SetTransform(transform);
1653 root_layer_->SetBounds(bounds_); 1652 root_layer_->SetBounds(bounds_);
1654 layer_tree_host()->SetRootLayer(root_layer_); 1653 layer_tree_host()->SetRootLayer(root_layer_);
1655 layer_tree_host()->SetViewportSize(bounds_); 1654 layer_tree_host()->SetViewportSize(bounds_);
1656 1655
1657 PostSetNeedsCommitToMainThread(); 1656 PostSetNeedsCommitToMainThread();
1658 client_.set_bounds(root_layer_->bounds()); 1657 client_.set_bounds(root_layer_->bounds());
1659 } 1658 }
1660 1659
1661 void InitializeSettings(LayerTreeSettings* settings) override { 1660 void InitializeSettings(LayerTreeSettings* settings) override {
1662 settings->gpu_rasterization_enabled = true;
1663 settings->gpu_rasterization_forced = true; 1661 settings->gpu_rasterization_forced = true;
1664 } 1662 }
1665 1663
1666 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { 1664 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override {
1667 if (num_draws_ == 2) { 1665 if (num_draws_ == 2) {
1668 auto* pending_tree = host_impl->pending_tree(); 1666 auto* pending_tree = host_impl->pending_tree();
1669 auto* pending_layer_impl = static_cast<FakePictureLayerImpl*>( 1667 auto* pending_layer_impl = static_cast<FakePictureLayerImpl*>(
1670 pending_tree->root_layer_for_testing()); 1668 pending_tree->root_layer_for_testing());
1671 EXPECT_NE(pending_layer_impl, nullptr); 1669 EXPECT_NE(pending_layer_impl, nullptr);
1672 1670
(...skipping 3484 matching lines...) Expand 10 before | Expand all | Expand 10 after
5157 FakeContentLayerClient client_; 5155 FakeContentLayerClient client_;
5158 std::unique_ptr<FakeScopedUIResource> ui_resource_; 5156 std::unique_ptr<FakeScopedUIResource> ui_resource_;
5159 }; 5157 };
5160 5158
5161 // This test is flaky, see http://crbug.com/386199 5159 // This test is flaky, see http://crbug.com/386199
5162 // MULTI_THREAD_TEST_F(LayerTreeHostTestHighResRequiredAfterEvictingUIResources) 5160 // MULTI_THREAD_TEST_F(LayerTreeHostTestHighResRequiredAfterEvictingUIResources)
5163 5161
5164 class LayerTreeHostTestGpuRasterizationDefault : public LayerTreeHostTest { 5162 class LayerTreeHostTestGpuRasterizationDefault : public LayerTreeHostTest {
5165 protected: 5163 protected:
5166 void InitializeSettings(LayerTreeSettings* settings) override { 5164 void InitializeSettings(LayerTreeSettings* settings) override {
5167 EXPECT_FALSE(settings->gpu_rasterization_enabled);
5168 EXPECT_FALSE(settings->gpu_rasterization_forced); 5165 EXPECT_FALSE(settings->gpu_rasterization_forced);
5169 } 5166 }
5170 5167
5171 void SetupTree() override { 5168 void SetupTree() override {
5172 LayerTreeHostTest::SetupTree(); 5169 LayerTreeHostTest::SetupTree();
5173 5170
5174 std::unique_ptr<FakeRecordingSource> recording_source( 5171 std::unique_ptr<FakeRecordingSource> recording_source(
5175 new FakeRecordingSource); 5172 new FakeRecordingSource);
5176 recording_source_ = recording_source.get(); 5173 recording_source_ = recording_source.get();
5177 5174
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
5264 5261
5265 void AfterTest() override {} 5262 void AfterTest() override {}
5266 5263
5267 FakeContentLayerClient layer_client_; 5264 FakeContentLayerClient layer_client_;
5268 FakePictureLayer* layer_; 5265 FakePictureLayer* layer_;
5269 FakeRecordingSource* recording_source_; 5266 FakeRecordingSource* recording_source_;
5270 }; 5267 };
5271 5268
5272 MULTI_THREAD_TEST_F(LayerTreeHostTestEmptyLayerGpuRasterization); 5269 MULTI_THREAD_TEST_F(LayerTreeHostTestEmptyLayerGpuRasterization);
5273 5270
5274 class LayerTreeHostTestGpuRasterizationEnabled : public LayerTreeHostTest { 5271 class LayerTreeHostWithGpuRasterizationTest : public LayerTreeHostTest {
5275 protected: 5272 protected:
5276 void InitializeSettings(LayerTreeSettings* settings) override { 5273 std::unique_ptr<TestCompositorFrameSink> CreateCompositorFrameSink(
5277 EXPECT_FALSE(settings->gpu_rasterization_enabled); 5274 scoped_refptr<ContextProvider> compositor_context_provider,
5278 settings->gpu_rasterization_enabled = true; 5275 scoped_refptr<ContextProvider> worker_context_provider) override {
5276 auto context = TestWebGraphicsContext3D::Create();
5277 context->set_gpu_rasterization(true);
5278 auto context_provider = TestContextProvider::Create(std::move(context));
5279 return LayerTreeHostTest::CreateCompositorFrameSink(
5280 std::move(context_provider), std::move(worker_context_provider));
5279 } 5281 }
5282 };
5280 5283
5284 class LayerTreeHostTestGpuRasterizationEnabled
5285 : public LayerTreeHostWithGpuRasterizationTest {
5286 protected:
5281 void SetupTree() override { 5287 void SetupTree() override {
5282 LayerTreeHostTest::SetupTree(); 5288 LayerTreeHostTest::SetupTree();
5283 5289
5284 std::unique_ptr<FakeRecordingSource> recording_source( 5290 std::unique_ptr<FakeRecordingSource> recording_source(
5285 new FakeRecordingSource); 5291 new FakeRecordingSource);
5286 recording_source_ = recording_source.get(); 5292 recording_source_ = recording_source.get();
5287 5293
5288 scoped_refptr<FakePictureLayer> layer = 5294 scoped_refptr<FakePictureLayer> layer =
5289 FakePictureLayer::CreateWithRecordingSource( 5295 FakePictureLayer::CreateWithRecordingSource(
5290 &layer_client_, std::move(recording_source)); 5296 &layer_client_, std::move(recording_source));
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
5332 5338
5333 void AfterTest() override {} 5339 void AfterTest() override {}
5334 5340
5335 FakeContentLayerClient layer_client_; 5341 FakeContentLayerClient layer_client_;
5336 FakePictureLayer* layer_; 5342 FakePictureLayer* layer_;
5337 FakeRecordingSource* recording_source_; 5343 FakeRecordingSource* recording_source_;
5338 }; 5344 };
5339 5345
5340 MULTI_THREAD_TEST_F(LayerTreeHostTestGpuRasterizationEnabled); 5346 MULTI_THREAD_TEST_F(LayerTreeHostTestGpuRasterizationEnabled);
5341 5347
5342 class LayerTreeHostTestGpuRasterizationReenabled : public LayerTreeHostTest { 5348 class LayerTreeHostTestGpuRasterizationReenabled
5349 : public LayerTreeHostWithGpuRasterizationTest {
5343 protected: 5350 protected:
5344 void InitializeSettings(LayerTreeSettings* settings) override {
5345 EXPECT_FALSE(settings->gpu_rasterization_enabled);
5346 settings->gpu_rasterization_enabled = true;
5347 }
5348
5349 void SetupTree() override { 5351 void SetupTree() override {
5350 LayerTreeHostTest::SetupTree(); 5352 LayerTreeHostTest::SetupTree();
5351 5353
5352 std::unique_ptr<FakeRecordingSource> recording_source( 5354 std::unique_ptr<FakeRecordingSource> recording_source(
5353 new FakeRecordingSource); 5355 new FakeRecordingSource);
5354 recording_source_ = recording_source.get(); 5356 recording_source_ = recording_source.get();
5355 5357
5356 scoped_refptr<FakePictureLayer> layer = 5358 scoped_refptr<FakePictureLayer> layer =
5357 FakePictureLayer::CreateWithRecordingSource( 5359 FakePictureLayer::CreateWithRecordingSource(
5358 &layer_client_, std::move(recording_source)); 5360 &layer_client_, std::move(recording_source));
(...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after
6144 FakeContentLayerClient client_; 6146 FakeContentLayerClient client_;
6145 }; 6147 };
6146 6148
6147 SINGLE_AND_MULTI_THREAD_TEST_F(RasterizeWithGpuRasterizationCreatesResources); 6149 SINGLE_AND_MULTI_THREAD_TEST_F(RasterizeWithGpuRasterizationCreatesResources);
6148 6150
6149 class GpuRasterizationRasterizesBorderTiles : public LayerTreeHostTest { 6151 class GpuRasterizationRasterizesBorderTiles : public LayerTreeHostTest {
6150 protected: 6152 protected:
6151 GpuRasterizationRasterizesBorderTiles() : viewport_size_(1024, 2048) {} 6153 GpuRasterizationRasterizesBorderTiles() : viewport_size_(1024, 2048) {}
6152 6154
6153 void InitializeSettings(LayerTreeSettings* settings) override { 6155 void InitializeSettings(LayerTreeSettings* settings) override {
6154 settings->gpu_rasterization_enabled = true;
6155 settings->gpu_rasterization_forced = true; 6156 settings->gpu_rasterization_forced = true;
6156 } 6157 }
6157 6158
6158 void SetupTree() override { 6159 void SetupTree() override {
6159 client_.set_fill_with_nonsolid_color(true); 6160 client_.set_fill_with_nonsolid_color(true);
6160 6161
6161 std::unique_ptr<FakeRecordingSource> recording(new FakeRecordingSource); 6162 std::unique_ptr<FakeRecordingSource> recording(new FakeRecordingSource);
6162 scoped_refptr<FakePictureLayer> root = 6163 scoped_refptr<FakePictureLayer> root =
6163 FakePictureLayer::CreateWithRecordingSource(&client_, 6164 FakePictureLayer::CreateWithRecordingSource(&client_,
6164 std::move(recording)); 6165 std::move(recording));
(...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after
6972 // Note that this code path won't always hit the crash, even when incorrect 6973 // Note that this code path won't always hit the crash, even when incorrect
6973 // behavior occurs, so this is more of a sanity check. 6974 // behavior occurs, so this is more of a sanity check.
6974 // TODO(ericrk): We should improve this so that we can reliably detect the 6975 // TODO(ericrk): We should improve this so that we can reliably detect the
6975 // crash. 6976 // crash.
6976 class GpuRasterizationSucceedsWithLargeImage : public LayerTreeHostTest { 6977 class GpuRasterizationSucceedsWithLargeImage : public LayerTreeHostTest {
6977 protected: 6978 protected:
6978 GpuRasterizationSucceedsWithLargeImage() 6979 GpuRasterizationSucceedsWithLargeImage()
6979 : viewport_size_(1024, 2048), large_image_size_(20000, 10) {} 6980 : viewport_size_(1024, 2048), large_image_size_(20000, 10) {}
6980 6981
6981 void InitializeSettings(LayerTreeSettings* settings) override { 6982 void InitializeSettings(LayerTreeSettings* settings) override {
6982 settings->gpu_rasterization_enabled = true;
6983 settings->gpu_rasterization_forced = true; 6983 settings->gpu_rasterization_forced = true;
6984 6984
6985 /// Set to 0 to force at-raster GPU image decode. 6985 /// Set to 0 to force at-raster GPU image decode.
6986 settings->gpu_decoded_image_budget_bytes = 0; 6986 settings->gpu_decoded_image_budget_bytes = 0;
6987 } 6987 }
6988 6988
6989 void SetupTree() override { 6989 void SetupTree() override {
6990 client_.set_fill_with_nonsolid_color(true); 6990 client_.set_fill_with_nonsolid_color(true);
6991 6991
6992 std::unique_ptr<FakeRecordingSource> recording = 6992 std::unique_ptr<FakeRecordingSource> recording =
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
7117 EndTest(); 7117 EndTest();
7118 } 7118 }
7119 7119
7120 void AfterTest() override {} 7120 void AfterTest() override {}
7121 }; 7121 };
7122 7122
7123 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSubmitFrameResources); 7123 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSubmitFrameResources);
7124 7124
7125 } // namespace 7125 } // namespace
7126 } // namespace cc 7126 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_pixeltest_tiles.cc ('k') | cc/trees/layer_tree_host_unittest_record_gpu_histogram.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698