Chromium Code Reviews| 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 #ifndef CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_OZONE_NATIVE_BUFFER_H_ | 5 #ifndef CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_OZONE_NATIVE_BUFFER_H_ |
| 6 #define CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_OZONE_NATIVE_BUFFER_H_ | 6 #define CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_OZONE_NATIVE_BUFFER_H_ |
| 7 | 7 |
| 8 #include "content/common/gpu/client/gpu_memory_buffer_impl.h" | 8 #include "content/common/gpu/client/gpu_memory_buffer_impl.h" |
| 9 | 9 |
| 10 struct gbm_bo; | |
| 11 | |
| 10 namespace content { | 12 namespace content { |
| 11 | 13 |
| 12 // Implementation of GPU memory buffer based on Ozone native buffers. | 14 // Implementation of GPU memory buffer based on Ozone native buffers. |
| 13 class GpuMemoryBufferImplOzoneNativeBuffer : public GpuMemoryBufferImpl { | 15 class GpuMemoryBufferImplOzoneNativeBuffer : public GpuMemoryBufferImpl { |
| 14 public: | 16 public: |
| 15 static scoped_ptr<GpuMemoryBufferImpl> CreateFromHandle( | 17 static scoped_ptr<GpuMemoryBufferImpl> CreateFromHandle( |
| 16 const gfx::GpuMemoryBufferHandle& handle, | 18 const gfx::GpuMemoryBufferHandle& handle, |
| 17 const gfx::Size& size, | 19 const gfx::Size& size, |
| 18 Format format, | 20 Format format, |
| 19 const DestructionCallback& callback); | 21 const DestructionCallback& callback); |
| 20 | 22 |
| 23 ~GpuMemoryBufferImplOzoneNativeBuffer() override; | |
| 24 | |
| 21 // Overridden from gfx::GpuMemoryBuffer: | 25 // Overridden from gfx::GpuMemoryBuffer: |
| 22 bool Map(void** data) override; | 26 bool Map(void** data) override; |
| 23 void Unmap() override; | 27 void Unmap() override; |
| 24 void GetStride(int* stride) const override; | 28 void GetStride(int* stride) const override; |
| 25 gfx::GpuMemoryBufferHandle GetHandle() const override; | 29 gfx::GpuMemoryBufferHandle GetHandle() const override; |
| 26 | 30 |
| 27 private: | 31 private: |
| 28 GpuMemoryBufferImplOzoneNativeBuffer(gfx::GpuMemoryBufferId id, | 32 GpuMemoryBufferImplOzoneNativeBuffer(gfx::GpuMemoryBufferId id, |
| 29 const gfx::Size& size, | 33 const gfx::Size& size, |
| 30 Format format, | 34 Format format, |
| 31 const DestructionCallback& callback); | 35 const DestructionCallback& callback); |
| 32 ~GpuMemoryBufferImplOzoneNativeBuffer() override; | 36 |
| 37 bool Initialize(const gfx::GpuMemoryBufferHandle& handle); | |
| 38 | |
| 39 uint32_t vgem_bo_handle_; | |
| 40 base::ScopedFD dma_buf_; | |
| 41 base::ScopedFD vgem_fd_; | |
| 42 size_t stride_; | |
| 43 void* mmap_ptr_; | |
|
reveman
2015/05/14 13:22:03
Please move all this into ui/ozone/ and keep one o
dshwang
2015/05/14 14:58:15
now I understand what you mean. It's very reasonab
| |
| 33 | 44 |
| 34 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferImplOzoneNativeBuffer); | 45 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferImplOzoneNativeBuffer); |
| 35 }; | 46 }; |
| 36 | 47 |
| 37 } // namespace content | 48 } // namespace content |
| 38 | 49 |
| 39 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_OZONE_NATIVE_BUFFER_ H_ | 50 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_OZONE_NATIVE_BUFFER_ H_ |
| OLD | NEW |