| 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/common/gpu/client/gpu_memory_buffer_impl_ozone_native_buffer.h
" | 5 #include "content/common/gpu/client/gpu_memory_buffer_impl_ozone_native_buffer.h
" |
| 6 | 6 |
| 7 #include "ui/ozone/public/surface_factory_ozone.h" | 7 #include "ui/ozone/public/surface_factory_ozone.h" |
| 8 | 8 |
| 9 #if defined(USE_OZONE_GBM) |
| 10 #include "content/common/gpu/client/gpu_memory_buffer_impl_ozone_gbm.h" |
| 11 #endif |
| 12 |
| 9 namespace content { | 13 namespace content { |
| 10 | 14 |
| 11 GpuMemoryBufferImplOzoneNativeBuffer::GpuMemoryBufferImplOzoneNativeBuffer( | 15 GpuMemoryBufferImplOzoneNativeBuffer::GpuMemoryBufferImplOzoneNativeBuffer( |
| 12 gfx::GpuMemoryBufferId id, | 16 gfx::GpuMemoryBufferId id, |
| 13 const gfx::Size& size, | 17 const gfx::Size& size, |
| 14 Format format, | 18 Format format, |
| 15 const DestructionCallback& callback) | 19 const DestructionCallback& callback) |
| 16 : GpuMemoryBufferImpl(id, size, format, callback) { | 20 : GpuMemoryBufferImpl(id, size, format, callback) { |
| 17 } | 21 } |
| 18 | 22 |
| 19 GpuMemoryBufferImplOzoneNativeBuffer::~GpuMemoryBufferImplOzoneNativeBuffer() { | 23 GpuMemoryBufferImplOzoneNativeBuffer::~GpuMemoryBufferImplOzoneNativeBuffer() { |
| 20 } | 24 } |
| 21 | 25 |
| 22 // static | 26 // static |
| 23 scoped_ptr<GpuMemoryBufferImpl> | 27 scoped_ptr<GpuMemoryBufferImpl> |
| 24 GpuMemoryBufferImplOzoneNativeBuffer::CreateFromHandle( | 28 GpuMemoryBufferImplOzoneNativeBuffer::CreateFromHandle( |
| 25 const gfx::GpuMemoryBufferHandle& handle, | 29 const gfx::GpuMemoryBufferHandle& handle, |
| 26 const gfx::Size& size, | 30 const gfx::Size& size, |
| 27 Format format, | 31 Format format, |
| 28 const DestructionCallback& callback) { | 32 const DestructionCallback& callback) { |
| 33 #if defined(USE_OZONE_GBM) |
| 34 // If |fd| is -1, it's SCANOUT buffer. |
| 35 if (handle.device_handle.fd != -1) |
| 36 return GpuMemoryBufferImplOzoneGbm::CreateFromHandle(handle, size, format, |
| 37 callback); |
| 38 #endif |
| 29 return make_scoped_ptr<GpuMemoryBufferImpl>( | 39 return make_scoped_ptr<GpuMemoryBufferImpl>( |
| 30 new GpuMemoryBufferImplOzoneNativeBuffer( | 40 new GpuMemoryBufferImplOzoneNativeBuffer( |
| 31 handle.id, size, format, callback)); | 41 handle.id, size, format, callback)); |
| 32 } | 42 } |
| 33 | 43 |
| 34 bool GpuMemoryBufferImplOzoneNativeBuffer::Map(void** data) { | 44 bool GpuMemoryBufferImplOzoneNativeBuffer::Map(void** data) { |
| 35 NOTREACHED(); | 45 NOTREACHED(); |
| 36 return false; | 46 return false; |
| 37 } | 47 } |
| 38 | 48 |
| 39 void GpuMemoryBufferImplOzoneNativeBuffer::Unmap() { | 49 void GpuMemoryBufferImplOzoneNativeBuffer::Unmap() { |
| 40 NOTREACHED(); | 50 NOTREACHED(); |
| 41 } | 51 } |
| 42 | 52 |
| 43 void GpuMemoryBufferImplOzoneNativeBuffer::GetStride(int* stride) const { | 53 void GpuMemoryBufferImplOzoneNativeBuffer::GetStride(int* stride) const { |
| 44 NOTREACHED(); | 54 NOTREACHED(); |
| 45 } | 55 } |
| 46 | 56 |
| 47 gfx::GpuMemoryBufferHandle GpuMemoryBufferImplOzoneNativeBuffer::GetHandle() | 57 gfx::GpuMemoryBufferHandle GpuMemoryBufferImplOzoneNativeBuffer::GetHandle() |
| 48 const { | 58 const { |
| 49 gfx::GpuMemoryBufferHandle handle; | 59 gfx::GpuMemoryBufferHandle handle; |
| 50 handle.type = gfx::OZONE_NATIVE_BUFFER; | 60 handle.type = gfx::OZONE_NATIVE_BUFFER; |
| 51 handle.id = id_; | 61 handle.id = id_; |
| 52 return handle; | 62 return handle; |
| 53 } | 63 } |
| 54 | 64 |
| 55 } // namespace content | 65 } // namespace content |
| OLD | NEW |