Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(167)

Side by Side Diff: gpu/command_buffer/service/async_pixel_transfer_manager_android.cc

Issue 862133002: Update from https://crrev.com/312398 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/command_line.h"
7 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
8 #include "base/sys_info.h" 9 #include "base/sys_info.h"
9 #include "gpu/command_buffer/service/async_pixel_transfer_manager_egl.h" 10 #include "gpu/command_buffer/service/async_pixel_transfer_manager_egl.h"
10 #include "gpu/command_buffer/service/async_pixel_transfer_manager_idle.h" 11 #include "gpu/command_buffer/service/async_pixel_transfer_manager_idle.h"
11 #include "gpu/command_buffer/service/async_pixel_transfer_manager_stub.h" 12 #include "gpu/command_buffer/service/async_pixel_transfer_manager_stub.h"
12 #include "gpu/command_buffer/service/async_pixel_transfer_manager_sync.h" 13 #include "gpu/command_buffer/service/async_pixel_transfer_manager_sync.h"
14 #include "gpu/command_buffer/service/gpu_switches.h"
13 #include "ui/gl/gl_context.h" 15 #include "ui/gl/gl_context.h"
14 #include "ui/gl/gl_implementation.h" 16 #include "ui/gl/gl_implementation.h"
15 17
16 namespace gpu { 18 namespace gpu {
17 namespace { 19 namespace {
18 20
19 enum GpuType { 21 enum GpuType {
20 GPU_BROADCOM, 22 GPU_BROADCOM,
21 GPU_IMAGINATION, 23 GPU_IMAGINATION,
22 GPU_NVIDIA_ES31, 24 GPU_NVIDIA_ES31,
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 // - Bind EGLImages to OpenGL textures (GL_OES_EGL_image) 70 // - Bind EGLImages to OpenGL textures (GL_OES_EGL_image)
69 // - Use fences (to test for upload completion). 71 // - Use fences (to test for upload completion).
70 // - The heap size is large enough. 72 // - The heap size is large enough.
71 // TODO(kaanb|epenner): Remove the IsImagination() check pending the 73 // TODO(kaanb|epenner): Remove the IsImagination() check pending the
72 // resolution of crbug.com/249147 74 // resolution of crbug.com/249147
73 // TODO(kaanb|epenner): Remove the IsLowEndDevice() check pending the 75 // TODO(kaanb|epenner): Remove the IsLowEndDevice() check pending the
74 // resolution of crbug.com/271929 76 // resolution of crbug.com/271929
75 AsyncPixelTransferManager* AsyncPixelTransferManager::Create( 77 AsyncPixelTransferManager* AsyncPixelTransferManager::Create(
76 gfx::GLContext* context) { 78 gfx::GLContext* context) {
77 DCHECK(context->IsCurrent(NULL)); 79 DCHECK(context->IsCurrent(NULL));
80 // Threaded mailbox uses EGLImage which conflicts with EGL uploader.
81 // The spec only allows one EGL image per sibling group, but currently the
82 // image handle cannot be shared between the threaded mailbox code and
83 // AsyncPixelTransferManagerEGL.
84 bool uses_threaded_mailboxes =
85 base::CommandLine::ForCurrentProcess()->HasSwitch(
86 switches::kEnableThreadedTextureMailboxes);
78 switch (gfx::GetGLImplementation()) { 87 switch (gfx::GetGLImplementation()) {
79 case gfx::kGLImplementationEGLGLES2: 88 case gfx::kGLImplementationEGLGLES2:
80 DCHECK(context); 89 DCHECK(context);
81 if (!base::SysInfo::IsLowEndDevice() && 90 if (!base::SysInfo::IsLowEndDevice() &&
82 context->HasExtension("EGL_KHR_fence_sync") && 91 context->HasExtension("EGL_KHR_fence_sync") &&
83 context->HasExtension("EGL_KHR_image") && 92 context->HasExtension("EGL_KHR_image") &&
84 context->HasExtension("EGL_KHR_image_base") && 93 context->HasExtension("EGL_KHR_image_base") &&
85 context->HasExtension("EGL_KHR_gl_texture_2D_image") && 94 context->HasExtension("EGL_KHR_gl_texture_2D_image") &&
86 context->HasExtension("GL_OES_EGL_image") && 95 context->HasExtension("GL_OES_EGL_image") &&
96 !uses_threaded_mailboxes &&
87 AllowTransferThreadForGpu()) { 97 AllowTransferThreadForGpu()) {
88 TRACE_EVENT0("gpu", "AsyncPixelTransferManager_CreateWithThread"); 98 TRACE_EVENT0("gpu", "AsyncPixelTransferManager_CreateWithThread");
89 return new AsyncPixelTransferManagerEGL; 99 return new AsyncPixelTransferManagerEGL;
90 } 100 }
91 return new AsyncPixelTransferManagerIdle; 101 return new AsyncPixelTransferManagerIdle;
92 case gfx::kGLImplementationOSMesaGL: { 102 case gfx::kGLImplementationOSMesaGL: {
93 TRACE_EVENT0("gpu", "AsyncPixelTransferManager_CreateIdle"); 103 TRACE_EVENT0("gpu", "AsyncPixelTransferManager_CreateIdle");
94 return new AsyncPixelTransferManagerIdle; 104 return new AsyncPixelTransferManagerIdle;
95 } 105 }
96 case gfx::kGLImplementationMockGL: 106 case gfx::kGLImplementationMockGL:
97 return new AsyncPixelTransferManagerStub; 107 return new AsyncPixelTransferManagerStub;
98 default: 108 default:
99 NOTREACHED(); 109 NOTREACHED();
100 return NULL; 110 return NULL;
101 } 111 }
102 } 112 }
103 113
104 } // namespace gpu 114 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698