diff options
author | danakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-24 19:48:56 +0000 |
---|---|---|
committer | danakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-24 19:48:56 +0000 |
commit | 3b2eb8890490df87ed957ba5076bcb5a39832c3c (patch) | |
tree | 69f90778f6a6a5b14da80bbaf886bfec97783b88 /cc | |
parent | 1502e60861419bd0499f9b52a11b90fc55dc1abc (diff) | |
download | chromium_src-3b2eb8890490df87ed957ba5076bcb5a39832c3c.zip chromium_src-3b2eb8890490df87ed957ba5076bcb5a39832c3c.tar.gz chromium_src-3b2eb8890490df87ed957ba5076bcb5a39832c3c.tar.bz2 |
Remove offscreen compositor contexts.
After https://codereview.chromium.org/250083002/ cc no longer uses an
offscreen context for ganesh filters. Instead using the main onscreen
context.
So, delete the code to create offscreen contexts for the compositor.
R=abarth@chromium.org, boliu@chromium.org, enne@chromium.org, piman@chromium.org, enne, piman
BUG=366132,366130
Review URL: https://codereview.chromium.org/251343002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@265974 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc')
43 files changed, 33 insertions, 592 deletions
diff --git a/cc/layers/delegated_renderer_layer.cc b/cc/layers/delegated_renderer_layer.cc index 1dab3c8..194455a 100644 --- a/cc/layers/delegated_renderer_layer.cc +++ b/cc/layers/delegated_renderer_layer.cc @@ -93,25 +93,6 @@ void DelegatedRendererLayer::SetDisplaySize(const gfx::Size& size) { SetNeedsCommit(); } -static bool FrameDataRequiresFilterContext(const DelegatedFrameData* frame) { - for (size_t i = 0; i < frame->render_pass_list.size(); ++i) { - const QuadList& quad_list = frame->render_pass_list[i]->quad_list; - for (size_t j = 0; j < quad_list.size(); ++j) { - if (quad_list[j]->shared_quad_state->blend_mode != - SkXfermode::kSrcOver_Mode) - return true; - if (quad_list[j]->material != DrawQuad::RENDER_PASS) - continue; - const RenderPassDrawQuad* render_pass_quad = - RenderPassDrawQuad::MaterialCast(quad_list[j]); - if (!render_pass_quad->filters.IsEmpty() || - !render_pass_quad->background_filters.IsEmpty()) - return true; - } - } - return false; -} - bool DelegatedRendererLayer::Update(ResourceUpdateQueue* queue, const OcclusionTracker<Layer>* occlusion) { bool updated = Layer::Update(queue, occlusion); @@ -122,11 +103,6 @@ bool DelegatedRendererLayer::Update(ResourceUpdateQueue* queue, frame_provider_->GetFrameDataAndRefResources(this, &frame_damage_); should_collect_new_frame_ = false; - // If any quad has a filter operation or a blend mode other than normal, - // then we need an offscreen context to draw this layer's content. - if (FrameDataRequiresFilterContext(frame_data_)) - layer_tree_host()->set_needs_filter_context(); - SetNeedsPushProperties(); return true; } diff --git a/cc/layers/layer.cc b/cc/layers/layer.cc index 733ecd2d..29c5c8e 100644 --- a/cc/layers/layer.cc +++ b/cc/layers/layer.cc @@ -133,7 +133,6 @@ void Layer::SetLayerTreeHost(LayerTreeHost* host) { if (host && layer_animation_controller_->has_any_animation()) host->SetNeedsCommit(); - SetNeedsFilterContextIfNeeded(); } void Layer::SetNeedsUpdate() { @@ -167,15 +166,6 @@ void Layer::SetNextCommitWaitsForActivation() { layer_tree_host_->SetNextCommitWaitsForActivation(); } -void Layer::SetNeedsFilterContextIfNeeded() { - if (!layer_tree_host_) - return; - - if (!filters_.IsEmpty() || !background_filters_.IsEmpty() || - !uses_default_blend_mode()) - layer_tree_host_->set_needs_filter_context(); -} - void Layer::SetNeedsPushProperties() { if (needs_push_properties_) return; @@ -487,7 +477,6 @@ void Layer::SetFilters(const FilterOperations& filters) { return; filters_ = filters; SetNeedsCommit(); - SetNeedsFilterContextIfNeeded(); } bool Layer::FilterIsAnimating() const { @@ -500,7 +489,6 @@ void Layer::SetBackgroundFilters(const FilterOperations& filters) { return; background_filters_ = filters; SetNeedsCommit(); - SetNeedsFilterContextIfNeeded(); } void Layer::SetOpacity(float opacity) { @@ -566,7 +554,6 @@ void Layer::SetBlendMode(SkXfermode::Mode blend_mode) { blend_mode_ = blend_mode; SetNeedsCommit(); - SetNeedsFilterContextIfNeeded(); } void Layer::SetIsRootForIsolatedGroup(bool root) { diff --git a/cc/layers/layer.h b/cc/layers/layer.h index f847b5e..f0e1b832 100644 --- a/cc/layers/layer.h +++ b/cc/layers/layer.h @@ -484,9 +484,6 @@ class CC_EXPORT Layer : public base::RefCounted<Layer>, // unused resources on the impl thread are returned before commit completes. void SetNextCommitWaitsForActivation(); - // Called when the blend mode or filters have been changed. - void SetNeedsFilterContextIfNeeded(); - void AddDependentNeedsPushProperties(); void RemoveDependentNeedsPushProperties(); bool parent_should_know_need_push_properties() const { diff --git a/cc/layers/picture_layer_impl_unittest.cc b/cc/layers/picture_layer_impl_unittest.cc index c7a5900..9af89af 100644 --- a/cc/layers/picture_layer_impl_unittest.cc +++ b/cc/layers/picture_layer_impl_unittest.cc @@ -1826,7 +1826,7 @@ TEST_F(DeferredInitPictureLayerImplTest, FakeOutputSurface* fake_output_surface = static_cast<FakeOutputSurface*>(host_impl_.output_surface()); ASSERT_TRUE(fake_output_surface->InitializeAndSetContext3d( - TestContextProvider::Create(), NULL)); + TestContextProvider::Create())); // These will crash PictureLayerImpl if this is not true. ASSERT_TRUE(host_impl_.pending_tree()->needs_update_draw_properties()); diff --git a/cc/output/delegating_renderer.cc b/cc/output/delegating_renderer.cc index 2b35955..63c975a 100644 --- a/cc/output/delegating_renderer.cc +++ b/cc/output/delegating_renderer.cc @@ -53,7 +53,6 @@ DelegatingRenderer::DelegatingRenderer(RendererClient* client, capabilities_.max_texture_size = resource_provider_->max_texture_size(); capabilities_.best_texture_format = resource_provider_->best_texture_format(); capabilities_.allow_partial_texture_updates = false; - capabilities_.using_offscreen_context3d = false; if (!output_surface_->context_provider()) { capabilities_.using_shared_memory_resources = true; @@ -88,7 +87,6 @@ static ResourceProvider::ResourceId AppendToArray( } void DelegatingRenderer::DrawFrame(RenderPassList* render_passes_in_draw_order, - ContextProvider* offscreen_context_provider, float device_scale_factor, const gfx::Rect& device_viewport_rect, const gfx::Rect& device_clip_rect, diff --git a/cc/output/delegating_renderer.h b/cc/output/delegating_renderer.h index a4f8c26..eec399a 100644 --- a/cc/output/delegating_renderer.h +++ b/cc/output/delegating_renderer.h @@ -29,7 +29,6 @@ class CC_EXPORT DelegatingRenderer : public Renderer { virtual bool CanReadPixels() const OVERRIDE; virtual void DrawFrame(RenderPassList* render_passes_in_draw_order, - ContextProvider* offscreen_context_provider, float device_scale_factor, const gfx::Rect& device_viewport_rect, const gfx::Rect& device_clip_rect, diff --git a/cc/output/direct_renderer.cc b/cc/output/direct_renderer.cc index 8960c55..245a451 100644 --- a/cc/output/direct_renderer.cc +++ b/cc/output/direct_renderer.cc @@ -58,10 +58,8 @@ static gfx::Transform window_matrix(int x, int y, int width, int height) { namespace cc { DirectRenderer::DrawingFrame::DrawingFrame() - : root_render_pass(NULL), - current_render_pass(NULL), - current_texture(NULL), - offscreen_context_provider(NULL) {} + : root_render_pass(NULL), current_render_pass(NULL), current_texture(NULL) { +} DirectRenderer::DrawingFrame::~DrawingFrame() {} @@ -198,7 +196,6 @@ void DirectRenderer::DecideRenderPassAllocationsForFrame( } void DirectRenderer::DrawFrame(RenderPassList* render_passes_in_draw_order, - ContextProvider* offscreen_context_provider, float device_scale_factor, const gfx::Rect& device_viewport_rect, const gfx::Rect& device_clip_rect, @@ -218,7 +215,6 @@ void DirectRenderer::DrawFrame(RenderPassList* render_passes_in_draw_order, frame.root_damage_rect.Intersect(gfx::Rect(device_viewport_rect.size())); frame.device_viewport_rect = device_viewport_rect; frame.device_clip_rect = device_clip_rect; - frame.offscreen_context_provider = offscreen_context_provider; frame.disable_picture_quad_image_filtering = disable_picture_quad_image_filtering; diff --git a/cc/output/direct_renderer.h b/cc/output/direct_renderer.h index 16394c5..cace98a 100644 --- a/cc/output/direct_renderer.h +++ b/cc/output/direct_renderer.h @@ -32,7 +32,6 @@ class CC_EXPORT DirectRenderer : public Renderer { virtual bool HasAllocatedResourcesForTesting(RenderPass::Id id) const OVERRIDE; virtual void DrawFrame(RenderPassList* render_passes_in_draw_order, - ContextProvider* offscreen_context_provider, float device_scale_factor, const gfx::Rect& device_viewport_rect, const gfx::Rect& device_clip_rect, @@ -53,8 +52,6 @@ class CC_EXPORT DirectRenderer : public Renderer { gfx::Transform projection_matrix; gfx::Transform window_matrix; - ContextProvider* offscreen_context_provider; - bool disable_picture_quad_image_filtering; OverlayCandidateList overlay_list; diff --git a/cc/output/gl_renderer.cc b/cc/output/gl_renderer.cc index 29df50f..b980d21 100644 --- a/cc/output/gl_renderer.cc +++ b/cc/output/gl_renderer.cc @@ -334,8 +334,6 @@ GLRenderer::GLRenderer(RendererClient* client, // so we only need to avoid POT textures if we have an NPOT fast-path. capabilities_.avoid_pow2_textures = context_caps.gpu.fast_npot_mo8_textures; - capabilities_.using_offscreen_context3d = false; - capabilities_.using_map_image = settings_->use_map_image && context_caps.gpu.map_image; diff --git a/cc/output/gl_renderer_unittest.cc b/cc/output/gl_renderer_unittest.cc index 57ec984..0723e3a 100644 --- a/cc/output/gl_renderer_unittest.cc +++ b/cc/output/gl_renderer_unittest.cc @@ -340,7 +340,6 @@ TEST_F(GLRendererWithDefaultHarnessTest, renderer_->SetVisible(true); renderer_->DrawFrame(&render_passes_in_draw_order_, - NULL, 1.f, viewport_rect, viewport_rect, @@ -365,7 +364,6 @@ TEST_F(GLRendererWithDefaultHarnessTest, char pixels[4]; renderer_->DrawFrame(&render_passes_in_draw_order_, - NULL, 1.f, viewport_rect, viewport_rect, @@ -390,7 +388,6 @@ TEST_F(GLRendererWithDefaultHarnessTest, ExternalStencil) { root_pass->has_transparent_background = false; renderer_->DrawFrame(&render_passes_in_draw_order_, - NULL, 1.f, viewport_rect, viewport_rect, @@ -620,7 +617,6 @@ TEST_F(GLRendererTest, OpaqueBackground) { EXPECT_CALL(*context, clear(_)).Times(1); #endif renderer.DrawFrame(&render_passes_in_draw_order_, - NULL, 1.f, viewport_rect, viewport_rect, @@ -659,7 +655,6 @@ TEST_F(GLRendererTest, TransparentBackground) { EXPECT_CALL(*context, discardFramebufferEXT(GL_FRAMEBUFFER, 1, _)).Times(1); EXPECT_CALL(*context, clear(_)).Times(1); renderer.DrawFrame(&render_passes_in_draw_order_, - NULL, 1.f, viewport_rect, viewport_rect, @@ -700,7 +695,6 @@ TEST_F(GLRendererTest, OffscreenOutputSurface) { .Times(1); EXPECT_CALL(*context, clear(_)).Times(AnyNumber()); renderer.DrawFrame(&render_passes_in_draw_order_, - NULL, 1.f, viewport_rect, viewport_rect, @@ -784,7 +778,6 @@ TEST_F(GLRendererTest, VisibilityChangeIsLastCall) { // the stack. renderer.SetVisible(true); renderer.DrawFrame(&render_passes_in_draw_order_, - NULL, 1.f, viewport_rect, viewport_rect, @@ -879,7 +872,6 @@ TEST_F(GLRendererTest, ActiveTextureState) { gfx::Rect viewport_rect(100, 100); renderer.DrawFrame(&render_passes_in_draw_order_, - NULL, 1.f, viewport_rect, viewport_rect, @@ -957,7 +949,6 @@ TEST_F(GLRendererTest, ShouldClearRootRenderPass) { renderer.DecideRenderPassAllocationsForFrame(render_passes_in_draw_order_); renderer.DrawFrame(&render_passes_in_draw_order_, - NULL, 1.f, viewport_rect, viewport_rect, @@ -1041,7 +1032,6 @@ TEST_F(GLRendererTest, ScissorTestWhenClearing) { renderer.DecideRenderPassAllocationsForFrame(render_passes_in_draw_order_); renderer.DrawFrame(&render_passes_in_draw_order_, - NULL, 1.f, viewport_rect, viewport_rect, @@ -1120,7 +1110,6 @@ TEST_F(GLRendererTest, NoDiscardOnPartialUpdates) { renderer.DecideRenderPassAllocationsForFrame(render_passes_in_draw_order_); renderer.DrawFrame(&render_passes_in_draw_order_, - NULL, 1.f, viewport_rect, clip_rect, @@ -1140,7 +1129,6 @@ TEST_F(GLRendererTest, NoDiscardOnPartialUpdates) { renderer.DecideRenderPassAllocationsForFrame(render_passes_in_draw_order_); renderer.DrawFrame(&render_passes_in_draw_order_, - NULL, 1.f, viewport_rect, clip_rect, @@ -1162,7 +1150,6 @@ TEST_F(GLRendererTest, NoDiscardOnPartialUpdates) { renderer.DecideRenderPassAllocationsForFrame(render_passes_in_draw_order_); renderer.DrawFrame(&render_passes_in_draw_order_, - NULL, 1.f, viewport_rect, clip_rect, @@ -1184,7 +1171,6 @@ TEST_F(GLRendererTest, NoDiscardOnPartialUpdates) { renderer.DecideRenderPassAllocationsForFrame(render_passes_in_draw_order_); renderer.DrawFrame(&render_passes_in_draw_order_, - NULL, 1.f, viewport_rect, clip_rect, @@ -1205,7 +1191,6 @@ TEST_F(GLRendererTest, NoDiscardOnPartialUpdates) { renderer.DecideRenderPassAllocationsForFrame(render_passes_in_draw_order_); renderer.DrawFrame(&render_passes_in_draw_order_, - NULL, 1.f, viewport_rect, clip_rect, @@ -1227,7 +1212,6 @@ TEST_F(GLRendererTest, NoDiscardOnPartialUpdates) { renderer.DecideRenderPassAllocationsForFrame(render_passes_in_draw_order_); renderer.DrawFrame(&render_passes_in_draw_order_, - NULL, 1.f, viewport_rect, clip_rect, @@ -1308,7 +1292,6 @@ TEST_F(GLRendererTest, ScissorAndViewportWithinNonreshapableSurface) { renderer.DecideRenderPassAllocationsForFrame(render_passes_in_draw_order_); renderer.DrawFrame(&render_passes_in_draw_order_, - NULL, 1.f, device_viewport_rect, device_viewport_rect, @@ -1374,7 +1357,6 @@ TEST_F(GLRendererShaderTest, DrawRenderPassQuadShaderPermutations) { renderer_->DecideRenderPassAllocationsForFrame(render_passes_in_draw_order_); renderer_->DrawFrame(&render_passes_in_draw_order_, - NULL, 1.f, viewport_rect, viewport_rect, @@ -1398,7 +1380,6 @@ TEST_F(GLRendererShaderTest, DrawRenderPassQuadShaderPermutations) { renderer_->DecideRenderPassAllocationsForFrame(render_passes_in_draw_order_); renderer_->DrawFrame(&render_passes_in_draw_order_, - NULL, 1.f, viewport_rect, viewport_rect, @@ -1423,7 +1404,6 @@ TEST_F(GLRendererShaderTest, DrawRenderPassQuadShaderPermutations) { renderer_->DecideRenderPassAllocationsForFrame(render_passes_in_draw_order_); renderer_->DrawFrame(&render_passes_in_draw_order_, - NULL, 1.f, viewport_rect, viewport_rect, @@ -1447,7 +1427,6 @@ TEST_F(GLRendererShaderTest, DrawRenderPassQuadShaderPermutations) { renderer_->DecideRenderPassAllocationsForFrame(render_passes_in_draw_order_); renderer_->DrawFrame(&render_passes_in_draw_order_, - NULL, 1.f, viewport_rect, viewport_rect, @@ -1472,7 +1451,6 @@ TEST_F(GLRendererShaderTest, DrawRenderPassQuadShaderPermutations) { renderer_->DecideRenderPassAllocationsForFrame(render_passes_in_draw_order_); renderer_->DrawFrame(&render_passes_in_draw_order_, - NULL, 1.f, viewport_rect, viewport_rect, @@ -1496,7 +1474,6 @@ TEST_F(GLRendererShaderTest, DrawRenderPassQuadShaderPermutations) { renderer_->DecideRenderPassAllocationsForFrame(render_passes_in_draw_order_); renderer_->DrawFrame(&render_passes_in_draw_order_, - NULL, 1.f, viewport_rect, viewport_rect, @@ -1521,7 +1498,6 @@ TEST_F(GLRendererShaderTest, DrawRenderPassQuadShaderPermutations) { renderer_->DecideRenderPassAllocationsForFrame(render_passes_in_draw_order_); renderer_->DrawFrame(&render_passes_in_draw_order_, - NULL, 1.f, viewport_rect, viewport_rect, @@ -1545,7 +1521,6 @@ TEST_F(GLRendererShaderTest, DrawRenderPassQuadShaderPermutations) { renderer_->DecideRenderPassAllocationsForFrame(render_passes_in_draw_order_); renderer_->DrawFrame(&render_passes_in_draw_order_, - NULL, 1.f, viewport_rect, viewport_rect, @@ -1590,7 +1565,6 @@ TEST_F(GLRendererShaderTest, DrawRenderPassQuadSkipsAAForClippingTransform) { renderer_->DecideRenderPassAllocationsForFrame(render_passes_in_draw_order_); renderer_->DrawFrame(&render_passes_in_draw_order_, - NULL, 1.f, viewport_rect, viewport_rect, @@ -1621,7 +1595,6 @@ TEST_F(GLRendererShaderTest, DrawSolidColorShader) { renderer_->DecideRenderPassAllocationsForFrame(render_passes_in_draw_order_); renderer_->DrawFrame(&render_passes_in_draw_order_, - NULL, 1.f, viewport_rect, viewport_rect, @@ -1703,7 +1676,6 @@ class MockOutputSurfaceTest : public GLRendererTest { renderer_->DecideRenderPassAllocationsForFrame( render_passes_in_draw_order_); renderer_->DrawFrame(&render_passes_in_draw_order_, - NULL, device_scale_factor, device_viewport_rect, device_viewport_rect, diff --git a/cc/output/output_surface.cc b/cc/output/output_surface.cc index 7818849..436e37c 100644 --- a/cc/output/output_surface.cc +++ b/cc/output/output_surface.cc @@ -263,8 +263,7 @@ bool OutputSurface::BindToClient(OutputSurfaceClient* client) { } bool OutputSurface::InitializeAndSetContext3d( - scoped_refptr<ContextProvider> context_provider, - scoped_refptr<ContextProvider> offscreen_context_provider) { + scoped_refptr<ContextProvider> context_provider) { DCHECK(!context_provider_); DCHECK(context_provider); DCHECK(client_); @@ -273,8 +272,8 @@ bool OutputSurface::InitializeAndSetContext3d( if (context_provider->BindToCurrentThread()) { context_provider_ = context_provider; SetUpContext3d(); - if (client_->DeferredInitialize(offscreen_context_provider)) - success = true; + client_->DeferredInitialize(); + success = true; } if (!success) diff --git a/cc/output/output_surface.h b/cc/output/output_surface.h index 471170a..2645d84 100644 --- a/cc/output/output_surface.h +++ b/cc/output/output_surface.h @@ -147,11 +147,8 @@ class CC_EXPORT OutputSurface : public FrameRateControllerClient { protected: // Synchronously initialize context3d and enter hardware mode. // This can only supported in threaded compositing mode. - // |offscreen_context_provider| should match what is returned by - // LayerTreeClient::OffscreenContextProvider(). bool InitializeAndSetContext3d( - scoped_refptr<ContextProvider> context_provider, - scoped_refptr<ContextProvider> offscreen_context_provider); + scoped_refptr<ContextProvider> context_provider); void ReleaseGL(); void PostSwapBuffersComplete(); diff --git a/cc/output/output_surface_client.h b/cc/output/output_surface_client.h index 141e01a..3b92e27 100644 --- a/cc/output/output_surface_client.h +++ b/cc/output/output_surface_client.h @@ -27,8 +27,7 @@ class CC_EXPORT OutputSurfaceClient { // Called to synchronously re-initialize using the Context3D. Upon returning // the compositor should be able to draw using GL what was previously // committed. - virtual bool DeferredInitialize( - scoped_refptr<ContextProvider> offscreen_context_provider) = 0; + virtual void DeferredInitialize() = 0; virtual void ReleaseGL() = 0; virtual void SetNeedsRedrawRect(const gfx::Rect& damage_rect) = 0; virtual void BeginFrame(const BeginFrameArgs& args) = 0; diff --git a/cc/output/output_surface_unittest.cc b/cc/output/output_surface_unittest.cc index 637ba05..9e7724f 100644 --- a/cc/output/output_surface_unittest.cc +++ b/cc/output/output_surface_unittest.cc @@ -40,8 +40,7 @@ class TestOutputSurface : public OutputSurface { bool InitializeNewContext3d( scoped_refptr<ContextProvider> new_context_provider) { - return InitializeAndSetContext3d(new_context_provider, - scoped_refptr<ContextProvider>()); + return InitializeAndSetContext3d(new_context_provider); } using OutputSurface::ReleaseGL; @@ -210,12 +209,6 @@ TEST_F(OutputSurfaceTestInitializeNewContext3d, Context3dMakeCurrentFails) { InitializeNewContextExpectFail(); } -TEST_F(OutputSurfaceTestInitializeNewContext3d, ClientDeferredInitializeFails) { - BindOutputSurface(); - client_.set_deferred_initialize_result(false); - InitializeNewContextExpectFail(); -} - TEST(OutputSurfaceTest, BeginFrameEmulation) { TestOutputSurface output_surface(TestContextProvider::Create()); EXPECT_FALSE(output_surface.HasClient()); diff --git a/cc/output/overlay_unittest.cc b/cc/output/overlay_unittest.cc index a6bc3d7..3b0c65a 100644 --- a/cc/output/overlay_unittest.cc +++ b/cc/output/overlay_unittest.cc @@ -569,8 +569,7 @@ TEST_F(GLRendererWithOverlaysTest, OverlayQuadNotDrawn) { _, kOverlayRect, BoundingRect(kUVTopLeft, kUVBottomRight))).Times(1); - renderer_->DrawFrame( - &pass_list, NULL, 1.f, viewport_rect, viewport_rect, false); + renderer_->DrawFrame(&pass_list, 1.f, viewport_rect, viewport_rect, false); SwapBuffers(); @@ -602,8 +601,7 @@ TEST_F(GLRendererWithOverlaysTest, OccludedQuadDrawn) { // 3 quads in the pass, all should draw. EXPECT_CALL(*renderer_, DoDrawQuad(_, _)).Times(3); EXPECT_CALL(scheduler_, Schedule(_, _, _, _, _)).Times(0); - renderer_->DrawFrame( - &pass_list, NULL, 1.f, viewport_rect, viewport_rect, false); + renderer_->DrawFrame(&pass_list, 1.f, viewport_rect, viewport_rect, false); SwapBuffers(); @@ -635,8 +633,7 @@ TEST_F(GLRendererWithOverlaysTest, NoValidatorNoOverlay) { // Should see no overlays. EXPECT_CALL(*renderer_, DoDrawQuad(_, _)).Times(3); EXPECT_CALL(scheduler_, Schedule(_, _, _, _, _)).Times(0); - renderer_->DrawFrame( - &pass_list, NULL, 1.f, viewport_rect, viewport_rect, false); + renderer_->DrawFrame(&pass_list, 1.f, viewport_rect, viewport_rect, false); SwapBuffers(); diff --git a/cc/output/renderer.cc b/cc/output/renderer.cc index b0c4a60..e12d69e 100644 --- a/cc/output/renderer.cc +++ b/cc/output/renderer.cc @@ -17,7 +17,6 @@ bool Renderer::IsContextLost() { RendererCapabilitiesImpl::RendererCapabilitiesImpl() : best_texture_format(RGBA_8888), allow_partial_texture_updates(false), - using_offscreen_context3d(false), max_texture_size(0), using_shared_memory_resources(false), using_partial_swap(false), @@ -32,7 +31,6 @@ RendererCapabilitiesImpl::~RendererCapabilitiesImpl() {} RendererCapabilities RendererCapabilitiesImpl::MainThreadCapabilities() const { return RendererCapabilities(best_texture_format, allow_partial_texture_updates, - using_offscreen_context3d, max_texture_size, using_shared_memory_resources); } diff --git a/cc/output/renderer.h b/cc/output/renderer.h index 7cb921b..d9f3310 100644 --- a/cc/output/renderer.h +++ b/cc/output/renderer.h @@ -23,7 +23,6 @@ struct RendererCapabilitiesImpl { // Capabilities copied to main thread. ResourceFormat best_texture_format; bool allow_partial_texture_updates; - bool using_offscreen_context3d; int max_texture_size; bool using_shared_memory_resources; @@ -61,7 +60,6 @@ class CC_EXPORT Renderer { // The |device_viewport_rect| and |device_clip_rect| are in non-y-flipped // window space. virtual void DrawFrame(RenderPassList* render_passes_in_draw_order, - ContextProvider* offscreen_context_provider, float device_scale_factor, const gfx::Rect& device_viewport_rect, const gfx::Rect& device_clip_rect, diff --git a/cc/output/renderer_pixeltest.cc b/cc/output/renderer_pixeltest.cc index 11eaab1..ce3abfa 100644 --- a/cc/output/renderer_pixeltest.cc +++ b/cc/output/renderer_pixeltest.cc @@ -218,7 +218,6 @@ TYPED_TEST(RendererPixelTest, SimpleGreenRect) { EXPECT_TRUE(this->RunPixelTest( &pass_list, - PixelTest::NoOffscreenContext, base::FilePath(FILE_PATH_LITERAL("green.png")), ExactPixelComparator(true))); } @@ -261,7 +260,6 @@ TYPED_TEST(RendererPixelTest, SimpleGreenRect_NonRootRenderPass) { EXPECT_TRUE(this->RunPixelTestWithReadbackTarget( &pass_list, child_pass_ptr, - PixelTest::NoOffscreenContext, base::FilePath(FILE_PATH_LITERAL("green_small.png")), ExactPixelComparator(true))); } @@ -293,7 +291,6 @@ TYPED_TEST(RendererPixelTest, PremultipliedTextureWithoutBackground) { EXPECT_TRUE(this->RunPixelTest( &pass_list, - PixelTest::NoOffscreenContext, base::FilePath(FILE_PATH_LITERAL("green_alpha.png")), FuzzyPixelOffByOneComparator(true))); } @@ -328,7 +325,6 @@ TYPED_TEST(RendererPixelTest, PremultipliedTextureWithBackground) { EXPECT_TRUE(this->RunPixelTest( &pass_list, - PixelTest::NoOffscreenContext, base::FilePath(FILE_PATH_LITERAL("green_alpha.png")), FuzzyPixelOffByOneComparator(true))); } @@ -361,7 +357,6 @@ TEST_F(GLRendererPixelTest, NonPremultipliedTextureWithoutBackground) { EXPECT_TRUE(this->RunPixelTest( &pass_list, - PixelTest::NoOffscreenContext, base::FilePath(FILE_PATH_LITERAL("green_alpha.png")), FuzzyPixelOffByOneComparator(true))); } @@ -397,7 +392,6 @@ TEST_F(GLRendererPixelTest, NonPremultipliedTextureWithBackground) { EXPECT_TRUE(this->RunPixelTest( &pass_list, - PixelTest::NoOffscreenContext, base::FilePath(FILE_PATH_LITERAL("green_alpha.png")), FuzzyPixelOffByOneComparator(true))); } @@ -524,7 +518,6 @@ TEST_F(VideoGLRendererPixelTest, SimpleYUVRect) { EXPECT_TRUE( this->RunPixelTest(&pass_list, - PixelTest::NoOffscreenContext, base::FilePath(FILE_PATH_LITERAL("yuv_stripes.png")), FuzzyPixelOffByOneComparator(true))); } @@ -552,7 +545,6 @@ TEST_F(VideoGLRendererPixelTest, OffsetYUVRect) { EXPECT_TRUE(this->RunPixelTest( &pass_list, - PixelTest::NoOffscreenContext, base::FilePath(FILE_PATH_LITERAL("yuv_stripes_offset.png")), FuzzyPixelOffByOneComparator(true))); } @@ -584,7 +576,6 @@ TEST_F(VideoGLRendererPixelTest, SimpleYUVARect) { EXPECT_TRUE(this->RunPixelTest( &pass_list, - PixelTest::NoOffscreenContext, base::FilePath(FILE_PATH_LITERAL("yuv_stripes_alpha.png")), FuzzyPixelOffByOneComparator(true))); } @@ -616,7 +607,6 @@ TEST_F(VideoGLRendererPixelTest, FullyTransparentYUVARect) { EXPECT_TRUE(this->RunPixelTest( &pass_list, - PixelTest::NoOffscreenContext, base::FilePath(FILE_PATH_LITERAL("black.png")), ExactPixelComparator(true))); } @@ -713,7 +703,6 @@ TYPED_TEST(RendererPixelTest, FastPassColorFilterAlpha) { // renderer so use a fuzzy comparator. EXPECT_TRUE(this->RunPixelTest( &pass_list, - PixelTest::NoOffscreenContext, base::FilePath(FILE_PATH_LITERAL("blue_yellow_alpha.png")), FuzzyForSoftwareOnlyPixelComparator<TypeParam>(false))); } @@ -788,7 +777,6 @@ TYPED_TEST(RendererPixelTest, FastPassSaturateFilter) { EXPECT_TRUE(this->RunPixelTest( &pass_list, - PixelTest::NoOffscreenContext, base::FilePath(FILE_PATH_LITERAL("blue_yellow_alpha.png")), ExactPixelComparator(true))); } @@ -864,7 +852,6 @@ TYPED_TEST(RendererPixelTest, FastPassFilterChain) { EXPECT_TRUE(this->RunPixelTest( &pass_list, - PixelTest::NoOffscreenContext, base::FilePath(FILE_PATH_LITERAL("blue_yellow_filter_chain.png")), ExactPixelComparator(true))); } @@ -964,7 +951,6 @@ TYPED_TEST(RendererPixelTest, FastPassColorFilterAlphaTranslation) { // renderer so use a fuzzy comparator. EXPECT_TRUE(this->RunPixelTest( &pass_list, - PixelTest::NoOffscreenContext, base::FilePath(FILE_PATH_LITERAL("blue_yellow_alpha_translate.png")), FuzzyForSoftwareOnlyPixelComparator<TypeParam>(false))); } @@ -1018,7 +1004,6 @@ TYPED_TEST(RendererPixelTest, EnlargedRenderPassTexture) { EXPECT_TRUE(this->RunPixelTest( &pass_list, - PixelTest::NoOffscreenContext, base::FilePath(FILE_PATH_LITERAL("blue_yellow.png")), ExactPixelComparator(true))); } @@ -1085,7 +1070,6 @@ TYPED_TEST(RendererPixelTest, EnlargedRenderPassTextureWithAntiAliasing) { EXPECT_TRUE(this->RunPixelTest( &pass_list, - PixelTest::NoOffscreenContext, base::FilePath(FILE_PATH_LITERAL("blue_yellow_anti_aliasing.png")), FuzzyPixelOffByOneComparator(true))); } @@ -1192,7 +1176,6 @@ TYPED_TEST(RendererPixelTest, RenderPassAndMaskWithPartialQuad) { EXPECT_TRUE(this->RunPixelTest( &pass_list, - PixelTest::NoOffscreenContext, base::FilePath(FILE_PATH_LITERAL("image_mask_of_layer.png")), ExactPixelComparator(true))); } @@ -1337,7 +1320,6 @@ TEST_F(GLRendererPixelTestWithBackgroundFilter, InvertFilter) { this->SetUpRenderPassList(); EXPECT_TRUE(this->RunPixelTest( &this->pass_list_, - PixelTest::WithOffscreenContext, base::FilePath(FILE_PATH_LITERAL("background_filter.png")), ExactPixelComparator(true))); } @@ -1395,7 +1377,6 @@ TEST_F(ExternalStencilPixelTest, StencilTestEnabled) { EXPECT_TRUE(this->RunPixelTest( &pass_list, - PixelTest::NoOffscreenContext, base::FilePath(FILE_PATH_LITERAL("four_blue_green_checkers.png")), ExactPixelComparator(true))); } @@ -1418,7 +1399,6 @@ TEST_F(ExternalStencilPixelTest, StencilTestDisabled) { EXPECT_TRUE(this->RunPixelTest( &pass_list, - PixelTest::NoOffscreenContext, base::FilePath(FILE_PATH_LITERAL("green.png")), ExactPixelComparator(true))); } @@ -1466,7 +1446,6 @@ TEST_F(ExternalStencilPixelTest, RenderSurfacesIgnoreStencil) { EXPECT_TRUE(this->RunPixelTest( &pass_list, - PixelTest::NoOffscreenContext, base::FilePath(FILE_PATH_LITERAL("four_blue_green_checkers.png")), ExactPixelComparator(true))); } @@ -1491,7 +1470,6 @@ TEST_F(ExternalStencilPixelTest, DeviceClip) { EXPECT_TRUE(this->RunPixelTest( &pass_list, - PixelTest::NoOffscreenContext, base::FilePath(FILE_PATH_LITERAL("green_with_blue_corner.png")), ExactPixelComparator(true))); } @@ -1537,7 +1515,6 @@ TEST_F(GLRendererPixelTest, AntiAliasing) { EXPECT_TRUE(this->RunPixelTest( &pass_list, - PixelTest::NoOffscreenContext, base::FilePath(FILE_PATH_LITERAL("anti_aliasing.png")), FuzzyPixelOffByOneComparator(true))); } @@ -1590,7 +1567,6 @@ TEST_F(GLRendererPixelTest, AxisAligned) { EXPECT_TRUE(this->RunPixelTest( &pass_list, - PixelTest::NoOffscreenContext, base::FilePath(FILE_PATH_LITERAL("axis_aligned.png")), ExactPixelComparator(true))); } @@ -1632,7 +1608,6 @@ TEST_F(GLRendererPixelTest, ForceAntiAliasingOff) { EXPECT_TRUE(this->RunPixelTest( &pass_list, - PixelTest::NoOffscreenContext, base::FilePath(FILE_PATH_LITERAL("force_anti_aliasing_off.png")), ExactPixelComparator(false))); } @@ -1674,7 +1649,6 @@ TEST_F(GLRendererPixelTest, AntiAliasingPerspective) { EXPECT_TRUE(this->RunPixelTest( &pass_list, - PixelTest::NoOffscreenContext, base::FilePath(FILE_PATH_LITERAL("anti_aliasing_perspective.png")), FuzzyPixelOffByOneComparator(true))); } @@ -1758,7 +1732,6 @@ TYPED_TEST(RendererPixelTest, PictureDrawQuadIdentityScale) { EXPECT_TRUE(this->RunPixelTest( &pass_list, - PixelTest::NoOffscreenContext, base::FilePath(FILE_PATH_LITERAL("green_with_blue_corner.png")), ExactPixelComparator(true))); } @@ -1830,7 +1803,6 @@ TYPED_TEST(RendererPixelTest, PictureDrawQuadOpacity) { EXPECT_TRUE(this->RunPixelTest( &pass_list, - PixelTest::NoOffscreenContext, base::FilePath(FILE_PATH_LITERAL("green_alpha.png")), FuzzyPixelOffByOneComparator(true))); } @@ -1908,7 +1880,6 @@ TYPED_TEST(RendererPixelTest, PictureDrawQuadDisableImageFiltering) { EXPECT_TRUE(this->RunPixelTest( &pass_list, - PixelTest::NoOffscreenContext, base::FilePath(FILE_PATH_LITERAL("four_blue_green_checkers.png")), ExactPixelComparator(true))); } @@ -2065,7 +2036,6 @@ TYPED_TEST(RendererPixelTest, PictureDrawQuadNonIdentityScale) { EXPECT_TRUE(this->RunPixelTest( &pass_list, - PixelTest::NoOffscreenContext, base::FilePath(FILE_PATH_LITERAL("four_blue_green_checkers.png")), ExactPixelComparator(true))); } @@ -2128,7 +2098,6 @@ TYPED_TEST(RendererPixelTest, WrapModeRepeat) { EXPECT_TRUE(this->RunPixelTest( &pass_list, - PixelTest::NoOffscreenContext, base::FilePath(FILE_PATH_LITERAL("wrap_mode_repeat.png")), FuzzyPixelOffByOneComparator(true))); } diff --git a/cc/output/software_renderer_unittest.cc b/cc/output/software_renderer_unittest.cc index 2db2864..a80d052 100644 --- a/cc/output/software_renderer_unittest.cc +++ b/cc/output/software_renderer_unittest.cc @@ -95,7 +95,6 @@ TEST_F(SoftwareRendererTest, SolidColorQuad) { float device_scale_factor = 1.f; gfx::Rect device_viewport_rect(outer_size); renderer()->DrawFrame(&list, - NULL, device_scale_factor, device_viewport_rect, device_viewport_rect, @@ -199,7 +198,6 @@ TEST_F(SoftwareRendererTest, TileQuad) { float device_scale_factor = 1.f; gfx::Rect device_viewport_rect(outer_size); renderer()->DrawFrame(&list, - NULL, device_scale_factor, device_viewport_rect, device_viewport_rect, @@ -280,7 +278,6 @@ TEST_F(SoftwareRendererTest, TileQuadVisibleRect) { float device_scale_factor = 1.f; gfx::Rect device_viewport_rect(tile_size); renderer()->DrawFrame(&list, - NULL, device_scale_factor, device_viewport_rect, device_viewport_rect, @@ -335,7 +332,6 @@ TEST_F(SoftwareRendererTest, ShouldClearRootRenderPass) { renderer()->DecideRenderPassAllocationsForFrame(list); renderer()->DrawFrame(&list, - NULL, device_scale_factor, viewport_rect, viewport_rect, @@ -359,7 +355,6 @@ TEST_F(SoftwareRendererTest, ShouldClearRootRenderPass) { renderer()->DecideRenderPassAllocationsForFrame(list); renderer()->DrawFrame(&list, - NULL, device_scale_factor, viewport_rect, viewport_rect, @@ -410,7 +405,6 @@ TEST_F(SoftwareRendererTest, RenderPassVisibleRect) { renderer()->DecideRenderPassAllocationsForFrame(list); renderer()->DrawFrame(&list, - NULL, device_scale_factor, viewport_rect, viewport_rect, diff --git a/cc/resources/resource_provider_unittest.cc b/cc/resources/resource_provider_unittest.cc index 509fc50..bffd07e 100644 --- a/cc/resources/resource_provider_unittest.cc +++ b/cc/resources/resource_provider_unittest.cc @@ -3168,7 +3168,7 @@ void InitializeGLAndCheck(ContextSharedData* shared_data, scoped_refptr<TestContextProvider> context_provider = TestContextProvider::Create( context_owned.PassAs<TestWebGraphicsContext3D>()); - output_surface->InitializeAndSetContext3d(context_provider, NULL); + output_surface->InitializeAndSetContext3d(context_provider); resource_provider->InitializeGL(); CheckCreateResource(ResourceProvider::GLTexture, resource_provider, context); diff --git a/cc/surfaces/surfaces_pixeltest.cc b/cc/surfaces/surfaces_pixeltest.cc index fd5951c..abcc532e 100644 --- a/cc/surfaces/surfaces_pixeltest.cc +++ b/cc/surfaces/surfaces_pixeltest.cc @@ -80,7 +80,6 @@ TEST_F(SurfacesPixelTest, DrawSimpleFrame) { RenderPassList* pass_list = &aggregated_frame->delegated_frame_data->render_pass_list; EXPECT_TRUE(RunPixelTest(pass_list, - PixelTest::NoOffscreenContext, base::FilePath(FILE_PATH_LITERAL("green.png")), pixel_comparator)); } @@ -161,7 +160,6 @@ TEST_F(SurfacesPixelTest, DrawSimpleAggregatedFrame) { RenderPassList* pass_list = &aggregated_frame->delegated_frame_data->render_pass_list; EXPECT_TRUE(RunPixelTest(pass_list, - PixelTest::NoOffscreenContext, base::FilePath(FILE_PATH_LITERAL("blue_yellow.png")), pixel_comparator)); } @@ -302,7 +300,6 @@ TEST_F(SurfacesPixelTest, DrawAggregatedFrameWithSurfaceTransforms) { &aggregated_frame->delegated_frame_data->render_pass_list; EXPECT_TRUE(RunPixelTest( pass_list, - PixelTest::NoOffscreenContext, base::FilePath(FILE_PATH_LITERAL("four_blue_green_checkers.png")), pixel_comparator)); } diff --git a/cc/test/fake_layer_tree_host_client.cc b/cc/test/fake_layer_tree_host_client.cc index 1ee0bb8..975f687 100644 --- a/cc/test/fake_layer_tree_host_client.cc +++ b/cc/test/fake_layer_tree_host_client.cc @@ -35,12 +35,4 @@ scoped_ptr<OutputSurface> FakeLayerTreeHostClient::CreateOutputSurface( return FakeOutputSurface::Create3d().PassAs<OutputSurface>(); } -scoped_refptr<ContextProvider> -FakeLayerTreeHostClient::OffscreenContextProvider() { - if (!offscreen_contexts_.get() || - offscreen_contexts_->DestroyedOnMainThread()) - offscreen_contexts_ = TestContextProvider::Create(); - return offscreen_contexts_; -} - } // namespace cc diff --git a/cc/test/fake_layer_tree_host_client.h b/cc/test/fake_layer_tree_host_client.h index 65ca019..1b0ec1f 100644 --- a/cc/test/fake_layer_tree_host_client.h +++ b/cc/test/fake_layer_tree_host_client.h @@ -40,7 +40,6 @@ class FakeLayerTreeHostClient : public LayerTreeHostClient, virtual void DidCommit() OVERRIDE {} virtual void DidCommitAndDrawFrame() OVERRIDE {} virtual void DidCompleteSwapBuffers() OVERRIDE {} - virtual scoped_refptr<ContextProvider> OffscreenContextProvider() OVERRIDE; // LayerTreeHostSingleThreadClient implementation. virtual void ScheduleComposite() OVERRIDE {} @@ -51,8 +50,6 @@ class FakeLayerTreeHostClient : public LayerTreeHostClient, private: bool use_software_rendering_; bool use_delegating_renderer_; - - scoped_refptr<TestContextProvider> offscreen_contexts_; }; } // namespace cc diff --git a/cc/test/fake_output_surface_client.cc b/cc/test/fake_output_surface_client.cc index 20de00e..2033ace 100644 --- a/cc/test/fake_output_surface_client.cc +++ b/cc/test/fake_output_surface_client.cc @@ -6,10 +6,8 @@ namespace cc { -bool FakeOutputSurfaceClient::DeferredInitialize( - scoped_refptr<ContextProvider> offscreen_context_provider) { +void FakeOutputSurfaceClient::DeferredInitialize() { deferred_initialize_called_ = true; - return deferred_initialize_result_; } void FakeOutputSurfaceClient::BeginFrame(const BeginFrameArgs& args) { diff --git a/cc/test/fake_output_surface_client.h b/cc/test/fake_output_surface_client.h index b572c5e..4f0486a 100644 --- a/cc/test/fake_output_surface_client.h +++ b/cc/test/fake_output_surface_client.h @@ -14,13 +14,11 @@ class FakeOutputSurfaceClient : public OutputSurfaceClient { public: FakeOutputSurfaceClient() : begin_frame_count_(0), - deferred_initialize_result_(true), deferred_initialize_called_(false), did_lose_output_surface_called_(false), memory_policy_(0) {} - virtual bool DeferredInitialize( - scoped_refptr<ContextProvider> offscreen_context_provider) OVERRIDE; + virtual void DeferredInitialize() OVERRIDE; virtual void ReleaseGL() OVERRIDE {} virtual void SetNeedsRedrawRect(const gfx::Rect& damage_rect) OVERRIDE {} virtual void BeginFrame(const BeginFrameArgs& args) OVERRIDE; @@ -38,10 +36,6 @@ class FakeOutputSurfaceClient : public OutputSurfaceClient { int begin_frame_count() { return begin_frame_count_; } - void set_deferred_initialize_result(bool result) { - deferred_initialize_result_ = result; - } - bool deferred_initialize_called() { return deferred_initialize_called_; } @@ -54,7 +48,6 @@ class FakeOutputSurfaceClient : public OutputSurfaceClient { private: int begin_frame_count_; - bool deferred_initialize_result_; bool deferred_initialize_called_; bool did_lose_output_surface_called_; ManagedMemoryPolicy memory_policy_; diff --git a/cc/test/layer_tree_pixel_test.cc b/cc/test/layer_tree_pixel_test.cc index a282cc4..3237c1a 100644 --- a/cc/test/layer_tree_pixel_test.cc +++ b/cc/test/layer_tree_pixel_test.cc @@ -64,10 +64,6 @@ scoped_ptr<OutputSurface> LayerTreePixelTest::CreateOutputSurface( return output_surface.PassAs<OutputSurface>(); } -scoped_refptr<ContextProvider> LayerTreePixelTest::OffscreenContextProvider() { - return scoped_refptr<ContextProvider>(new TestInProcessContextProvider); -} - void LayerTreePixelTest::CommitCompleteOnThread(LayerTreeHostImpl* impl) { LayerTreeImpl* commit_tree = impl->pending_tree() ? impl->pending_tree() : impl->active_tree(); diff --git a/cc/test/layer_tree_pixel_test.h b/cc/test/layer_tree_pixel_test.h index 16873e5..cd0c988 100644 --- a/cc/test/layer_tree_pixel_test.h +++ b/cc/test/layer_tree_pixel_test.h @@ -35,7 +35,6 @@ class LayerTreePixelTest : public LayerTreeTest { virtual ~LayerTreePixelTest(); virtual scoped_ptr<OutputSurface> CreateOutputSurface(bool fallback) OVERRIDE; - virtual scoped_refptr<ContextProvider> OffscreenContextProvider() OVERRIDE; virtual void CommitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE; virtual scoped_ptr<CopyOutputRequest> CreateCopyOutputRequest(); diff --git a/cc/test/layer_tree_test.cc b/cc/test/layer_tree_test.cc index 5c85d16..f67ee7c 100644 --- a/cc/test/layer_tree_test.cc +++ b/cc/test/layer_tree_test.cc @@ -271,10 +271,6 @@ class LayerTreeHostClientForTesting : public LayerTreeHostClient, virtual void DidPostSwapBuffers() OVERRIDE {} virtual void DidAbortSwapBuffers() OVERRIDE {} - virtual scoped_refptr<ContextProvider> OffscreenContextProvider() OVERRIDE { - return test_hooks_->OffscreenContextProvider(); - } - private: explicit LayerTreeHostClientForTesting(TestHooks* test_hooks) : test_hooks_(test_hooks) {} @@ -682,13 +678,6 @@ scoped_ptr<FakeOutputSurface> LayerTreeTest::CreateFakeOutputSurface( return FakeOutputSurface::Create3d(); } -scoped_refptr<ContextProvider> LayerTreeTest::OffscreenContextProvider() { - if (!compositor_contexts_.get() || - compositor_contexts_->DestroyedOnMainThread()) - compositor_contexts_ = TestContextProvider::Create(); - return compositor_contexts_; -} - TestWebGraphicsContext3D* LayerTreeTest::TestContext() { return static_cast<TestContextProvider*>( output_surface_->context_provider().get())->TestContext3d(); diff --git a/cc/test/layer_tree_test.h b/cc/test/layer_tree_test.h index 19a379b..42ef53f 100644 --- a/cc/test/layer_tree_test.h +++ b/cc/test/layer_tree_test.h @@ -87,7 +87,6 @@ class TestHooks : public AnimationDelegate { Animation::TargetProperty target_property) OVERRIDE {} virtual scoped_ptr<OutputSurface> CreateOutputSurface(bool fallback) = 0; - virtual scoped_refptr<ContextProvider> OffscreenContextProvider() = 0; }; class BeginTask; @@ -186,8 +185,6 @@ class LayerTreeTest : public testing::Test, public TestHooks { // Override this for unit tests, which should not produce pixel output. virtual scoped_ptr<FakeOutputSurface> CreateFakeOutputSurface(bool fallback); - virtual scoped_refptr<ContextProvider> OffscreenContextProvider() OVERRIDE; - TestWebGraphicsContext3D* TestContext(); diff --git a/cc/test/pixel_test.cc b/cc/test/pixel_test.cc index 112d391..f716eea 100644 --- a/cc/test/pixel_test.cc +++ b/cc/test/pixel_test.cc @@ -36,12 +36,10 @@ PixelTest::PixelTest() PixelTest::~PixelTest() {} bool PixelTest::RunPixelTest(RenderPassList* pass_list, - OffscreenContextOption provide_offscreen_context, const base::FilePath& ref_file, const PixelComparator& comparator) { return RunPixelTestWithReadbackTarget(pass_list, pass_list->back(), - provide_offscreen_context, ref_file, comparator); } @@ -49,7 +47,6 @@ bool PixelTest::RunPixelTest(RenderPassList* pass_list, bool PixelTest::RunPixelTestWithReadbackTarget( RenderPassList* pass_list, RenderPass* target, - OffscreenContextOption provide_offscreen_context, const base::FilePath& ref_file, const PixelComparator& comparator) { base::RunLoop run_loop; @@ -59,16 +56,6 @@ bool PixelTest::RunPixelTestWithReadbackTarget( base::Unretained(this), run_loop.QuitClosure()))); - scoped_refptr<ContextProvider> offscreen_contexts; - switch (provide_offscreen_context) { - case NoOffscreenContext: - break; - case WithOffscreenContext: - offscreen_contexts = new TestInProcessContextProvider; - CHECK(offscreen_contexts->BindToCurrentThread()); - break; - } - float device_scale_factor = 1.f; gfx::Rect device_viewport_rect = gfx::Rect(device_viewport_size_) + external_device_viewport_offset_; @@ -77,7 +64,6 @@ bool PixelTest::RunPixelTestWithReadbackTarget( : external_device_clip_rect_; renderer_->DecideRenderPassAllocationsForFrame(*pass_list); renderer_->DrawFrame(pass_list, - offscreen_contexts.get(), device_scale_factor, device_viewport_rect, device_clip_rect, diff --git a/cc/test/pixel_test.h b/cc/test/pixel_test.h index dc01098..bb4c13d 100644 --- a/cc/test/pixel_test.h +++ b/cc/test/pixel_test.h @@ -28,20 +28,13 @@ class PixelTest : public testing::Test, RendererClient { PixelTest(); virtual ~PixelTest(); - enum OffscreenContextOption { - NoOffscreenContext, - WithOffscreenContext - }; - bool RunPixelTest(RenderPassList* pass_list, - OffscreenContextOption provide_offscreen_context, const base::FilePath& ref_file, const PixelComparator& comparator); bool RunPixelTestWithReadbackTarget( RenderPassList* pass_list, RenderPass* target, - OffscreenContextOption provide_offscreen_context, const base::FilePath& ref_file, const PixelComparator& comparator); diff --git a/cc/trees/layer_tree_host.cc b/cc/trees/layer_tree_host.cc index d2d5e3a..4cdd97d 100644 --- a/cc/trees/layer_tree_host.cc +++ b/cc/trees/layer_tree_host.cc @@ -48,19 +48,16 @@ namespace cc { RendererCapabilities::RendererCapabilities(ResourceFormat best_texture_format, bool allow_partial_texture_updates, - bool using_offscreen_context3d, int max_texture_size, bool using_shared_memory_resources) : best_texture_format(best_texture_format), allow_partial_texture_updates(allow_partial_texture_updates), - using_offscreen_context3d(using_offscreen_context3d), max_texture_size(max_texture_size), using_shared_memory_resources(using_shared_memory_resources) {} RendererCapabilities::RendererCapabilities() : best_texture_format(RGBA_8888), allow_partial_texture_updates(false), - using_offscreen_context3d(false), max_texture_size(0), using_shared_memory_resources(false) {} @@ -98,7 +95,6 @@ LayerTreeHost::LayerTreeHost( next_ui_resource_id_(1), animating_(false), needs_full_tree_sync_(true), - needs_filter_context_(false), client_(client), source_frame_number_(0), rendering_stats_instrumentation_(RenderingStatsInstrumentation::Create()), diff --git a/cc/trees/layer_tree_host.h b/cc/trees/layer_tree_host.h index 508a728..17dacc8 100644 --- a/cc/trees/layer_tree_host.h +++ b/cc/trees/layer_tree_host.h @@ -65,7 +65,6 @@ struct ScrollAndScaleSet; struct CC_EXPORT RendererCapabilities { RendererCapabilities(ResourceFormat best_texture_format, bool allow_partial_texture_updates, - bool using_offscreen_context3d, int max_texture_size, bool using_shared_memory_resources); @@ -75,7 +74,6 @@ struct CC_EXPORT RendererCapabilities { // Duplicate any modification to this list to RendererCapabilitiesImpl. ResourceFormat best_texture_format; bool allow_partial_texture_updates; - bool using_offscreen_context3d; int max_texture_size; bool using_shared_memory_resources; }; @@ -98,11 +96,6 @@ class CC_EXPORT LayerTreeHost { void SetLayerTreeHostClientReady(); - void set_needs_filter_context() { needs_filter_context_ = true; } - bool needs_offscreen_context() const { - return needs_filter_context_; - } - // LayerTreeHost interface to Proxy. void WillBeginMainFrame() { client_->WillBeginMainFrame(source_frame_number_); @@ -366,7 +359,6 @@ class CC_EXPORT LayerTreeHost { bool animating_; bool needs_full_tree_sync_; - bool needs_filter_context_; base::CancelableClosure prepaint_callback_; diff --git a/cc/trees/layer_tree_host_client.h b/cc/trees/layer_tree_host_client.h index deca800..bd185e8 100644 --- a/cc/trees/layer_tree_host_client.h +++ b/cc/trees/layer_tree_host_client.h @@ -37,11 +37,6 @@ class LayerTreeHostClient { virtual void DidCommitAndDrawFrame() = 0; virtual void DidCompleteSwapBuffers() = 0; - // If the client provides an OutputSurface bound to a 3d context for direct - // rendering, this must return a provider that provides contexts usable from - // the same thread as the OutputSurface's context. - virtual scoped_refptr<ContextProvider> OffscreenContextProvider() = 0; - // Requests that the client insert a rate limiting token in the shared main // thread context's command stream that will block if the context gets too far // ahead of the compositor's command stream. Only needed if the tree contains diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc index 447bfc0..679e0e7 100644 --- a/cc/trees/layer_tree_host_impl.cc +++ b/cc/trees/layer_tree_host_impl.cc @@ -1426,14 +1426,12 @@ void LayerTreeHostImpl::DrawLayers(FrameData* frame, scoped_ptr<SoftwareRenderer> temp_software_renderer = SoftwareRenderer::Create(this, &settings_, output_surface_.get(), NULL); temp_software_renderer->DrawFrame(&frame->render_passes, - NULL, device_scale_factor_, DeviceViewport(), DeviceClip(), disable_picture_quad_image_filtering); } else { renderer_->DrawFrame(&frame->render_passes, - offscreen_context_provider_.get(), device_scale_factor_, DeviceViewport(), DeviceClip(), @@ -1917,8 +1915,7 @@ bool LayerTreeHostImpl::InitializeRenderer( return true; } -bool LayerTreeHostImpl::DeferredInitialize( - scoped_refptr<ContextProvider> offscreen_context_provider) { +void LayerTreeHostImpl::DeferredInitialize() { DCHECK(output_surface_->capabilities().deferred_gl_initialization); DCHECK(settings_.impl_side_painting); DCHECK(output_surface_->context_provider()); @@ -1932,39 +1929,8 @@ bool LayerTreeHostImpl::DeferredInitialize( CreateAndSetRenderer( output_surface_.get(), resource_provider_.get(), skip_gl_renderer); - bool success = true; - if (offscreen_context_provider.get() && - !offscreen_context_provider->BindToCurrentThread()) - success = false; - - if (success) { - EnforceZeroBudget(false); - client_->SetNeedsCommitOnImplThread(); - } else { - if (offscreen_context_provider.get()) { - if (offscreen_context_provider->BindToCurrentThread()) - offscreen_context_provider->VerifyContexts(); - offscreen_context_provider = NULL; - } - - client_->DidLoseOutputSurfaceOnImplThread(); - - // If this method fails, the context provider will be dropped from the - // output surface and destroyed. But the GLRenderer expects the output - // surface to stick around - and hold onto the context3d - as long as it is - // alive. - // TODO(danakj): Remove the need for this code path: crbug.com/276411 - renderer_.reset(); - - // The resource provider can't stay in GL mode or it tries to clean up GL - // stuff, but the context provider is going away on the output surface - // which contradicts being in GL mode. - // TODO(danakj): Remove the need for this code path: crbug.com/276411 - resource_provider_->InitializeSoftware(); - } - - SetOffscreenContextProvider(offscreen_context_provider); - return success; + EnforceZeroBudget(false); + client_->SetNeedsCommitOnImplThread(); } void LayerTreeHostImpl::ReleaseGL() { @@ -1991,8 +1957,6 @@ void LayerTreeHostImpl::ReleaseGL() { GetRendererCapabilities().allow_rasterize_on_demand); DCHECK(tile_manager_); - SetOffscreenContextProvider(NULL); - client_->SetNeedsCommitOnImplThread(); } @@ -2821,21 +2785,6 @@ void LayerTreeHostImpl::SendReleaseResourcesRecursive(LayerImpl* current) { SendReleaseResourcesRecursive(current->children()[i]); } -void LayerTreeHostImpl::SetOffscreenContextProvider( - const scoped_refptr<ContextProvider>& offscreen_context_provider) { - if (!offscreen_context_provider.get()) { - offscreen_context_provider_ = NULL; - return; - } - - if (!offscreen_context_provider->BindToCurrentThread()) { - offscreen_context_provider_ = NULL; - return; - } - - offscreen_context_provider_ = offscreen_context_provider; -} - std::string LayerTreeHostImpl::LayerTreeAsJson() const { std::string str; if (active_tree_->root_layer()) { diff --git a/cc/trees/layer_tree_host_impl.h b/cc/trees/layer_tree_host_impl.h index a1f4fae..c503806 100644 --- a/cc/trees/layer_tree_host_impl.h +++ b/cc/trees/layer_tree_host_impl.h @@ -222,8 +222,7 @@ class CC_EXPORT LayerTreeHostImpl virtual void NotifyReadyToActivate() OVERRIDE; // OutputSurfaceClient implementation. - virtual bool DeferredInitialize( - scoped_refptr<ContextProvider> offscreen_context_provider) OVERRIDE; + virtual void DeferredInitialize() OVERRIDE; virtual void ReleaseGL() OVERRIDE; virtual void SetNeedsRedrawRect(const gfx::Rect& rect) OVERRIDE; virtual void BeginFrame(const BeginFrameArgs& args) OVERRIDE; @@ -247,12 +246,6 @@ class CC_EXPORT LayerTreeHostImpl bool CanDraw() const; OutputSurface* output_surface() const { return output_surface_.get(); } - void SetOffscreenContextProvider( - const scoped_refptr<ContextProvider>& offscreen_context_provider); - ContextProvider* offscreen_context_provider() const { - return offscreen_context_provider_.get(); - } - std::string LayerTreeAsJson() const; void FinishAllRendering(); diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc index dfea47b..c8a19da 100644 --- a/cc/trees/layer_tree_host_impl_unittest.cc +++ b/cc/trees/layer_tree_host_impl_unittest.cc @@ -5516,7 +5516,6 @@ class LayerTreeHostImplTestDeferredInitialize : public LayerTreeHostImplTest { SetupRootLayerImpl(root_layer.PassAs<LayerImpl>()); onscreen_context_provider_ = TestContextProvider::Create(); - offscreen_context_provider_ = TestContextProvider::Create(); } virtual void UpdateRendererCapabilitiesOnImplThread() OVERRIDE { @@ -5525,7 +5524,6 @@ class LayerTreeHostImplTestDeferredInitialize : public LayerTreeHostImplTest { FakeOutputSurface* output_surface_; scoped_refptr<TestContextProvider> onscreen_context_provider_; - scoped_refptr<TestContextProvider> offscreen_context_provider_; bool did_update_renderer_capabilities_; }; @@ -5535,16 +5533,13 @@ TEST_F(LayerTreeHostImplTestDeferredInitialize, Success) { DrawFrame(); EXPECT_FALSE(host_impl_->output_surface()->context_provider()); - EXPECT_FALSE(host_impl_->offscreen_context_provider()); // DeferredInitialize and hardware draw. did_update_renderer_capabilities_ = false; - EXPECT_TRUE(output_surface_->InitializeAndSetContext3d( - onscreen_context_provider_, offscreen_context_provider_)); + EXPECT_TRUE( + output_surface_->InitializeAndSetContext3d(onscreen_context_provider_)); EXPECT_EQ(onscreen_context_provider_, host_impl_->output_surface()->context_provider()); - EXPECT_EQ(offscreen_context_provider_, - host_impl_->offscreen_context_provider()); EXPECT_TRUE(did_update_renderer_capabilities_); // Defer intialized GL draw. @@ -5554,14 +5549,13 @@ TEST_F(LayerTreeHostImplTestDeferredInitialize, Success) { did_update_renderer_capabilities_ = false; output_surface_->ReleaseGL(); EXPECT_FALSE(host_impl_->output_surface()->context_provider()); - EXPECT_FALSE(host_impl_->offscreen_context_provider()); EXPECT_TRUE(did_update_renderer_capabilities_); // Software draw again. DrawFrame(); } -TEST_F(LayerTreeHostImplTestDeferredInitialize, Fails_OnscreenContext_0) { +TEST_F(LayerTreeHostImplTestDeferredInitialize, Fails) { // Software draw. DrawFrame(); @@ -5570,79 +5564,18 @@ TEST_F(LayerTreeHostImplTestDeferredInitialize, Fails_OnscreenContext_0) { onscreen_context_provider_->UnboundTestContext3d()->set_context_lost(true); EXPECT_FALSE(host_impl_->output_surface()->context_provider()); - EXPECT_FALSE(host_impl_->offscreen_context_provider()); // DeferredInitialize fails. did_update_renderer_capabilities_ = false; - EXPECT_FALSE(output_surface_->InitializeAndSetContext3d( - onscreen_context_provider_, offscreen_context_provider_)); + EXPECT_FALSE( + output_surface_->InitializeAndSetContext3d(onscreen_context_provider_)); EXPECT_FALSE(host_impl_->output_surface()->context_provider()); - EXPECT_FALSE(host_impl_->offscreen_context_provider()); EXPECT_FALSE(did_update_renderer_capabilities_); // Software draw again. DrawFrame(); } -// TODO(boliu): After r239415, fails_OnscreenContext_1 and 2 are exactly the -// same as 0. They were supposed to test makeCurrent failing in the -// OutputSurface, LayerTreeHostImpl, and GLRenderer respectively. -TEST_F(LayerTreeHostImplTestDeferredInitialize, Fails_OnscreenContext_1) { - // Software draw. - DrawFrame(); - - EXPECT_FALSE(host_impl_->output_surface()->context_provider()); - EXPECT_FALSE(host_impl_->offscreen_context_provider()); - - onscreen_context_provider_->UnboundTestContext3d()->set_context_lost(true); - - EXPECT_FALSE(host_impl_->output_surface()->context_provider()); - // DeferredInitialize fails. - did_update_renderer_capabilities_ = false; - EXPECT_FALSE(output_surface_->InitializeAndSetContext3d( - onscreen_context_provider_, offscreen_context_provider_)); - EXPECT_FALSE(host_impl_->output_surface()->context_provider()); - EXPECT_FALSE(host_impl_->offscreen_context_provider()); - EXPECT_FALSE(did_update_renderer_capabilities_); -} - -TEST_F(LayerTreeHostImplTestDeferredInitialize, Fails_OnscreenContext_2) { - // Software draw. - DrawFrame(); - - EXPECT_FALSE(host_impl_->output_surface()->context_provider()); - EXPECT_FALSE(host_impl_->offscreen_context_provider()); - - onscreen_context_provider_->UnboundTestContext3d()->set_context_lost(true); - - // DeferredInitialize fails. - did_update_renderer_capabilities_ = false; - EXPECT_FALSE(output_surface_->InitializeAndSetContext3d( - onscreen_context_provider_, offscreen_context_provider_)); - EXPECT_FALSE(host_impl_->output_surface()->context_provider()); - EXPECT_FALSE(host_impl_->offscreen_context_provider()); - EXPECT_FALSE(did_update_renderer_capabilities_); -} - -TEST_F(LayerTreeHostImplTestDeferredInitialize, Fails_OffscreenContext) { - // Software draw. - DrawFrame(); - - EXPECT_FALSE(host_impl_->output_surface()->context_provider()); - EXPECT_FALSE(host_impl_->offscreen_context_provider()); - - // Fail initialization of the offscreen context. - onscreen_context_provider_->UnboundTestContext3d()->set_context_lost(true); - - // DeferredInitialize fails. - did_update_renderer_capabilities_ = false; - EXPECT_FALSE(output_surface_->InitializeAndSetContext3d( - onscreen_context_provider_, offscreen_context_provider_)); - EXPECT_FALSE(host_impl_->output_surface()->context_provider()); - EXPECT_FALSE(host_impl_->offscreen_context_provider()); - EXPECT_FALSE(did_update_renderer_capabilities_); -} - // Checks that we have a non-0 default allocation if we pass a context that // doesn't support memory management extensions. TEST_F(LayerTreeHostImplTest, DefaultMemoryAllocation) { diff --git a/cc/trees/layer_tree_host_unittest.cc b/cc/trees/layer_tree_host_unittest.cc index 60c71be..56f2a17 100644 --- a/cc/trees/layer_tree_host_unittest.cc +++ b/cc/trees/layer_tree_host_unittest.cc @@ -3085,7 +3085,7 @@ class LayerTreeHostTestDeferredInitialize : public LayerTreeHostTest { scoped_refptr<TestContextProvider> context_provider = TestContextProvider::Create(); // Not bound to thread. EXPECT_TRUE( - fake_output_surface->InitializeAndSetContext3d(context_provider, NULL)); + fake_output_surface->InitializeAndSetContext3d(context_provider)); did_initialize_gl_ = true; } @@ -4608,31 +4608,6 @@ class LayerTreeHostTestMemoryLimits : public LayerTreeHostTest { SINGLE_AND_MULTI_THREAD_NOIMPL_TEST_F(LayerTreeHostTestMemoryLimits); -class LayerSetsNeedsFilterContext : public Layer { - public: - static scoped_refptr<LayerSetsNeedsFilterContext> Create() { - return make_scoped_refptr(new LayerSetsNeedsFilterContext()); - } - - virtual bool Update(ResourceUpdateQueue* queue, - const OcclusionTracker<Layer>* occlusion) OVERRIDE { - bool updated = Layer::Update(queue, occlusion); - if (needs_context_) { - layer_tree_host()->set_needs_filter_context(); - return true; - } - return updated; - } - - void set_needs_context(bool need) { needs_context_ = need; } - - private: - LayerSetsNeedsFilterContext() : needs_context_(false) {} - virtual ~LayerSetsNeedsFilterContext() {} - - bool needs_context_; -}; - class LayerTreeHostTestNoQuadsForEmptyLayer : public LayerTreeHostTest { protected: virtual void SetupTree() OVERRIDE { diff --git a/cc/trees/layer_tree_host_unittest_context.cc b/cc/trees/layer_tree_host_unittest_context.cc index 3afdbc1..a441d8a 100644 --- a/cc/trees/layer_tree_host_unittest_context.cc +++ b/cc/trees/layer_tree_host_unittest_context.cc @@ -56,11 +56,8 @@ class LayerTreeHostContextTest : public LayerTreeTest { times_to_lose_during_commit_(0), times_to_lose_during_draw_(0), times_to_fail_recreate_(0), - times_to_fail_create_offscreen_(0), - times_to_fail_recreate_offscreen_(0), times_to_expect_create_failed_(0), times_create_failed_(0), - times_offscreen_created_(0), committed_at_least_once_(false), context_should_support_io_surface_(false), fallback_context_works_(false) { @@ -99,35 +96,6 @@ class LayerTreeHostContextTest : public LayerTreeTest { return FakeOutputSurface::Create3d(context3d.Pass()); } - scoped_ptr<TestWebGraphicsContext3D> CreateOffscreenContext3d() { - if (!context3d_) - return scoped_ptr<TestWebGraphicsContext3D>(); - - ++times_offscreen_created_; - - if (times_to_fail_create_offscreen_) { - --times_to_fail_create_offscreen_; - ExpectCreateToFail(); - return scoped_ptr<TestWebGraphicsContext3D>(); - } - - scoped_ptr<TestWebGraphicsContext3D> offscreen_context3d = - TestWebGraphicsContext3D::Create().Pass(); - DCHECK(offscreen_context3d); - context3d_->add_share_group_context(offscreen_context3d.get()); - - return offscreen_context3d.Pass(); - } - - virtual scoped_refptr<ContextProvider> OffscreenContextProvider() OVERRIDE { - if (!offscreen_contexts_.get() || - offscreen_contexts_->DestroyedOnMainThread()) { - offscreen_contexts_ = - TestContextProvider::Create(CreateOffscreenContext3d()); - } - return offscreen_contexts_; - } - virtual DrawSwapReadbackResult::DrawResult PrepareToDrawOnThread( LayerTreeHostImpl* host_impl, LayerTreeHostImpl::FrameData* frame, @@ -141,8 +109,6 @@ class LayerTreeHostContextTest : public LayerTreeTest { times_to_fail_create_ = times_to_fail_recreate_; times_to_fail_recreate_ = 0; - times_to_fail_create_offscreen_ = times_to_fail_recreate_offscreen_; - times_to_fail_recreate_offscreen_ = 0; return draw_result; } @@ -157,8 +123,6 @@ class LayerTreeHostContextTest : public LayerTreeTest { times_to_fail_create_ = times_to_fail_recreate_; times_to_fail_recreate_ = 0; - times_to_fail_create_offscreen_ = times_to_fail_recreate_offscreen_; - times_to_fail_recreate_offscreen_ = 0; } virtual void DidFailToInitializeOutputSurface() OVERRIDE { @@ -178,16 +142,11 @@ class LayerTreeHostContextTest : public LayerTreeTest { int times_to_lose_during_commit_; int times_to_lose_during_draw_; int times_to_fail_recreate_; - int times_to_fail_create_offscreen_; - int times_to_fail_recreate_offscreen_; int times_to_expect_create_failed_; int times_create_failed_; - int times_offscreen_created_; bool committed_at_least_once_; bool context_should_support_io_surface_; bool fallback_context_works_; - - scoped_refptr<TestContextProvider> offscreen_contexts_; }; class LayerTreeHostContextTestLostContextSucceeds @@ -246,25 +205,21 @@ class LayerTreeHostContextTestLostContextSucceeds {1, // times_to_lose_during_commit 0, // times_to_lose_during_draw 0, // times_to_fail_recreate - 0, // times_to_fail_recreate_offscreen false, // fallback_context_works }, {0, // times_to_lose_during_commit 1, // times_to_lose_during_draw 0, // times_to_fail_recreate - 0, // times_to_fail_recreate_offscreen false, // fallback_context_works }, {1, // times_to_lose_during_commit 0, // times_to_lose_during_draw 3, // times_to_fail_recreate - 0, // times_to_fail_recreate_offscreen false, // fallback_context_works }, {0, // times_to_lose_during_commit 1, // times_to_lose_during_draw 3, // times_to_fail_recreate - 0, // times_to_fail_recreate_offscreen false, // fallback_context_works }, // Losing the context and recreating it any number of times should @@ -272,13 +227,11 @@ class LayerTreeHostContextTestLostContextSucceeds {10, // times_to_lose_during_commit 0, // times_to_lose_during_draw 0, // times_to_fail_recreate - 0, // times_to_fail_recreate_offscreen false, // fallback_context_works }, {0, // times_to_lose_during_commit 10, // times_to_lose_during_draw 0, // times_to_fail_recreate - 0, // times_to_fail_recreate_offscreen false, // fallback_context_works }, // Losing the context, failing to reinitialize it, and making a fallback @@ -286,7 +239,6 @@ class LayerTreeHostContextTestLostContextSucceeds {0, // times_to_lose_during_commit 1, // times_to_lose_during_draw 0, // times_to_fail_recreate - 0, // times_to_fail_recreate_offscreen true, // fallback_context_works }, }; @@ -301,8 +253,6 @@ class LayerTreeHostContextTestLostContextSucceeds kTests[test_case_].times_to_lose_during_commit; times_to_lose_during_draw_ = kTests[test_case_].times_to_lose_during_draw; times_to_fail_recreate_ = kTests[test_case_].times_to_fail_recreate; - times_to_fail_recreate_offscreen_ = - kTests[test_case_].times_to_fail_recreate_offscreen; fallback_context_works_ = kTests[test_case_].fallback_context_works; ++test_case_; return true; @@ -312,7 +262,6 @@ class LayerTreeHostContextTestLostContextSucceeds int times_to_lose_during_commit; int times_to_lose_during_draw; int times_to_fail_recreate; - int times_to_fail_recreate_offscreen; bool fallback_context_works; }; @@ -494,57 +443,6 @@ class LayerTreeHostContextTestCreateOutputSurfaceIsHopeless SINGLE_AND_MULTI_THREAD_TEST_F( LayerTreeHostContextTestCreateOutputSurfaceIsHopeless); - -class LayerTreeHostContextTestOffscreenContextFails - : public LayerTreeHostContextTest { - public: - virtual void SetupTree() OVERRIDE { - root_ = Layer::Create(); - root_->SetBounds(gfx::Size(10, 10)); - root_->SetAnchorPoint(gfx::PointF()); - root_->SetIsDrawable(true); - - content_ = FakeContentLayer::Create(&client_); - content_->SetBounds(gfx::Size(10, 10)); - content_->SetAnchorPoint(gfx::PointF()); - content_->SetIsDrawable(true); - content_->SetForceRenderSurface(true); - // Filters require us to create an offscreen context. - FilterOperations filters; - filters.Append(FilterOperation::CreateGrayscaleFilter(0.5f)); - content_->SetFilters(filters); - content_->SetBackgroundFilters(filters); - - root_->AddChild(content_); - - layer_tree_host()->SetRootLayer(root_); - LayerTreeHostContextTest::SetupTree(); - } - - virtual void BeginTest() OVERRIDE { - times_to_fail_create_offscreen_ = 1; - PostSetNeedsCommitToMainThread(); - } - - virtual void DrawLayersOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { - ContextProvider* contexts = host_impl->offscreen_context_provider(); - EXPECT_FALSE(contexts); - - // This did not lead to create failure. - times_to_expect_create_failed_ = 0; - EndTest(); - } - - virtual void AfterTest() OVERRIDE {} - - protected: - FakeContentLayerClient client_; - scoped_refptr<Layer> root_; - scoped_refptr<ContentLayer> content_; -}; - -SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostContextTestOffscreenContextFails); - class LayerTreeHostContextTestLostContextFails : public LayerTreeHostContextTest { public: diff --git a/cc/trees/single_thread_proxy.cc b/cc/trees/single_thread_proxy.cc index 72f16dc..b5968fe 100644 --- a/cc/trees/single_thread_proxy.cc +++ b/cc/trees/single_thread_proxy.cc @@ -32,7 +32,6 @@ SingleThreadProxy::SingleThreadProxy(LayerTreeHost* layer_tree_host, : Proxy(NULL), layer_tree_host_(layer_tree_host), client_(client), - created_offscreen_context_provider_(false), next_frame_is_newly_committed_frame_(false), inside_draw_(false) { TRACE_EVENT0("cc", "SingleThreadProxy::SingleThreadProxy"); @@ -122,17 +121,6 @@ void SingleThreadProxy::CreateAndInitializeOutputSurface() { return; } - scoped_refptr<ContextProvider> offscreen_context_provider; - if (created_offscreen_context_provider_) { - offscreen_context_provider = - layer_tree_host_->client()->OffscreenContextProvider(); - if (!offscreen_context_provider.get() || - !offscreen_context_provider->BindToCurrentThread()) { - OnOutputSurfaceInitializeAttempted(false); - return; - } - } - { DebugScopedSetMainThreadBlocked main_thread_blocked(this); DebugScopedSetImplThread impl(this); @@ -147,13 +135,6 @@ void SingleThreadProxy::CreateAndInitializeOutputSurface() { DCHECK(output_surface); initialized = layer_tree_host_impl_->InitializeRenderer( output_surface.Pass()); - if (!initialized && offscreen_context_provider.get()) { - offscreen_context_provider->VerifyContexts(); - offscreen_context_provider = NULL; - } - - layer_tree_host_impl_->SetOffscreenContextProvider( - offscreen_context_provider); } OnOutputSurfaceInitializeAttempted(initialized); @@ -469,25 +450,9 @@ bool SingleThreadProxy::CommitAndComposite( layer_tree_host_->WillCommit(); - scoped_refptr<ContextProvider> offscreen_context_provider; - if (renderer_capabilities_for_main_thread_.using_offscreen_context3d && - layer_tree_host_->needs_offscreen_context()) { - offscreen_context_provider = - layer_tree_host_->client()->OffscreenContextProvider(); - if (offscreen_context_provider.get() && - !offscreen_context_provider->BindToCurrentThread()) - offscreen_context_provider = NULL; - - if (offscreen_context_provider.get()) - created_offscreen_context_provider_ = true; - } - DoCommit(queue.Pass()); - bool result = DoComposite(offscreen_context_provider, - frame_begin_time, - device_viewport_damage_rect, - for_readback, - frame); + bool result = DoComposite( + frame_begin_time, device_viewport_damage_rect, for_readback, frame); layer_tree_host_->DidBeginMainFrame(); return result; } @@ -505,7 +470,6 @@ void SingleThreadProxy::UpdateBackgroundAnimateTicking() { } bool SingleThreadProxy::DoComposite( - scoped_refptr<ContextProvider> offscreen_context_provider, base::TimeTicks frame_begin_time, const gfx::Rect& device_viewport_damage_rect, bool for_readback, @@ -518,9 +482,6 @@ bool SingleThreadProxy::DoComposite( DebugScopedSetImplThread impl(this); base::AutoReset<bool> mark_inside(&inside_draw_, true); - layer_tree_host_impl_->SetOffscreenContextProvider( - offscreen_context_provider); - bool can_do_readback = layer_tree_host_impl_->renderer()->CanReadPixels(); // We guard PrepareToDraw() with CanDraw() because it always returns a valid @@ -550,10 +511,6 @@ bool SingleThreadProxy::DoComposite( } if (lost_output_surface) { - ContextProvider* offscreen_contexts = - layer_tree_host_impl_->offscreen_context_provider(); - if (offscreen_contexts) - offscreen_contexts->VerifyContexts(); layer_tree_host_->DidLoseOutputSurface(); return false; } diff --git a/cc/trees/single_thread_proxy.h b/cc/trees/single_thread_proxy.h index 0f86673..df1113e 100644 --- a/cc/trees/single_thread_proxy.h +++ b/cc/trees/single_thread_proxy.h @@ -94,8 +94,7 @@ class SingleThreadProxy : public Proxy, LayerTreeHostImplClient { bool for_readback, LayerTreeHostImpl::FrameData* frame); void DoCommit(scoped_ptr<ResourceUpdateQueue> queue); - bool DoComposite(scoped_refptr<ContextProvider> offscreen_context_provider, - base::TimeTicks frame_begin_time, + bool DoComposite(base::TimeTicks frame_begin_time, const gfx::Rect& device_viewport_damage_rect, bool for_readback, LayerTreeHostImpl::FrameData* frame); @@ -107,7 +106,6 @@ class SingleThreadProxy : public Proxy, LayerTreeHostImplClient { // Accessed on main thread only. LayerTreeHost* layer_tree_host_; LayerTreeHostSingleThreadClient* client_; - bool created_offscreen_context_provider_; // Used on the Thread, but checked on main thread during // initialization/shutdown. diff --git a/cc/trees/thread_proxy.cc b/cc/trees/thread_proxy.cc index cac9bc6..df350b8 100644 --- a/cc/trees/thread_proxy.cc +++ b/cc/trees/thread_proxy.cc @@ -92,7 +92,6 @@ ThreadProxy::MainThreadOnly::MainThreadOnly(ThreadProxy* proxy, animate_requested(false), commit_requested(false), commit_request_sent_to_impl_thread(false), - created_offscreen_context_provider(false), started(false), in_composite_and_readback(false), manage_tiles_pending(false), @@ -294,17 +293,6 @@ void ThreadProxy::DoCreateAndInitializeOutputSurface() { return; } - scoped_refptr<ContextProvider> offscreen_context_provider; - if (main().created_offscreen_context_provider) { - offscreen_context_provider = - layer_tree_host()->client()->OffscreenContextProvider(); - success = !!offscreen_context_provider.get(); - if (!success) { - OnOutputSurfaceInitializeAttempted(false, capabilities); - return; - } - } - success = false; { // Make a blocking call to InitializeOutputSurfaceOnImplThread. The results @@ -319,7 +307,6 @@ void ThreadProxy::DoCreateAndInitializeOutputSurface() { impl_thread_weak_ptr_, &completion, base::Passed(&output_surface), - offscreen_context_provider, &success, &capabilities)); completion.Wait(); @@ -427,9 +414,6 @@ void ThreadProxy::CheckOutputSurfaceStatusOnImplThread() { DCHECK(IsImplThread()); if (!impl().layer_tree_host_impl->IsContextLost()) return; - if (ContextProvider* offscreen_contexts = - impl().layer_tree_host_impl->offscreen_context_provider()) - offscreen_contexts->VerifyContexts(); impl().scheduler->DidLoseOutputSurface(); } @@ -949,15 +933,6 @@ void ThreadProxy::BeginMainFrame( return; } - scoped_refptr<ContextProvider> offscreen_context_provider; - if (main().renderer_capabilities_main_thread_copy.using_offscreen_context3d && - layer_tree_host()->needs_offscreen_context()) { - offscreen_context_provider = - layer_tree_host()->client()->OffscreenContextProvider(); - if (offscreen_context_provider.get()) - main().created_offscreen_context_provider = true; - } - // Notify the impl thread that the main thread is ready to commit. This will // begin the commit process, which is blocking from the main thread's // point of view, but asynchronously performed on the impl thread, @@ -978,8 +953,7 @@ void ThreadProxy::BeginMainFrame( base::Bind(&ThreadProxy::StartCommitOnImplThread, impl_thread_weak_ptr_, &completion, - queue.release(), - offscreen_context_provider)); + queue.release())); completion.Wait(); RenderingStatsInstrumentation* stats_instrumentation = @@ -993,10 +967,8 @@ void ThreadProxy::BeginMainFrame( layer_tree_host()->DidBeginMainFrame(); } -void ThreadProxy::StartCommitOnImplThread( - CompletionEvent* completion, - ResourceUpdateQueue* raw_queue, - scoped_refptr<ContextProvider> offscreen_context_provider) { +void ThreadProxy::StartCommitOnImplThread(CompletionEvent* completion, + ResourceUpdateQueue* raw_queue) { TRACE_EVENT0("cc", "ThreadProxy::StartCommitOnImplThread"); DCHECK(!impl().commit_completion_event); DCHECK(IsImplThread() && IsMainThreadBlocked()); @@ -1016,11 +988,6 @@ void ThreadProxy::StartCommitOnImplThread( scoped_ptr<ResourceUpdateQueue> queue(raw_queue); - if (offscreen_context_provider.get()) - offscreen_context_provider->BindToCurrentThread(); - impl().layer_tree_host_impl->SetOffscreenContextProvider( - offscreen_context_provider); - if (impl().contents_texture_manager) { DCHECK_EQ(impl().contents_texture_manager, blocked_main().contents_texture_manager()); @@ -1452,7 +1419,6 @@ void ThreadProxy::InitializeImplOnImplThread(CompletionEvent* completion) { void ThreadProxy::InitializeOutputSurfaceOnImplThread( CompletionEvent* completion, scoped_ptr<OutputSurface> output_surface, - scoped_refptr<ContextProvider> offscreen_context_provider, bool* success, RendererCapabilities* capabilities) { TRACE_EVENT0("cc", "ThreadProxy::InitializeOutputSurfaceOnImplThread"); @@ -1472,15 +1438,8 @@ void ThreadProxy::InitializeOutputSurfaceOnImplThread( .layer_tree_host_impl->GetRendererCapabilities() .MainThreadCapabilities(); impl().scheduler->DidCreateAndInitializeOutputSurface(); - } else if (offscreen_context_provider.get()) { - if (offscreen_context_provider->BindToCurrentThread()) - offscreen_context_provider->VerifyContexts(); - offscreen_context_provider = NULL; } - impl().layer_tree_host_impl->SetOffscreenContextProvider( - offscreen_context_provider); - completion->Signal(); } diff --git a/cc/trees/thread_proxy.h b/cc/trees/thread_proxy.h index e2a8f21..8bdd7b6 100644 --- a/cc/trees/thread_proxy.h +++ b/cc/trees/thread_proxy.h @@ -160,10 +160,8 @@ class ThreadProxy : public Proxy, void ForceCommitForReadbackOnImplThread( CompletionEvent* begin_main_frame_sent_completion, ReadbackRequest* request); - void StartCommitOnImplThread( - CompletionEvent* completion, - ResourceUpdateQueue* queue, - scoped_refptr<ContextProvider> offscreen_context_provider); + void StartCommitOnImplThread(CompletionEvent* completion, + ResourceUpdateQueue* queue); void BeginMainFrameAbortedOnImplThread(bool did_handle); void RequestReadbackOnImplThread(ReadbackRequest* request); void FinishAllRenderingOnImplThread(CompletionEvent* completion); @@ -177,7 +175,6 @@ class ThreadProxy : public Proxy, void InitializeOutputSurfaceOnImplThread( CompletionEvent* completion, scoped_ptr<OutputSurface> output_surface, - scoped_refptr<ContextProvider> offscreen_context_provider, bool* success, RendererCapabilities* capabilities); void FinishGLOnImplThread(CompletionEvent* completion); @@ -214,8 +211,6 @@ class ThreadProxy : public Proxy, bool commit_requested; // Set by SetNeedsAnimate, SetNeedsUpdateLayers, and SetNeedsCommit. bool commit_request_sent_to_impl_thread; - // Set by BeginMainFrame - bool created_offscreen_context_provider; bool started; bool in_composite_and_readback; |