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_egl.h" | 5 #include "ui/gl/gl_surface_egl.h" |
6 | 6 |
7 #if defined(OS_ANDROID) | 7 #if defined(OS_ANDROID) |
8 #include <android/native_window_jni.h> | 8 #include <android/native_window_jni.h> |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 surface_ = eglCreateWindowSurface( | 388 surface_ = eglCreateWindowSurface( |
389 GetDisplay(), GetConfig(), window_, &egl_window_attributes[0]); | 389 GetDisplay(), GetConfig(), window_, &egl_window_attributes[0]); |
390 | 390 |
391 if (!surface_) { | 391 if (!surface_) { |
392 LOG(ERROR) << "eglCreateWindowSurface failed with error " | 392 LOG(ERROR) << "eglCreateWindowSurface failed with error " |
393 << GetLastEGLErrorString(); | 393 << GetLastEGLErrorString(); |
394 Destroy(); | 394 Destroy(); |
395 return false; | 395 return false; |
396 } | 396 } |
397 | 397 |
398 EGLint surfaceVal; | 398 if (gfx::g_driver_egl.ext.b_EGL_NV_post_sub_buffer) { |
399 EGLBoolean retVal = eglQuerySurface(GetDisplay(), | 399 EGLint surfaceVal; |
400 surface_, | 400 EGLBoolean retVal = eglQuerySurface( |
401 EGL_POST_SUB_BUFFER_SUPPORTED_NV, | 401 GetDisplay(), surface_, EGL_POST_SUB_BUFFER_SUPPORTED_NV, &surfaceVal); |
402 &surfaceVal); | 402 supports_post_sub_buffer_ = (surfaceVal && retVal) == EGL_TRUE; |
403 supports_post_sub_buffer_ = (surfaceVal && retVal) == EGL_TRUE; | 403 } |
404 | 404 |
405 if (sync_provider) | 405 if (sync_provider) |
406 vsync_provider_.reset(sync_provider.release()); | 406 vsync_provider_.reset(sync_provider.release()); |
407 else if (g_egl_sync_control_supported) | 407 else if (g_egl_sync_control_supported) |
408 vsync_provider_.reset(new EGLSyncControlVSyncProvider(surface_)); | 408 vsync_provider_.reset(new EGLSyncControlVSyncProvider(surface_)); |
409 return true; | 409 return true; |
410 } | 410 } |
411 | 411 |
412 void NativeViewGLSurfaceEGL::Destroy() { | 412 void NativeViewGLSurfaceEGL::Destroy() { |
413 if (surface_) { | 413 if (surface_) { |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
760 } | 760 } |
761 | 761 |
762 void* SurfacelessEGL::GetShareHandle() { | 762 void* SurfacelessEGL::GetShareHandle() { |
763 return NULL; | 763 return NULL; |
764 } | 764 } |
765 | 765 |
766 SurfacelessEGL::~SurfacelessEGL() { | 766 SurfacelessEGL::~SurfacelessEGL() { |
767 } | 767 } |
768 | 768 |
769 } // namespace gfx | 769 } // namespace gfx |
OLD | NEW |