| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/test/layer_tree_pixel_test.h" | 5 #include "cc/test/layer_tree_pixel_test.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/path_service.h" | 11 #include "base/path_service.h" |
| 12 #include "cc/base/switches.h" | 12 #include "cc/base/switches.h" |
| 13 #include "cc/layers/solid_color_layer.h" | 13 #include "cc/layers/solid_color_layer.h" |
| 14 #include "cc/layers/texture_layer.h" | 14 #include "cc/layers/texture_layer.h" |
| 15 #include "cc/output/copy_output_request.h" | 15 #include "cc/output/copy_output_request.h" |
| 16 #include "cc/output/copy_output_result.h" | 16 #include "cc/output/copy_output_result.h" |
| 17 #include "cc/resources/texture_mailbox.h" | 17 #include "cc/resources/texture_mailbox.h" |
| 18 #include "cc/test/paths.h" | 18 #include "cc/test/paths.h" |
| 19 #include "cc/test/pixel_comparator.h" | 19 #include "cc/test/pixel_comparator.h" |
| 20 #include "cc/test/pixel_test_output_surface.h" | 20 #include "cc/test/pixel_test_output_surface.h" |
| 21 #include "cc/test/pixel_test_software_output_device.h" | 21 #include "cc/test/pixel_test_software_output_device.h" |
| 22 #include "cc/test/pixel_test_utils.h" | 22 #include "cc/test/pixel_test_utils.h" |
| 23 #include "cc/test/test_delegating_output_surface.h" | 23 #include "cc/test/test_compositor_frame_sink.h" |
| 24 #include "cc/test/test_in_process_context_provider.h" | 24 #include "cc/test/test_in_process_context_provider.h" |
| 25 #include "cc/trees/layer_tree_impl.h" | 25 #include "cc/trees/layer_tree_impl.h" |
| 26 #include "gpu/command_buffer/client/gl_in_process_context.h" | 26 #include "gpu/command_buffer/client/gl_in_process_context.h" |
| 27 #include "gpu/command_buffer/client/gles2_implementation.h" | 27 #include "gpu/command_buffer/client/gles2_implementation.h" |
| 28 | 28 |
| 29 using gpu::gles2::GLES2Interface; | 29 using gpu::gles2::GLES2Interface; |
| 30 | 30 |
| 31 namespace cc { | 31 namespace cc { |
| 32 | 32 |
| 33 LayerTreePixelTest::LayerTreePixelTest() | 33 LayerTreePixelTest::LayerTreePixelTest() |
| 34 : pixel_comparator_(new ExactPixelComparator(true)), | 34 : pixel_comparator_(new ExactPixelComparator(true)), |
| 35 test_type_(PIXEL_TEST_GL), | 35 test_type_(PIXEL_TEST_GL), |
| 36 pending_texture_mailbox_callbacks_(0) {} | 36 pending_texture_mailbox_callbacks_(0) {} |
| 37 | 37 |
| 38 LayerTreePixelTest::~LayerTreePixelTest() {} | 38 LayerTreePixelTest::~LayerTreePixelTest() {} |
| 39 | 39 |
| 40 std::unique_ptr<TestDelegatingOutputSurface> | 40 std::unique_ptr<TestCompositorFrameSink> |
| 41 LayerTreePixelTest::CreateDelegatingOutputSurface( | 41 LayerTreePixelTest::CreateCompositorFrameSink( |
| 42 scoped_refptr<ContextProvider>, | 42 scoped_refptr<ContextProvider>, |
| 43 scoped_refptr<ContextProvider>) { | 43 scoped_refptr<ContextProvider>) { |
| 44 scoped_refptr<TestInProcessContextProvider> compositor_context_provider; | 44 scoped_refptr<TestInProcessContextProvider> compositor_context_provider; |
| 45 scoped_refptr<TestInProcessContextProvider> worker_context_provider; | 45 scoped_refptr<TestInProcessContextProvider> worker_context_provider; |
| 46 if (test_type_ == PIXEL_TEST_GL) { | 46 if (test_type_ == PIXEL_TEST_GL) { |
| 47 compositor_context_provider = new TestInProcessContextProvider(nullptr); | 47 compositor_context_provider = new TestInProcessContextProvider(nullptr); |
| 48 worker_context_provider = | 48 worker_context_provider = |
| 49 new TestInProcessContextProvider(compositor_context_provider.get()); | 49 new TestInProcessContextProvider(compositor_context_provider.get()); |
| 50 } | 50 } |
| 51 bool synchronous_composite = | 51 bool synchronous_composite = |
| 52 !HasImplThread() && | 52 !HasImplThread() && |
| 53 !layer_tree_host()->GetSettings().single_thread_proxy_scheduler; | 53 !layer_tree_host()->GetSettings().single_thread_proxy_scheduler; |
| 54 // Allow resource reclaiming for partial raster tests to get back | 54 // Allow resource reclaiming for partial raster tests to get back |
| 55 // resources from the Display. | 55 // resources from the Display. |
| 56 bool force_disable_reclaim_resources = false; | 56 bool force_disable_reclaim_resources = false; |
| 57 auto delegating_output_surface = | 57 auto delegating_output_surface = base::MakeUnique<TestCompositorFrameSink>( |
| 58 base::MakeUnique<TestDelegatingOutputSurface>( | 58 compositor_context_provider, std::move(worker_context_provider), |
| 59 compositor_context_provider, std::move(worker_context_provider), | 59 CreateDisplayOutputSurface(compositor_context_provider), |
| 60 CreateDisplayOutputSurface(compositor_context_provider), | 60 shared_bitmap_manager(), gpu_memory_buffer_manager(), RendererSettings(), |
| 61 shared_bitmap_manager(), gpu_memory_buffer_manager(), | 61 ImplThreadTaskRunner(), synchronous_composite, |
| 62 RendererSettings(), ImplThreadTaskRunner(), synchronous_composite, | 62 force_disable_reclaim_resources); |
| 63 force_disable_reclaim_resources); | |
| 64 delegating_output_surface->SetEnlargePassTextureAmount( | 63 delegating_output_surface->SetEnlargePassTextureAmount( |
| 65 enlarge_texture_amount_); | 64 enlarge_texture_amount_); |
| 66 return delegating_output_surface; | 65 return delegating_output_surface; |
| 67 } | 66 } |
| 68 | 67 |
| 69 std::unique_ptr<OutputSurface> LayerTreePixelTest::CreateDisplayOutputSurface( | 68 std::unique_ptr<OutputSurface> LayerTreePixelTest::CreateDisplayOutputSurface( |
| 70 scoped_refptr<ContextProvider> compositor_context_provider) { | 69 scoped_refptr<ContextProvider> compositor_context_provider) { |
| 71 // Always test Webview shenanigans. | 70 // Always test Webview shenanigans. |
| 72 gfx::Size surface_expansion_size(40, 60); | 71 gfx::Size surface_expansion_size(40, 60); |
| 73 | 72 |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 } | 289 } |
| 291 | 290 |
| 292 void LayerTreePixelTest::Finish() { | 291 void LayerTreePixelTest::Finish() { |
| 293 std::unique_ptr<gpu::GLInProcessContext> context = | 292 std::unique_ptr<gpu::GLInProcessContext> context = |
| 294 CreateTestInProcessContext(); | 293 CreateTestInProcessContext(); |
| 295 GLES2Interface* gl = context->GetImplementation(); | 294 GLES2Interface* gl = context->GetImplementation(); |
| 296 gl->Finish(); | 295 gl->Finish(); |
| 297 } | 296 } |
| 298 | 297 |
| 299 } // namespace cc | 298 } // namespace cc |
| OLD | NEW |