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 11 matching lines...) Expand all Loading... | |
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(USE_X11) | 29 #if defined(USE_X11) |
30 extern "C" { | 30 extern "C" { |
31 #include <X11/Xlib.h> | 31 #include <X11/Xlib.h> |
32 #define Status int | |
32 } | 33 } |
33 #endif | 34 #endif |
34 | 35 |
35 #if defined (USE_OZONE) | 36 #if defined (USE_OZONE) |
36 #include "ui/ozone/public/ozone_platform.h" | 37 #include "ui/ozone/public/ozone_platform.h" |
37 #include "ui/ozone/public/surface_factory_ozone.h" | 38 #include "ui/ozone/public/surface_factory_ozone.h" |
38 #endif | 39 #endif |
39 | 40 |
40 #if defined(USE_X11) && !defined(OS_CHROMEOS) | 41 #if defined(USE_X11) && !defined(OS_CHROMEOS) |
42 #include "ui/base/x/x11_util_internal.h" | |
41 #include "ui/gfx/x/x11_switches.h" | 43 #include "ui/gfx/x/x11_switches.h" |
42 #endif | 44 #endif |
43 | 45 |
44 #if !defined(EGL_FIXED_SIZE_ANGLE) | 46 #if !defined(EGL_FIXED_SIZE_ANGLE) |
45 #define EGL_FIXED_SIZE_ANGLE 0x3201 | 47 #define EGL_FIXED_SIZE_ANGLE 0x3201 |
46 #endif | 48 #endif |
47 | 49 |
48 #if !defined(EGL_OPENGL_ES3_BIT) | 50 #if !defined(EGL_OPENGL_ES3_BIT) |
49 #define EGL_OPENGL_ES3_BIT 0x00000040 | 51 #define EGL_OPENGL_ES3_BIT 0x00000040 |
50 #endif | 52 #endif |
(...skipping 18 matching lines...) Expand all Loading... | |
69 #define EGL_PLATFORM_ANGLE_DEVICE_TYPE_WARP_ANGLE 0x320B | 71 #define EGL_PLATFORM_ANGLE_DEVICE_TYPE_WARP_ANGLE 0x320B |
70 #define EGL_PLATFORM_ANGLE_DEVICE_TYPE_REFERENCE_ANGLE 0x320C | 72 #define EGL_PLATFORM_ANGLE_DEVICE_TYPE_REFERENCE_ANGLE 0x320C |
71 #endif /* EGL_ANGLE_platform_angle_d3d */ | 73 #endif /* EGL_ANGLE_platform_angle_d3d */ |
72 | 74 |
73 #ifndef EGL_ANGLE_platform_angle_opengl | 75 #ifndef EGL_ANGLE_platform_angle_opengl |
74 #define EGL_ANGLE_platform_angle_opengl 1 | 76 #define EGL_ANGLE_platform_angle_opengl 1 |
75 #define EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE 0x320D | 77 #define EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE 0x320D |
76 #define EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE 0x320E | 78 #define EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE 0x320E |
77 #endif /* EGL_ANGLE_platform_angle_opengl */ | 79 #endif /* EGL_ANGLE_platform_angle_opengl */ |
78 | 80 |
81 #ifndef EGL_ANGLE_x11_visual | |
82 #define EGL_ANGLE_x11_visual 1 | |
83 #define EGL_X11_VISUAL_ID_ANGLE 0x33A3 | |
84 #endif /* EGL_ANGLE_x11_visual */ | |
85 | |
79 using ui::GetLastEGLErrorString; | 86 using ui::GetLastEGLErrorString; |
80 | 87 |
81 namespace gfx { | 88 namespace gfx { |
82 | 89 |
83 #if defined(OS_WIN) | 90 #if defined(OS_WIN) |
84 unsigned int NativeViewGLSurfaceEGL::current_swap_generation_ = 0; | 91 unsigned int NativeViewGLSurfaceEGL::current_swap_generation_ = 0; |
85 unsigned int NativeViewGLSurfaceEGL::swaps_this_generation_ = 0; | 92 unsigned int NativeViewGLSurfaceEGL::swaps_this_generation_ = 0; |
86 unsigned int NativeViewGLSurfaceEGL::last_multiswap_generation_ = 0; | 93 unsigned int NativeViewGLSurfaceEGL::last_multiswap_generation_ = 0; |
87 | 94 |
88 const unsigned int MULTISWAP_FRAME_VSYNC_THRESHOLD = 60; | 95 const unsigned int MULTISWAP_FRAME_VSYNC_THRESHOLD = 60; |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
142 std::vector<EGLint> display_attribs; | 149 std::vector<EGLint> display_attribs; |
143 | 150 |
144 display_attribs.push_back(EGL_PLATFORM_ANGLE_TYPE_ANGLE); | 151 display_attribs.push_back(EGL_PLATFORM_ANGLE_TYPE_ANGLE); |
145 display_attribs.push_back(platform_type); | 152 display_attribs.push_back(platform_type); |
146 | 153 |
147 if (warpDevice) { | 154 if (warpDevice) { |
148 display_attribs.push_back(EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE); | 155 display_attribs.push_back(EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE); |
149 display_attribs.push_back(EGL_PLATFORM_ANGLE_DEVICE_TYPE_WARP_ANGLE); | 156 display_attribs.push_back(EGL_PLATFORM_ANGLE_DEVICE_TYPE_WARP_ANGLE); |
150 } | 157 } |
151 | 158 |
159 #if defined(USE_X11) && !defined(OS_CHROMEOS) | |
160 Visual* visual; | |
161 ui::ChooseVisualForWindow(&visual, nullptr); | |
162 display_attribs.push_back(EGL_X11_VISUAL_ID_ANGLE); | |
Ken Russell (switch to Gerrit)
2015/12/07 22:10:12
Should this code block test for the presence of th
Corentin Wallez
2015/12/07 22:13:12
I don't think it has to since the code above doesn
| |
163 display_attribs.push_back((EGLint)visual->visualid); | |
164 #endif | |
165 | |
152 display_attribs.push_back(EGL_NONE); | 166 display_attribs.push_back(EGL_NONE); |
153 | 167 |
154 return eglGetPlatformDisplayEXT(EGL_PLATFORM_ANGLE_ANGLE, | 168 return eglGetPlatformDisplayEXT(EGL_PLATFORM_ANGLE_ANGLE, |
155 reinterpret_cast<void*>(native_display), | 169 reinterpret_cast<void*>(native_display), |
156 &display_attribs[0]); | 170 &display_attribs[0]); |
157 } | 171 } |
158 | 172 |
159 EGLDisplay GetDisplayFromType(DisplayType display_type, | 173 EGLDisplay GetDisplayFromType(DisplayType display_type, |
160 EGLNativeDisplayType native_display) { | 174 EGLNativeDisplayType native_display) { |
161 switch (display_type) { | 175 switch (display_type) { |
(...skipping 828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
990 } | 1004 } |
991 | 1005 |
992 void* SurfacelessEGL::GetShareHandle() { | 1006 void* SurfacelessEGL::GetShareHandle() { |
993 return NULL; | 1007 return NULL; |
994 } | 1008 } |
995 | 1009 |
996 SurfacelessEGL::~SurfacelessEGL() { | 1010 SurfacelessEGL::~SurfacelessEGL() { |
997 } | 1011 } |
998 | 1012 |
999 } // namespace gfx | 1013 } // namespace gfx |
OLD | NEW |