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

Side by Side Diff: ui/ozone/platform/x11/x11_surface_factory.cc

Issue 2731733002: Convert Ozone GL OSMesa implementation. (Closed)
Patch Set: Fix rebase. Created 3 years, 9 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
« no previous file with comments | « ui/ozone/platform/x11/x11_surface_factory.h ('k') | ui/ozone/public/surface_factory_ozone.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/ozone/platform/x11/x11_surface_factory.h" 5 #include "ui/ozone/platform/x11/x11_surface_factory.h"
6 6
7 #include <X11/Xlib.h> 7 #include <X11/Xlib.h>
8 8
9 #include "base/memory/ptr_util.h"
9 #include "third_party/khronos/EGL/egl.h" 10 #include "third_party/khronos/EGL/egl.h"
10 #include "ui/gfx/x/x11_types.h" 11 #include "ui/gfx/x/x11_types.h"
11 #include "ui/gl/egl_util.h" 12 #include "ui/gl/egl_util.h"
12 #include "ui/gl/gl_surface_egl.h" 13 #include "ui/gl/gl_surface_egl.h"
13 #include "ui/ozone/common/egl_util.h" 14 #include "ui/ozone/common/egl_util.h"
14 #include "ui/ozone/common/gl_ozone_egl.h" 15 #include "ui/ozone/common/gl_ozone_egl.h"
16 #include "ui/ozone/common/gl_ozone_osmesa.h"
15 #include "ui/ozone/platform/x11/gl_ozone_glx.h" 17 #include "ui/ozone/platform/x11/gl_ozone_glx.h"
16 18
17 namespace ui { 19 namespace ui {
18 20
19 namespace { 21 namespace {
20 22
21 // GLSurface implementation for Ozone X11 EGL. 23 // GLSurface implementation for Ozone X11 EGL.
22 class GLSurfaceEGLOzoneX11 : public gl::NativeViewGLSurfaceEGL { 24 class GLSurfaceEGLOzoneX11 : public gl::NativeViewGLSurfaceEGL {
23 public: 25 public:
24 explicit GLSurfaceEGLOzoneX11(EGLNativeWindowType window); 26 explicit GLSurfaceEGLOzoneX11(EGLNativeWindowType window);
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 } 144 }
143 145
144 bool LoadGLES2Bindings() override { return LoadDefaultEGLGLES2Bindings(); } 146 bool LoadGLES2Bindings() override { return LoadDefaultEGLGLES2Bindings(); }
145 147
146 private: 148 private:
147 DISALLOW_COPY_AND_ASSIGN(GLOzoneEGLX11); 149 DISALLOW_COPY_AND_ASSIGN(GLOzoneEGLX11);
148 }; 150 };
149 151
150 } // namespace 152 } // namespace
151 153
152 X11SurfaceFactory::X11SurfaceFactory() { 154 X11SurfaceFactory::X11SurfaceFactory()
153 glx_implementation_.reset(new GLOzoneGLX()); 155 : glx_implementation_(base::MakeUnique<GLOzoneGLX>()),
154 egl_implementation_.reset(new GLOzoneEGLX11()); 156 egl_implementation_(base::MakeUnique<GLOzoneEGLX11>()),
155 } 157 osmesa_implementation_(base::MakeUnique<GLOzoneOSMesa>()) {}
156 158
157 X11SurfaceFactory::~X11SurfaceFactory() {} 159 X11SurfaceFactory::~X11SurfaceFactory() {}
158 160
159 std::vector<gl::GLImplementation> 161 std::vector<gl::GLImplementation>
160 X11SurfaceFactory::GetAllowedGLImplementations() { 162 X11SurfaceFactory::GetAllowedGLImplementations() {
161 std::vector<gl::GLImplementation> impls;
162 impls.push_back(gl::kGLImplementationEGLGLES2);
163 // DesktopGL (GLX) should be the first option when crbug.com/646982 is fixed. 163 // DesktopGL (GLX) should be the first option when crbug.com/646982 is fixed.
164 impls.push_back(gl::kGLImplementationDesktopGL); 164 return std::vector<gl::GLImplementation>{gl::kGLImplementationEGLGLES2,
165 impls.push_back(gl::kGLImplementationOSMesaGL); 165 gl::kGLImplementationDesktopGL,
166 return impls; 166 gl::kGLImplementationOSMesaGL};
167 } 167 }
168 168
169 GLOzone* X11SurfaceFactory::GetGLOzone(gl::GLImplementation implementation) { 169 GLOzone* X11SurfaceFactory::GetGLOzone(gl::GLImplementation implementation) {
170 switch (implementation) { 170 switch (implementation) {
171 case gl::kGLImplementationDesktopGL: 171 case gl::kGLImplementationDesktopGL:
172 return glx_implementation_.get(); 172 return glx_implementation_.get();
173 case gl::kGLImplementationEGLGLES2: 173 case gl::kGLImplementationEGLGLES2:
174 return egl_implementation_.get(); 174 return egl_implementation_.get();
175 case gl::kGLImplementationOSMesaGL:
176 return osmesa_implementation_.get();
175 default: 177 default:
176 return nullptr; 178 return nullptr;
177 } 179 }
178 } 180 }
179 181
180 } // namespace ui 182 } // namespace ui
OLDNEW
« no previous file with comments | « ui/ozone/platform/x11/x11_surface_factory.h ('k') | ui/ozone/public/surface_factory_ozone.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698