Commit 17ec17f1 authored by ericrk's avatar ericrk Committed by Commit bot

Re-enable ForceReclaimResources w/ ui impl side painting

Disabling ForceReclaimResource on BeginCommit when using ui impl side painting
had the unintended consequence of breaking Display::Draw's mechanism for
not drawing while an OutputSurface was between Commit/Swap. Re enabling
this for now. Tracking handling this in a more robust way in
crbug.com/489515.

BUG=481656,489515

Review URL: https://codereview.chromium.org/1139823008

Cr-Commit-Position: refs/heads/master@{#330587}
parent 81c9cea9
...@@ -297,9 +297,12 @@ void LayerTreeHostImpl::BeginCommit() { ...@@ -297,9 +297,12 @@ void LayerTreeHostImpl::BeginCommit() {
TRACE_EVENT0("cc", "LayerTreeHostImpl::BeginCommit"); TRACE_EVENT0("cc", "LayerTreeHostImpl::BeginCommit");
// Ensure all textures are returned so partial texture updates can happen // Ensure all textures are returned so partial texture updates can happen
// during the commit. Impl-side-painting doesn't upload during commits, so // during the commit.
// is unaffected. // TODO(ericrk): We should not need to ForceReclaimResources when using
if (!settings_.impl_side_painting && output_surface_) // Impl-side-painting as it doesn't upload during commits. However,
// Display::Draw currently relies on resource being reclaimed to block drawing
// between BeginCommit / Swap. See crbug.com/489515.
if (output_surface_)
output_surface_->ForceReclaimResources(); output_surface_->ForceReclaimResources();
if (settings_.impl_side_painting && !proxy_->CommitToActiveTree()) if (settings_.impl_side_painting && !proxy_->CommitToActiveTree())
......
...@@ -7774,5 +7774,40 @@ TEST_F(LayerTreeHostImplTest, GpuRasterizationStatusModes) { ...@@ -7774,5 +7774,40 @@ TEST_F(LayerTreeHostImplTest, GpuRasterizationStatusModes) {
EXPECT_TRUE(host_impl_->use_gpu_rasterization()); EXPECT_TRUE(host_impl_->use_gpu_rasterization());
} }
// A mock output surface which lets us detect calls to ForceReclaimResources.
class MockReclaimResourcesOutputSurface : public FakeOutputSurface {
public:
static scoped_ptr<MockReclaimResourcesOutputSurface> Create3d() {
return make_scoped_ptr(new MockReclaimResourcesOutputSurface(
TestContextProvider::Create(), TestContextProvider::Create(), false));
}
MOCK_METHOD0(ForceReclaimResources, void());
protected:
MockReclaimResourcesOutputSurface(
scoped_refptr<ContextProvider> context_provider,
scoped_refptr<ContextProvider> worker_context_provider,
bool delegated_rendering)
: FakeOutputSurface(context_provider,
worker_context_provider,
delegated_rendering) {}
};
// Display::Draw (and the planned Display Scheduler) currently rely on resources
// being reclaimed to block drawing between BeginCommit / Swap. This test
// ensures that BeginCommit triggers ForceReclaimResources. See
// crbug.com/489515.
TEST_F(LayerTreeHostImplTest, BeginCommitReclaimsResources) {
scoped_ptr<MockReclaimResourcesOutputSurface> output_surface(
MockReclaimResourcesOutputSurface::Create3d());
// Hold an unowned pointer to the output surface to use for mock expectations.
MockReclaimResourcesOutputSurface* mock_output_surface = output_surface.get();
CreateHostImpl(DefaultSettings(), output_surface.Pass());
EXPECT_CALL(*mock_output_surface, ForceReclaimResources()).Times(1);
host_impl_->BeginCommit();
}
} // namespace } // namespace
} // namespace cc } // namespace cc
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment