summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--content/browser/gpu/gpu_process_host.cc1
-rw-r--r--content/browser/renderer_host/compositing_iosurface_mac.h6
-rw-r--r--content/browser/renderer_host/compositing_iosurface_mac.mm14
-rw-r--r--content/browser/renderer_host/render_widget_host_impl.cc1
-rw-r--r--content/browser/renderer_host/render_widget_host_view_mac.h6
-rw-r--r--content/browser/renderer_host/render_widget_host_view_mac.mm19
-rw-r--r--content/common/view_messages.h1
7 files changed, 35 insertions, 13 deletions
diff --git a/content/browser/gpu/gpu_process_host.cc b/content/browser/gpu/gpu_process_host.cc
index fb9c479..6bf1c4a 100644
--- a/content/browser/gpu/gpu_process_host.cc
+++ b/content/browser/gpu/gpu_process_host.cc
@@ -940,6 +940,7 @@ void GpuProcessHost::OnAcceleratedSurfaceBuffersSwapped(
view_params.size = params.size;
view_params.scale_factor = params.scale_factor;
view_params.gpu_process_host_id = host_id_;
+ view_params.latency_info = params.latency_info;
helper->DidReceiveBackingStoreMsg(ViewHostMsg_CompositorSurfaceBuffersSwapped(
render_widget_id,
view_params));
diff --git a/content/browser/renderer_host/compositing_iosurface_mac.h b/content/browser/renderer_host/compositing_iosurface_mac.h
index 2f1e11a..28eec05 100644
--- a/content/browser/renderer_host/compositing_iosurface_mac.h
+++ b/content/browser/renderer_host/compositing_iosurface_mac.h
@@ -19,6 +19,7 @@
#include "base/time.h"
#include "base/timer.h"
#include "media/base/video_frame.h"
+#include "ui/base/latency_info.h"
#include "ui/gfx/native_widget_types.h"
#include "ui/gfx/rect.h"
#include "ui/gfx/rect_conversions.h"
@@ -60,7 +61,8 @@ class CompositingIOSurfaceMac {
// Set IOSurface that will be drawn on the next NSView drawRect.
void SetIOSurface(uint64 io_surface_handle,
const gfx::Size& size,
- float scale_factor);
+ float scale_factor,
+ const ui::LatencyInfo& latency_info);
// Get the CGL renderer ID currently associated with this context.
int GetRendererID();
@@ -354,6 +356,8 @@ class CompositingIOSurfaceMac {
bool initialized_is_intel_;
bool is_intel_;
GLint screen_;
+
+ ui::LatencyInfo latency_info_;
};
} // namespace content
diff --git a/content/browser/renderer_host/compositing_iosurface_mac.mm b/content/browser/renderer_host/compositing_iosurface_mac.mm
index e58adcb..1ed2ed0 100644
--- a/content/browser/renderer_host/compositing_iosurface_mac.mm
+++ b/content/browser/renderer_host/compositing_iosurface_mac.mm
@@ -18,6 +18,7 @@
#include "content/browser/renderer_host/compositing_iosurface_context_mac.h"
#include "content/browser/renderer_host/compositing_iosurface_shader_programs_mac.h"
#include "content/browser/renderer_host/compositing_iosurface_transformer_mac.h"
+#include "content/browser/renderer_host/render_widget_host_impl.h"
#include "content/common/content_constants_internal.h"
#include "content/port/browser/render_widget_host_view_frame_subscriber.h"
#include "gpu/command_buffer/service/gpu_switches.h"
@@ -358,15 +359,18 @@ CompositingIOSurfaceMac::~CompositingIOSurfaceMac() {
context_ = nil;
}
-void CompositingIOSurfaceMac::SetIOSurface(uint64 io_surface_handle,
- const gfx::Size& size,
- float scale_factor) {
+void CompositingIOSurfaceMac::SetIOSurface(
+ uint64 io_surface_handle,
+ const gfx::Size& size,
+ float scale_factor,
+ const ui::LatencyInfo& latency_info) {
pixel_io_surface_size_ = size;
dip_io_surface_size_ = gfx::ToFlooredSize(
gfx::ScaleSize(pixel_io_surface_size_, 1.0 / scale_factor));
CGLSetCurrentContext(context_->cgl_context());
MapIOSurfaceToTexture(io_surface_handle);
CGLSetCurrentContext(0);
+ latency_info_.MergeWith(latency_info);
}
int CompositingIOSurfaceMac::GetRendererID() {
@@ -502,6 +506,10 @@ void CompositingIOSurfaceMac::DrawIOSurface(
CGLFlushDrawable(context_->cgl_context());
+ latency_info_.swap_timestamp = base::TimeTicks::HighResNow();
+ RenderWidgetHostImpl::CompositorFrameDrawn(latency_info_);
+ latency_info_.Clear();
+
// For latency_tests.cc:
UNSHIPPED_TRACE_EVENT_INSTANT0("test_gpu", "CompositorSwapBuffersComplete",
TRACE_EVENT_SCOPE_THREAD);
diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc
index 994f691..f6a6d11 100644
--- a/content/browser/renderer_host/render_widget_host_impl.cc
+++ b/content/browser/renderer_host/render_widget_host_impl.cc
@@ -1685,6 +1685,7 @@ void RenderWidgetHostImpl::OnCompositorSurfaceBuffersSwapped(
gpu_params.route_id = params.route_id;
gpu_params.size = params.size;
gpu_params.scale_factor = params.scale_factor;
+ gpu_params.latency_info = params.latency_info;
view_->AcceleratedSurfaceBuffersSwapped(gpu_params,
params.gpu_process_host_id);
}
diff --git a/content/browser/renderer_host/render_widget_host_view_mac.h b/content/browser/renderer_host/render_widget_host_view_mac.h
index 60028b0..171decf 100644
--- a/content/browser/renderer_host/render_widget_host_view_mac.h
+++ b/content/browser/renderer_host/render_widget_host_view_mac.h
@@ -325,8 +325,10 @@ class RenderWidgetHostViewMac : public RenderWidgetHostViewBase,
// Call setNeedsDisplay on the cocoa_view_. The IOSurface will be drawn during
// the next drawRect. Return true if the Ack should be sent, false if it
// should be deferred until drawRect.
- bool CompositorSwapBuffers(
- uint64 surface_handle, const gfx::Size& size, float scale_factor);
+ bool CompositorSwapBuffers(uint64 surface_handle,
+ const gfx::Size& size,
+ float scale_factor,
+ const ui::LatencyInfo& latency_info);
// Ack pending SwapBuffers requests, if any, to unblock the GPU process. Has
// no effect if there are no pending requests.
void AckPendingSwapBuffers();
diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm
index 7b98f6c..0a6ea3e 100644
--- a/content/browser/renderer_host/render_widget_host_view_mac.mm
+++ b/content/browser/renderer_host/render_widget_host_view_mac.mm
@@ -1043,9 +1043,11 @@ void RenderWidgetHostViewMac::PluginImeCompositionCompleted(
}
}
-bool RenderWidgetHostViewMac::CompositorSwapBuffers(uint64 surface_handle,
- const gfx::Size& size,
- float scale_factor) {
+bool RenderWidgetHostViewMac::CompositorSwapBuffers(
+ uint64 surface_handle,
+ const gfx::Size& size,
+ float scale_factor,
+ const ui::LatencyInfo& latency_info) {
if (is_hidden_)
return true;
@@ -1060,7 +1062,7 @@ bool RenderWidgetHostViewMac::CompositorSwapBuffers(uint64 surface_handle,
if (frame_subscriber_->ShouldCaptureFrame(present_time,
&frame, &callback)) {
compositing_iosurface_->SetIOSurface(
- surface_handle, size, scale_factor);
+ surface_handle, size, scale_factor, latency_info);
compositing_iosurface_->CopyToVideoFrame(
gfx::Rect(size), frame,
base::Bind(callback, present_time));
@@ -1102,7 +1104,8 @@ bool RenderWidgetHostViewMac::CompositorSwapBuffers(uint64 surface_handle,
if (!compositing_iosurface_)
return true;
- compositing_iosurface_->SetIOSurface(surface_handle, size, scale_factor);
+ compositing_iosurface_->SetIOSurface(
+ surface_handle, size, scale_factor, latency_info);
GotAcceleratedFrame();
@@ -1314,7 +1317,8 @@ void RenderWidgetHostViewMac::AcceleratedSurfaceBuffersSwapped(
if (CompositorSwapBuffers(params.surface_handle,
params.size,
- params.scale_factor))
+ params.scale_factor,
+ params.latency_info))
AckPendingSwapBuffers();
}
@@ -1330,7 +1334,8 @@ void RenderWidgetHostViewMac::AcceleratedSurfacePostSubBuffer(
if (CompositorSwapBuffers(params.surface_handle,
params.surface_size,
- params.surface_scale_factor))
+ params.surface_scale_factor,
+ params.latency_info))
AckPendingSwapBuffers();
}
diff --git a/content/common/view_messages.h b/content/common/view_messages.h
index feda4da..5cdd995 100644
--- a/content/common/view_messages.h
+++ b/content/common/view_messages.h
@@ -2050,6 +2050,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_END()
// This message is synthesized by GpuProcessHost to pass through a swap message