| 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 #include "ui/gl/gl_surface_glx.h" | 5 #include "ui/gl/gl_surface_glx.h" |
| 6 | 6 |
| 7 extern "C" { | 7 extern "C" { |
| 8 #include <X11/Xlib.h> | 8 #include <X11/Xlib.h> |
| 9 } | 9 } |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 #include "ui/gl/gl_implementation.h" | 30 #include "ui/gl/gl_implementation.h" |
| 31 #include "ui/gl/sync_control_vsync_provider.h" | 31 #include "ui/gl/sync_control_vsync_provider.h" |
| 32 | 32 |
| 33 namespace gl { | 33 namespace gl { |
| 34 | 34 |
| 35 namespace { | 35 namespace { |
| 36 | 36 |
| 37 Display* g_display = nullptr; | 37 Display* g_display = nullptr; |
| 38 bool g_glx_context_create = false; | 38 bool g_glx_context_create = false; |
| 39 bool g_glx_create_context_robustness_supported = false; | 39 bool g_glx_create_context_robustness_supported = false; |
| 40 bool g_glx_create_context_profile_supported = false; |
| 41 bool g_glx_create_context_profile_es2_supported = false; |
| 40 bool g_glx_texture_from_pixmap_supported = false; | 42 bool g_glx_texture_from_pixmap_supported = false; |
| 41 bool g_glx_oml_sync_control_supported = false; | 43 bool g_glx_oml_sync_control_supported = false; |
| 42 | 44 |
| 43 // Track support of glXGetMscRateOML separately from GLX_OML_sync_control as a | 45 // Track support of glXGetMscRateOML separately from GLX_OML_sync_control as a |
| 44 // whole since on some platforms (e.g. crosbug.com/34585), glXGetMscRateOML | 46 // whole since on some platforms (e.g. crosbug.com/34585), glXGetMscRateOML |
| 45 // always fails even though GLX_OML_sync_control is reported as being supported. | 47 // always fails even though GLX_OML_sync_control is reported as being supported. |
| 46 bool g_glx_get_msc_rate_oml_supported = false; | 48 bool g_glx_get_msc_rate_oml_supported = false; |
| 47 | 49 |
| 48 bool g_glx_sgi_video_sync_supported = false; | 50 bool g_glx_sgi_video_sync_supported = false; |
| 49 | 51 |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 | 386 |
| 385 if (major == 1 && minor < 3) { | 387 if (major == 1 && minor < 3) { |
| 386 LOG(ERROR) << "GLX 1.3 or later is required."; | 388 LOG(ERROR) << "GLX 1.3 or later is required."; |
| 387 return false; | 389 return false; |
| 388 } | 390 } |
| 389 | 391 |
| 390 g_glx_context_create = | 392 g_glx_context_create = |
| 391 HasGLXExtension("GLX_ARB_create_context"); | 393 HasGLXExtension("GLX_ARB_create_context"); |
| 392 g_glx_create_context_robustness_supported = | 394 g_glx_create_context_robustness_supported = |
| 393 HasGLXExtension("GLX_ARB_create_context_robustness"); | 395 HasGLXExtension("GLX_ARB_create_context_robustness"); |
| 396 g_glx_create_context_profile_supported = |
| 397 HasGLXExtension("GLX_ARB_create_context_profile"); |
| 398 g_glx_create_context_profile_es2_supported = |
| 399 HasGLXExtension("GLX_ARB_create_context_es2_profile"); |
| 394 g_glx_texture_from_pixmap_supported = | 400 g_glx_texture_from_pixmap_supported = |
| 395 HasGLXExtension("GLX_EXT_texture_from_pixmap"); | 401 HasGLXExtension("GLX_EXT_texture_from_pixmap"); |
| 396 g_glx_oml_sync_control_supported = | 402 g_glx_oml_sync_control_supported = |
| 397 HasGLXExtension("GLX_OML_sync_control"); | 403 HasGLXExtension("GLX_OML_sync_control"); |
| 398 g_glx_get_msc_rate_oml_supported = g_glx_oml_sync_control_supported; | 404 g_glx_get_msc_rate_oml_supported = g_glx_oml_sync_control_supported; |
| 399 g_glx_sgi_video_sync_supported = | 405 g_glx_sgi_video_sync_supported = |
| 400 HasGLXExtension("GLX_SGI_video_sync"); | 406 HasGLXExtension("GLX_SGI_video_sync"); |
| 401 | 407 |
| 402 if (!g_glx_get_msc_rate_oml_supported && g_glx_sgi_video_sync_supported) | 408 if (!g_glx_get_msc_rate_oml_supported && g_glx_sgi_video_sync_supported) |
| 403 SGIVideoSyncProviderThreadShim::display_ = gfx::OpenNewXDisplay(); | 409 SGIVideoSyncProviderThreadShim::display_ = gfx::OpenNewXDisplay(); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 420 bool GLSurfaceGLX::IsCreateContextSupported() { | 426 bool GLSurfaceGLX::IsCreateContextSupported() { |
| 421 return g_glx_context_create; | 427 return g_glx_context_create; |
| 422 } | 428 } |
| 423 | 429 |
| 424 // static | 430 // static |
| 425 bool GLSurfaceGLX::IsCreateContextRobustnessSupported() { | 431 bool GLSurfaceGLX::IsCreateContextRobustnessSupported() { |
| 426 return g_glx_create_context_robustness_supported; | 432 return g_glx_create_context_robustness_supported; |
| 427 } | 433 } |
| 428 | 434 |
| 429 // static | 435 // static |
| 436 bool GLSurfaceGLX::IsCreateContextProfileSupported() { |
| 437 return g_glx_create_context_profile_supported; |
| 438 } |
| 439 |
| 440 // static |
| 441 bool GLSurfaceGLX::IsCreateContextES2ProfileSupported() { |
| 442 return g_glx_create_context_profile_es2_supported; |
| 443 } |
| 444 |
| 445 // static |
| 430 bool GLSurfaceGLX::IsTextureFromPixmapSupported() { | 446 bool GLSurfaceGLX::IsTextureFromPixmapSupported() { |
| 431 return g_glx_texture_from_pixmap_supported; | 447 return g_glx_texture_from_pixmap_supported; |
| 432 } | 448 } |
| 433 | 449 |
| 434 // static | 450 // static |
| 435 bool GLSurfaceGLX::IsOMLSyncControlSupported() { | 451 bool GLSurfaceGLX::IsOMLSyncControlSupported() { |
| 436 return g_glx_oml_sync_control_supported; | 452 return g_glx_oml_sync_control_supported; |
| 437 } | 453 } |
| 438 | 454 |
| 439 void* GLSurfaceGLX::GetDisplay() { | 455 void* GLSurfaceGLX::GetDisplay() { |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 639 if (!config_) | 655 if (!config_) |
| 640 config_ = GetConfigForWindow(g_display, window_); | 656 config_ = GetConfigForWindow(g_display, window_); |
| 641 return config_; | 657 return config_; |
| 642 } | 658 } |
| 643 | 659 |
| 644 UnmappedNativeViewGLSurfaceGLX::~UnmappedNativeViewGLSurfaceGLX() { | 660 UnmappedNativeViewGLSurfaceGLX::~UnmappedNativeViewGLSurfaceGLX() { |
| 645 Destroy(); | 661 Destroy(); |
| 646 } | 662 } |
| 647 | 663 |
| 648 } // namespace gl | 664 } // namespace gl |
| OLD | NEW |