From 3ae68c5b8f8d968ad46db4dff4b3fc5b0bcb6be9 Mon Sep 17 00:00:00 2001 From: "jbauman@chromium.org" Date: Fri, 12 Apr 2013 06:10:05 +0000 Subject: Plumb cc::LatencyInfo through command buffer and output surface This allows the LatencyInfo struct to pass from the compositor to the gpu process and up to the browser. It only works completely with the passthrough image transport surface at the moment, because that doesn't require passing data through some extra components. BUG=155367 Review URL: https://chromiumcodereview.appspot.com/12614013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@193864 0039d316-1c4b-4281-b951-d872f2087c98 --- cc/output/compositor_frame_metadata.h | 3 +++ cc/output/gl_renderer.cc | 5 +++-- cc/output/gl_renderer_unittest.cc | 8 ++++---- cc/output/output_surface.cc | 5 +++-- cc/output/output_surface.h | 5 +++-- 5 files changed, 16 insertions(+), 10 deletions(-) (limited to 'cc/output') diff --git a/cc/output/compositor_frame_metadata.h b/cc/output/compositor_frame_metadata.h index 3aedb9e5..55ee9da 100644 --- a/cc/output/compositor_frame_metadata.h +++ b/cc/output/compositor_frame_metadata.h @@ -6,6 +6,7 @@ #define CC_OUTPUT_COMPOSITOR_FRAME_METADATA_H_ #include "cc/base/cc_export.h" +#include "cc/debug/latency_info.h" #include "ui/gfx/size_f.h" #include "ui/gfx/vector2d_f.h" @@ -36,6 +37,8 @@ class CC_EXPORT CompositorFrameMetadata { gfx::Vector2dF location_bar_offset; gfx::Vector2dF location_bar_content_translation; float overdraw_bottom_height; + + LatencyInfo latency_info; }; } // namespace cc diff --git a/cc/output/gl_renderer.cc b/cc/output/gl_renderer.cc index 14b5365..5a70f38 100644 --- a/cc/output/gl_renderer.cc +++ b/cc/output/gl_renderer.cc @@ -1870,9 +1870,10 @@ bool GLRenderer::SwapBuffers() { output_surface_->PostSubBuffer(gfx::Rect(swap_buffer_rect_.x(), flipped_y_pos_of_rect_bottom, swap_buffer_rect_.width(), - swap_buffer_rect_.height())); + swap_buffer_rect_.height()), + LatencyInfo()); } else { - output_surface_->SwapBuffers(); + output_surface_->SwapBuffers(LatencyInfo()); } swap_buffer_rect_ = gfx::Rect(); diff --git a/cc/output/gl_renderer_unittest.cc b/cc/output/gl_renderer_unittest.cc index b8a43e7..2dfdb39 100644 --- a/cc/output/gl_renderer_unittest.cc +++ b/cc/output/gl_renderer_unittest.cc @@ -1288,8 +1288,8 @@ class MockOutputSurface : public OutputSurface { MOCK_METHOD0(DiscardBackbuffer, void()); MOCK_METHOD1(Reshape, void(gfx::Size size)); MOCK_METHOD0(BindFramebuffer, void()); - MOCK_METHOD1(PostSubBuffer, void(gfx::Rect rect)); - MOCK_METHOD0(SwapBuffers, void()); + MOCK_METHOD2(PostSubBuffer, void(gfx::Rect rect, const LatencyInfo&)); + MOCK_METHOD1(SwapBuffers, void(const LatencyInfo&)); }; class MockOutputSurfaceTest : public testing::Test, public FakeRendererClient { @@ -1337,7 +1337,7 @@ class MockOutputSurfaceTest : public testing::Test, public FakeRendererClient { TEST_F(MockOutputSurfaceTest, DrawFrameAndSwap) { DrawFrame(); - EXPECT_CALL(output_surface_, SwapBuffers()).Times(1); + EXPECT_CALL(output_surface_, SwapBuffers(_)).Times(1); renderer_.SwapBuffers(); } @@ -1353,7 +1353,7 @@ class MockOutputSurfaceTestWithPartialSwap : public MockOutputSurfaceTest { TEST_F(MockOutputSurfaceTestWithPartialSwap, DrawFrameAndSwap) { DrawFrame(); - EXPECT_CALL(output_surface_, PostSubBuffer(_)).Times(1); + EXPECT_CALL(output_surface_, PostSubBuffer(_, _)).Times(1); renderer_.SwapBuffers(); } diff --git a/cc/output/output_surface.cc b/cc/output/output_surface.cc index 534b46d..4164402 100644 --- a/cc/output/output_surface.cc +++ b/cc/output/output_surface.cc @@ -95,14 +95,15 @@ void OutputSurface::BindFramebuffer() { context3d_->bindFramebuffer(GL_FRAMEBUFFER, 0); } -void OutputSurface::SwapBuffers() { +void OutputSurface::SwapBuffers(const LatencyInfo& latency_info) { DCHECK(context3d_); // Note that currently this has the same effect as SwapBuffers; we should // consider exposing a different entry point on WebGraphicsContext3D. context3d_->prepareTexture(); } -void OutputSurface::PostSubBuffer(gfx::Rect rect) { +void OutputSurface::PostSubBuffer(gfx::Rect rect, + const LatencyInfo& latency_info) { DCHECK(context3d_); context3d_->postSubBufferCHROMIUM( rect.x(), rect.y(), rect.width(), rect.height()); diff --git a/cc/output/output_surface.h b/cc/output/output_surface.h index e23aaaf..2e7a190 100644 --- a/cc/output/output_surface.h +++ b/cc/output/output_surface.h @@ -20,6 +20,7 @@ namespace cc { class CompositorFrame; class OutputSurfaceClient; +struct LatencyInfo; // Represents the output surface for a compositor. The compositor owns // and manages its destruction. Its lifetime is: @@ -82,8 +83,8 @@ class CC_EXPORT OutputSurface { virtual void BindFramebuffer(); - virtual void PostSubBuffer(gfx::Rect rect); - virtual void SwapBuffers(); + virtual void PostSubBuffer(gfx::Rect rect, const LatencyInfo&); + virtual void SwapBuffers(const LatencyInfo&); // Notifies frame-rate smoothness preference. If true, all non-critical // processing should be stopped, or lowered in priority. -- cgit v1.1