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