OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 extern "C" { | 5 extern "C" { |
6 #include <X11/Xlib.h> | 6 #include <X11/Xlib.h> |
7 } | 7 } |
8 | 8 |
9 #include "ui/gl/gl_surface_glx.h" | 9 #include "ui/gl/gl_surface_glx.h" |
10 | 10 |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 | 190 |
191 if (!context_ || cancel_vsync_flag_.IsSet()) | 191 if (!context_ || cancel_vsync_flag_.IsSet()) |
192 return; | 192 return; |
193 | 193 |
194 glXMakeCurrent(display_, window_, context_); | 194 glXMakeCurrent(display_, window_, context_); |
195 | 195 |
196 unsigned int retrace_count = 0; | 196 unsigned int retrace_count = 0; |
197 if (glXWaitVideoSyncSGI(1, 0, &retrace_count) != 0) | 197 if (glXWaitVideoSyncSGI(1, 0, &retrace_count) != 0) |
198 return; | 198 return; |
199 | 199 |
200 TRACE_EVENT_INSTANT0("gpu", "vblank"); | 200 TRACE_EVENT_INSTANT0("gpu", "vblank", TRACE_EVENT_SCOPE_THREAD); |
201 now = base::TimeTicks::HighResNow(); | 201 now = base::TimeTicks::HighResNow(); |
202 | 202 |
203 glXMakeCurrent(display_, 0, 0); | 203 glXMakeCurrent(display_, 0, 0); |
204 } | 204 } |
205 | 205 |
206 const base::TimeDelta kDefaultInterval = | 206 const base::TimeDelta kDefaultInterval = |
207 base::TimeDelta::FromSeconds(1) / 60; | 207 base::TimeDelta::FromSeconds(1) / 60; |
208 | 208 |
209 message_loop_->PostTask( | 209 message_loop_->PostTask( |
210 FROM_HERE, base::Bind(callback, now, kDefaultInterval)); | 210 FROM_HERE, base::Bind(callback, now, kDefaultInterval)); |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 return true; | 422 return true; |
423 } | 423 } |
424 | 424 |
425 bool NativeViewGLSurfaceGLX::IsOffscreen() { | 425 bool NativeViewGLSurfaceGLX::IsOffscreen() { |
426 return false; | 426 return false; |
427 } | 427 } |
428 | 428 |
429 bool NativeViewGLSurfaceGLX::SwapBuffers() { | 429 bool NativeViewGLSurfaceGLX::SwapBuffers() { |
430 glXSwapBuffers(g_display, window_); | 430 glXSwapBuffers(g_display, window_); |
431 // For latency_tests.cc: | 431 // For latency_tests.cc: |
432 UNSHIPPED_TRACE_EVENT_INSTANT0("test_gpu", "CompositorSwapBuffersComplete"); | 432 UNSHIPPED_TRACE_EVENT_INSTANT0("test_gpu", "CompositorSwapBuffersComplete", |
| 433 TRACE_EVENT_SCOPE_THREAD); |
433 return true; | 434 return true; |
434 } | 435 } |
435 | 436 |
436 gfx::Size NativeViewGLSurfaceGLX::GetSize() { | 437 gfx::Size NativeViewGLSurfaceGLX::GetSize() { |
437 return size_; | 438 return size_; |
438 } | 439 } |
439 | 440 |
440 void* NativeViewGLSurfaceGLX::GetHandle() { | 441 void* NativeViewGLSurfaceGLX::GetHandle() { |
441 return reinterpret_cast<void*>(window_); | 442 return reinterpret_cast<void*>(window_); |
442 } | 443 } |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
614 | 615 |
615 void* PbufferGLSurfaceGLX::GetConfig() { | 616 void* PbufferGLSurfaceGLX::GetConfig() { |
616 return config_; | 617 return config_; |
617 } | 618 } |
618 | 619 |
619 PbufferGLSurfaceGLX::~PbufferGLSurfaceGLX() { | 620 PbufferGLSurfaceGLX::~PbufferGLSurfaceGLX() { |
620 Destroy(); | 621 Destroy(); |
621 } | 622 } |
622 | 623 |
623 } // namespace gfx | 624 } // namespace gfx |
OLD | NEW |