diff options
author | miletus@chromium.org <miletus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-16 18:25:44 +0000 |
---|---|---|
committer | miletus@chromium.org <miletus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-16 18:25:44 +0000 |
commit | 030d4c5068925f73b85a29c29875dcbbfcdb6f9d (patch) | |
tree | 78f21b44f51907e0dd8b98e498828ae33c83fa62 /content/common | |
parent | 326b71ab656d94ffa8517de3c525dcc79404a920 (diff) | |
download | chromium_src-030d4c5068925f73b85a29c29875dcbbfcdb6f9d.zip chromium_src-030d4c5068925f73b85a29c29875dcbbfcdb6f9d.tar.gz chromium_src-030d4c5068925f73b85a29c29875dcbbfcdb6f9d.tar.bz2 |
Remove gpu side LatencyInfo merging
This CL removes the LatecyInfo merging from the following path:
Compsitor to GPU:
CommandBufferProxyImpl::SetLatencyInfo()
-> (GpuCommandBufferMsg_SetLatencyInfo)
-> GpuCommandBufferStub::OnSetLatencyInfo()
-> ImageTransportHelper::SetLatencyInfo()
-> XXXImageTransportSurface:SetLatencyInfo()
After swap buffers:
XXXImageTransportSurface::SwapBuffers()
-> (GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params/
GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params/
GpuHostMsg_FrameDrawn)
-> RenderWidgetHostView
BUG=246034
TEST=unittests pass.
Tested on Pixel. chrome://tracing shows correct InputLatency tracking for
various inputs.
Review URL: https://codereview.chromium.org/123563002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@245260 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/common')
-rw-r--r-- | content/common/gpu/client/command_buffer_proxy_impl.cc | 8 | ||||
-rw-r--r-- | content/common/gpu/gpu_command_buffer_stub.cc | 5 | ||||
-rw-r--r-- | content/common/gpu/gpu_command_buffer_stub.h | 4 | ||||
-rw-r--r-- | content/common/gpu/gpu_messages.h | 8 | ||||
-rw-r--r-- | content/common/gpu/image_transport_surface.cc | 29 | ||||
-rw-r--r-- | content/common/gpu/image_transport_surface.h | 10 | ||||
-rw-r--r-- | content/common/gpu/image_transport_surface_mac.cc | 14 | ||||
-rw-r--r-- | content/common/gpu/image_transport_surface_win.cc | 11 | ||||
-rw-r--r-- | content/common/gpu/texture_image_transport_surface.cc | 9 | ||||
-rw-r--r-- | content/common/gpu/texture_image_transport_surface.h | 4 | ||||
-rw-r--r-- | content/common/view_messages.h | 2 |
11 files changed, 56 insertions, 48 deletions
diff --git a/content/common/gpu/client/command_buffer_proxy_impl.cc b/content/common/gpu/client/command_buffer_proxy_impl.cc index 70e070f..0d31a91 100644 --- a/content/common/gpu/client/command_buffer_proxy_impl.cc +++ b/content/common/gpu/client/command_buffer_proxy_impl.cc @@ -215,13 +215,7 @@ void CommandBufferProxyImpl::SetLatencyInfo( const std::vector<ui::LatencyInfo>& latency_info) { if (last_state_.error != gpu::error::kNoError) return; - // TODO(miletus) : Pass the std::vector<ui::LatencyInfo> latency_info - // directly without merging once GpuCommandBufferMsg_SetLatencyInfo - // is converted to contain std::vector<ui::LatencyInfo>. - ui::LatencyInfo merged_latency; - for (size_t i = 0; i < latency_info.size(); i++) - merged_latency.MergeWith(latency_info[i]); - Send(new GpuCommandBufferMsg_SetLatencyInfo(route_id_, merged_latency)); + Send(new GpuCommandBufferMsg_SetLatencyInfo(route_id_, latency_info)); } gpu::CommandBuffer::State CommandBufferProxyImpl::FlushSync( diff --git a/content/common/gpu/gpu_command_buffer_stub.cc b/content/common/gpu/gpu_command_buffer_stub.cc index 181edc5..7716d62 100644 --- a/content/common/gpu/gpu_command_buffer_stub.cc +++ b/content/common/gpu/gpu_command_buffer_stub.cc @@ -567,7 +567,10 @@ void GpuCommandBufferStub::OnInitialize( } void GpuCommandBufferStub::OnSetLatencyInfo( - const ui::LatencyInfo& latency_info) { + const std::vector<ui::LatencyInfo>& latency_info) { + if (!ui::LatencyInfo::Verify(latency_info, + "GpuCommandBufferStub::OnSetLatencyInfo")) + return; if (!latency_info_callback_.is_null()) latency_info_callback_.Run(latency_info); } diff --git a/content/common/gpu/gpu_command_buffer_stub.h b/content/common/gpu/gpu_command_buffer_stub.h index 247329e..4539f6a 100644 --- a/content/common/gpu/gpu_command_buffer_stub.h +++ b/content/common/gpu/gpu_command_buffer_stub.h @@ -61,7 +61,7 @@ class GpuCommandBufferStub virtual ~DestructionObserver() {} }; - typedef base::Callback<void(const ui::LatencyInfo&)> + typedef base::Callback<void(const std::vector<ui::LatencyInfo>&)> LatencyInfoCallback; GpuCommandBufferStub( @@ -196,7 +196,7 @@ class GpuCommandBufferStub void OnCommandProcessed(); void OnParseError(); - void OnSetLatencyInfo(const ui::LatencyInfo& latency_info); + void OnSetLatencyInfo(const std::vector<ui::LatencyInfo>& latency_info); void ReportState(); diff --git a/content/common/gpu/gpu_messages.h b/content/common/gpu/gpu_messages.h index 9e25bc9..5bf75c1 100644 --- a/content/common/gpu/gpu_messages.h +++ b/content/common/gpu/gpu_messages.h @@ -55,7 +55,7 @@ IPC_STRUCT_BEGIN(GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params) IPC_STRUCT_MEMBER(std::string, mailbox_name) IPC_STRUCT_MEMBER(gfx::Size, size) IPC_STRUCT_MEMBER(float, scale_factor) - IPC_STRUCT_MEMBER(ui::LatencyInfo, latency_info) + IPC_STRUCT_MEMBER(std::vector<ui::LatencyInfo>, latency_info) IPC_STRUCT_END() IPC_STRUCT_BEGIN(GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params) @@ -69,7 +69,7 @@ IPC_STRUCT_BEGIN(GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params) IPC_STRUCT_MEMBER(std::string, mailbox_name) IPC_STRUCT_MEMBER(gfx::Size, surface_size) IPC_STRUCT_MEMBER(float, surface_scale_factor) - IPC_STRUCT_MEMBER(ui::LatencyInfo, latency_info) + IPC_STRUCT_MEMBER(std::vector<ui::LatencyInfo>, latency_info) IPC_STRUCT_END() #undef IPC_MESSAGE_EXPORT #define IPC_MESSAGE_EXPORT @@ -402,7 +402,7 @@ IPC_MESSAGE_CONTROL2(GpuHostMsg_AcceleratedSurfaceInitialized, // Tells the browser that a frame with the specific latency info was drawn to // the screen IPC_MESSAGE_CONTROL1(GpuHostMsg_FrameDrawn, - ui::LatencyInfo /* latency_info */) + std::vector<ui::LatencyInfo> /* latency_info */) // Same as above with a rect of the part of the surface that changed. IPC_MESSAGE_CONTROL1(GpuHostMsg_AcceleratedSurfaceBuffersSwapped, @@ -566,7 +566,7 @@ IPC_MESSAGE_ROUTED2(GpuCommandBufferMsg_AsyncFlush, // Sends information about the latency of the current frame to the GPU // process. IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_SetLatencyInfo, - ui::LatencyInfo /* latency_info */) + std::vector<ui::LatencyInfo> /* latency_info */) // Asynchronously process any commands known to the GPU process. This is only // used in the event that a channel is unscheduled and needs to be flushed diff --git a/content/common/gpu/image_transport_surface.cc b/content/common/gpu/image_transport_surface.cc index 4ce6f40..91ab8dd 100644 --- a/content/common/gpu/image_transport_surface.cc +++ b/content/common/gpu/image_transport_surface.cc @@ -55,7 +55,7 @@ ImageTransportHelper::ImageTransportHelper(ImageTransportSurface* surface, ImageTransportHelper::~ImageTransportHelper() { if (stub_.get()) { stub_->SetLatencyInfoCallback( - base::Callback<void(const ui::LatencyInfo&)>()); + base::Callback<void(const std::vector<ui::LatencyInfo>&)>()); } manager_->RemoveRoute(route_id_); } @@ -132,7 +132,7 @@ void ImageTransportHelper::SendUpdateVSyncParameters( } void ImageTransportHelper::SendLatencyInfo( - const ui::LatencyInfo& latency_info) { + const std::vector<ui::LatencyInfo>& latency_info) { manager_->Send(new GpuHostMsg_FrameDrawn(latency_info)); } @@ -209,7 +209,7 @@ void ImageTransportHelper::Resize(gfx::Size size, float scale_factor) { } void ImageTransportHelper::SetLatencyInfo( - const ui::LatencyInfo& latency_info) { + const std::vector<ui::LatencyInfo>& latency_info) { surface_->SetLatencyInfo(latency_info); } @@ -250,8 +250,9 @@ bool PassThroughImageTransportSurface::DeferDraws() { } void PassThroughImageTransportSurface::SetLatencyInfo( - const ui::LatencyInfo& latency_info) { - latency_info_ = latency_info; + const std::vector<ui::LatencyInfo>& latency_info) { + for (size_t i = 0; i < latency_info.size(); i++) + latency_info_.push_back(latency_info[i]); } bool PassThroughImageTransportSurface::SwapBuffers() { @@ -259,8 +260,10 @@ bool PassThroughImageTransportSurface::SwapBuffers() { // crbug.com/223558. SendVSyncUpdateIfAvailable(); bool result = gfx::GLSurfaceAdapter::SwapBuffers(); - latency_info_.AddLatencyNumber( - ui::INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, 0, 0); + for (size_t i = 0; i < latency_info_.size(); i++) { + latency_info_[i].AddLatencyNumber( + ui::INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, 0, 0); + } if (transport_) { DCHECK(!is_swap_buffers_pending_); @@ -270,12 +273,13 @@ bool PassThroughImageTransportSurface::SwapBuffers() { // SwapBuffers message. GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params; params.surface_handle = 0; - params.latency_info = latency_info_; + params.latency_info.swap(latency_info_); params.size = surface()->GetSize(); helper_->SendAcceleratedSurfaceBuffersSwapped(params); } else { helper_->SendLatencyInfo(latency_info_); } + latency_info_.clear(); return result; } @@ -283,8 +287,10 @@ bool PassThroughImageTransportSurface::PostSubBuffer( int x, int y, int width, int height) { SendVSyncUpdateIfAvailable(); bool result = gfx::GLSurfaceAdapter::PostSubBuffer(x, y, width, height); - latency_info_.AddLatencyNumber( - ui::INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, 0, 0); + for (size_t i = 0; i < latency_info_.size(); i++) { + latency_info_[i].AddLatencyNumber( + ui::INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, 0, 0); + } if (transport_) { DCHECK(!is_swap_buffers_pending_); @@ -294,7 +300,7 @@ bool PassThroughImageTransportSurface::PostSubBuffer( // PostSubBuffer message. GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params params; params.surface_handle = 0; - params.latency_info = latency_info_; + params.latency_info.swap(latency_info_); params.surface_size = surface()->GetSize(); params.x = x; params.y = y; @@ -306,6 +312,7 @@ bool PassThroughImageTransportSurface::PostSubBuffer( } else { helper_->SendLatencyInfo(latency_info_); } + latency_info_.clear(); return result; } diff --git a/content/common/gpu/image_transport_surface.h b/content/common/gpu/image_transport_surface.h index 0bad48c..40c258f 100644 --- a/content/common/gpu/image_transport_surface.h +++ b/content/common/gpu/image_transport_surface.h @@ -63,7 +63,7 @@ class ImageTransportSurface { virtual void OnResizeViewACK() = 0; virtual void OnResize(gfx::Size size, float scale_factor) = 0; virtual void SetLatencyInfo( - const ui::LatencyInfo& latency_info) = 0; + const std::vector<ui::LatencyInfo>& latency_info) = 0; virtual void WakeUpGpu() = 0; // Creates a surface with the given attributes. @@ -125,7 +125,7 @@ class ImageTransportHelper void SendUpdateVSyncParameters( base::TimeTicks timebase, base::TimeDelta interval); - void SendLatencyInfo(const ui::LatencyInfo& latency_info); + void SendLatencyInfo(const std::vector<ui::LatencyInfo>& latency_info); // Whether or not we should execute more commands. void SetScheduled(bool is_scheduled); @@ -159,7 +159,7 @@ class ImageTransportHelper // Backbuffer resize callback. void Resize(gfx::Size size, float scale_factor); - void SetLatencyInfo(const ui::LatencyInfo& latency_info); + void SetLatencyInfo(const std::vector<ui::LatencyInfo>& latency_info); // Weak pointers that point to objects that outlive this helper. ImageTransportSurface* surface_; @@ -198,7 +198,7 @@ class PassThroughImageTransportSurface virtual void OnResize(gfx::Size size, float scale_factor) OVERRIDE; virtual gfx::Size GetSize() OVERRIDE; virtual void SetLatencyInfo( - const ui::LatencyInfo& latency_info) OVERRIDE; + const std::vector<ui::LatencyInfo>& latency_info) OVERRIDE; virtual void WakeUpGpu() OVERRIDE; protected: @@ -217,7 +217,7 @@ class PassThroughImageTransportSurface bool did_set_swap_interval_; bool did_unschedule_; bool is_swap_buffers_pending_; - ui::LatencyInfo latency_info_; + std::vector<ui::LatencyInfo> latency_info_; DISALLOW_COPY_AND_ASSIGN(PassThroughImageTransportSurface); }; diff --git a/content/common/gpu/image_transport_surface_mac.cc b/content/common/gpu/image_transport_surface_mac.cc index 67ac4ae..615c7d0 100644 --- a/content/common/gpu/image_transport_surface_mac.cc +++ b/content/common/gpu/image_transport_surface_mac.cc @@ -63,7 +63,8 @@ class IOSurfaceImageTransportSurface const AcceleratedSurfaceMsg_BufferPresented_Params& params) OVERRIDE; virtual void OnResizeViewACK() OVERRIDE; virtual void OnResize(gfx::Size size, float scale_factor) OVERRIDE; - virtual void SetLatencyInfo(const ui::LatencyInfo&) OVERRIDE; + virtual void SetLatencyInfo( + const std::vector<ui::LatencyInfo>&) OVERRIDE; virtual void WakeUpGpu() OVERRIDE; // GpuCommandBufferStub::DestructionObserver implementation. @@ -105,7 +106,7 @@ class IOSurfaceImageTransportSurface // Whether we unscheduled command buffer because of pending SwapBuffers. bool did_unschedule_; - ui::LatencyInfo latency_info_; + std::vector<ui::LatencyInfo> latency_info_; scoped_ptr<ImageTransportHelper> helper_; @@ -249,7 +250,7 @@ bool IOSurfaceImageTransportSurface::SwapBuffers() { params.surface_handle = io_surface_handle_; params.size = GetSize(); params.scale_factor = scale_factor_; - params.latency_info = latency_info_; + params.latency_info.swap(latency_info_); helper_->SendAcceleratedSurfaceBuffersSwapped(params); DCHECK(!is_swap_buffers_pending_); @@ -272,7 +273,7 @@ bool IOSurfaceImageTransportSurface::PostSubBuffer( params.height = height; params.surface_size = GetSize(); params.surface_scale_factor = scale_factor_; - params.latency_info = latency_info_; + params.latency_info.swap(latency_info_); helper_->SendAcceleratedSurfacePostSubBuffer(params); DCHECK(!is_swap_buffers_pending_); @@ -323,8 +324,9 @@ void IOSurfaceImageTransportSurface::OnResize(gfx::Size size, } void IOSurfaceImageTransportSurface::SetLatencyInfo( - const ui::LatencyInfo& latency_info) { - latency_info_ = latency_info; + const std::vector<ui::LatencyInfo>& latency_info) { + for (size_t i = 0; i < latency_info.size(); i++) + latency_info_.push_back(latency_info[i]); } void IOSurfaceImageTransportSurface::WakeUpGpu() { diff --git a/content/common/gpu/image_transport_surface_win.cc b/content/common/gpu/image_transport_surface_win.cc index 240a160..d48b8a4 100644 --- a/content/common/gpu/image_transport_surface_win.cc +++ b/content/common/gpu/image_transport_surface_win.cc @@ -47,7 +47,7 @@ class PbufferImageTransportSurface const AcceleratedSurfaceMsg_BufferPresented_Params& params) OVERRIDE; virtual void OnResizeViewACK() OVERRIDE; virtual void OnResize(gfx::Size size, float scale_factor) OVERRIDE; - virtual void SetLatencyInfo(const ui::LatencyInfo&) OVERRIDE; + virtual void SetLatencyInfo(const std::vector<ui::LatencyInfo>&) OVERRIDE; virtual void WakeUpGpu() OVERRIDE; virtual gfx::Size GetSize() OVERRIDE; @@ -69,7 +69,7 @@ class PbufferImageTransportSurface // Size to resize to when the surface becomes visible. gfx::Size visible_size_; - ui::LatencyInfo latency_info_; + std::vector<ui::LatencyInfo> latency_info_; scoped_ptr<ImageTransportHelper> helper_; @@ -190,7 +190,7 @@ void PbufferImageTransportSurface::SendBuffersSwapped() { params.surface_handle = reinterpret_cast<int64>(GetShareHandle()); CHECK(params.surface_handle); params.size = GetSize(); - params.latency_info = latency_info_; + params.latency_info.swap(latency_info_); helper_->SendAcceleratedSurfaceBuffersSwapped(params); @@ -228,8 +228,9 @@ void PbufferImageTransportSurface::OnResize(gfx::Size size, } void PbufferImageTransportSurface::SetLatencyInfo( - const ui::LatencyInfo& latency_info) { - latency_info_ = latency_info; + const std::vector<ui::LatencyInfo>& latency_info) { + for (size_t i = 0; i < latency_info.size(); i++) + latency_info_.push_back(latency_info[i]); } void PbufferImageTransportSurface::WakeUpGpu() { diff --git a/content/common/gpu/texture_image_transport_surface.cc b/content/common/gpu/texture_image_transport_surface.cc index 7d4a2d9..e1db18a 100644 --- a/content/common/gpu/texture_image_transport_surface.cc +++ b/content/common/gpu/texture_image_transport_surface.cc @@ -192,8 +192,9 @@ void TextureImageTransportSurface::OnWillDestroyStub() { } void TextureImageTransportSurface::SetLatencyInfo( - const ui::LatencyInfo& latency_info) { - latency_info_ = latency_info; + const std::vector<ui::LatencyInfo>& latency_info) { + for (size_t i = 0; i < latency_info.size(); i++) + latency_info_.push_back(latency_info[i]); } void TextureImageTransportSurface::WakeUpGpu() { @@ -222,7 +223,7 @@ bool TextureImageTransportSurface::SwapBuffers() { glFlush(); - params.latency_info = latency_info_; + params.latency_info.swap(latency_info_); helper_->SendAcceleratedSurfaceBuffersSwapped(params); DCHECK(!is_swap_buffers_pending_); @@ -262,7 +263,7 @@ bool TextureImageTransportSurface::PostSubBuffer( glFlush(); - params.latency_info = latency_info_; + params.latency_info.swap(latency_info_); helper_->SendAcceleratedSurfacePostSubBuffer(params); DCHECK(!is_swap_buffers_pending_); diff --git a/content/common/gpu/texture_image_transport_surface.h b/content/common/gpu/texture_image_transport_surface.h index 4afe534..2162ffe 100644 --- a/content/common/gpu/texture_image_transport_surface.h +++ b/content/common/gpu/texture_image_transport_surface.h @@ -53,7 +53,7 @@ class TextureImageTransportSurface virtual void OnResizeViewACK() OVERRIDE; virtual void OnResize(gfx::Size size, float scale_factor) OVERRIDE; virtual void SetLatencyInfo( - const ui::LatencyInfo& latency_info) OVERRIDE; + const std::vector<ui::LatencyInfo>& latency_info) OVERRIDE; virtual void WakeUpGpu() OVERRIDE; // GpuCommandBufferStub::DestructionObserver implementation. @@ -116,7 +116,7 @@ class TextureImageTransportSurface // Holds a reference to the mailbox manager for cleanup. scoped_refptr<gpu::gles2::MailboxManager> mailbox_manager_; - ui::LatencyInfo latency_info_; + std::vector<ui::LatencyInfo> latency_info_; DISALLOW_COPY_AND_ASSIGN(TextureImageTransportSurface); }; diff --git a/content/common/view_messages.h b/content/common/view_messages.h index 39a755e..8a2a28d 100644 --- a/content/common/view_messages.h +++ b/content/common/view_messages.h @@ -2043,7 +2043,7 @@ IPC_STRUCT_BEGIN(ViewHostMsg_CompositorSurfaceBuffersSwapped_Params) IPC_STRUCT_MEMBER(gfx::Size, size) IPC_STRUCT_MEMBER(float, scale_factor) IPC_STRUCT_MEMBER(int32, gpu_process_host_id) - IPC_STRUCT_MEMBER(ui::LatencyInfo, latency_info) + IPC_STRUCT_MEMBER(std::vector<ui::LatencyInfo>, latency_info) IPC_STRUCT_END() // This message is synthesized by GpuProcessHost to pass through a swap message |