diff options
Diffstat (limited to 'cc/test')
-rw-r--r-- | cc/test/fake_output_surface.h | 8 | ||||
-rw-r--r-- | cc/test/fake_resource_provider.h | 5 | ||||
-rw-r--r-- | cc/test/layer_tree_pixel_resource_test.cc | 27 | ||||
-rw-r--r-- | cc/test/layer_tree_pixel_resource_test.h | 4 | ||||
-rw-r--r-- | cc/test/layer_tree_pixel_test.cc | 6 | ||||
-rw-r--r-- | cc/test/layer_tree_pixel_test.h | 2 | ||||
-rw-r--r-- | cc/test/layer_tree_test.cc | 10 | ||||
-rw-r--r-- | cc/test/layer_tree_test.h | 3 | ||||
-rw-r--r-- | cc/test/pixel_test.cc | 4 | ||||
-rw-r--r-- | cc/test/test_in_process_context_provider.cc | 1 |
10 files changed, 41 insertions, 29 deletions
diff --git a/cc/test/fake_output_surface.h b/cc/test/fake_output_surface.h index 066f027..a682177 100644 --- a/cc/test/fake_output_surface.h +++ b/cc/test/fake_output_surface.h @@ -60,15 +60,13 @@ class FakeOutputSurface : public OutputSurface { static scoped_ptr<FakeOutputSurface> CreateDelegating3d( scoped_refptr<TestContextProvider> context_provider) { - return make_scoped_ptr(new FakeOutputSurface( - context_provider, TestContextProvider::Create(), true)); + return make_scoped_ptr(new FakeOutputSurface(context_provider, true)); } static scoped_ptr<FakeOutputSurface> CreateDelegating3d( scoped_ptr<TestWebGraphicsContext3D> context) { - return make_scoped_ptr( - new FakeOutputSurface(TestContextProvider::Create(context.Pass()), - TestContextProvider::Create(), true)); + return make_scoped_ptr(new FakeOutputSurface( + TestContextProvider::Create(context.Pass()), true)); } static scoped_ptr<FakeOutputSurface> CreateDelegatingSoftware( diff --git a/cc/test/fake_resource_provider.h b/cc/test/fake_resource_provider.h index e954d26..2295a4f 100644 --- a/cc/test/fake_resource_provider.h +++ b/cc/test/fake_resource_provider.h @@ -17,6 +17,7 @@ class FakeResourceProvider : public ResourceProvider { SharedBitmapManager* shared_bitmap_manager) { scoped_ptr<FakeResourceProvider> provider(new FakeResourceProvider( output_surface, shared_bitmap_manager, nullptr, nullptr, 0, false, 1, + false, std::vector<unsigned>(static_cast<size_t>(gfx::BufferFormat::LAST) + 1, GL_TEXTURE_2D))); provider->Initialize(); @@ -29,7 +30,7 @@ class FakeResourceProvider : public ResourceProvider { gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager) { scoped_ptr<FakeResourceProvider> provider(new FakeResourceProvider( output_surface, shared_bitmap_manager, gpu_memory_buffer_manager, - nullptr, 0, false, 1, + nullptr, 0, false, 1, false, std::vector<unsigned>(static_cast<size_t>(gfx::BufferFormat::LAST) + 1, GL_TEXTURE_2D))); provider->Initialize(); @@ -44,6 +45,7 @@ class FakeResourceProvider : public ResourceProvider { int highp_threshold_min, bool use_rgba_4444_texture_format, size_t id_allocation_chunk_size, + bool use_persistent_map_for_gpu_memory_buffers, const std::vector<unsigned>& use_image_texture_targets) : ResourceProvider(output_surface, shared_bitmap_manager, @@ -52,6 +54,7 @@ class FakeResourceProvider : public ResourceProvider { highp_threshold_min, use_rgba_4444_texture_format, id_allocation_chunk_size, + use_persistent_map_for_gpu_memory_buffers, use_image_texture_targets) {} }; diff --git a/cc/test/layer_tree_pixel_resource_test.cc b/cc/test/layer_tree_pixel_resource_test.cc index 3b52487..bc323f1 100644 --- a/cc/test/layer_tree_pixel_resource_test.cc +++ b/cc/test/layer_tree_pixel_resource_test.cc @@ -45,7 +45,8 @@ bool IsTestCaseSupported(PixelResourceTestCase test_case) { LayerTreeHostPixelResourceTest::LayerTreeHostPixelResourceTest( PixelResourceTestCase test_case) - : draw_texture_target_(GL_INVALID_VALUE), + : staging_texture_target_(GL_INVALID_VALUE), + draw_texture_target_(GL_INVALID_VALUE), resource_pool_option_(BITMAP_TILE_TASK_WORKER_POOL), initialized_(false), test_case_(test_case) { @@ -53,10 +54,12 @@ LayerTreeHostPixelResourceTest::LayerTreeHostPixelResourceTest( } LayerTreeHostPixelResourceTest::LayerTreeHostPixelResourceTest() - : draw_texture_target_(GL_INVALID_VALUE), + : staging_texture_target_(GL_INVALID_VALUE), + draw_texture_target_(GL_INVALID_VALUE), resource_pool_option_(BITMAP_TILE_TASK_WORKER_POOL), initialized_(false), - test_case_(SOFTWARE) {} + test_case_(SOFTWARE) { +} void LayerTreeHostPixelResourceTest::InitializeFromTestCase( PixelResourceTestCase test_case) { @@ -65,46 +68,55 @@ void LayerTreeHostPixelResourceTest::InitializeFromTestCase( switch (test_case) { case SOFTWARE: test_type_ = PIXEL_TEST_SOFTWARE; + staging_texture_target_ = GL_INVALID_VALUE; draw_texture_target_ = GL_INVALID_VALUE; resource_pool_option_ = BITMAP_TILE_TASK_WORKER_POOL; return; case GL_GPU_RASTER_2D_DRAW: test_type_ = PIXEL_TEST_GL; + staging_texture_target_ = GL_INVALID_VALUE; draw_texture_target_ = GL_TEXTURE_2D; resource_pool_option_ = GPU_TILE_TASK_WORKER_POOL; return; case GL_ONE_COPY_2D_STAGING_2D_DRAW: test_type_ = PIXEL_TEST_GL; + staging_texture_target_ = GL_TEXTURE_2D; draw_texture_target_ = GL_TEXTURE_2D; resource_pool_option_ = ONE_COPY_TILE_TASK_WORKER_POOL; return; case GL_ONE_COPY_RECT_STAGING_2D_DRAW: test_type_ = PIXEL_TEST_GL; + staging_texture_target_ = GL_TEXTURE_RECTANGLE_ARB; draw_texture_target_ = GL_TEXTURE_2D; resource_pool_option_ = ONE_COPY_TILE_TASK_WORKER_POOL; return; case GL_ONE_COPY_EXTERNAL_STAGING_2D_DRAW: test_type_ = PIXEL_TEST_GL; + staging_texture_target_ = GL_TEXTURE_EXTERNAL_OES; draw_texture_target_ = GL_TEXTURE_2D; resource_pool_option_ = ONE_COPY_TILE_TASK_WORKER_POOL; return; case GL_ZERO_COPY_2D_DRAW: test_type_ = PIXEL_TEST_GL; + staging_texture_target_ = GL_INVALID_VALUE; draw_texture_target_ = GL_TEXTURE_2D; resource_pool_option_ = ZERO_COPY_TILE_TASK_WORKER_POOL; return; case GL_ZERO_COPY_RECT_DRAW: test_type_ = PIXEL_TEST_GL; + staging_texture_target_ = GL_INVALID_VALUE; draw_texture_target_ = GL_TEXTURE_RECTANGLE_ARB; resource_pool_option_ = ZERO_COPY_TILE_TASK_WORKER_POOL; return; case GL_ZERO_COPY_EXTERNAL_DRAW: test_type_ = PIXEL_TEST_GL; + staging_texture_target_ = GL_INVALID_VALUE; draw_texture_target_ = GL_TEXTURE_EXTERNAL_OES; resource_pool_option_ = ZERO_COPY_TILE_TASK_WORKER_POOL; return; case GL_ASYNC_UPLOAD_2D_DRAW: test_type_ = PIXEL_TEST_GL; + staging_texture_target_ = GL_INVALID_VALUE; draw_texture_target_ = GL_TEXTURE_2D; resource_pool_option_ = PIXEL_BUFFER_TILE_TASK_WORKER_POOL; return; @@ -115,7 +127,8 @@ void LayerTreeHostPixelResourceTest::InitializeFromTestCase( void LayerTreeHostPixelResourceTest::CreateResourceAndTileTaskWorkerPool( LayerTreeHostImpl* host_impl, scoped_ptr<TileTaskWorkerPool>* tile_task_worker_pool, - scoped_ptr<ResourcePool>* resource_pool) { + scoped_ptr<ResourcePool>* resource_pool, + scoped_ptr<ResourcePool>* staging_resource_pool) { base::SingleThreadTaskRunner* task_runner = proxy()->HasImplThread() ? proxy()->ImplThreadTaskRunner() : proxy()->MainThreadTaskRunner(); @@ -127,7 +140,6 @@ void LayerTreeHostPixelResourceTest::CreateResourceAndTileTaskWorkerPool( ResourceProvider* resource_provider = host_impl->resource_provider(); size_t max_transfer_buffer_usage_bytes = 1024u * 1024u * 60u; int max_bytes_per_copy_operation = 1024 * 1024; - int max_staging_buffers = 32; switch (resource_pool_option_) { case BITMAP_TILE_TASK_WORKER_POOL: @@ -165,12 +177,15 @@ void LayerTreeHostPixelResourceTest::CreateResourceAndTileTaskWorkerPool( EXPECT_TRUE(context_provider); EXPECT_EQ(PIXEL_TEST_GL, test_type_); EXPECT_TRUE(host_impl->GetRendererCapabilities().using_image); + // We need to create a staging resource pool when using copy rasterizer. + *staging_resource_pool = + ResourcePool::Create(resource_provider, staging_texture_target_); *resource_pool = ResourcePool::Create(resource_provider, draw_texture_target_); *tile_task_worker_pool = OneCopyTileTaskWorkerPool::Create( task_runner, task_graph_runner(), context_provider, resource_provider, - max_bytes_per_copy_operation, false, max_staging_buffers); + staging_resource_pool->get(), max_bytes_per_copy_operation, false); break; case PIXEL_BUFFER_TILE_TASK_WORKER_POOL: EXPECT_TRUE(context_provider); diff --git a/cc/test/layer_tree_pixel_resource_test.h b/cc/test/layer_tree_pixel_resource_test.h index 8c3242a..16b7ca9 100644 --- a/cc/test/layer_tree_pixel_resource_test.h +++ b/cc/test/layer_tree_pixel_resource_test.h @@ -38,7 +38,8 @@ class LayerTreeHostPixelResourceTest : public LayerTreePixelTest { void CreateResourceAndTileTaskWorkerPool( LayerTreeHostImpl* host_impl, scoped_ptr<TileTaskWorkerPool>* tile_task_worker_pool, - scoped_ptr<ResourcePool>* resource_pool) override; + scoped_ptr<ResourcePool>* resource_pool, + scoped_ptr<ResourcePool>* staging_resource_pool) override; void RunPixelResourceTest(scoped_refptr<Layer> content_root, base::FilePath file_name); @@ -52,6 +53,7 @@ class LayerTreeHostPixelResourceTest : public LayerTreePixelTest { }; protected: + unsigned staging_texture_target_; unsigned draw_texture_target_; TileTaskWorkerPoolOption resource_pool_option_; bool initialized_; diff --git a/cc/test/layer_tree_pixel_test.cc b/cc/test/layer_tree_pixel_test.cc index 77399b9..c145735 100644 --- a/cc/test/layer_tree_pixel_test.cc +++ b/cc/test/layer_tree_pixel_test.cc @@ -381,10 +381,4 @@ void LayerTreePixelTest::CopyBitmapToTextureMailboxAsTexture( texture_id)); } -void LayerTreePixelTest::Finish() { - scoped_ptr<gpu::GLInProcessContext> context = CreateTestInProcessContext(); - GLES2Interface* gl = context->GetImplementation(); - gl->Finish(); -} - } // namespace cc diff --git a/cc/test/layer_tree_pixel_test.h b/cc/test/layer_tree_pixel_test.h index fcaf1b4..f2352b0 100644 --- a/cc/test/layer_tree_pixel_test.h +++ b/cc/test/layer_tree_pixel_test.h @@ -91,8 +91,6 @@ class LayerTreePixelTest : public LayerTreeTest { uint32 sync_point, bool lost_resource); - void Finish(); - void set_enlarge_texture_amount(const gfx::Vector2d& enlarge_texture_amount) { enlarge_texture_amount_ = enlarge_texture_amount; } diff --git a/cc/test/layer_tree_test.cc b/cc/test/layer_tree_test.cc index c426bc1..a866ac1 100644 --- a/cc/test/layer_tree_test.cc +++ b/cc/test/layer_tree_test.cc @@ -107,9 +107,10 @@ DrawResult TestHooks::PrepareToDrawOnThread( void TestHooks::CreateResourceAndTileTaskWorkerPool( LayerTreeHostImpl* host_impl, scoped_ptr<TileTaskWorkerPool>* tile_task_worker_pool, - scoped_ptr<ResourcePool>* resource_pool) { + scoped_ptr<ResourcePool>* resource_pool, + scoped_ptr<ResourcePool>* staging_resource_pool) { host_impl->LayerTreeHostImpl::CreateResourceAndTileTaskWorkerPool( - tile_task_worker_pool, resource_pool); + tile_task_worker_pool, resource_pool, staging_resource_pool); } // Adapts ThreadProxy for test. Injects test hooks for testing. @@ -302,9 +303,10 @@ class LayerTreeHostImplForTesting : public LayerTreeHostImpl { void CreateResourceAndTileTaskWorkerPool( scoped_ptr<TileTaskWorkerPool>* tile_task_worker_pool, - scoped_ptr<ResourcePool>* resource_pool) override { + scoped_ptr<ResourcePool>* resource_pool, + scoped_ptr<ResourcePool>* staging_resource_pool) override { test_hooks_->CreateResourceAndTileTaskWorkerPool( - this, tile_task_worker_pool, resource_pool); + this, tile_task_worker_pool, resource_pool, staging_resource_pool); } void WillBeginImplFrame(const BeginFrameArgs& args) override { diff --git a/cc/test/layer_tree_test.h b/cc/test/layer_tree_test.h index 9f6d369..828850c 100644 --- a/cc/test/layer_tree_test.h +++ b/cc/test/layer_tree_test.h @@ -55,7 +55,8 @@ class TestHooks : public AnimationDelegate { virtual void CreateResourceAndTileTaskWorkerPool( LayerTreeHostImpl* host_impl, scoped_ptr<TileTaskWorkerPool>* tile_task_worker_pool, - scoped_ptr<ResourcePool>* resource_pool); + scoped_ptr<ResourcePool>* resource_pool, + scoped_ptr<ResourcePool>* staging_resource_pool); virtual void WillBeginImplFrameOnThread(LayerTreeHostImpl* host_impl, const BeginFrameArgs& args) {} virtual void DidFinishImplFrameOnThread(LayerTreeHostImpl* host_impl) {} diff --git a/cc/test/pixel_test.cc b/cc/test/pixel_test.cc index d76da9f..32f32d3 100644 --- a/cc/test/pixel_test.cc +++ b/cc/test/pixel_test.cc @@ -136,7 +136,7 @@ void PixelTest::SetUpGLRenderer(bool use_skia_gpu_backend, resource_provider_ = ResourceProvider::Create( output_surface_.get(), shared_bitmap_manager_.get(), gpu_memory_buffer_manager_.get(), main_thread_task_runner_.get(), 0, - false, 1, settings_.use_image_texture_targets); + false, 1, false, settings_.use_image_texture_targets); texture_mailbox_deleter_ = make_scoped_ptr( new TextureMailboxDeleter(base::ThreadTaskRunnerHandle::Get())); @@ -177,7 +177,7 @@ void PixelTest::SetUpSoftwareRenderer() { resource_provider_ = ResourceProvider::Create( output_surface_.get(), shared_bitmap_manager_.get(), gpu_memory_buffer_manager_.get(), main_thread_task_runner_.get(), 0, - false, 1, settings_.use_image_texture_targets); + false, 1, false, settings_.use_image_texture_targets); renderer_ = SoftwareRenderer::Create(this, &settings_.renderer_settings, output_surface_.get(), resource_provider_.get()); diff --git a/cc/test/test_in_process_context_provider.cc b/cc/test/test_in_process_context_provider.cc index 79d53d2..efbbeec 100644 --- a/cc/test/test_in_process_context_provider.cc +++ b/cc/test/test_in_process_context_provider.cc @@ -142,7 +142,6 @@ TestInProcessContextProvider::ContextCapabilities() { ContextProvider::Capabilities capabilities; capabilities.gpu.image = true; capabilities.gpu.texture_rectangle = true; - capabilities.gpu.sync_query = true; switch (PlatformColor::Format()) { case PlatformColor::SOURCE_FORMAT_RGBA8: |