| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "gpu/command_buffer/service/async_pixel_transfer_manager.h" | 5 #include "gpu/command_buffer/service/async_pixel_transfer_manager.h" |
| 6 | 6 |
| 7 #include "base/android/sys_utils.h" |
| 7 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
| 8 #include "gpu/command_buffer/service/async_pixel_transfer_manager_egl.h" | 9 #include "gpu/command_buffer/service/async_pixel_transfer_manager_egl.h" |
| 9 #include "gpu/command_buffer/service/async_pixel_transfer_manager_idle.h" | 10 #include "gpu/command_buffer/service/async_pixel_transfer_manager_idle.h" |
| 10 #include "gpu/command_buffer/service/async_pixel_transfer_manager_stub.h" | 11 #include "gpu/command_buffer/service/async_pixel_transfer_manager_stub.h" |
| 11 #include "gpu/command_buffer/service/async_pixel_transfer_manager_sync.h" | 12 #include "gpu/command_buffer/service/async_pixel_transfer_manager_sync.h" |
| 12 #include "ui/gl/gl_context.h" | 13 #include "ui/gl/gl_context.h" |
| 13 #include "ui/gl/gl_implementation.h" | 14 #include "ui/gl/gl_implementation.h" |
| 14 | 15 |
| 15 namespace gpu { | 16 namespace gpu { |
| 16 namespace { | 17 namespace { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 31 | 32 |
| 32 } | 33 } |
| 33 | 34 |
| 34 // We only used threaded uploads when we can: | 35 // We only used threaded uploads when we can: |
| 35 // - Create EGLImages out of OpenGL textures (EGL_KHR_gl_texture_2D_image) | 36 // - Create EGLImages out of OpenGL textures (EGL_KHR_gl_texture_2D_image) |
| 36 // - Bind EGLImages to OpenGL textures (GL_OES_EGL_image) | 37 // - Bind EGLImages to OpenGL textures (GL_OES_EGL_image) |
| 37 // - Use fences (to test for upload completion). | 38 // - Use fences (to test for upload completion). |
| 38 // - The heap size is large enough. | 39 // - The heap size is large enough. |
| 39 // TODO(kaanb|epenner): Remove the IsImagination() check pending the | 40 // TODO(kaanb|epenner): Remove the IsImagination() check pending the |
| 40 // resolution of crbug.com/249147 | 41 // resolution of crbug.com/249147 |
| 42 // TODO(kaanb|epenner): Remove the IsLowEndDevice() check pending the |
| 43 // resolution of crbug.com/271929 |
| 41 AsyncPixelTransferManager* AsyncPixelTransferManager::Create( | 44 AsyncPixelTransferManager* AsyncPixelTransferManager::Create( |
| 42 gfx::GLContext* context) { | 45 gfx::GLContext* context) { |
| 43 TRACE_EVENT0("gpu", "AsyncPixelTransferManager::Create"); | 46 TRACE_EVENT0("gpu", "AsyncPixelTransferManager::Create"); |
| 44 switch (gfx::GetGLImplementation()) { | 47 switch (gfx::GetGLImplementation()) { |
| 45 case gfx::kGLImplementationEGLGLES2: | 48 case gfx::kGLImplementationEGLGLES2: |
| 46 DCHECK(context); | 49 DCHECK(context); |
| 47 if (context->HasExtension("EGL_KHR_fence_sync") && | 50 if (context->HasExtension("EGL_KHR_fence_sync") && |
| 48 context->HasExtension("EGL_KHR_image") && | 51 context->HasExtension("EGL_KHR_image") && |
| 49 context->HasExtension("EGL_KHR_image_base") && | 52 context->HasExtension("EGL_KHR_image_base") && |
| 50 context->HasExtension("EGL_KHR_gl_texture_2D_image") && | 53 context->HasExtension("EGL_KHR_gl_texture_2D_image") && |
| 51 context->HasExtension("GL_OES_EGL_image") && | 54 context->HasExtension("GL_OES_EGL_image") && |
| 52 !IsBroadcom() && | 55 !IsBroadcom() && |
| 53 !IsImagination()) { | 56 !IsImagination() && |
| 57 !base::android::SysUtils::IsLowEndDevice()) { |
| 54 return new AsyncPixelTransferManagerEGL; | 58 return new AsyncPixelTransferManagerEGL; |
| 55 } | 59 } |
| 56 LOG(INFO) << "Async pixel transfers not supported"; | 60 LOG(INFO) << "Async pixel transfers not supported"; |
| 57 return new AsyncPixelTransferManagerIdle; | 61 return new AsyncPixelTransferManagerIdle; |
| 58 case gfx::kGLImplementationMockGL: | 62 case gfx::kGLImplementationMockGL: |
| 59 return new AsyncPixelTransferManagerStub; | 63 return new AsyncPixelTransferManagerStub; |
| 60 default: | 64 default: |
| 61 NOTREACHED(); | 65 NOTREACHED(); |
| 62 return NULL; | 66 return NULL; |
| 63 } | 67 } |
| 64 } | 68 } |
| 65 | 69 |
| 66 } // namespace gpu | 70 } // namespace gpu |
| OLD | NEW |