| 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 "gpu/ipc/client/gpu_memory_buffer_impl_surface_texture.h" | 5 #include "gpu/ipc/client/gpu_memory_buffer_impl_surface_texture.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "base/trace_event/trace_event.h" | 9 #include "base/trace_event/trace_event.h" |
| 10 #include "gpu/ipc/common/android/surface_texture_manager.h" | 10 #include "gpu/ipc/common/android/surface_texture_manager.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 case gfx::BufferFormat::UYVY_422: | 36 case gfx::BufferFormat::UYVY_422: |
| 37 NOTREACHED(); | 37 NOTREACHED(); |
| 38 return 0; | 38 return 0; |
| 39 } | 39 } |
| 40 | 40 |
| 41 NOTREACHED(); | 41 NOTREACHED(); |
| 42 return 0; | 42 return 0; |
| 43 } | 43 } |
| 44 | 44 |
| 45 void FreeSurfaceTextureForTesting( | 45 void FreeSurfaceTextureForTesting( |
| 46 scoped_refptr<gfx::SurfaceTexture> surface_texture, | 46 scoped_refptr<gl::SurfaceTexture> surface_texture, |
| 47 gfx::GpuMemoryBufferId id) { | 47 gfx::GpuMemoryBufferId id) { |
| 48 gpu::SurfaceTextureManager::GetInstance()->UnregisterSurfaceTexture(id.id, 0); | 48 gpu::SurfaceTextureManager::GetInstance()->UnregisterSurfaceTexture(id.id, 0); |
| 49 } | 49 } |
| 50 | 50 |
| 51 } // namespace | 51 } // namespace |
| 52 | 52 |
| 53 GpuMemoryBufferImplSurfaceTexture::GpuMemoryBufferImplSurfaceTexture( | 53 GpuMemoryBufferImplSurfaceTexture::GpuMemoryBufferImplSurfaceTexture( |
| 54 gfx::GpuMemoryBufferId id, | 54 gfx::GpuMemoryBufferId id, |
| 55 const gfx::Size& size, | 55 const gfx::Size& size, |
| 56 gfx::BufferFormat format, | 56 gfx::BufferFormat format, |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 gfx::BufferUsage usage) { | 90 gfx::BufferUsage usage) { |
| 91 return gpu::IsNativeGpuMemoryBufferConfigurationSupported(format, usage); | 91 return gpu::IsNativeGpuMemoryBufferConfigurationSupported(format, usage); |
| 92 } | 92 } |
| 93 | 93 |
| 94 // static | 94 // static |
| 95 base::Closure GpuMemoryBufferImplSurfaceTexture::AllocateForTesting( | 95 base::Closure GpuMemoryBufferImplSurfaceTexture::AllocateForTesting( |
| 96 const gfx::Size& size, | 96 const gfx::Size& size, |
| 97 gfx::BufferFormat format, | 97 gfx::BufferFormat format, |
| 98 gfx::BufferUsage usage, | 98 gfx::BufferUsage usage, |
| 99 gfx::GpuMemoryBufferHandle* handle) { | 99 gfx::GpuMemoryBufferHandle* handle) { |
| 100 scoped_refptr<gfx::SurfaceTexture> surface_texture = | 100 scoped_refptr<gl::SurfaceTexture> surface_texture = |
| 101 gfx::SurfaceTexture::Create(0); | 101 gl::SurfaceTexture::Create(0); |
| 102 DCHECK(surface_texture); | 102 DCHECK(surface_texture); |
| 103 const gfx::GpuMemoryBufferId kBufferId(1); | 103 const gfx::GpuMemoryBufferId kBufferId(1); |
| 104 gpu::SurfaceTextureManager::GetInstance()->RegisterSurfaceTexture( | 104 gpu::SurfaceTextureManager::GetInstance()->RegisterSurfaceTexture( |
| 105 kBufferId.id, 0, surface_texture.get()); | 105 kBufferId.id, 0, surface_texture.get()); |
| 106 handle->type = gfx::SURFACE_TEXTURE_BUFFER; | 106 handle->type = gfx::SURFACE_TEXTURE_BUFFER; |
| 107 handle->id = kBufferId; | 107 handle->id = kBufferId; |
| 108 return base::Bind(&FreeSurfaceTextureForTesting, surface_texture, kBufferId); | 108 return base::Bind(&FreeSurfaceTextureForTesting, surface_texture, kBufferId); |
| 109 } | 109 } |
| 110 | 110 |
| 111 bool GpuMemoryBufferImplSurfaceTexture::Map() { | 111 bool GpuMemoryBufferImplSurfaceTexture::Map() { |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 | 143 |
| 144 gfx::GpuMemoryBufferHandle GpuMemoryBufferImplSurfaceTexture::GetHandle() | 144 gfx::GpuMemoryBufferHandle GpuMemoryBufferImplSurfaceTexture::GetHandle() |
| 145 const { | 145 const { |
| 146 gfx::GpuMemoryBufferHandle handle; | 146 gfx::GpuMemoryBufferHandle handle; |
| 147 handle.type = gfx::SURFACE_TEXTURE_BUFFER; | 147 handle.type = gfx::SURFACE_TEXTURE_BUFFER; |
| 148 handle.id = id_; | 148 handle.id = id_; |
| 149 return handle; | 149 return handle; |
| 150 } | 150 } |
| 151 | 151 |
| 152 } // namespace gpu | 152 } // namespace gpu |
| OLD | NEW |