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 "content/common/gpu/gpu_memory_buffer_factory_io_surface.h" |
9 #include "content/common/mac/io_surface_manager.h" | 9 #include "content/common/mac/io_surface_manager.h" |
10 #include "ui/gfx/buffer_format_util.h" | 10 #include "ui/gfx/buffer_format_util.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; |
19 case gfx::BufferUsage::GPU_READ: | 19 case gfx::BufferUsage::GPU_READ: |
20 case gfx::BufferUsage::GPU_READ_WRITE: | 20 case gfx::BufferUsage::SCANOUT: |
21 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE_PERSISTENT: | 21 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE_PERSISTENT: |
22 return 0; | 22 return 0; |
23 } | 23 } |
24 NOTREACHED(); | 24 NOTREACHED(); |
25 return 0; | 25 return 0; |
26 } | 26 } |
27 | 27 |
28 void FreeIOSurfaceForTesting(gfx::GpuMemoryBufferId id) { | 28 void FreeIOSurfaceForTesting(gfx::GpuMemoryBufferId id) { |
29 IOSurfaceManager::GetInstance()->UnregisterIOSurface(id, 0); | 29 IOSurfaceManager::GetInstance()->UnregisterIOSurface(id, 0); |
30 } | 30 } |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 } | 115 } |
116 | 116 |
117 gfx::GpuMemoryBufferHandle GpuMemoryBufferImplIOSurface::GetHandle() const { | 117 gfx::GpuMemoryBufferHandle GpuMemoryBufferImplIOSurface::GetHandle() const { |
118 gfx::GpuMemoryBufferHandle handle; | 118 gfx::GpuMemoryBufferHandle handle; |
119 handle.type = gfx::IO_SURFACE_BUFFER; | 119 handle.type = gfx::IO_SURFACE_BUFFER; |
120 handle.id = id_; | 120 handle.id = id_; |
121 return handle; | 121 return handle; |
122 } | 122 } |
123 | 123 |
124 } // namespace content | 124 } // namespace content |
OLD | NEW |