| 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 #if defined(OS_ANDROID) |
| 8 #include <android/native_window_jni.h> | 8 #include <android/native_window_jni.h> |
| 9 #endif | 9 #endif |
| 10 | 10 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 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 (USE_OZONE) | 29 #if defined (USE_OZONE) |
| 30 #include "ui/ozone/public/ozone_platform.h" | 30 #include "ui/ozone/public/ozone_platform.h" |
| 31 #include "ui/ozone/public/surface_factory_ozone.h" | 31 #include "ui/ozone/public/surface_factory_ozone.h" |
| 32 #endif | 32 #endif |
| 33 | 33 |
| 34 #if defined(USE_X11) && !defined(OS_CHROMEOS) | 34 #if defined(USE_X11) && !defined(OS_CHROMEOS) |
| 35 extern "C" { |
| 36 #include <X11/Xlib.h> |
| 37 #define Status int |
| 38 } |
| 39 #include "ui/base/x/x11_util_internal.h" |
| 35 #include "ui/gfx/x/x11_switches.h" | 40 #include "ui/gfx/x/x11_switches.h" |
| 36 #endif | 41 #endif |
| 37 | 42 |
| 38 #if !defined(EGL_FIXED_SIZE_ANGLE) | 43 #if !defined(EGL_FIXED_SIZE_ANGLE) |
| 39 #define EGL_FIXED_SIZE_ANGLE 0x3201 | 44 #define EGL_FIXED_SIZE_ANGLE 0x3201 |
| 40 #endif | 45 #endif |
| 41 | 46 |
| 42 #if !defined(EGL_OPENGL_ES3_BIT) | 47 #if !defined(EGL_OPENGL_ES3_BIT) |
| 43 #define EGL_OPENGL_ES3_BIT 0x00000040 | 48 #define EGL_OPENGL_ES3_BIT 0x00000040 |
| 44 #endif | 49 #endif |
| (...skipping 18 matching lines...) Expand all Loading... |
| 63 #define EGL_PLATFORM_ANGLE_DEVICE_TYPE_WARP_ANGLE 0x320B | 68 #define EGL_PLATFORM_ANGLE_DEVICE_TYPE_WARP_ANGLE 0x320B |
| 64 #define EGL_PLATFORM_ANGLE_DEVICE_TYPE_REFERENCE_ANGLE 0x320C | 69 #define EGL_PLATFORM_ANGLE_DEVICE_TYPE_REFERENCE_ANGLE 0x320C |
| 65 #endif /* EGL_ANGLE_platform_angle_d3d */ | 70 #endif /* EGL_ANGLE_platform_angle_d3d */ |
| 66 | 71 |
| 67 #ifndef EGL_ANGLE_platform_angle_opengl | 72 #ifndef EGL_ANGLE_platform_angle_opengl |
| 68 #define EGL_ANGLE_platform_angle_opengl 1 | 73 #define EGL_ANGLE_platform_angle_opengl 1 |
| 69 #define EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE 0x320D | 74 #define EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE 0x320D |
| 70 #define EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE 0x320E | 75 #define EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE 0x320E |
| 71 #endif /* EGL_ANGLE_platform_angle_opengl */ | 76 #endif /* EGL_ANGLE_platform_angle_opengl */ |
| 72 | 77 |
| 78 #ifndef EGL_ANGLE_x11_visual |
| 79 #define EGL_ANGLE_x11_visual 1 |
| 80 #define EGL_X11_VISUAL_ID_ANGLE 0x33A3 |
| 81 #endif /* EGL_ANGLE_x11_visual */ |
| 82 |
| 73 using ui::GetLastEGLErrorString; | 83 using ui::GetLastEGLErrorString; |
| 74 | 84 |
| 75 namespace gfx { | 85 namespace gfx { |
| 76 | 86 |
| 77 #if defined(OS_WIN) | 87 #if defined(OS_WIN) |
| 78 unsigned int NativeViewGLSurfaceEGL::current_swap_generation_ = 0; | 88 unsigned int NativeViewGLSurfaceEGL::current_swap_generation_ = 0; |
| 79 unsigned int NativeViewGLSurfaceEGL::swaps_this_generation_ = 0; | 89 unsigned int NativeViewGLSurfaceEGL::swaps_this_generation_ = 0; |
| 80 unsigned int NativeViewGLSurfaceEGL::last_multiswap_generation_ = 0; | 90 unsigned int NativeViewGLSurfaceEGL::last_multiswap_generation_ = 0; |
| 81 | 91 |
| 82 const unsigned int MULTISWAP_FRAME_VSYNC_THRESHOLD = 60; | 92 const unsigned int MULTISWAP_FRAME_VSYNC_THRESHOLD = 60; |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 std::vector<EGLint> display_attribs; | 146 std::vector<EGLint> display_attribs; |
| 137 | 147 |
| 138 display_attribs.push_back(EGL_PLATFORM_ANGLE_TYPE_ANGLE); | 148 display_attribs.push_back(EGL_PLATFORM_ANGLE_TYPE_ANGLE); |
| 139 display_attribs.push_back(platform_type); | 149 display_attribs.push_back(platform_type); |
| 140 | 150 |
| 141 if (warpDevice) { | 151 if (warpDevice) { |
| 142 display_attribs.push_back(EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE); | 152 display_attribs.push_back(EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE); |
| 143 display_attribs.push_back(EGL_PLATFORM_ANGLE_DEVICE_TYPE_WARP_ANGLE); | 153 display_attribs.push_back(EGL_PLATFORM_ANGLE_DEVICE_TYPE_WARP_ANGLE); |
| 144 } | 154 } |
| 145 | 155 |
| 156 #if defined(USE_X11) && !defined(OS_CHROMEOS) |
| 157 Visual* visual; |
| 158 ui::ChooseVisualForWindow(&visual, nullptr); |
| 159 display_attribs.push_back(EGL_X11_VISUAL_ID_ANGLE); |
| 160 display_attribs.push_back((EGLint)visual->visualid); |
| 161 #endif |
| 162 |
| 146 display_attribs.push_back(EGL_NONE); | 163 display_attribs.push_back(EGL_NONE); |
| 147 | 164 |
| 148 return eglGetPlatformDisplayEXT(EGL_PLATFORM_ANGLE_ANGLE, | 165 return eglGetPlatformDisplayEXT(EGL_PLATFORM_ANGLE_ANGLE, |
| 149 reinterpret_cast<void*>(native_display), | 166 reinterpret_cast<void*>(native_display), |
| 150 &display_attribs[0]); | 167 &display_attribs[0]); |
| 151 } | 168 } |
| 152 | 169 |
| 153 EGLDisplay GetDisplayFromType(DisplayType display_type, | 170 EGLDisplay GetDisplayFromType(DisplayType display_type, |
| 154 EGLNativeDisplayType native_display) { | 171 EGLNativeDisplayType native_display) { |
| 155 switch (display_type) { | 172 switch (display_type) { |
| (...skipping 766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 922 } | 939 } |
| 923 | 940 |
| 924 void* SurfacelessEGL::GetShareHandle() { | 941 void* SurfacelessEGL::GetShareHandle() { |
| 925 return NULL; | 942 return NULL; |
| 926 } | 943 } |
| 927 | 944 |
| 928 SurfacelessEGL::~SurfacelessEGL() { | 945 SurfacelessEGL::~SurfacelessEGL() { |
| 929 } | 946 } |
| 930 | 947 |
| 931 } // namespace gfx | 948 } // namespace gfx |
| OLD | NEW |