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

Side by Side Diff: ui/gl/gl_surface_glx.cc

Issue 1390083002: Revert of ui: Add GLImage unit test framework. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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
« no previous file with comments | « ui/gl/gl_image_shared_memory_unittest.cc ('k') | ui/gl/gl_tests.gyp » ('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 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 16 matching lines...) Expand all
27 #include "ui/gfx/x/x11_types.h" 27 #include "ui/gfx/x/x11_types.h"
28 #include "ui/gl/gl_bindings.h" 28 #include "ui/gl/gl_bindings.h"
29 #include "ui/gl/gl_implementation.h" 29 #include "ui/gl/gl_implementation.h"
30 #include "ui/gl/sync_control_vsync_provider.h" 30 #include "ui/gl/sync_control_vsync_provider.h"
31 31
32 namespace gfx { 32 namespace gfx {
33 33
34 namespace { 34 namespace {
35 35
36 Display* g_display = nullptr; 36 Display* g_display = nullptr;
37 const char* g_glx_extensions = nullptr;
37 bool g_glx_context_create = false; 38 bool g_glx_context_create = false;
38 bool g_glx_create_context_robustness_supported = false; 39 bool g_glx_create_context_robustness_supported = false;
39 bool g_glx_texture_from_pixmap_supported = false; 40 bool g_glx_texture_from_pixmap_supported = false;
40 bool g_glx_oml_sync_control_supported = false; 41 bool g_glx_oml_sync_control_supported = false;
41 42
42 // 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
43 // whole since on some platforms (e.g. crosbug.com/34585), glXGetMscRateOML 44 // whole since on some platforms (e.g. crosbug.com/34585), glXGetMscRateOML
44 // 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.
45 bool g_glx_get_msc_rate_oml_supported = false; 46 bool g_glx_get_msc_rate_oml_supported = false;
46 47
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 if (!glXQueryVersion(g_display, &major, &minor)) { 342 if (!glXQueryVersion(g_display, &major, &minor)) {
342 LOG(ERROR) << "glxQueryVersion failed"; 343 LOG(ERROR) << "glxQueryVersion failed";
343 return false; 344 return false;
344 } 345 }
345 346
346 if (major == 1 && minor < 3) { 347 if (major == 1 && minor < 3) {
347 LOG(ERROR) << "GLX 1.3 or later is required."; 348 LOG(ERROR) << "GLX 1.3 or later is required.";
348 return false; 349 return false;
349 } 350 }
350 351
352 g_glx_extensions = glXQueryExtensionsString(g_display, 0);
351 g_glx_context_create = 353 g_glx_context_create =
352 HasGLXExtension("GLX_ARB_create_context"); 354 HasGLXExtension("GLX_ARB_create_context");
353 g_glx_create_context_robustness_supported = 355 g_glx_create_context_robustness_supported =
354 HasGLXExtension("GLX_ARB_create_context_robustness"); 356 HasGLXExtension("GLX_ARB_create_context_robustness");
355 g_glx_texture_from_pixmap_supported = 357 g_glx_texture_from_pixmap_supported =
356 HasGLXExtension("GLX_EXT_texture_from_pixmap"); 358 HasGLXExtension("GLX_EXT_texture_from_pixmap");
357 g_glx_oml_sync_control_supported = 359 g_glx_oml_sync_control_supported =
358 HasGLXExtension("GLX_OML_sync_control"); 360 HasGLXExtension("GLX_OML_sync_control");
359 g_glx_get_msc_rate_oml_supported = g_glx_oml_sync_control_supported; 361 g_glx_get_msc_rate_oml_supported = g_glx_oml_sync_control_supported;
360 g_glx_sgi_video_sync_supported = 362 g_glx_sgi_video_sync_supported =
361 HasGLXExtension("GLX_SGI_video_sync"); 363 HasGLXExtension("GLX_SGI_video_sync");
362 364
363 if (!g_glx_get_msc_rate_oml_supported && g_glx_sgi_video_sync_supported) 365 if (!g_glx_get_msc_rate_oml_supported && g_glx_sgi_video_sync_supported)
364 SGIVideoSyncProviderThreadShim::display_ = gfx::OpenNewXDisplay(); 366 SGIVideoSyncProviderThreadShim::display_ = gfx::OpenNewXDisplay();
365 367
366 initialized = true; 368 initialized = true;
367 return true; 369 return true;
368 } 370 }
369 371
370 // static 372 // static
371 const char* GLSurfaceGLX::GetGLXExtensions() { 373 const char* GLSurfaceGLX::GetGLXExtensions() {
372 return glXQueryExtensionsString(g_display, 0); 374 return g_glx_extensions;
373 } 375 }
374 376
375 // static 377 // static
376 bool GLSurfaceGLX::HasGLXExtension(const char* name) { 378 bool GLSurfaceGLX::HasGLXExtension(const char* name) {
377 return ExtensionsContain(GetGLXExtensions(), name); 379 return ExtensionsContain(GetGLXExtensions(), name);
378 } 380 }
379 381
380 // static 382 // static
381 bool GLSurfaceGLX::IsCreateContextSupported() { 383 bool GLSurfaceGLX::IsCreateContextSupported() {
382 return g_glx_context_create; 384 return g_glx_context_create;
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 if (!config_) 636 if (!config_)
635 config_ = GLSurfaceGLX::GetConfig(window_); 637 config_ = GLSurfaceGLX::GetConfig(window_);
636 return config_; 638 return config_;
637 } 639 }
638 640
639 UnmappedNativeViewGLSurfaceGLX::~UnmappedNativeViewGLSurfaceGLX() { 641 UnmappedNativeViewGLSurfaceGLX::~UnmappedNativeViewGLSurfaceGLX() {
640 Destroy(); 642 Destroy();
641 } 643 }
642 644
643 } // namespace gfx 645 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gl/gl_image_shared_memory_unittest.cc ('k') | ui/gl/gl_tests.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698