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