OLD | NEW |
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 "content/common/gpu/client/gpu_memory_buffer_impl.h" | 5 #include "content/common/gpu/client/gpu_memory_buffer_impl.h" |
6 | 6 |
| 7 #include "content/common/gpu/client/gpu_memory_buffer_impl_intel_drm.h" |
7 #include "content/common/gpu/client/gpu_memory_buffer_impl_shm.h" | 8 #include "content/common/gpu/client/gpu_memory_buffer_impl_shm.h" |
8 | 9 |
9 namespace content { | 10 namespace content { |
10 | 11 |
11 // static | 12 // static |
12 scoped_ptr<GpuMemoryBufferImpl> GpuMemoryBufferImpl::Create( | 13 scoped_ptr<GpuMemoryBufferImpl> GpuMemoryBufferImpl::Create( |
13 const gfx::Size& size, | 14 const gfx::Size& size, |
14 unsigned internalformat, | 15 unsigned internalformat, |
15 unsigned usage) { | 16 unsigned usage) { |
16 if (GpuMemoryBufferImplShm::IsConfigurationSupported( | 17 if (GpuMemoryBufferImplShm::IsConfigurationSupported( |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 unsigned internalformat) { | 51 unsigned internalformat) { |
51 switch (handle.type) { | 52 switch (handle.type) { |
52 case gfx::SHARED_MEMORY_BUFFER: { | 53 case gfx::SHARED_MEMORY_BUFFER: { |
53 scoped_ptr<GpuMemoryBufferImplShm> buffer( | 54 scoped_ptr<GpuMemoryBufferImplShm> buffer( |
54 new GpuMemoryBufferImplShm(size, internalformat)); | 55 new GpuMemoryBufferImplShm(size, internalformat)); |
55 if (!buffer->InitializeFromHandle(handle)) | 56 if (!buffer->InitializeFromHandle(handle)) |
56 return scoped_ptr<GpuMemoryBufferImpl>(); | 57 return scoped_ptr<GpuMemoryBufferImpl>(); |
57 | 58 |
58 return buffer.PassAs<GpuMemoryBufferImpl>(); | 59 return buffer.PassAs<GpuMemoryBufferImpl>(); |
59 } | 60 } |
| 61 case gfx::INTEL_DRM_BUFFER: { |
| 62 scoped_ptr<GpuMemoryBufferImplIntelDRM> buffer( |
| 63 new GpuMemoryBufferImplIntelDRM(size, internalformat)); |
| 64 if (!buffer->Initialize(handle)) |
| 65 return scoped_ptr<GpuMemoryBufferImpl>(); |
| 66 |
| 67 return buffer.PassAs<GpuMemoryBufferImpl>(); |
| 68 } |
60 default: | 69 default: |
61 return scoped_ptr<GpuMemoryBufferImpl>(); | 70 return scoped_ptr<GpuMemoryBufferImpl>(); |
62 } | 71 } |
63 } | 72 } |
64 | 73 |
65 } // namespace content | 74 } // namespace content |
OLD | NEW |