summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cc/output/direct_renderer.cc5
-rw-r--r--cc/output/gl_renderer.cc2
-rw-r--r--cc/output/gl_renderer_unittest.cc3
-rw-r--r--cc/output/renderer.h1
-rw-r--r--cc/output/software_renderer_unittest.cc3
-rw-r--r--cc/test/pixel_test.cc3
-rw-r--r--cc/trees/damage_tracker.cc8
-rw-r--r--cc/trees/layer_tree_host_impl.cc7
-rw-r--r--cc/trees/layer_tree_host_impl.h1
-rw-r--r--cc/trees/layer_tree_host_impl_unittest.cc3
10 files changed, 33 insertions, 3 deletions
diff --git a/cc/output/direct_renderer.cc b/cc/output/direct_renderer.cc
index 0789c29..ae8ff9b 100644
--- a/cc/output/direct_renderer.cc
+++ b/cc/output/direct_renderer.cc
@@ -188,7 +188,7 @@ void DirectRenderer::DrawFrame(RenderPassList* render_passes_in_draw_order) {
DrawingFrame frame;
frame.root_render_pass = root_render_pass;
frame.root_damage_rect =
- Capabilities().using_partial_swap ?
+ Capabilities().using_partial_swap && client_->AllowPartialSwap() ?
root_render_pass->damage_rect : root_render_pass->output_rect;
frame.root_damage_rect.Intersect(gfx::Rect(ViewportSize()));
@@ -257,7 +257,8 @@ void DirectRenderer::DrawRenderPass(DrawingFrame* frame,
if (!UseRenderPass(frame, render_pass))
return;
- bool using_scissor_as_optimization = Capabilities().using_partial_swap;
+ bool using_scissor_as_optimization =
+ Capabilities().using_partial_swap && client_->AllowPartialSwap();
gfx::RectF render_pass_scissor;
if (using_scissor_as_optimization) {
diff --git a/cc/output/gl_renderer.cc b/cc/output/gl_renderer.cc
index eaeb31d..8653a11 100644
--- a/cc/output/gl_renderer.cc
+++ b/cc/output/gl_renderer.cc
@@ -1861,7 +1861,7 @@ bool GLRenderer::SwapBuffers() {
TRACE_EVENT0("cc", "GLRenderer::SwapBuffers");
// We're done! Time to swapbuffers!
- if (capabilities_.using_partial_swap) {
+ if (capabilities_.using_partial_swap && client_->AllowPartialSwap()) {
// If supported, we can save significant bandwidth by only swapping the
// damaged/scissored region (clamped to the viewport)
swap_buffer_rect_.Intersect(gfx::Rect(ViewportSize()));
diff --git a/cc/output/gl_renderer_unittest.cc b/cc/output/gl_renderer_unittest.cc
index 30ba585..b8a43e7 100644
--- a/cc/output/gl_renderer_unittest.cc
+++ b/cc/output/gl_renderer_unittest.cc
@@ -184,6 +184,9 @@ class FakeRendererClient : public RendererClient {
virtual CompositorFrameMetadata MakeCompositorFrameMetadata() const OVERRIDE {
return CompositorFrameMetadata();
}
+ virtual bool AllowPartialSwap() const OVERRIDE {
+ return true;
+ }
// Methods added for test.
int set_full_root_layer_damage_count() const {
diff --git a/cc/output/renderer.h b/cc/output/renderer.h
index b2dd42c..3d26407 100644
--- a/cc/output/renderer.h
+++ b/cc/output/renderer.h
@@ -30,6 +30,7 @@ class CC_EXPORT RendererClient {
virtual bool HasImplThread() const = 0;
virtual bool ShouldClearRootRenderPass() const = 0;
virtual CompositorFrameMetadata MakeCompositorFrameMetadata() const = 0;
+ virtual bool AllowPartialSwap() const = 0;
protected:
virtual ~RendererClient() {}
diff --git a/cc/output/software_renderer_unittest.cc b/cc/output/software_renderer_unittest.cc
index fc5ba6d..127ad3e 100644
--- a/cc/output/software_renderer_unittest.cc
+++ b/cc/output/software_renderer_unittest.cc
@@ -69,6 +69,9 @@ class SoftwareRendererTest : public testing::Test, public RendererClient {
virtual CompositorFrameMetadata MakeCompositorFrameMetadata() const OVERRIDE {
return CompositorFrameMetadata();
}
+ virtual bool AllowPartialSwap() const OVERRIDE {
+ return true;
+ }
protected:
scoped_ptr<FakeOutputSurface> output_surface_;
diff --git a/cc/test/pixel_test.cc b/cc/test/pixel_test.cc
index abd5a2d..7d03606 100644
--- a/cc/test/pixel_test.cc
+++ b/cc/test/pixel_test.cc
@@ -43,6 +43,9 @@ class PixelTest::PixelTestRendererClient : public RendererClient {
OVERRIDE {
return CompositorFrameMetadata();
}
+ virtual bool AllowPartialSwap() const OVERRIDE {
+ return true;
+ }
private:
gfx::Size device_viewport_size_;
diff --git a/cc/trees/damage_tracker.cc b/cc/trees/damage_tracker.cc
index 5138e6f..94ab9fa 100644
--- a/cc/trees/damage_tracker.cc
+++ b/cc/trees/damage_tracker.cc
@@ -7,9 +7,11 @@
#include <algorithm>
#include "cc/base/math_util.h"
+#include "cc/layers/heads_up_display_layer_impl.h"
#include "cc/layers/layer_impl.h"
#include "cc/layers/render_surface_impl.h"
#include "cc/trees/layer_tree_host_common.h"
+#include "cc/trees/layer_tree_impl.h"
#include "third_party/WebKit/Source/Platform/chromium/public/WebFilterOperations.h"
namespace cc {
@@ -192,6 +194,12 @@ gfx::RectF DamageTracker::TrackDamageFromActiveLayers(
// Visit layers in back-to-front order.
LayerImpl* layer = layer_list[layer_index];
+ // We skip damage from the HUD layer because (a) the HUD layer damages the
+ // whole frame and (b) we don't want HUD layer damage to be shown by the
+ // HUD damage rect visualization.
+ if (layer == layer->layer_tree_impl()->hud_layer())
+ continue;
+
if (LayerTreeHostCommon::RenderSurfaceContributesToTarget<LayerImpl>(
layer, target_surface_layer_id))
ExtendDamageForRenderSurface(layer, &damage_rect);
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc
index d751441..d38df8b 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -979,6 +979,13 @@ CompositorFrameMetadata LayerTreeHostImpl::MakeCompositorFrameMetadata() const {
return metadata;
}
+bool LayerTreeHostImpl::AllowPartialSwap() const {
+ // We don't track damage on the HUD layer (it interacts with damage tracking
+ // visualizations), so disable partial swaps to make the HUD layer display
+ // properly.
+ return !debug_state_.ShowHudRects();
+}
+
void LayerTreeHostImpl::DrawLayers(FrameData* frame,
base::TimeTicks frame_begin_time) {
TRACE_EVENT0("cc", "LayerTreeHostImpl::DrawLayers");
diff --git a/cc/trees/layer_tree_host_impl.h b/cc/trees/layer_tree_host_impl.h
index 520fc90..ef0c41e 100644
--- a/cc/trees/layer_tree_host_impl.h
+++ b/cc/trees/layer_tree_host_impl.h
@@ -174,6 +174,7 @@ class CC_EXPORT LayerTreeHostImpl : public InputHandlerClient,
virtual bool HasImplThread() const OVERRIDE;
virtual bool ShouldClearRootRenderPass() const OVERRIDE;
virtual CompositorFrameMetadata MakeCompositorFrameMetadata() const OVERRIDE;
+ virtual bool AllowPartialSwap() const OVERRIDE;
// TileManagerClient implementation.
virtual void ScheduleManageTiles() OVERRIDE;
diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc
index 5dc4581..40d0ced 100644
--- a/cc/trees/layer_tree_host_impl_unittest.cc
+++ b/cc/trees/layer_tree_host_impl_unittest.cc
@@ -4271,6 +4271,9 @@ class TestRenderer : public GLRenderer, public RendererClient {
virtual bool ShouldClearRootRenderPass() const OVERRIDE { return true; }
virtual CompositorFrameMetadata MakeCompositorFrameMetadata() const
OVERRIDE { return CompositorFrameMetadata(); }
+ virtual bool AllowPartialSwap() const OVERRIDE {
+ return true;
+ }
protected:
TestRenderer(ResourceProvider* resource_provider,