summaryrefslogtreecommitdiffstats
path: root/cc/surfaces
diff options
context:
space:
mode:
authorjbauman <jbauman@chromium.org>2015-12-11 20:13:54 -0800
committerCommit bot <commit-bot@chromium.org>2015-12-12 04:15:11 +0000
commite95e17121740b79c447cb93d0e1d07bbfc407a14 (patch)
tree1dbf9513f7cebac201af5710179b486d7bf9923c /cc/surfaces
parent334f797d5e78ced08399d0125a6de75f08c24e3d (diff)
downloadchromium_src-e95e17121740b79c447cb93d0e1d07bbfc407a14.zip
chromium_src-e95e17121740b79c447cb93d0e1d07bbfc407a14.tar.gz
chromium_src-e95e17121740b79c447cb93d0e1d07bbfc407a14.tar.bz2
Resize output_rect of aggregated CompositorFrame to enable it to be drawn when resizing.
It's possible for the browser compositor to get at least one frame behind the resizes that come from Windows so the Surface that it creates is never the right size to be swapped to screen. In this case, resize the aggregated frame so that the it fills the backbuffer. This allows it to be drawn, even if there may be a resize gutter or clipping around it. BUG= CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel Review URL: https://codereview.chromium.org/1426453006 Cr-Commit-Position: refs/heads/master@{#364897}
Diffstat (limited to 'cc/surfaces')
-rw-r--r--cc/surfaces/display.cc16
-rw-r--r--cc/surfaces/display_unittest.cc24
2 files changed, 36 insertions, 4 deletions
diff --git a/cc/surfaces/display.cc b/cc/surfaces/display.cc
index 2cdcfcd..3eebfde 100644
--- a/cc/surfaces/display.cc
+++ b/cc/surfaces/display.cc
@@ -219,14 +219,22 @@ bool Display::DrawAndSwap() {
gfx::Size surface_size;
bool have_damage = false;
if (!frame_data->render_pass_list.empty()) {
- surface_size = frame_data->render_pass_list.back()->output_rect.size();
- have_damage =
- !frame_data->render_pass_list.back()->damage_rect.size().IsEmpty();
+ RenderPass& last_render_pass = *frame_data->render_pass_list.back();
+ if (last_render_pass.output_rect.size() != current_surface_size_ &&
+ last_render_pass.damage_rect == last_render_pass.output_rect &&
+ !current_surface_size_.IsEmpty()) {
+ // Resize the output rect to the current surface size so that we won't
+ // skip the draw and so that the GL swap won't stretch the output.
+ last_render_pass.output_rect.set_size(current_surface_size_);
+ last_render_pass.damage_rect = last_render_pass.output_rect;
+ }
+ surface_size = last_render_pass.output_rect.size();
+ have_damage = !last_render_pass.damage_rect.size().IsEmpty();
}
bool size_matches = surface_size == current_surface_size_;
if (!size_matches)
- TRACE_EVENT_INSTANT0("cc", "Size missmatch.", TRACE_EVENT_SCOPE_THREAD);
+ TRACE_EVENT_INSTANT0("cc", "Size mismatch.", TRACE_EVENT_SCOPE_THREAD);
bool should_draw = !frame->metadata.latency_info.empty() ||
have_copy_requests || (have_damage && size_matches);
diff --git a/cc/surfaces/display_unittest.cc b/cc/surfaces/display_unittest.cc
index a92496c..c699349 100644
--- a/cc/surfaces/display_unittest.cc
+++ b/cc/surfaces/display_unittest.cc
@@ -396,6 +396,30 @@ TEST_F(DisplayTest, DisplayDamaged) {
EXPECT_EQ(6u, output_surface_ptr_->num_sent_frames());
}
+ {
+ // Surface that's damaged completely should be resized and swapped.
+ pass = RenderPass::Create();
+ pass->output_rect = gfx::Rect(0, 0, 99, 99);
+ pass->damage_rect = gfx::Rect(0, 0, 99, 99);
+ pass->id = RenderPassId(1, 1);
+
+ pass_list.push_back(pass.Pass());
+ scheduler.ResetDamageForTest();
+ SubmitCompositorFrame(&pass_list, surface_id);
+ EXPECT_TRUE(scheduler.damaged);
+ EXPECT_FALSE(scheduler.display_resized_);
+ EXPECT_FALSE(scheduler.has_new_root_surface);
+
+ scheduler.swapped = false;
+ display.DrawAndSwap();
+ EXPECT_TRUE(scheduler.swapped);
+ EXPECT_EQ(7u, output_surface_ptr_->num_sent_frames());
+ EXPECT_EQ(gfx::Size(100, 100),
+ software_output_device_->viewport_pixel_size());
+ EXPECT_EQ(gfx::Rect(0, 0, 100, 100),
+ software_output_device_->damage_rect());
+ }
+
factory_.Destroy(surface_id);
}