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

Side by Side Diff: ui/gl/gl_surface_egl.h

Issue 2102443003: Break //ui/gl/ dependency on //ui/ozone. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@gl_bindings
Patch Set: GYP again. Created 4 years, 5 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 unified diff | Download patch
OLDNEW
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 #ifndef UI_GL_GL_SURFACE_EGL_H_ 5 #ifndef UI_GL_GL_SURFACE_EGL_H_
6 #define UI_GL_GL_SURFACE_EGL_H_ 6 #define UI_GL_GL_SURFACE_EGL_H_
7 7
8 #if defined(OS_WIN) 8 #if defined(OS_WIN)
9 #include <windows.h> 9 #include <windows.h>
10 #endif 10 #endif
11 11
12 #include <memory> 12 #include <memory>
13 #include <string> 13 #include <string>
14 14
15 #include "base/command_line.h" 15 #include "base/command_line.h"
16 #include "base/compiler_specific.h" 16 #include "base/compiler_specific.h"
17 #include "base/macros.h" 17 #include "base/macros.h"
18 #include "base/time/time.h" 18 #include "base/time/time.h"
19 #include "build/build_config.h" 19 #include "build/build_config.h"
20 #include "ui/gfx/geometry/size.h" 20 #include "ui/gfx/geometry/size.h"
21 #include "ui/gfx/vsync_provider.h" 21 #include "ui/gfx/vsync_provider.h"
22 #include "ui/gl/gl_bindings.h" 22 #include "ui/gl/gl_bindings.h"
23 #include "ui/gl/gl_export.h" 23 #include "ui/gl/gl_export.h"
24 #include "ui/gl/gl_surface.h" 24 #include "ui/gl/gl_surface.h"
25 #include "ui/gl/gl_surface_overlay.h" 25 #include "ui/gl/gl_surface_overlay.h"
26 26
27 namespace gl { 27 namespace gl {
28 28
29 // Get default EGL display for GLSurfaceEGL (differs by platform).
30 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay();
31
32 // If adding a new type, also add it to EGLDisplayType in 29 // If adding a new type, also add it to EGLDisplayType in
33 // tools/metrics/histograms/histograms.xml. Don't remove or reorder entries. 30 // tools/metrics/histograms/histograms.xml. Don't remove or reorder entries.
34 enum DisplayType { 31 enum DisplayType {
35 DEFAULT = 0, 32 DEFAULT = 0,
36 SWIFT_SHADER = 1, 33 SWIFT_SHADER = 1,
37 ANGLE_WARP = 2, 34 ANGLE_WARP = 2,
38 ANGLE_D3D9 = 3, 35 ANGLE_D3D9 = 3,
39 ANGLE_D3D11 = 4, 36 ANGLE_D3D11 = 4,
40 ANGLE_OPENGL = 5, 37 ANGLE_OPENGL = 5,
41 ANGLE_OPENGLES = 6, 38 ANGLE_OPENGLES = 6,
42 DISPLAY_TYPE_MAX = 7, 39 DISPLAY_TYPE_MAX = 7,
43 }; 40 };
44 41
45 GL_EXPORT void GetEGLInitDisplays(bool supports_angle_d3d, 42 GL_EXPORT void GetEGLInitDisplays(bool supports_angle_d3d,
46 bool supports_angle_opengl, 43 bool supports_angle_opengl,
47 const base::CommandLine* command_line, 44 const base::CommandLine* command_line,
48 std::vector<DisplayType>* init_displays); 45 std::vector<DisplayType>* init_displays);
49 46
50 // Interface for EGL surface. 47 // Interface for EGL surface.
51 class GL_EXPORT GLSurfaceEGL : public GLSurface { 48 class GL_EXPORT GLSurfaceEGL : public GLSurface {
52 public: 49 public:
53 GLSurfaceEGL(); 50 GLSurfaceEGL();
54 51
55 // Implement GLSurface. 52 // Implement GLSurface.
56 EGLDisplay GetDisplay() override; 53 EGLDisplay GetDisplay() override;
57 EGLConfig GetConfig() override; 54 EGLConfig GetConfig() override;
58 GLSurface::Format GetFormat() override; 55 GLSurface::Format GetFormat() override;
59 56
57 // Sets the native display for EGL. Should be set before calling
58 // InitializeOneOff() or InitializeDisplay().
59 static void SetNativeDisplay(EGLNativeDisplayType native_display);
piman 2016/07/06 21:02:16 Could we instead pass the native display explicitl
kylechar 2016/07/07 13:18:05 The problem with doing that is DriverEGL::GetPlatf
piman 2016/07/07 20:37:17 So, unless I'm reading things incorrectly, it look
kylechar 2016/07/08 15:55:05 Yep, I totally missed that. Good catch. I've imple
60
60 static bool InitializeOneOff(); 61 static bool InitializeOneOff();
61 static EGLDisplay GetHardwareDisplay(); 62 static EGLDisplay GetHardwareDisplay();
62 static EGLDisplay InitializeDisplay(); 63 static EGLDisplay InitializeDisplay();
63 static EGLNativeDisplayType GetNativeDisplay(); 64 static EGLNativeDisplayType GetNativeDisplay();
64 65
65 // These aren't particularly tied to surfaces, but since we already 66 // These aren't particularly tied to surfaces, but since we already
66 // have the static InitializeOneOff here, it's easiest to reuse its 67 // have the static InitializeOneOff here, it's easiest to reuse its
67 // initialization guards. 68 // initialization guards.
68 static const char* GetEGLExtensions(); 69 static const char* GetEGLExtensions();
69 static bool HasEGLExtension(const char* name); 70 static bool HasEGLExtension(const char* name);
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 ~SurfacelessEGL() override; 208 ~SurfacelessEGL() override;
208 209
209 private: 210 private:
210 gfx::Size size_; 211 gfx::Size size_;
211 DISALLOW_COPY_AND_ASSIGN(SurfacelessEGL); 212 DISALLOW_COPY_AND_ASSIGN(SurfacelessEGL);
212 }; 213 };
213 214
214 } // namespace gl 215 } // namespace gl
215 216
216 #endif // UI_GL_GL_SURFACE_EGL_H_ 217 #endif // UI_GL_GL_SURFACE_EGL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698