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

Side by Side Diff: ui/gfx/gl/gl_surface_linux.cc

Issue 10009024: Remove WAYLAND port (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync Created 8 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « ui/gfx/gl/gl_surface_egl.cc ('k') | ui/gfx/native_widget_types.h » ('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 (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/gfx/gl/gl_surface.h" 5 #include "ui/gfx/gl/gl_surface.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #if !defined(USE_WAYLAND)
11 #include "third_party/mesa/MesaLib/include/GL/osmesa.h" 10 #include "third_party/mesa/MesaLib/include/GL/osmesa.h"
12 #endif
13 #include "ui/gfx/gl/gl_bindings.h" 11 #include "ui/gfx/gl/gl_bindings.h"
14 #include "ui/gfx/gl/gl_implementation.h" 12 #include "ui/gfx/gl/gl_implementation.h"
15 #include "ui/gfx/gl/gl_surface_egl.h" 13 #include "ui/gfx/gl/gl_surface_egl.h"
16 #if !defined(USE_WAYLAND)
17 #include "ui/gfx/gl/gl_surface_glx.h" 14 #include "ui/gfx/gl/gl_surface_glx.h"
18 #include "ui/gfx/gl/gl_surface_osmesa.h" 15 #include "ui/gfx/gl/gl_surface_osmesa.h"
19 #endif
20 #include "ui/gfx/gl/gl_surface_stub.h" 16 #include "ui/gfx/gl/gl_surface_stub.h"
21 17
22 namespace gfx { 18 namespace gfx {
23 19
24 #if !defined(USE_WAYLAND)
25
26 namespace { 20 namespace {
27 Display* g_osmesa_display; 21 Display* g_osmesa_display;
28 } // namespace anonymous 22 } // namespace anonymous
29 23
30 // This OSMesa GL surface can use XLib to swap the contents of the buffer to a 24 // This OSMesa GL surface can use XLib to swap the contents of the buffer to a
31 // view. 25 // view.
32 class NativeViewGLSurfaceOSMesa : public GLSurfaceOSMesa { 26 class NativeViewGLSurfaceOSMesa : public GLSurfaceOSMesa {
33 public: 27 public:
34 explicit NativeViewGLSurfaceOSMesa(gfx::AcceleratedWidget window); 28 explicit NativeViewGLSurfaceOSMesa(gfx::AcceleratedWidget window);
35 virtual ~NativeViewGLSurfaceOSMesa(); 29 virtual ~NativeViewGLSurfaceOSMesa();
(...skipping 11 matching lines...) Expand all
47 41
48 private: 42 private:
49 GC window_graphics_context_; 43 GC window_graphics_context_;
50 gfx::AcceleratedWidget window_; 44 gfx::AcceleratedWidget window_;
51 GC pixmap_graphics_context_; 45 GC pixmap_graphics_context_;
52 Pixmap pixmap_; 46 Pixmap pixmap_;
53 47
54 DISALLOW_COPY_AND_ASSIGN(NativeViewGLSurfaceOSMesa); 48 DISALLOW_COPY_AND_ASSIGN(NativeViewGLSurfaceOSMesa);
55 }; 49 };
56 50
57 #endif // !USE_WAYLAND
58
59 bool GLSurface::InitializeOneOffInternal() { 51 bool GLSurface::InitializeOneOffInternal() {
60 switch (GetGLImplementation()) { 52 switch (GetGLImplementation()) {
61 #if !defined(USE_WAYLAND)
62 case kGLImplementationDesktopGL: 53 case kGLImplementationDesktopGL:
63 if (!GLSurfaceGLX::InitializeOneOff()) { 54 if (!GLSurfaceGLX::InitializeOneOff()) {
64 LOG(ERROR) << "GLSurfaceGLX::InitializeOneOff failed."; 55 LOG(ERROR) << "GLSurfaceGLX::InitializeOneOff failed.";
65 return false; 56 return false;
66 } 57 }
67 break; 58 break;
68 case kGLImplementationOSMesaGL: 59 case kGLImplementationOSMesaGL:
69 if (!NativeViewGLSurfaceOSMesa::InitializeOneOff()) { 60 if (!NativeViewGLSurfaceOSMesa::InitializeOneOff()) {
70 LOG(ERROR) << "NativeViewGLSurfaceOSMesa::InitializeOneOff failed."; 61 LOG(ERROR) << "NativeViewGLSurfaceOSMesa::InitializeOneOff failed.";
71 return false; 62 return false;
72 } 63 }
73 break; 64 break;
74 #endif
75 case kGLImplementationEGLGLES2: 65 case kGLImplementationEGLGLES2:
76 if (!GLSurfaceEGL::InitializeOneOff()) { 66 if (!GLSurfaceEGL::InitializeOneOff()) {
77 LOG(ERROR) << "GLSurfaceEGL::InitializeOneOff failed."; 67 LOG(ERROR) << "GLSurfaceEGL::InitializeOneOff failed.";
78 return false; 68 return false;
79 } 69 }
80 break; 70 break;
81 default: 71 default:
82 break; 72 break;
83 } 73 }
84 74
85 return true; 75 return true;
86 } 76 }
87 77
88 #if !defined(USE_WAYLAND)
89
90 NativeViewGLSurfaceOSMesa::NativeViewGLSurfaceOSMesa( 78 NativeViewGLSurfaceOSMesa::NativeViewGLSurfaceOSMesa(
91 gfx::AcceleratedWidget window) 79 gfx::AcceleratedWidget window)
92 : GLSurfaceOSMesa(OSMESA_BGRA, gfx::Size(1, 1)), 80 : GLSurfaceOSMesa(OSMESA_BGRA, gfx::Size(1, 1)),
93 window_graphics_context_(0), 81 window_graphics_context_(0),
94 window_(window), 82 window_(window),
95 pixmap_graphics_context_(0), 83 pixmap_graphics_context_(0),
96 pixmap_(0) { 84 pixmap_(0) {
97 DCHECK(window); 85 DCHECK(window);
98 } 86 }
99 87
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 pixmap_, 253 pixmap_,
266 window_, 254 window_,
267 window_graphics_context_, 255 window_graphics_context_,
268 x, y, 256 x, y,
269 width, height, 257 width, height,
270 x, y); 258 x, y);
271 259
272 return true; 260 return true;
273 } 261 }
274 262
275 #endif // !USE_WAYLAND
276
277 scoped_refptr<GLSurface> GLSurface::CreateViewGLSurface( 263 scoped_refptr<GLSurface> GLSurface::CreateViewGLSurface(
278 bool software, 264 bool software,
279 gfx::AcceleratedWidget window) { 265 gfx::AcceleratedWidget window) {
280 if (software) 266 if (software)
281 return NULL; 267 return NULL;
282 268
283 switch (GetGLImplementation()) { 269 switch (GetGLImplementation()) {
284 #if !defined(USE_WAYLAND)
285 case kGLImplementationOSMesaGL: { 270 case kGLImplementationOSMesaGL: {
286 scoped_refptr<GLSurface> surface( 271 scoped_refptr<GLSurface> surface(
287 new NativeViewGLSurfaceOSMesa(window)); 272 new NativeViewGLSurfaceOSMesa(window));
288 if (!surface->Initialize()) 273 if (!surface->Initialize())
289 return NULL; 274 return NULL;
290 275
291 return surface; 276 return surface;
292 } 277 }
293 case kGLImplementationDesktopGL: { 278 case kGLImplementationDesktopGL: {
294 scoped_refptr<GLSurface> surface(new NativeViewGLSurfaceGLX( 279 scoped_refptr<GLSurface> surface(new NativeViewGLSurfaceGLX(
295 window)); 280 window));
296 if (!surface->Initialize()) 281 if (!surface->Initialize())
297 return NULL; 282 return NULL;
298 283
299 return surface; 284 return surface;
300 } 285 }
301 #endif
302 case kGLImplementationEGLGLES2: { 286 case kGLImplementationEGLGLES2: {
303 scoped_refptr<GLSurface> surface(new NativeViewGLSurfaceEGL( 287 scoped_refptr<GLSurface> surface(new NativeViewGLSurfaceEGL(
304 false, window)); 288 false, window));
305 if (!surface->Initialize()) 289 if (!surface->Initialize())
306 return NULL; 290 return NULL;
307 291
308 return surface; 292 return surface;
309 } 293 }
310 case kGLImplementationMockGL: 294 case kGLImplementationMockGL:
311 return new GLSurfaceStub; 295 return new GLSurfaceStub;
312 default: 296 default:
313 NOTREACHED(); 297 NOTREACHED();
314 return NULL; 298 return NULL;
315 } 299 }
316 } 300 }
317 301
318 scoped_refptr<GLSurface> GLSurface::CreateOffscreenGLSurface( 302 scoped_refptr<GLSurface> GLSurface::CreateOffscreenGLSurface(
319 bool software, 303 bool software,
320 const gfx::Size& size) { 304 const gfx::Size& size) {
321 if (software) 305 if (software)
322 return NULL; 306 return NULL;
323 307
324 switch (GetGLImplementation()) { 308 switch (GetGLImplementation()) {
325 #if !defined(USE_WAYLAND)
326 case kGLImplementationOSMesaGL: { 309 case kGLImplementationOSMesaGL: {
327 scoped_refptr<GLSurface> surface(new GLSurfaceOSMesa(OSMESA_RGBA, 310 scoped_refptr<GLSurface> surface(new GLSurfaceOSMesa(OSMESA_RGBA,
328 size)); 311 size));
329 if (!surface->Initialize()) 312 if (!surface->Initialize())
330 return NULL; 313 return NULL;
331 314
332 return surface; 315 return surface;
333 } 316 }
334 case kGLImplementationDesktopGL: { 317 case kGLImplementationDesktopGL: {
335 scoped_refptr<GLSurface> surface(new PbufferGLSurfaceGLX(size)); 318 scoped_refptr<GLSurface> surface(new PbufferGLSurfaceGLX(size));
336 if (!surface->Initialize()) 319 if (!surface->Initialize())
337 return NULL; 320 return NULL;
338 321
339 return surface; 322 return surface;
340 } 323 }
341 #endif
342 case kGLImplementationEGLGLES2: { 324 case kGLImplementationEGLGLES2: {
343 scoped_refptr<GLSurface> surface(new PbufferGLSurfaceEGL(false, size)); 325 scoped_refptr<GLSurface> surface(new PbufferGLSurfaceEGL(false, size));
344 if (!surface->Initialize()) 326 if (!surface->Initialize())
345 return NULL; 327 return NULL;
346 328
347 return surface; 329 return surface;
348 } 330 }
349 case kGLImplementationMockGL: 331 case kGLImplementationMockGL:
350 return new GLSurfaceStub; 332 return new GLSurfaceStub;
351 default: 333 default:
352 NOTREACHED(); 334 NOTREACHED();
353 return NULL; 335 return NULL;
354 } 336 }
355 } 337 }
356 338
357 } // namespace gfx 339 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/gl/gl_surface_egl.cc ('k') | ui/gfx/native_widget_types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698