| 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_io_surface.h" | 5 #include "content/common/gpu/client/gpu_memory_buffer_impl_io_surface.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "content/common/gpu/gpu_memory_buffer_factory_io_surface.h" | 8 #include "gpu/ipc/common/gpu_memory_buffer_support.h" |
| 9 #include "ui/gfx/buffer_format_util.h" | 9 #include "ui/gfx/buffer_format_util.h" |
| 10 #include "ui/gfx/mac/io_surface.h" | 10 #include "ui/gfx/mac/io_surface.h" |
| 11 | 11 |
| 12 namespace content { | 12 namespace content { |
| 13 namespace { | 13 namespace { |
| 14 | 14 |
| 15 uint32_t LockFlags(gfx::BufferUsage usage) { | 15 uint32_t LockFlags(gfx::BufferUsage usage) { |
| 16 switch (usage) { | 16 switch (usage) { |
| 17 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE: | 17 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE: |
| 18 return kIOSurfaceLockAvoidSync; | 18 return kIOSurfaceLockAvoidSync; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 | 59 |
| 60 return make_scoped_ptr( | 60 return make_scoped_ptr( |
| 61 new GpuMemoryBufferImplIOSurface(handle.id, size, format, callback, | 61 new GpuMemoryBufferImplIOSurface(handle.id, size, format, callback, |
| 62 io_surface.release(), LockFlags(usage))); | 62 io_surface.release(), LockFlags(usage))); |
| 63 } | 63 } |
| 64 | 64 |
| 65 // static | 65 // static |
| 66 bool GpuMemoryBufferImplIOSurface::IsConfigurationSupported( | 66 bool GpuMemoryBufferImplIOSurface::IsConfigurationSupported( |
| 67 gfx::BufferFormat format, | 67 gfx::BufferFormat format, |
| 68 gfx::BufferUsage usage) { | 68 gfx::BufferUsage usage) { |
| 69 return GpuMemoryBufferFactoryIOSurface:: | 69 return gpu::IsNativeGpuMemoryBufferConfigurationSupported(format, usage); |
| 70 IsGpuMemoryBufferConfigurationSupported(format, usage); | |
| 71 } | 70 } |
| 72 | 71 |
| 73 // static | 72 // static |
| 74 base::Closure GpuMemoryBufferImplIOSurface::AllocateForTesting( | 73 base::Closure GpuMemoryBufferImplIOSurface::AllocateForTesting( |
| 75 const gfx::Size& size, | 74 const gfx::Size& size, |
| 76 gfx::BufferFormat format, | 75 gfx::BufferFormat format, |
| 77 gfx::BufferUsage usage, | 76 gfx::BufferUsage usage, |
| 78 gfx::GpuMemoryBufferHandle* handle) { | 77 gfx::GpuMemoryBufferHandle* handle) { |
| 79 base::ScopedCFTypeRef<IOSurfaceRef> io_surface( | 78 base::ScopedCFTypeRef<IOSurfaceRef> io_surface( |
| 80 gfx::CreateIOSurface(size, format)); | 79 gfx::CreateIOSurface(size, format)); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 } | 115 } |
| 117 | 116 |
| 118 gfx::GpuMemoryBufferHandle GpuMemoryBufferImplIOSurface::GetHandle() const { | 117 gfx::GpuMemoryBufferHandle GpuMemoryBufferImplIOSurface::GetHandle() const { |
| 119 gfx::GpuMemoryBufferHandle handle; | 118 gfx::GpuMemoryBufferHandle handle; |
| 120 handle.type = gfx::IO_SURFACE_BUFFER; | 119 handle.type = gfx::IO_SURFACE_BUFFER; |
| 121 handle.id = id_; | 120 handle.id = id_; |
| 122 return handle; | 121 return handle; |
| 123 } | 122 } |
| 124 | 123 |
| 125 } // namespace content | 124 } // namespace content |
| OLD | NEW |