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

Side by Side Diff: content/browser/gpu/browser_gpu_memory_buffer_manager.cc

Issue 1232083007: Revert of Re-land: content: Enable native GpuMemoryBuffers by default on MacOSX. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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
« no previous file with comments | « no previous file | content/child/child_thread_impl_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "content/browser/gpu/browser_gpu_memory_buffer_manager.h" 5 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h"
6 6
7 #include "base/atomic_sequence_num.h" 7 #include "base/atomic_sequence_num.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
11 #include "base/synchronization/waitable_event.h" 11 #include "base/synchronization/waitable_event.h"
12 #include "base/threading/thread_restrictions.h" 12 #include "base/threading/thread_restrictions.h"
13 #include "base/trace_event/process_memory_dump.h" 13 #include "base/trace_event/process_memory_dump.h"
14 #include "base/trace_event/trace_event.h" 14 #include "base/trace_event/trace_event.h"
15 #include "content/browser/gpu/gpu_process_host.h" 15 #include "content/browser/gpu/gpu_process_host.h"
16 #include "content/common/gpu/client/gpu_memory_buffer_impl.h" 16 #include "content/common/gpu/client/gpu_memory_buffer_impl.h"
17 #include "content/common/gpu/client/gpu_memory_buffer_impl_shared_memory.h" 17 #include "content/common/gpu/client/gpu_memory_buffer_impl_shared_memory.h"
18 #include "content/common/gpu/gpu_memory_buffer_factory_shared_memory.h" 18 #include "content/common/gpu/gpu_memory_buffer_factory_shared_memory.h"
19 #include "content/public/browser/browser_thread.h" 19 #include "content/public/browser/browser_thread.h"
20 #include "content/public/common/content_switches.h" 20 #include "content/public/common/content_switches.h"
21 #include "gpu/GLES2/gl2extchromium.h" 21 #include "gpu/GLES2/gl2extchromium.h"
22 #include "ui/gl/gl_switches.h"
23 22
24 #if defined(OS_MACOSX) 23 #if defined(OS_MACOSX)
25 #include "content/common/gpu/gpu_memory_buffer_factory_io_surface.h" 24 #include "content/common/gpu/gpu_memory_buffer_factory_io_surface.h"
26 #endif 25 #endif
27 26
28 #if defined(OS_ANDROID) 27 #if defined(OS_ANDROID)
29 #include "content/common/gpu/gpu_memory_buffer_factory_surface_texture.h" 28 #include "content/common/gpu/gpu_memory_buffer_factory_surface_texture.h"
30 #endif 29 #endif
31 30
32 #if defined(USE_OZONE) 31 #if defined(USE_OZONE)
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 GpuMemoryBufferFactory::GetSupportedTypes(&supported_types); 80 GpuMemoryBufferFactory::GetSupportedTypes(&supported_types);
82 DCHECK(!supported_types.empty()); 81 DCHECK(!supported_types.empty());
83 82
84 // The GPU service will always use the preferred type. 83 // The GPU service will always use the preferred type.
85 return supported_types[0]; 84 return supported_types[0];
86 } 85 }
87 86
88 std::vector<GpuMemoryBufferFactory::Configuration> 87 std::vector<GpuMemoryBufferFactory::Configuration>
89 GetSupportedGpuMemoryBufferConfigurations(gfx::GpuMemoryBufferType type) { 88 GetSupportedGpuMemoryBufferConfigurations(gfx::GpuMemoryBufferType type) {
90 std::vector<GpuMemoryBufferFactory::Configuration> configurations; 89 std::vector<GpuMemoryBufferFactory::Configuration> configurations;
91 #if defined(OS_MACOSX) 90 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
92 bool enable_native_gpu_memory_buffers = 91 switches::kEnableNativeGpuMemoryBuffers)) {
93 !base::CommandLine::ForCurrentProcess()->HasSwitch(
94 switches::kDisableNativeGpuMemoryBuffers);
95 #else
96 bool enable_native_gpu_memory_buffers =
97 base::CommandLine::ForCurrentProcess()->HasSwitch(
98 switches::kEnableNativeGpuMemoryBuffers);
99 #endif
100
101 // Disable native buffers when using Mesa.
102 if (base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
103 switches::kUseGL) == gfx::kGLImplementationOSMesaName) {
104 enable_native_gpu_memory_buffers = false;
105 }
106
107 if (enable_native_gpu_memory_buffers) {
108 const GpuMemoryBufferFactory::Configuration kNativeConfigurations[] = { 92 const GpuMemoryBufferFactory::Configuration kNativeConfigurations[] = {
109 {gfx::GpuMemoryBuffer::R_8, gfx::GpuMemoryBuffer::MAP}, 93 {gfx::GpuMemoryBuffer::R_8, gfx::GpuMemoryBuffer::MAP},
110 {gfx::GpuMemoryBuffer::R_8, gfx::GpuMemoryBuffer::PERSISTENT_MAP}, 94 {gfx::GpuMemoryBuffer::R_8, gfx::GpuMemoryBuffer::PERSISTENT_MAP},
111 {gfx::GpuMemoryBuffer::RGBA_4444, gfx::GpuMemoryBuffer::MAP}, 95 {gfx::GpuMemoryBuffer::RGBA_4444, gfx::GpuMemoryBuffer::MAP},
112 {gfx::GpuMemoryBuffer::RGBA_4444, gfx::GpuMemoryBuffer::PERSISTENT_MAP}, 96 {gfx::GpuMemoryBuffer::RGBA_4444, gfx::GpuMemoryBuffer::PERSISTENT_MAP},
113 {gfx::GpuMemoryBuffer::RGBA_8888, gfx::GpuMemoryBuffer::MAP}, 97 {gfx::GpuMemoryBuffer::RGBA_8888, gfx::GpuMemoryBuffer::MAP},
114 {gfx::GpuMemoryBuffer::RGBA_8888, gfx::GpuMemoryBuffer::PERSISTENT_MAP}, 98 {gfx::GpuMemoryBuffer::RGBA_8888, gfx::GpuMemoryBuffer::PERSISTENT_MAP},
115 {gfx::GpuMemoryBuffer::BGRA_8888, gfx::GpuMemoryBuffer::MAP}, 99 {gfx::GpuMemoryBuffer::BGRA_8888, gfx::GpuMemoryBuffer::MAP},
116 {gfx::GpuMemoryBuffer::BGRA_8888, 100 {gfx::GpuMemoryBuffer::BGRA_8888,
117 gfx::GpuMemoryBuffer::PERSISTENT_MAP}}; 101 gfx::GpuMemoryBuffer::PERSISTENT_MAP}};
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
576 } 560 }
577 561
578 GpuProcessHost* host = GpuProcessHost::FromID(buffer_it->second.gpu_host_id); 562 GpuProcessHost* host = GpuProcessHost::FromID(buffer_it->second.gpu_host_id);
579 if (host) 563 if (host)
580 host->DestroyGpuMemoryBuffer(id, client_id, sync_point); 564 host->DestroyGpuMemoryBuffer(id, client_id, sync_point);
581 565
582 buffers.erase(buffer_it); 566 buffers.erase(buffer_it);
583 } 567 }
584 568
585 } // namespace content 569 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/child/child_thread_impl_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698