summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcpu@chromium.org <cpu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-06 00:03:20 +0000
committercpu@chromium.org <cpu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-06 00:03:20 +0000
commit8d9080abab79f5223c55ffef492213ff2e23abca (patch)
tree7ea9cc1ada42ca1f4462620a2725b2dd4c3b55e9
parentc97fb87e1853d025e062fd00cc59ef814b7d8cd7 (diff)
downloadchromium_src-8d9080abab79f5223c55ffef492213ff2e23abca.zip
chromium_src-8d9080abab79f5223c55ffef492213ff2e23abca.tar.gz
chromium_src-8d9080abab79f5223c55ffef492213ff2e23abca.tar.bz2
Fix large mis-paint when resizing windows aura chrome
See bug attached for screenshots The CL does two things: - Disables the resizer lock, so that UI bits can go ahead of content bits - Janks (blocks) the UI thread until the compositor has flushed / finished the pending commands. This makes the mis-draw way less, up to one frame behind, which at my regular mouse speed of 1.2 pixels / ms comes out to 20 pixels of whiteout. BUG=177115 TEST=none Review URL: https://codereview.chromium.org/13604007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@192657 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--content/browser/renderer_host/render_widget_host_view_aura.cc9
-rwxr-xr-xgpu/command_buffer/build_gles2_cmd_buffer.py1
-rw-r--r--gpu/command_buffer/client/gles2_implementation_unittest_autogen.h2
-rw-r--r--gpu/command_buffer/common/gles2_cmd_utils_implementation_autogen.h13
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder_autogen.h2
-rw-r--r--ui/compositor/compositor.cc15
-rw-r--r--ui/compositor/compositor.h2
7 files changed, 38 insertions, 6 deletions
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc
index 443eee9..adc258a 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura.cc
+++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -771,6 +771,14 @@ void RenderWidgetHostViewAura::SetBounds(const gfx::Rect& rect) {
if (!compositor->HasObserver(this))
compositor->AddObserver(this);
+// On Windows while resizing, the the resize locks makes us mis-paint a white
+// vertical strip (including the non-client area) if the content composition is
+// lagging the UI composition. So here we disable the throttling so that the UI
+// bits can draw ahead of the content thereby reducing the amount of whiteout.
+// Because this causes the content to be drawn at wrong sizes while resizing
+// we compensate by blocking the UI thread in Compositor::Draw() by issuing a
+// FinishAllRendering() if we are resizing.
+#if !defined (OS_WIN)
bool defer_compositor_lock =
can_lock_compositor_ == NO_PENDING_RENDERER_FRAME ||
can_lock_compositor_ == NO_PENDING_COMMIT;
@@ -780,6 +788,7 @@ void RenderWidgetHostViewAura::SetBounds(const gfx::Rect& rect) {
resize_locks_.push_back(make_linked_ptr(
new ResizeLock(root_window, rect.size(), defer_compositor_lock)));
+#endif
}
}
window_->SetBounds(rect);
diff --git a/gpu/command_buffer/build_gles2_cmd_buffer.py b/gpu/command_buffer/build_gles2_cmd_buffer.py
index 9f472a1..6d79673 100755
--- a/gpu/command_buffer/build_gles2_cmd_buffer.py
+++ b/gpu/command_buffer/build_gles2_cmd_buffer.py
@@ -1457,6 +1457,7 @@ _FUNCTION_INFO = {
'impl_func': False,
'client_test': False,
'decoder_func': 'DoFinish',
+ 'defer_reads': True,
},
'Flush': {
'impl_func': False,
diff --git a/gpu/command_buffer/client/gles2_implementation_unittest_autogen.h b/gpu/command_buffer/client/gles2_implementation_unittest_autogen.h
index 92b2e23..b28a051 100644
--- a/gpu/command_buffer/client/gles2_implementation_unittest_autogen.h
+++ b/gpu/command_buffer/client/gles2_implementation_unittest_autogen.h
@@ -662,8 +662,8 @@ TEST_F(GLES2ImplementationTest, GetShaderiv) {
EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
EXPECT_EQ(static_cast<Result::Type>(1), result);
}
-
// TODO: Implement unit test for GetShaderInfoLog
+// TODO: Implement unit test for GetShaderPrecisionFormat
TEST_F(GLES2ImplementationTest, GetTexParameterfv) {
struct Cmds {
diff --git a/gpu/command_buffer/common/gles2_cmd_utils_implementation_autogen.h b/gpu/command_buffer/common/gles2_cmd_utils_implementation_autogen.h
index 9e4c660..7a2147b 100644
--- a/gpu/command_buffer/common/gles2_cmd_utils_implementation_autogen.h
+++ b/gpu/command_buffer/common/gles2_cmd_utils_implementation_autogen.h
@@ -10,10 +10,12 @@
#define GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_UTILS_IMPLEMENTATION_AUTOGEN_H_
static GLES2Util::EnumToString enum_to_string_table[] = {
+ { 0x78EC, "GL_PIXEL_UNPACK_TRANSFER_BUFFER_CHROMIUM", },
{ 0x8825, "GL_DRAW_BUFFER0_NV", },
{ 0x0BC1, "GL_ALPHA_TEST_FUNC_QCOM", },
{ 0x884C, "GL_TEXTURE_COMPARE_MODE_EXT", },
{ 0x0BC2, "GL_ALPHA_TEST_REF_QCOM", },
+ { 0x78EF, "GL_PIXEL_UNPACK_TRANSFER_BUFFER_BINDING_CHROMIUM", },
{ 0x884D, "GL_TEXTURE_COMPARE_FUNC_EXT", },
{ 0x884E, "GL_COMPARE_REF_TO_TEXTURE_EXT", },
{ 0x93A1, "GL_BGRA8_EXT", },
@@ -89,7 +91,6 @@ static GLES2Util::EnumToString enum_to_string_table[] = {
{ 0x0C10, "GL_SCISSOR_BOX", },
{ 0x0C11, "GL_SCISSOR_TEST", },
{ 0x80000000, "GL_MULTISAMPLE_BUFFER_BIT7_QCOM", },
- { 0x300E, "GL_CONTEXT_LOST", },
{ 0x02000000, "GL_MULTISAMPLE_BUFFER_BIT1_QCOM", },
{ 0x8C2F, "GL_ANY_SAMPLES_PASSED_EXT", },
{ 0x8BD2, "GL_TEXTURE_WIDTH_QCOM", },
@@ -258,7 +259,7 @@ static GLES2Util::EnumToString enum_to_string_table[] = {
{ 0x00000400, "GL_STENCIL_BUFFER_BIT", },
{ 0x800A, "GL_FUNC_SUBTRACT", },
{ 0x8E2C, "GL_DEPTH_COMPONENT16_NONLINEAR_NV", },
- { 0x889F, "GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING", },
+ { 0x8508, "GL_DECR_WRAP", },
{ 0x8219, "GL_FRAMEBUFFER_UNDEFINED_OES", },
{ 0x8006, "GL_FUNC_ADD", },
{ 0x8007, "GL_MIN_EXT", },
@@ -552,7 +553,6 @@ static GLES2Util::EnumToString enum_to_string_table[] = {
{ 0x80C9, "GL_BLEND_SRC_RGB", },
{ 0x80C8, "GL_BLEND_DST_RGB", },
{ 0x0504, "GL_STACK_UNDERFLOW", },
- { 0x88EC, "GL_PIXEL_UNPACK_TRANSFER_BUFFER_CHROMIUM", },
{ 0x8059, "GL_RGB10_A2_EXT", },
{ 0x8058, "GL_RGBA8_OES", },
{ 0x00002000, "GL_DEPTH_BUFFER_BIT5_QCOM", },
@@ -561,8 +561,11 @@ static GLES2Util::EnumToString enum_to_string_table[] = {
{ 0x8CAB, "GL_RENDERBUFFER_SAMPLES_ANGLE", },
{ 0x8057, "GL_RGB5_A1", },
{ 0x8056, "GL_RGBA4", },
+ { 0x300E, "GL_CONTEXT_LOST", },
{ 0x150A, "GL_INVERT", },
{ 0x01000000, "GL_MULTISAMPLE_BUFFER_BIT0_QCOM", },
+ { 0x78ED, "GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM", },
+ { 0x78EE, "GL_PIXEL_PACK_TRANSFER_BUFFER_BINDING_CHROMIUM", },
{ 0x8269, "GL_DEBUG_TYPE_PUSH_GROUP", },
{ 0x0B45, "GL_CULL_FACE_MODE", },
{ 0x00100000, "GL_STENCIL_BUFFER_BIT4_QCOM", },
@@ -591,7 +594,7 @@ static GLES2Util::EnumToString enum_to_string_table[] = {
{ 0x8253, "GL_GUILTY_CONTEXT_RESET_EXT", },
{ 0x8CE5, "GL_COLOR_ATTACHMENT5_NV", },
{ 0x8872, "GL_MAX_TEXTURE_IMAGE_UNITS", },
- { 0x8508, "GL_DECR_WRAP", },
+ { 0x889F, "GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING", },
{ 0x8507, "GL_INCR_WRAP", },
{ 0x8895, "GL_ELEMENT_ARRAY_BUFFER_BINDING", },
{ 0x8894, "GL_ARRAY_BUFFER_BINDING", },
@@ -630,13 +633,13 @@ static GLES2Util::EnumToString enum_to_string_table[] = {
{ 0x8829, "GL_DRAW_BUFFER4_NV", },
{ 0x0404, "GL_FRONT", },
{ 0x0405, "GL_BACK", },
+ { 0x88E1, "GL_STREAM_READ", },
{ 0x88E0, "GL_STREAM_DRAW", },
{ 0x88E4, "GL_STATIC_DRAW", },
{ 0x88E8, "GL_DYNAMIC_DRAW", },
{ 0x8CAA, "GL_READ_FRAMEBUFFER_BINDING_ANGLE", },
{ 0x40000000, "GL_MULTISAMPLE_BUFFER_BIT6_QCOM", },
{ 0x9116, "GL_SYNC_FENCE_APPLE", },
- { 0x88EF, "GL_PIXEL_UNPACK_TRANSFER_BUFFER_BINDING_CHROMIUM", },
{ 0x6000, "GL_TEXTURE_POOL_CHROMIUM", },
{ 0x00000800, "GL_DEPTH_BUFFER_BIT3_QCOM", },
{ 0x1903, "GL_RED_EXT", },
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_autogen.h b/gpu/command_buffer/service/gles2_cmd_decoder_autogen.h
index 6ea12d8..bf9efeb 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder_autogen.h
+++ b/gpu/command_buffer/service/gles2_cmd_decoder_autogen.h
@@ -739,6 +739,8 @@ error::Error GLES2DecoderImpl::HandleEnableVertexAttribArray(
error::Error GLES2DecoderImpl::HandleFinish(
uint32 immediate_data_size, const gles2::cmds::Finish& c) {
+ if (ShouldDeferReads())
+ return error::kDeferCommandUntilLater;
DoFinish();
return error::kNoError;
}
diff --git a/ui/compositor/compositor.cc b/ui/compositor/compositor.cc
index 92b52da..630f046 100644
--- a/ui/compositor/compositor.cc
+++ b/ui/compositor/compositor.cc
@@ -410,6 +410,7 @@ Compositor::Compositor(CompositorDelegate* delegate,
device_scale_factor_(0.0f),
last_started_frame_(0),
last_ended_frame_(0),
+ next_draw_is_resize_(false),
disable_schedule_composite_(false),
compositor_lock_(NULL) {
root_web_layer_ = cc::Layer::Create();
@@ -527,6 +528,18 @@ void Compositor::Draw(bool force_clear) {
// compositeImmediately() directly.
Layout();
host_->Composite(base::TimeTicks::Now());
+
+#if defined(OS_WIN)
+ // While we resize, we are usually a few frames behind. By blocking
+ // the UI thread here we minize the area that is mis-painted, specially
+ // in the non-client area. See RenderWidgetHostViewAura::SetBounds for
+ // more details and bug 177115.
+ if (next_draw_is_resize_ && (last_ended_frame_ > 1)) {
+ next_draw_is_resize_ = false;
+ host_->FinishAllRendering();
+ }
+#endif
+
}
if (!pending_swap.posted())
NotifyEnd();
@@ -557,6 +570,8 @@ void Compositor::SetScaleAndSize(float scale, const gfx::Size& size_in_pixel) {
size_ = size_in_pixel;
host_->SetViewportSize(size_in_pixel, size_in_pixel);
root_web_layer_->SetBounds(size_in_pixel);
+
+ next_draw_is_resize_ = true;
}
if (device_scale_factor_ != scale) {
device_scale_factor_ = scale;
diff --git a/ui/compositor/compositor.h b/ui/compositor/compositor.h
index 412faf3..187cdce 100644
--- a/ui/compositor/compositor.h
+++ b/ui/compositor/compositor.h
@@ -359,6 +359,8 @@ class COMPOSITOR_EXPORT Compositor
int last_started_frame_;
int last_ended_frame_;
+ bool next_draw_is_resize_;
+
bool disable_schedule_composite_;
CompositorLock* compositor_lock_;