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 extern "C" { | 5 extern "C" { |
6 #include <X11/Xlib.h> | 6 #include <X11/Xlib.h> |
7 } | 7 } |
8 | 8 |
9 #include "ui/gl/gl_surface_glx.h" | 9 #include "ui/gl/gl_surface_glx.h" |
10 | 10 |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 | 310 |
311 SGIVideoSyncThread* SGIVideoSyncThread::g_video_sync_thread = NULL; | 311 SGIVideoSyncThread* SGIVideoSyncThread::g_video_sync_thread = NULL; |
312 | 312 |
313 // In order to take advantage of GLX_SGI_video_sync, we need a display | 313 // In order to take advantage of GLX_SGI_video_sync, we need a display |
314 // for use on a separate thread. We must allocate this before the sandbox | 314 // for use on a separate thread. We must allocate this before the sandbox |
315 // goes up (rather than on-demand when we start the thread). | 315 // goes up (rather than on-demand when we start the thread). |
316 Display* SGIVideoSyncProviderThreadShim::display_ = NULL; | 316 Display* SGIVideoSyncProviderThreadShim::display_ = NULL; |
317 | 317 |
318 } // namespace | 318 } // namespace |
319 | 319 |
320 GLSurfaceGLX::GLSurfaceGLX() {} | 320 GLSurfaceGLX::GLSurfaceGLX(SurfaceConfiguration requested_configuration) |
| 321 : GLSurface(requested_configuration) { |
| 322 } |
321 | 323 |
322 bool GLSurfaceGLX::InitializeOneOff() { | 324 bool GLSurfaceGLX::InitializeOneOff() { |
323 static bool initialized = false; | 325 static bool initialized = false; |
324 if (initialized) | 326 if (initialized) |
325 return true; | 327 return true; |
326 | 328 |
327 // http://crbug.com/245466 | 329 // http://crbug.com/245466 |
328 setenv("force_s3tc_enable", "true", 1); | 330 setenv("force_s3tc_enable", "true", 1); |
329 | 331 |
330 // SGIVideoSyncProviderShim (if instantiated) will issue X commands on | 332 // SGIVideoSyncProviderShim (if instantiated) will issue X commands on |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
522 // attempting to use GLX_ARB_create_context_robustness, in which | 524 // attempting to use GLX_ARB_create_context_robustness, in which |
523 // case we need a GLXFBConfig for the window in order to create a | 525 // case we need a GLXFBConfig for the window in order to create a |
524 // context for it. | 526 // context for it. |
525 // | 527 // |
526 // TODO(kbr): this is not a reliable code path. On platforms which | 528 // TODO(kbr): this is not a reliable code path. On platforms which |
527 // support it, we should use glXChooseFBConfig in the browser | 529 // support it, we should use glXChooseFBConfig in the browser |
528 // process to choose the FBConfig and from there the X Visual to | 530 // process to choose the FBConfig and from there the X Visual to |
529 // use when creating the window in the first place. Then we can | 531 // use when creating the window in the first place. Then we can |
530 // pass that FBConfig down rather than attempting to reconstitute | 532 // pass that FBConfig down rather than attempting to reconstitute |
531 // it. | 533 // it. |
| 534 // |
| 535 // TODO(iansf): Perhaps instead of kbr's suggestion above, we can |
| 536 // now use GLSurface::GetSurfaceConfiguration to use the returned |
| 537 // gfx::SurfaceConfiguration with glXChooseFBConfig in a manner |
| 538 // similar to that used in NativeViewGLSurfaceEGL::GetConfig. |
532 | 539 |
533 XWindowAttributes attributes; | 540 XWindowAttributes attributes; |
534 if (!XGetWindowAttributes( | 541 if (!XGetWindowAttributes( |
535 g_display, | 542 g_display, |
536 window_, | 543 window_, |
537 &attributes)) { | 544 &attributes)) { |
538 LOG(ERROR) << "XGetWindowAttributes failed for window " << | 545 LOG(ERROR) << "XGetWindowAttributes failed for window " << |
539 window_ << "."; | 546 window_ << "."; |
540 return NULL; | 547 return NULL; |
541 } | 548 } |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
674 | 681 |
675 void* PbufferGLSurfaceGLX::GetConfig() { | 682 void* PbufferGLSurfaceGLX::GetConfig() { |
676 return config_; | 683 return config_; |
677 } | 684 } |
678 | 685 |
679 PbufferGLSurfaceGLX::~PbufferGLSurfaceGLX() { | 686 PbufferGLSurfaceGLX::~PbufferGLSurfaceGLX() { |
680 Destroy(); | 687 Destroy(); |
681 } | 688 } |
682 | 689 |
683 } // namespace gfx | 690 } // namespace gfx |
OLD | NEW |