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 dce01a234876b204cbd5f8ed3ccb2e139855893a..a11ad86720d6eaf3593d70312880d25f402868e7 100644 |
--- a/content/common/gpu/image_transport_surface.cc |
+++ b/content/common/gpu/image_transport_surface.cc |
@@ -157,6 +157,12 @@ void ImageTransportHelper::SendResizeView(const gfx::Size& size) { |
size)); |
} |
+void ImageTransportHelper::SendUpdateVSyncParameters( |
+ base::TimeTicks timebase, base::TimeDelta interval) { |
+ manager_->Send(new GpuHostMsg_UpdateVSyncParameters(timebase, |
+ interval)); |
+} |
+ |
void ImageTransportHelper::SetScheduled(bool is_scheduled) { |
gpu::GpuScheduler* scheduler = Scheduler(); |
if (!scheduler) |
@@ -270,6 +276,7 @@ void PassThroughImageTransportSurface::Destroy() { |
bool PassThroughImageTransportSurface::SwapBuffers() { |
bool result = gfx::GLSurfaceAdapter::SwapBuffers(); |
+ SendVSyncUpdateIfAvailable(); |
if (transport_) { |
// Round trip to the browser UI thread, for throttling, by sending a dummy |
@@ -286,6 +293,7 @@ bool PassThroughImageTransportSurface::SwapBuffers() { |
bool PassThroughImageTransportSurface::PostSubBuffer( |
int x, int y, int width, int height) { |
bool result = gfx::GLSurfaceAdapter::PostSubBuffer(x, y, width, height); |
+ SendVSyncUpdateIfAvailable(); |
if (transport_) { |
// Round trip to the browser UI thread, for throttling, by sending a dummy |
@@ -340,6 +348,24 @@ gfx::Size PassThroughImageTransportSurface::GetSize() { |
PassThroughImageTransportSurface::~PassThroughImageTransportSurface() {} |
+void PassThroughImageTransportSurface::SendVSyncUpdateIfAvailable() { |
+ int64 monotonicTime; |
+ int64 mediaStreamCounter; |
+ int64 swapBufferCounter; |
+ |
+ // TODO: Use glXGetMscRateOML (where available) to get the correct interval |
+ // time. If unavailable, we should plumb-in information about when we |
+ // clock down. |
+ const int64 intervalTime = base::Time::kMicrosecondsPerSecond / 60; |
piman
2012/10/24 16:56:54
This sounds like it belongs to GLSurfaceGLX too.
ajuma
2012/10/26 20:12:39
Done.
|
+ |
+ if (GetSyncValues(&monotonicTime, &mediaStreamCounter, &swapBufferCounter)) { |
+ base::TimeTicks timebase = base::TimeTicks::FromInternalValue( |
+ monotonicTime); |
+ base::TimeDelta interval = base::TimeDelta::FromMicroseconds(intervalTime); |
+ helper_->SendUpdateVSyncParameters(timebase, interval); |
+ } |
+} |
+ |
} // namespace content |
#endif // defined(ENABLE_GPU) |