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

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

Issue 769703005: Move AW renderer compositor context to gpu thread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 10 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/command_line.h"
8 #include "base/sys_info.h" 8 #include "base/sys_info.h"
9 #include "base/trace_event/trace_event.h" 9 #include "base/trace_event/trace_event.h"
10 #include "gpu/command_buffer/service/async_pixel_transfer_manager_egl.h" 10 #include "gpu/command_buffer/service/async_pixel_transfer_manager_egl.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 // - Bind EGLImages to OpenGL textures (GL_OES_EGL_image) 70 // - Bind EGLImages to OpenGL textures (GL_OES_EGL_image)
71 // - Use fences (to test for upload completion). 71 // - Use fences (to test for upload completion).
72 // - The heap size is large enough. 72 // - The heap size is large enough.
73 // TODO(kaanb|epenner): Remove the IsImagination() check pending the 73 // TODO(kaanb|epenner): Remove the IsImagination() check pending the
74 // resolution of crbug.com/249147 74 // resolution of crbug.com/249147
75 // TODO(kaanb|epenner): Remove the IsLowEndDevice() check pending the 75 // TODO(kaanb|epenner): Remove the IsLowEndDevice() check pending the
76 // resolution of crbug.com/271929 76 // resolution of crbug.com/271929
77 AsyncPixelTransferManager* AsyncPixelTransferManager::Create( 77 AsyncPixelTransferManager* AsyncPixelTransferManager::Create(
78 gfx::GLContext* context) { 78 gfx::GLContext* context) {
79 DCHECK(context->IsCurrent(NULL)); 79 DCHECK(context->IsCurrent(NULL));
80 base::CommandLine* cl = base::CommandLine::ForCurrentProcess();
81
80 // Threaded mailbox uses EGLImage which conflicts with EGL uploader. 82 // Threaded mailbox uses EGLImage which conflicts with EGL uploader.
81 // The spec only allows one EGL image per sibling group, but currently the 83 // 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 84 // image handle cannot be shared between the threaded mailbox code and
83 // AsyncPixelTransferManagerEGL. 85 // AsyncPixelTransferManagerEGL.
84 bool uses_threaded_mailboxes = 86 bool uses_threaded_mailboxes =
85 base::CommandLine::ForCurrentProcess()->HasSwitch( 87 cl->HasSwitch(switches::kEnableThreadedTextureMailboxes);
86 switches::kEnableThreadedTextureMailboxes); 88 // TexImage2D orphans the EGLImage used for threaded mailbox sharing.
89 bool use_teximage2d_over_texsubimage2d = !uses_threaded_mailboxes;
87 switch (gfx::GetGLImplementation()) { 90 switch (gfx::GetGLImplementation()) {
88 case gfx::kGLImplementationEGLGLES2: 91 case gfx::kGLImplementationEGLGLES2:
89 DCHECK(context); 92 DCHECK(context);
90 if (!base::SysInfo::IsLowEndDevice() && 93 if (!base::SysInfo::IsLowEndDevice() &&
91 context->HasExtension("EGL_KHR_fence_sync") && 94 context->HasExtension("EGL_KHR_fence_sync") &&
92 context->HasExtension("EGL_KHR_image") && 95 context->HasExtension("EGL_KHR_image") &&
93 context->HasExtension("EGL_KHR_image_base") && 96 context->HasExtension("EGL_KHR_image_base") &&
94 context->HasExtension("EGL_KHR_gl_texture_2D_image") && 97 context->HasExtension("EGL_KHR_gl_texture_2D_image") &&
95 context->HasExtension("GL_OES_EGL_image") && 98 context->HasExtension("GL_OES_EGL_image") &&
96 !uses_threaded_mailboxes && 99 !uses_threaded_mailboxes && AllowTransferThreadForGpu()) {
97 AllowTransferThreadForGpu()) {
98 TRACE_EVENT0("gpu", "AsyncPixelTransferManager_CreateWithThread"); 100 TRACE_EVENT0("gpu", "AsyncPixelTransferManager_CreateWithThread");
99 return new AsyncPixelTransferManagerEGL; 101 return new AsyncPixelTransferManagerEGL;
100 } 102 }
101 return new AsyncPixelTransferManagerIdle; 103 return new AsyncPixelTransferManagerIdle(
104 use_teximage2d_over_texsubimage2d);
102 case gfx::kGLImplementationOSMesaGL: { 105 case gfx::kGLImplementationOSMesaGL: {
103 TRACE_EVENT0("gpu", "AsyncPixelTransferManager_CreateIdle"); 106 TRACE_EVENT0("gpu", "AsyncPixelTransferManager_CreateIdle");
104 return new AsyncPixelTransferManagerIdle; 107 return new AsyncPixelTransferManagerIdle(
108 use_teximage2d_over_texsubimage2d);
105 } 109 }
106 case gfx::kGLImplementationMockGL: 110 case gfx::kGLImplementationMockGL:
107 return new AsyncPixelTransferManagerStub; 111 return new AsyncPixelTransferManagerStub;
108 default: 112 default:
109 NOTREACHED(); 113 NOTREACHED();
110 return NULL; 114 return NULL;
111 } 115 }
112 } 116 }
113 117
114 } // namespace gpu 118 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698