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_delegate.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_delegate_egl.h" |
9 #include "gpu/command_buffer/service/async_pixel_transfer_delegate_stub.h" | 9 #include "gpu/command_buffer/service/async_pixel_transfer_delegate_stub.h" |
10 #include "gpu/command_buffer/service/async_pixel_transfer_delegate_sync.h" | 10 #include "gpu/command_buffer/service/async_pixel_transfer_delegate_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 { |
| 16 |
| 17 bool IsBroadcom() { |
| 18 const char* vendor = reinterpret_cast<const char*>(glGetString(GL_VENDOR)); |
| 19 if (vendor) |
| 20 return std::string(vendor).find("Broadcom") != std::string::npos; |
| 21 return false; |
| 22 } |
| 23 |
| 24 } |
15 | 25 |
16 // We only used threaded uploads when we can: | 26 // We only used threaded uploads when we can: |
17 // - 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) |
18 // - Bind EGLImages to OpenGL textures (GL_OES_EGL_image) | 28 // - Bind EGLImages to OpenGL textures (GL_OES_EGL_image) |
19 // - Use fences (to test for upload completion). | 29 // - Use fences (to test for upload completion). |
20 AsyncPixelTransferDelegate* AsyncPixelTransferDelegate::Create( | 30 AsyncPixelTransferDelegate* AsyncPixelTransferDelegate::Create( |
21 gfx::GLContext* context) { | 31 gfx::GLContext* context) { |
22 TRACE_EVENT0("gpu", "AsyncPixelTransferDelegate::Create"); | 32 TRACE_EVENT0("gpu", "AsyncPixelTransferDelegate::Create"); |
23 switch (gfx::GetGLImplementation()) { | 33 switch (gfx::GetGLImplementation()) { |
24 case gfx::kGLImplementationEGLGLES2: | 34 case gfx::kGLImplementationEGLGLES2: |
25 DCHECK(context); | 35 DCHECK(context); |
26 if (context->HasExtension("EGL_KHR_fence_sync") && | 36 if (context->HasExtension("EGL_KHR_fence_sync") && |
27 context->HasExtension("EGL_KHR_image") && | 37 context->HasExtension("EGL_KHR_image") && |
28 context->HasExtension("EGL_KHR_image_base") && | 38 context->HasExtension("EGL_KHR_image_base") && |
29 context->HasExtension("EGL_KHR_gl_texture_2D_image") && | 39 context->HasExtension("EGL_KHR_gl_texture_2D_image") && |
30 context->HasExtension("GL_OES_EGL_image")) { | 40 context->HasExtension("GL_OES_EGL_image") && |
| 41 !IsBroadcom()) { |
31 return new AsyncPixelTransferDelegateEGL; | 42 return new AsyncPixelTransferDelegateEGL; |
32 } | 43 } |
33 LOG(INFO) << "Async pixel transfers not supported"; | 44 LOG(INFO) << "Async pixel transfers not supported"; |
34 return new AsyncPixelTransferDelegateSync; | 45 return new AsyncPixelTransferDelegateSync; |
35 case gfx::kGLImplementationMockGL: | 46 case gfx::kGLImplementationMockGL: |
36 return new AsyncPixelTransferDelegateStub; | 47 return new AsyncPixelTransferDelegateStub; |
37 default: | 48 default: |
38 NOTREACHED(); | 49 NOTREACHED(); |
39 return NULL; | 50 return NULL; |
40 } | 51 } |
41 } | 52 } |
42 | 53 |
43 } // namespace gpu | 54 } // namespace gpu |
OLD | NEW |