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 #include "ui/gl/gl_surface_egl.h" | 5 #include "ui/gl/gl_surface_egl.h" |
6 | 6 |
7 #if defined(OS_ANDROID) | 7 #include <stddef.h> |
8 #include <android/native_window_jni.h> | 8 #include <stdint.h> |
9 #endif | |
10 | 9 |
11 #include "base/command_line.h" | 10 #include "base/command_line.h" |
12 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/macros.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/message_loop/message_loop.h" | 14 #include "base/message_loop/message_loop.h" |
15 #include "base/metrics/histogram_macros.h" | 15 #include "base/metrics/histogram_macros.h" |
16 #include "base/strings/string_number_conversions.h" | 16 #include "base/strings/string_number_conversions.h" |
17 #include "base/trace_event/trace_event.h" | 17 #include "base/trace_event/trace_event.h" |
18 #include "build/build_config.h" | 18 #include "build/build_config.h" |
19 #include "ui/gfx/geometry/rect.h" | 19 #include "ui/gfx/geometry/rect.h" |
20 #include "ui/gl/egl_util.h" | 20 #include "ui/gl/egl_util.h" |
21 #include "ui/gl/gl_context.h" | 21 #include "ui/gl/gl_context.h" |
22 #include "ui/gl/gl_image.h" | 22 #include "ui/gl/gl_image.h" |
23 #include "ui/gl/gl_implementation.h" | 23 #include "ui/gl/gl_implementation.h" |
24 #include "ui/gl/gl_surface_stub.h" | 24 #include "ui/gl/gl_surface_stub.h" |
25 #include "ui/gl/gl_switches.h" | 25 #include "ui/gl/gl_switches.h" |
26 #include "ui/gl/scoped_make_current.h" | 26 #include "ui/gl/scoped_make_current.h" |
27 #include "ui/gl/sync_control_vsync_provider.h" | 27 #include "ui/gl/sync_control_vsync_provider.h" |
28 | 28 |
| 29 #if defined(OS_ANDROID) |
| 30 #include <android/native_window_jni.h> |
| 31 #endif |
| 32 |
29 #if defined (USE_OZONE) | 33 #if defined (USE_OZONE) |
30 #include "ui/ozone/public/ozone_platform.h" | 34 #include "ui/ozone/public/ozone_platform.h" |
31 #include "ui/ozone/public/surface_factory_ozone.h" | 35 #include "ui/ozone/public/surface_factory_ozone.h" |
32 #endif | 36 #endif |
33 | 37 |
34 #if defined(USE_X11) && !defined(OS_CHROMEOS) | 38 #if defined(USE_X11) && !defined(OS_CHROMEOS) |
35 extern "C" { | 39 extern "C" { |
36 #include <X11/Xlib.h> | 40 #include <X11/Xlib.h> |
37 #define Status int | 41 #define Status int |
38 } | 42 } |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 : public gfx::SyncControlVSyncProvider { | 112 : public gfx::SyncControlVSyncProvider { |
109 public: | 113 public: |
110 explicit EGLSyncControlVSyncProvider(EGLSurface surface) | 114 explicit EGLSyncControlVSyncProvider(EGLSurface surface) |
111 : SyncControlVSyncProvider(), | 115 : SyncControlVSyncProvider(), |
112 surface_(surface) { | 116 surface_(surface) { |
113 } | 117 } |
114 | 118 |
115 ~EGLSyncControlVSyncProvider() override {} | 119 ~EGLSyncControlVSyncProvider() override {} |
116 | 120 |
117 protected: | 121 protected: |
118 bool GetSyncValues(int64* system_time, | 122 bool GetSyncValues(int64_t* system_time, |
119 int64* media_stream_counter, | 123 int64_t* media_stream_counter, |
120 int64* swap_buffer_counter) override { | 124 int64_t* swap_buffer_counter) override { |
121 uint64 u_system_time, u_media_stream_counter, u_swap_buffer_counter; | 125 uint64_t u_system_time, u_media_stream_counter, u_swap_buffer_counter; |
122 bool result = eglGetSyncValuesCHROMIUM( | 126 bool result = eglGetSyncValuesCHROMIUM( |
123 g_display, surface_, &u_system_time, | 127 g_display, surface_, &u_system_time, |
124 &u_media_stream_counter, &u_swap_buffer_counter) == EGL_TRUE; | 128 &u_media_stream_counter, &u_swap_buffer_counter) == EGL_TRUE; |
125 if (result) { | 129 if (result) { |
126 *system_time = static_cast<int64>(u_system_time); | 130 *system_time = static_cast<int64_t>(u_system_time); |
127 *media_stream_counter = static_cast<int64>(u_media_stream_counter); | 131 *media_stream_counter = static_cast<int64_t>(u_media_stream_counter); |
128 *swap_buffer_counter = static_cast<int64>(u_swap_buffer_counter); | 132 *swap_buffer_counter = static_cast<int64_t>(u_swap_buffer_counter); |
129 } | 133 } |
130 return result; | 134 return result; |
131 } | 135 } |
132 | 136 |
133 bool GetMscRate(int32* numerator, int32* denominator) override { | 137 bool GetMscRate(int32_t* numerator, int32_t* denominator) override { |
134 return false; | 138 return false; |
135 } | 139 } |
136 | 140 |
137 private: | 141 private: |
138 EGLSurface surface_; | 142 EGLSurface surface_; |
139 | 143 |
140 DISALLOW_COPY_AND_ASSIGN(EGLSyncControlVSyncProvider); | 144 DISALLOW_COPY_AND_ASSIGN(EGLSyncControlVSyncProvider); |
141 }; | 145 }; |
142 | 146 |
143 EGLDisplay GetPlatformANGLEDisplay(EGLNativeDisplayType native_display, | 147 EGLDisplay GetPlatformANGLEDisplay(EGLNativeDisplayType native_display, |
(...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
947 } | 951 } |
948 | 952 |
949 void* SurfacelessEGL::GetShareHandle() { | 953 void* SurfacelessEGL::GetShareHandle() { |
950 return NULL; | 954 return NULL; |
951 } | 955 } |
952 | 956 |
953 SurfacelessEGL::~SurfacelessEGL() { | 957 SurfacelessEGL::~SurfacelessEGL() { |
954 } | 958 } |
955 | 959 |
956 } // namespace gfx | 960 } // namespace gfx |
OLD | NEW |