OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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.h" | 5 #include "ui/gl/gl_surface.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "base/threading/worker_pool.h" | 13 #include "base/threading/worker_pool.h" |
14 #include "ui/gfx/native_widget_types.h" | 14 #include "ui/gfx/native_widget_types.h" |
15 #include "ui/gl/gl_context.h" | 15 #include "ui/gl/gl_context.h" |
16 #include "ui/gl/gl_image.h" | 16 #include "ui/gl/gl_image.h" |
17 #include "ui/gl/gl_image_linux_dma_buffer.h" | 17 #include "ui/gl/gl_image_linux_dma_buffer.h" |
18 #include "ui/gl/gl_implementation.h" | 18 #include "ui/gl/gl_implementation.h" |
19 #include "ui/gl/gl_surface_egl.h" | 19 #include "ui/gl/gl_surface_egl.h" |
20 #include "ui/gl/gl_surface_osmesa.h" | 20 #include "ui/gl/gl_surface_osmesa.h" |
21 #include "ui/gl/gl_surface_stub.h" | 21 #include "ui/gl/gl_surface_stub.h" |
22 #include "ui/gl/scoped_binders.h" | 22 #include "ui/gl/scoped_binders.h" |
23 #include "ui/gl/scoped_make_current.h" | 23 #include "ui/gl/scoped_make_current.h" |
24 #include "ui/ozone/public/native_pixmap.h" | 24 #include "ui/ozone/public/native_pixmap.h" |
| 25 #include "ui/ozone/public/ozone_platform.h" |
25 #include "ui/ozone/public/surface_factory_ozone.h" | 26 #include "ui/ozone/public/surface_factory_ozone.h" |
26 #include "ui/ozone/public/surface_ozone_egl.h" | 27 #include "ui/ozone/public/surface_ozone_egl.h" |
27 | 28 |
28 namespace gfx { | 29 namespace gfx { |
29 | 30 |
30 namespace { | 31 namespace { |
31 | 32 |
32 void WaitForFence(EGLDisplay display, EGLSyncKHR fence) { | 33 void WaitForFence(EGLDisplay display, EGLSyncKHR fence) { |
33 eglClientWaitSyncKHR(display, fence, EGL_SYNC_FLUSH_COMMANDS_BIT_KHR, | 34 eglClientWaitSyncKHR(display, fence, EGL_SYNC_FLUSH_COMMANDS_BIT_KHR, |
34 EGL_FOREVER_KHR); | 35 EGL_FOREVER_KHR); |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 GLuint textures_[2]; | 388 GLuint textures_[2]; |
388 scoped_refptr<GLImage> images_[2]; | 389 scoped_refptr<GLImage> images_[2]; |
389 int current_surface_; | 390 int current_surface_; |
390 DISALLOW_COPY_AND_ASSIGN(GLSurfaceOzoneSurfacelessSurfaceImpl); | 391 DISALLOW_COPY_AND_ASSIGN(GLSurfaceOzoneSurfacelessSurfaceImpl); |
391 }; | 392 }; |
392 | 393 |
393 } // namespace | 394 } // namespace |
394 | 395 |
395 // static | 396 // static |
396 bool GLSurface::InitializeOneOffInternal() { | 397 bool GLSurface::InitializeOneOffInternal() { |
| 398 ui::OzonePlatform::InitializeForGpuPostMainLoop(); |
397 switch (GetGLImplementation()) { | 399 switch (GetGLImplementation()) { |
398 case kGLImplementationEGLGLES2: | 400 case kGLImplementationEGLGLES2: |
399 if (!GLSurfaceEGL::InitializeOneOff()) { | 401 if (!GLSurfaceEGL::InitializeOneOff()) { |
400 LOG(ERROR) << "GLSurfaceEGL::InitializeOneOff failed."; | 402 LOG(ERROR) << "GLSurfaceEGL::InitializeOneOff failed."; |
401 return false; | 403 return false; |
402 } | 404 } |
403 | 405 |
404 return true; | 406 return true; |
405 case kGLImplementationOSMesaGL: | 407 case kGLImplementationOSMesaGL: |
406 case kGLImplementationMockGL: | 408 case kGLImplementationMockGL: |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 NOTREACHED(); | 503 NOTREACHED(); |
502 return NULL; | 504 return NULL; |
503 } | 505 } |
504 } | 506 } |
505 | 507 |
506 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay() { | 508 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay() { |
507 return ui::SurfaceFactoryOzone::GetInstance()->GetNativeDisplay(); | 509 return ui::SurfaceFactoryOzone::GetInstance()->GetNativeDisplay(); |
508 } | 510 } |
509 | 511 |
510 } // namespace gfx | 512 } // namespace gfx |
OLD | NEW |