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

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

Issue 11195011: Send vsync timebase updates to the browser compositor (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use the existing output surface mechanism to feed vsync info into the compositor Created 8 years, 2 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 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)

Powered by Google App Engine
This is Rietveld 408576698