| 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 "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" |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 | 107 |
| 108 if (enable_native_gpu_memory_buffers) { | 108 if (enable_native_gpu_memory_buffers) { |
| 109 const GpuMemoryBufferFactory::Configuration kNativeConfigurations[] = { | 109 const GpuMemoryBufferFactory::Configuration kNativeConfigurations[] = { |
| 110 {gfx::BufferFormat::R_8, gfx::BufferUsage::MAP}, | 110 {gfx::BufferFormat::R_8, gfx::BufferUsage::MAP}, |
| 111 {gfx::BufferFormat::R_8, gfx::BufferUsage::PERSISTENT_MAP}, | 111 {gfx::BufferFormat::R_8, gfx::BufferUsage::PERSISTENT_MAP}, |
| 112 {gfx::BufferFormat::RGBA_4444, gfx::BufferUsage::MAP}, | 112 {gfx::BufferFormat::RGBA_4444, gfx::BufferUsage::MAP}, |
| 113 {gfx::BufferFormat::RGBA_4444, gfx::BufferUsage::PERSISTENT_MAP}, | 113 {gfx::BufferFormat::RGBA_4444, gfx::BufferUsage::PERSISTENT_MAP}, |
| 114 {gfx::BufferFormat::RGBA_8888, gfx::BufferUsage::MAP}, | 114 {gfx::BufferFormat::RGBA_8888, gfx::BufferUsage::MAP}, |
| 115 {gfx::BufferFormat::RGBA_8888, gfx::BufferUsage::PERSISTENT_MAP}, | 115 {gfx::BufferFormat::RGBA_8888, gfx::BufferUsage::PERSISTENT_MAP}, |
| 116 {gfx::BufferFormat::BGRA_8888, gfx::BufferUsage::MAP}, | 116 {gfx::BufferFormat::BGRA_8888, gfx::BufferUsage::MAP}, |
| 117 {gfx::BufferFormat::BGRA_8888, gfx::BufferUsage::PERSISTENT_MAP}}; | 117 {gfx::BufferFormat::BGRA_8888, gfx::BufferUsage::PERSISTENT_MAP}, |
| 118 {gfx::BufferFormat::YUV_420_BIPLANAR, gfx::BufferUsage::MAP}, |
| 119 {gfx::BufferFormat::YUV_420_BIPLANAR, gfx::BufferUsage::PERSISTENT_MAP}, |
| 120 }; |
| 118 for (auto& configuration : kNativeConfigurations) { | 121 for (auto& configuration : kNativeConfigurations) { |
| 119 if (IsGpuMemoryBufferFactoryConfigurationSupported(type, configuration)) | 122 if (IsGpuMemoryBufferFactoryConfigurationSupported(type, configuration)) |
| 120 configurations.push_back(configuration); | 123 configurations.push_back(configuration); |
| 121 } | 124 } |
| 122 } | 125 } |
| 123 | 126 |
| 124 #if defined(USE_OZONE) || defined(OS_MACOSX) | 127 #if defined(USE_OZONE) || defined(OS_MACOSX) |
| 125 const GpuMemoryBufferFactory::Configuration kScanoutConfigurations[] = { | 128 const GpuMemoryBufferFactory::Configuration kScanoutConfigurations[] = { |
| 126 {gfx::BufferFormat::BGRA_8888, gfx::BufferUsage::SCANOUT}, | 129 {gfx::BufferFormat::BGRA_8888, gfx::BufferUsage::SCANOUT}, |
| 127 {gfx::BufferFormat::RGBX_8888, gfx::BufferUsage::SCANOUT}}; | 130 {gfx::BufferFormat::RGBX_8888, gfx::BufferUsage::SCANOUT}, |
| 131 {gfx::BufferFormat::YUV_420_BIPLANAR, gfx::BufferUsage::SCANOUT}, |
| 132 }; |
| 128 for (auto& configuration : kScanoutConfigurations) { | 133 for (auto& configuration : kScanoutConfigurations) { |
| 129 if (IsGpuMemoryBufferFactoryConfigurationSupported(type, configuration)) | 134 if (IsGpuMemoryBufferFactoryConfigurationSupported(type, configuration)) |
| 130 configurations.push_back(configuration); | 135 configurations.push_back(configuration); |
| 131 } | 136 } |
| 132 #endif | 137 #endif |
| 133 | 138 |
| 134 return configurations; | 139 return configurations; |
| 135 } | 140 } |
| 136 | 141 |
| 137 BrowserGpuMemoryBufferManager* g_gpu_memory_buffer_manager = nullptr; | 142 BrowserGpuMemoryBufferManager* g_gpu_memory_buffer_manager = nullptr; |
| (...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 615 return gpu_client_tracing_id_; | 620 return gpu_client_tracing_id_; |
| 616 } | 621 } |
| 617 | 622 |
| 618 // In normal cases, |client_id| is a child process id, so we can perform | 623 // In normal cases, |client_id| is a child process id, so we can perform |
| 619 // the standard conversion. | 624 // the standard conversion. |
| 620 return ChildProcessHostImpl::ChildProcessUniqueIdToTracingProcessId( | 625 return ChildProcessHostImpl::ChildProcessUniqueIdToTracingProcessId( |
| 621 client_id); | 626 client_id); |
| 622 } | 627 } |
| 623 | 628 |
| 624 } // namespace content | 629 } // namespace content |
| OLD | NEW |