OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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_delegate.h" | 5 #include "gpu/command_buffer/service/async_pixel_transfer_manager.h" |
6 | 6 |
7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "gpu/command_buffer/service/async_pixel_transfer_delegate_egl.h" | 8 #include "gpu/command_buffer/service/async_pixel_transfer_manager_egl.h" |
9 #include "gpu/command_buffer/service/async_pixel_transfer_delegate_stub.h" | 9 #include "gpu/command_buffer/service/async_pixel_transfer_manager_stub.h" |
10 #include "gpu/command_buffer/service/async_pixel_transfer_delegate_sync.h" | 10 #include "gpu/command_buffer/service/async_pixel_transfer_manager_sync.h" |
11 #include "ui/gl/gl_context.h" | 11 #include "ui/gl/gl_context.h" |
12 #include "ui/gl/gl_implementation.h" | 12 #include "ui/gl/gl_implementation.h" |
13 | 13 |
14 namespace gpu { | 14 namespace gpu { |
15 namespace { | 15 namespace { |
16 | 16 |
17 bool IsBroadcom() { | 17 bool IsBroadcom() { |
18 const char* vendor = reinterpret_cast<const char*>(glGetString(GL_VENDOR)); | 18 const char* vendor = reinterpret_cast<const char*>(glGetString(GL_VENDOR)); |
19 if (vendor) | 19 if (vendor) |
20 return std::string(vendor).find("Broadcom") != std::string::npos; | 20 return std::string(vendor).find("Broadcom") != std::string::npos; |
21 return false; | 21 return false; |
22 } | 22 } |
23 | 23 |
24 } | 24 } |
25 | 25 |
26 // We only used threaded uploads when we can: | 26 // We only used threaded uploads when we can: |
27 // - Create EGLImages out of OpenGL textures (EGL_KHR_gl_texture_2D_image) | 27 // - Create EGLImages out of OpenGL textures (EGL_KHR_gl_texture_2D_image) |
28 // - Bind EGLImages to OpenGL textures (GL_OES_EGL_image) | 28 // - Bind EGLImages to OpenGL textures (GL_OES_EGL_image) |
29 // - Use fences (to test for upload completion). | 29 // - Use fences (to test for upload completion). |
30 AsyncPixelTransferDelegate* AsyncPixelTransferDelegate::Create( | 30 AsyncPixelTransferManager* AsyncPixelTransferManager::Create( |
31 gfx::GLContext* context) { | 31 gfx::GLContext* context) { |
32 TRACE_EVENT0("gpu", "AsyncPixelTransferDelegate::Create"); | 32 TRACE_EVENT0("gpu", "AsyncPixelTransferManager::Create"); |
33 switch (gfx::GetGLImplementation()) { | 33 switch (gfx::GetGLImplementation()) { |
34 case gfx::kGLImplementationEGLGLES2: | 34 case gfx::kGLImplementationEGLGLES2: |
35 DCHECK(context); | 35 DCHECK(context); |
36 if (context->HasExtension("EGL_KHR_fence_sync") && | 36 if (context->HasExtension("EGL_KHR_fence_sync") && |
37 context->HasExtension("EGL_KHR_image") && | 37 context->HasExtension("EGL_KHR_image") && |
38 context->HasExtension("EGL_KHR_image_base") && | 38 context->HasExtension("EGL_KHR_image_base") && |
39 context->HasExtension("EGL_KHR_gl_texture_2D_image") && | 39 context->HasExtension("EGL_KHR_gl_texture_2D_image") && |
40 context->HasExtension("GL_OES_EGL_image") && | 40 context->HasExtension("GL_OES_EGL_image") && |
41 !IsBroadcom()) { | 41 !IsBroadcom()) { |
42 return new AsyncPixelTransferDelegateEGL; | 42 return new AsyncPixelTransferManagerEGL; |
43 } | 43 } |
44 LOG(INFO) << "Async pixel transfers not supported"; | 44 LOG(INFO) << "Async pixel transfers not supported"; |
45 return new AsyncPixelTransferDelegateSync; | 45 return new AsyncPixelTransferManagerSync; |
46 case gfx::kGLImplementationMockGL: | 46 case gfx::kGLImplementationMockGL: |
47 return new AsyncPixelTransferDelegateStub; | 47 return new AsyncPixelTransferManagerStub; |
48 default: | 48 default: |
49 NOTREACHED(); | 49 NOTREACHED(); |
50 return NULL; | 50 return NULL; |
51 } | 51 } |
52 } | 52 } |
53 | 53 |
54 } // namespace gpu | 54 } // namespace gpu |
OLD | NEW |