OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/mailbox_manager_sync.h" | 5 #include "gpu/command_buffer/service/mailbox_manager_sync.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <queue> | 8 #include <queue> |
9 | 9 |
10 #include "base/command_line.h" | |
11 #include "base/lazy_instance.h" | |
10 #include "base/memory/linked_ptr.h" | 12 #include "base/memory/linked_ptr.h" |
11 #include "base/synchronization/lock.h" | 13 #include "base/synchronization/lock.h" |
14 #include "gpu/command_buffer/service/gpu_switches.h" | |
12 #include "gpu/command_buffer/service/texture_manager.h" | 15 #include "gpu/command_buffer/service/texture_manager.h" |
13 #include "ui/gl/gl_fence.h" | 16 #include "ui/gl/gl_fence.h" |
14 #include "ui/gl/gl_implementation.h" | 17 #include "ui/gl/gl_implementation.h" |
15 | 18 |
16 #if !defined(OS_MACOSX) | 19 #if !defined(OS_MACOSX) |
17 #include "ui/gl/gl_fence_egl.h" | 20 #include "ui/gl/gl_fence_egl.h" |
18 #endif | 21 #endif |
19 | 22 |
20 namespace gpu { | 23 namespace gpu { |
21 namespace gles2 { | 24 namespace gles2 { |
22 | 25 |
23 namespace { | 26 namespace { |
24 | 27 |
28 struct SkipManagedPool { | |
29 SkipManagedPool() { | |
30 skip = !base::CommandLine::ForCurrentProcess()->HasSwitch( | |
31 switches::kEnableAsyncPixelWithThreadedTextureMailboxes); | |
32 } | |
33 | |
34 bool skip; | |
35 }; | |
36 | |
37 base::LazyInstance<SkipManagedPool> g_skip_managed_pool = | |
38 LAZY_INSTANCE_INITIALIZER; | |
39 | |
25 bool SkipTextureWorkarounds(const Texture* texture) { | 40 bool SkipTextureWorkarounds(const Texture* texture) { |
26 // TODO(sievers): crbug.com/352274 | 41 // TODO(sievers): crbug.com/352274 |
27 // Should probably only fail if it already *has* mipmaps, while allowing | 42 // Should probably only fail if it already *has* mipmaps, while allowing |
28 // incomplete textures here. | 43 // incomplete textures here. |
29 bool needs_mips = | 44 bool needs_mips = |
30 texture->min_filter() != GL_NEAREST && texture->min_filter() != GL_LINEAR; | 45 texture->min_filter() != GL_NEAREST && texture->min_filter() != GL_LINEAR; |
31 if (texture->target() != GL_TEXTURE_2D || needs_mips || !texture->IsDefined()) | 46 if (texture->target() != GL_TEXTURE_2D || needs_mips || !texture->IsDefined()) |
32 return true; | 47 return true; |
33 | 48 |
34 // Skip compositor resources/tile textures. | 49 // Skip compositor resources/tile textures. |
35 // TODO: Remove this, see crbug.com/399226. | 50 // TODO: Remove this, see crbug.com/399226. |
36 if (texture->pool() == GL_TEXTURE_POOL_MANAGED_CHROMIUM) | 51 if (g_skip_managed_pool.Get().skip && |
52 texture->pool() == GL_TEXTURE_POOL_MANAGED_CHROMIUM) { | |
no sievers
2015/01/15 20:26:05
Can we just remove the workaround entirely?
We sho
| |
37 return true; | 53 return true; |
54 } | |
38 | 55 |
39 return false; | 56 return false; |
40 } | 57 } |
41 | 58 |
42 base::LazyInstance<base::Lock> g_lock = LAZY_INSTANCE_INITIALIZER; | 59 base::LazyInstance<base::Lock> g_lock = LAZY_INSTANCE_INITIALIZER; |
43 | 60 |
44 typedef std::map<uint32, linked_ptr<gfx::GLFence>> SyncPointToFenceMap; | 61 typedef std::map<uint32, linked_ptr<gfx::GLFence>> SyncPointToFenceMap; |
45 base::LazyInstance<SyncPointToFenceMap> g_sync_point_to_fence = | 62 base::LazyInstance<SyncPointToFenceMap> g_sync_point_to_fence = |
46 LAZY_INSTANCE_INITIALIZER; | 63 LAZY_INSTANCE_INITIALIZER; |
47 #if !defined(OS_MACOSX) | 64 #if !defined(OS_MACOSX) |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
330 if (texture_version == definition.version() || | 347 if (texture_version == definition.version() || |
331 definition.IsOlderThan(texture_version)) | 348 definition.IsOlderThan(texture_version)) |
332 continue; | 349 continue; |
333 texture_version = definition.version(); | 350 texture_version = definition.version(); |
334 definition.UpdateTexture(texture); | 351 definition.UpdateTexture(texture); |
335 } | 352 } |
336 } | 353 } |
337 | 354 |
338 } // namespace gles2 | 355 } // namespace gles2 |
339 } // namespace gpu | 356 } // namespace gpu |
OLD | NEW |