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 12 matching lines...) Expand all Loading... |
23 | 23 |
24 #if defined(OS_MACOSX) | 24 #if defined(OS_MACOSX) |
25 #include "content/common/gpu/gpu_memory_buffer_factory_io_surface.h" | 25 #include "content/common/gpu/gpu_memory_buffer_factory_io_surface.h" |
26 #endif | 26 #endif |
27 | 27 |
28 #if defined(OS_ANDROID) | 28 #if defined(OS_ANDROID) |
29 #include "content/common/gpu/gpu_memory_buffer_factory_surface_texture.h" | 29 #include "content/common/gpu/gpu_memory_buffer_factory_surface_texture.h" |
30 #endif | 30 #endif |
31 | 31 |
32 #if defined(USE_OZONE) | 32 #if defined(USE_OZONE) |
33 #include "content/common/gpu/gpu_memory_buffer_factory_ozone_native_buffer.h" | 33 #include "content/common/gpu/gpu_memory_buffer_factory_ozone_native_pixmap.h" |
34 #endif | 34 #endif |
35 | 35 |
36 namespace content { | 36 namespace content { |
37 namespace { | 37 namespace { |
38 | 38 |
39 void GpuMemoryBufferDeleted( | 39 void GpuMemoryBufferDeleted( |
40 scoped_refptr<base::SingleThreadTaskRunner> destruction_task_runner, | 40 scoped_refptr<base::SingleThreadTaskRunner> destruction_task_runner, |
41 const GpuMemoryBufferImpl::DestructionCallback& destruction_callback, | 41 const GpuMemoryBufferImpl::DestructionCallback& destruction_callback, |
42 uint32 sync_point) { | 42 uint32 sync_point) { |
43 destruction_task_runner->PostTask( | 43 destruction_task_runner->PostTask( |
(...skipping 14 matching lines...) Expand all Loading... |
58 IsGpuMemoryBufferConfigurationSupported(configuration.format, | 58 IsGpuMemoryBufferConfigurationSupported(configuration.format, |
59 configuration.usage); | 59 configuration.usage); |
60 #endif | 60 #endif |
61 #if defined(OS_ANDROID) | 61 #if defined(OS_ANDROID) |
62 case gfx::SURFACE_TEXTURE_BUFFER: | 62 case gfx::SURFACE_TEXTURE_BUFFER: |
63 return GpuMemoryBufferFactorySurfaceTexture:: | 63 return GpuMemoryBufferFactorySurfaceTexture:: |
64 IsGpuMemoryBufferConfigurationSupported(configuration.format, | 64 IsGpuMemoryBufferConfigurationSupported(configuration.format, |
65 configuration.usage); | 65 configuration.usage); |
66 #endif | 66 #endif |
67 #if defined(USE_OZONE) | 67 #if defined(USE_OZONE) |
68 case gfx::OZONE_NATIVE_BUFFER: | 68 case gfx::OZONE_NATIVE_PIXMAP: |
69 return GpuMemoryBufferFactoryOzoneNativeBuffer:: | 69 return GpuMemoryBufferFactoryOzoneNativePixmap:: |
70 IsGpuMemoryBufferConfigurationSupported(configuration.format, | 70 IsGpuMemoryBufferConfigurationSupported(configuration.format, |
71 configuration.usage); | 71 configuration.usage); |
72 #endif | 72 #endif |
73 default: | 73 default: |
74 NOTREACHED(); | 74 NOTREACHED(); |
75 return false; | 75 return false; |
76 } | 76 } |
77 } | 77 } |
78 | 78 |
79 gfx::GpuMemoryBufferType GetGpuMemoryBufferFactoryType() { | 79 gfx::GpuMemoryBufferType GetGpuMemoryBufferFactoryType() { |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 uint32 BrowserGpuMemoryBufferManager::GetImageTextureTarget( | 171 uint32 BrowserGpuMemoryBufferManager::GetImageTextureTarget( |
172 gfx::GpuMemoryBuffer::Format format, | 172 gfx::GpuMemoryBuffer::Format format, |
173 gfx::GpuMemoryBuffer::Usage usage) { | 173 gfx::GpuMemoryBuffer::Usage usage) { |
174 gfx::GpuMemoryBufferType type = GetGpuMemoryBufferFactoryType(); | 174 gfx::GpuMemoryBufferType type = GetGpuMemoryBufferFactoryType(); |
175 for (auto& configuration : GetSupportedGpuMemoryBufferConfigurations(type)) { | 175 for (auto& configuration : GetSupportedGpuMemoryBufferConfigurations(type)) { |
176 if (configuration.format != format || configuration.usage != usage) | 176 if (configuration.format != format || configuration.usage != usage) |
177 continue; | 177 continue; |
178 | 178 |
179 switch (type) { | 179 switch (type) { |
180 case gfx::SURFACE_TEXTURE_BUFFER: | 180 case gfx::SURFACE_TEXTURE_BUFFER: |
181 case gfx::OZONE_NATIVE_BUFFER: | 181 case gfx::OZONE_NATIVE_PIXMAP: |
182 // GPU memory buffers that are shared with the GL using EGLImages | 182 // GPU memory buffers that are shared with the GL using EGLImages |
183 // require TEXTURE_EXTERNAL_OES. | 183 // require TEXTURE_EXTERNAL_OES. |
184 return GL_TEXTURE_EXTERNAL_OES; | 184 return GL_TEXTURE_EXTERNAL_OES; |
185 case gfx::IO_SURFACE_BUFFER: | 185 case gfx::IO_SURFACE_BUFFER: |
186 // IOSurface backed images require GL_TEXTURE_RECTANGLE_ARB. | 186 // IOSurface backed images require GL_TEXTURE_RECTANGLE_ARB. |
187 return GL_TEXTURE_RECTANGLE_ARB; | 187 return GL_TEXTURE_RECTANGLE_ARB; |
188 default: | 188 default: |
189 return GL_TEXTURE_2D; | 189 return GL_TEXTURE_2D; |
190 } | 190 } |
191 } | 191 } |
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
584 } | 584 } |
585 | 585 |
586 GpuProcessHost* host = GpuProcessHost::FromID(buffer_it->second.gpu_host_id); | 586 GpuProcessHost* host = GpuProcessHost::FromID(buffer_it->second.gpu_host_id); |
587 if (host) | 587 if (host) |
588 host->DestroyGpuMemoryBuffer(id, client_id, sync_point); | 588 host->DestroyGpuMemoryBuffer(id, client_id, sync_point); |
589 | 589 |
590 buffers.erase(buffer_it); | 590 buffers.erase(buffer_it); |
591 } | 591 } |
592 | 592 |
593 } // namespace content | 593 } // namespace content |
OLD | NEW |