OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 extern "C" { | 5 extern "C" { |
6 #include <X11/Xlib.h> | 6 #include <X11/Xlib.h> |
7 } | 7 } |
8 | 8 |
9 #include "ui/gfx/gl/gl_surface_glx.h" | 9 #include "ui/gfx/gl/gl_surface_glx.h" |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/message_loop.h" |
14 #include "base/process_util.h" | 15 #include "base/process_util.h" |
15 #include "third_party/mesa/MesaLib/include/GL/osmesa.h" | 16 #include "third_party/mesa/MesaLib/include/GL/osmesa.h" |
16 #include "ui/base/x/x11_util.h" | 17 #include "ui/base/x/x11_util.h" |
17 #include "ui/gfx/gl/gl_bindings.h" | 18 #include "ui/gfx/gl/gl_bindings.h" |
18 #include "ui/gfx/gl/gl_implementation.h" | 19 #include "ui/gfx/gl/gl_implementation.h" |
19 | 20 |
20 namespace gfx { | 21 namespace gfx { |
21 | 22 |
22 namespace { | 23 namespace { |
23 | 24 |
(...skipping 17 matching lines...) Expand all Loading... |
41 } | 42 } |
42 | 43 |
43 GLSurfaceGLX::~GLSurfaceGLX() { | 44 GLSurfaceGLX::~GLSurfaceGLX() { |
44 } | 45 } |
45 | 46 |
46 bool GLSurfaceGLX::InitializeOneOff() { | 47 bool GLSurfaceGLX::InitializeOneOff() { |
47 static bool initialized = false; | 48 static bool initialized = false; |
48 if (initialized) | 49 if (initialized) |
49 return true; | 50 return true; |
50 | 51 |
51 g_display = XOpenDisplay(NULL); | 52 g_display = base::MessagePumpForUI::GetDefaultXDisplay(); |
52 if (!g_display) { | 53 if (!g_display) { |
53 LOG(ERROR) << "XOpenDisplay failed."; | 54 LOG(ERROR) << "XOpenDisplay failed."; |
54 return false; | 55 return false; |
55 } | 56 } |
56 | 57 |
57 int major, minor; | 58 int major, minor; |
58 if (!glXQueryVersion(g_display, &major, &minor)) { | 59 if (!glXQueryVersion(g_display, &major, &minor)) { |
59 LOG(ERROR) << "glxQueryVersion failed"; | 60 LOG(ERROR) << "glxQueryVersion failed"; |
60 return false; | 61 return false; |
61 } | 62 } |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 | 306 |
306 void* PbufferGLSurfaceGLX::GetHandle() { | 307 void* PbufferGLSurfaceGLX::GetHandle() { |
307 return reinterpret_cast<void*>(pbuffer_); | 308 return reinterpret_cast<void*>(pbuffer_); |
308 } | 309 } |
309 | 310 |
310 void* PbufferGLSurfaceGLX::GetConfig() { | 311 void* PbufferGLSurfaceGLX::GetConfig() { |
311 return config_; | 312 return config_; |
312 } | 313 } |
313 | 314 |
314 } // namespace gfx | 315 } // namespace gfx |
OLD | NEW |