Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(640)

Unified Diff: content/common/gpu/image_transport_surface.cc

Issue 12614013: Plumb cc::LatencyInfo through command buffer and output surface (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/common/gpu/image_transport_surface.cc
diff --git a/content/common/gpu/image_transport_surface.cc b/content/common/gpu/image_transport_surface.cc
index 460c20a989a2701938bdc5a1ef44baa88e3cce46..bf2ccd09fb117dfc7974e42c45e5d575323ec44b 100644
--- a/content/common/gpu/image_transport_surface.cc
+++ b/content/common/gpu/image_transport_surface.cc
@@ -36,6 +36,9 @@ ImageTransportHelper::ImageTransportHelper(ImageTransportSurface* surface,
}
ImageTransportHelper::~ImageTransportHelper() {
+ if (stub_)
apatrick_chromium 2013/03/15 19:09:35 nit: braces
+ stub_->SetLatencyInfoCallback(
+ base::Callback<void(const cc::LatencyInfo&)>());
manager_->RemoveRoute(route_id_);
}
@@ -48,6 +51,11 @@ bool ImageTransportHelper::Initialize() {
decoder->SetResizeCallback(
base::Bind(&ImageTransportHelper::Resize, base::Unretained(this)));
+ if (stub_)
apatrick_chromium 2013/03/15 19:09:35 nit: braces
+ stub_->SetLatencyInfoCallback(
+ base::Bind(&ImageTransportHelper::SetLatencyInfo,
+ base::Unretained(this)));
+
return true;
}
@@ -59,6 +67,7 @@ bool ImageTransportHelper::OnMessageReceived(const IPC::Message& message) {
IPC_MESSAGE_HANDLER(AcceleratedSurfaceMsg_BufferPresented,
OnBufferPresented)
IPC_MESSAGE_HANDLER(AcceleratedSurfaceMsg_ResizeViewACK, OnResizeViewACK);
+ IPC_MESSAGE_HANDLER(AcceleratedSurfaceMsg_FrameDisplayed, OnFrameDisplayed);
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
return handled;
@@ -108,6 +117,11 @@ void ImageTransportHelper::SendUpdateVSyncParameters(
interval));
}
+void ImageTransportHelper::SendLatencyInfo(
+ const cc::LatencyInfo& latency_info) {
+ stub_->SetLatencyInfo(latency_info);
+}
+
void ImageTransportHelper::SetScheduled(bool is_scheduled) {
gpu::GpuScheduler* scheduler = Scheduler();
if (!scheduler)
@@ -176,6 +190,16 @@ void ImageTransportHelper::Resize(gfx::Size size) {
#endif
}
+void ImageTransportHelper::SetLatencyInfo(
+ const cc::LatencyInfo& latency_info) {
+ surface_->SetLatencyInfo(latency_info);
+}
+
+void ImageTransportHelper::OnFrameDisplayed(
+ const cc::LatencyInfo& latency_info) {
+ SendLatencyInfo(latency_info);
+}
+
PassThroughImageTransportSurface::PassThroughImageTransportSurface(
GpuChannelManager* manager,
GpuCommandBufferStub* stub,
@@ -212,8 +236,16 @@ bool PassThroughImageTransportSurface::DeferDraws() {
return false;
}
+void PassThroughImageTransportSurface::SetLatencyInfo(
+ const cc::LatencyInfo& latency_info) {
+ latency_info_ = latency_info;
+}
+
bool PassThroughImageTransportSurface::SwapBuffers() {
bool result = gfx::GLSurfaceAdapter::SwapBuffers();
+ latency_info_.swap_timestamp = base::TimeTicks::HighResNow();
+ helper_->SendLatencyInfo(latency_info_);
+
SendVSyncUpdateIfAvailable();
if (transport_) {
@@ -224,6 +256,7 @@ bool PassThroughImageTransportSurface::SwapBuffers() {
// SwapBuffers message.
GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params;
params.surface_handle = 0;
+ params.latency_info = latency_info_;
params.size = surface()->GetSize();
helper_->SendAcceleratedSurfaceBuffersSwapped(params);
}
@@ -233,6 +266,8 @@ bool PassThroughImageTransportSurface::SwapBuffers() {
bool PassThroughImageTransportSurface::PostSubBuffer(
int x, int y, int width, int height) {
bool result = gfx::GLSurfaceAdapter::PostSubBuffer(x, y, width, height);
+ latency_info_.swap_timestamp = base::TimeTicks::HighResNow();
+ helper_->SendLatencyInfo(latency_info_);
SendVSyncUpdateIfAvailable();
if (transport_) {
@@ -243,6 +278,7 @@ bool PassThroughImageTransportSurface::PostSubBuffer(
// PostSubBuffer message.
GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params params;
params.surface_handle = 0;
+ params.latency_info = latency_info_;
params.surface_size = surface()->GetSize();
params.x = x;
params.y = y;

Powered by Google App Engine
This is Rietveld 408576698