| 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 "cc/layers/content_layer_client.h" | 5 #include "cc/layers/content_layer_client.h" |
| 6 #include "cc/layers/picture_layer.h" | 6 #include "cc/layers/picture_layer.h" |
| 7 #include "cc/output/copy_output_request.h" | 7 #include "cc/output/copy_output_request.h" |
| 8 #include "cc/playback/display_item_list.h" | 8 #include "cc/playback/display_item_list.h" |
| 9 #include "cc/playback/display_item_list_settings.h" | 9 #include "cc/playback/display_item_list_settings.h" |
| 10 #include "cc/playback/drawing_display_item.h" | 10 #include "cc/playback/drawing_display_item.h" |
| 11 #include "cc/test/layer_tree_pixel_test.h" | 11 #include "cc/test/layer_tree_pixel_test.h" |
| 12 #include "cc/test/test_gpu_memory_buffer_manager.h" | 12 #include "cc/test/test_gpu_memory_buffer_manager.h" |
| 13 #include "third_party/skia/include/core/SkCanvas.h" | 13 #include "third_party/skia/include/core/SkCanvas.h" |
| 14 #include "third_party/skia/include/core/SkPictureRecorder.h" | 14 #include "third_party/skia/include/core/SkPictureRecorder.h" |
| 15 | 15 |
| 16 #if !defined(OS_ANDROID) | 16 #if !defined(OS_ANDROID) |
| 17 | 17 |
| 18 namespace cc { | 18 namespace cc { |
| 19 namespace { | 19 namespace { |
| 20 | 20 |
| 21 enum RasterMode { | 21 enum RasterMode { |
| 22 PARTIAL_ONE_COPY, | 22 PARTIAL_ONE_COPY, |
| 23 FULL_ONE_COPY, | 23 FULL_ONE_COPY, |
| 24 GPU, | 24 PARTIAL_GPU, |
| 25 BITMAP, | 25 FULL_GPU, |
| 26 PARTIAL_BITMAP, |
| 27 FULL_BITMAP, |
| 26 }; | 28 }; |
| 27 | 29 |
| 28 class LayerTreeHostTilesPixelTest : public LayerTreePixelTest { | 30 class LayerTreeHostTilesPixelTest : public LayerTreePixelTest { |
| 29 protected: | 31 protected: |
| 30 void InitializeSettings(LayerTreeSettings* settings) override { | 32 void InitializeSettings(LayerTreeSettings* settings) override { |
| 31 LayerTreePixelTest::InitializeSettings(settings); | 33 LayerTreePixelTest::InitializeSettings(settings); |
| 32 switch (raster_mode_) { | 34 switch (raster_mode_) { |
| 33 case PARTIAL_ONE_COPY: | 35 case PARTIAL_ONE_COPY: |
| 34 settings->use_zero_copy = false; | 36 settings->use_zero_copy = false; |
| 35 settings->use_persistent_map_for_gpu_memory_buffers = true; | 37 settings->use_partial_raster = true; |
| 36 break; | 38 break; |
| 37 case FULL_ONE_COPY: | 39 case FULL_ONE_COPY: |
| 38 settings->use_zero_copy = false; | 40 settings->use_zero_copy = false; |
| 39 settings->use_persistent_map_for_gpu_memory_buffers = false; | 41 settings->use_partial_raster = false; |
| 40 break; | 42 break; |
| 41 case BITMAP: | 43 case PARTIAL_BITMAP: |
| 42 // This is done via context creation. No settings to change here! | 44 settings->use_partial_raster = true; |
| 43 break; | 45 break; |
| 44 case GPU: | 46 case FULL_BITMAP: |
| 47 settings->use_partial_raster = false; |
| 48 break; |
| 49 case PARTIAL_GPU: |
| 45 settings->gpu_rasterization_enabled = true; | 50 settings->gpu_rasterization_enabled = true; |
| 46 settings->gpu_rasterization_forced = true; | 51 settings->gpu_rasterization_forced = true; |
| 52 settings->use_partial_raster = true; |
| 53 break; |
| 54 case FULL_GPU: |
| 55 settings->gpu_rasterization_enabled = true; |
| 56 settings->gpu_rasterization_forced = true; |
| 57 settings->use_partial_raster = false; |
| 47 break; | 58 break; |
| 48 } | 59 } |
| 49 } | 60 } |
| 50 | 61 |
| 51 void BeginTest() override { | 62 void BeginTest() override { |
| 52 // Don't set up a readback target at the start of the test. | 63 // Don't set up a readback target at the start of the test. |
| 53 PostSetNeedsCommitToMainThread(); | 64 PostSetNeedsCommitToMainThread(); |
| 54 } | 65 } |
| 55 | 66 |
| 56 void DoReadback() { | 67 void DoReadback() { |
| 57 Layer* target = | 68 Layer* target = |
| 58 readback_target_ ? readback_target_ : layer_tree_host()->root_layer(); | 69 readback_target_ ? readback_target_ : layer_tree_host()->root_layer(); |
| 59 target->RequestCopyOfOutput(CreateCopyOutputRequest()); | 70 target->RequestCopyOfOutput(CreateCopyOutputRequest()); |
| 60 } | 71 } |
| 61 | 72 |
| 62 void RunRasterPixelTest(bool threaded, | 73 void RunRasterPixelTest(bool threaded, |
| 63 RasterMode mode, | 74 RasterMode mode, |
| 64 scoped_refptr<Layer> content_root, | 75 scoped_refptr<Layer> content_root, |
| 65 base::FilePath file_name) { | 76 base::FilePath file_name) { |
| 66 raster_mode_ = mode; | 77 raster_mode_ = mode; |
| 67 | 78 |
| 68 PixelTestType test_type = PIXEL_TEST_SOFTWARE; | 79 PixelTestType test_type = PIXEL_TEST_SOFTWARE; |
| 69 switch (mode) { | 80 switch (mode) { |
| 70 case PARTIAL_ONE_COPY: | 81 case PARTIAL_ONE_COPY: |
| 71 case FULL_ONE_COPY: | 82 case FULL_ONE_COPY: |
| 72 case GPU: | 83 case PARTIAL_GPU: |
| 84 case FULL_GPU: |
| 73 test_type = PIXEL_TEST_GL; | 85 test_type = PIXEL_TEST_GL; |
| 74 break; | 86 break; |
| 75 case BITMAP: | 87 case PARTIAL_BITMAP: |
| 88 case FULL_BITMAP: |
| 76 test_type = PIXEL_TEST_SOFTWARE; | 89 test_type = PIXEL_TEST_SOFTWARE; |
| 77 } | 90 } |
| 78 | 91 |
| 79 if (threaded) | 92 if (threaded) |
| 80 RunPixelTest(test_type, content_root, file_name); | 93 RunPixelTest(test_type, content_root, file_name); |
| 81 else | 94 else |
| 82 RunSingleThreadedPixelTest(test_type, content_root, file_name); | 95 RunSingleThreadedPixelTest(test_type, content_root, file_name); |
| 83 } | 96 } |
| 84 | 97 |
| 85 base::FilePath ref_file_; | 98 base::FilePath ref_file_; |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 TEST_F(LayerTreeHostTilesTestPartialInvalidation, | 211 TEST_F(LayerTreeHostTilesTestPartialInvalidation, |
| 199 FullRaster_MultiThread_OneCopy) { | 212 FullRaster_MultiThread_OneCopy) { |
| 200 RunRasterPixelTest( | 213 RunRasterPixelTest( |
| 201 true, FULL_ONE_COPY, picture_layer_, | 214 true, FULL_ONE_COPY, picture_layer_, |
| 202 base::FilePath(FILE_PATH_LITERAL("blue_yellow_flipped.png"))); | 215 base::FilePath(FILE_PATH_LITERAL("blue_yellow_flipped.png"))); |
| 203 } | 216 } |
| 204 | 217 |
| 205 TEST_F(LayerTreeHostTilesTestPartialInvalidation, | 218 TEST_F(LayerTreeHostTilesTestPartialInvalidation, |
| 206 PartialRaster_SingleThread_Software) { | 219 PartialRaster_SingleThread_Software) { |
| 207 RunRasterPixelTest( | 220 RunRasterPixelTest( |
| 208 false, BITMAP, picture_layer_, | 221 false, PARTIAL_BITMAP, picture_layer_, |
| 209 base::FilePath(FILE_PATH_LITERAL("blue_yellow_partial_flipped.png"))); | 222 base::FilePath(FILE_PATH_LITERAL("blue_yellow_partial_flipped.png"))); |
| 210 } | 223 } |
| 211 | 224 |
| 212 TEST_F(LayerTreeHostTilesTestPartialInvalidation, | 225 TEST_F(LayerTreeHostTilesTestPartialInvalidation, |
| 226 FulllRaster_SingleThread_Software) { |
| 227 RunRasterPixelTest( |
| 228 false, FULL_BITMAP, picture_layer_, |
| 229 base::FilePath(FILE_PATH_LITERAL("blue_yellow_flipped.png"))); |
| 230 } |
| 231 |
| 232 TEST_F(LayerTreeHostTilesTestPartialInvalidation, |
| 213 PartialRaster_SingleThread_GpuRaster) { | 233 PartialRaster_SingleThread_GpuRaster) { |
| 214 RunRasterPixelTest( | 234 RunRasterPixelTest( |
| 215 false, GPU, picture_layer_, | 235 false, PARTIAL_GPU, picture_layer_, |
| 216 base::FilePath(FILE_PATH_LITERAL("blue_yellow_partial_flipped.png"))); | 236 base::FilePath(FILE_PATH_LITERAL("blue_yellow_partial_flipped.png"))); |
| 217 } | 237 } |
| 218 | 238 |
| 239 TEST_F(LayerTreeHostTilesTestPartialInvalidation, |
| 240 FullRaster_SingleThread_GpuRaster) { |
| 241 RunRasterPixelTest( |
| 242 false, FULL_GPU, picture_layer_, |
| 243 base::FilePath(FILE_PATH_LITERAL("blue_yellow_flipped.png"))); |
| 244 } |
| 245 |
| 219 } // namespace | 246 } // namespace |
| 220 } // namespace cc | 247 } // namespace cc |
| 221 | 248 |
| 222 #endif // !defined(OS_ANDROID) | 249 #endif // !defined(OS_ANDROID) |
| OLD | NEW |