| 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 GPU_IPC_CLIENT_GPU_MEMORY_BUFFER_IMPL_OZONE_NATIVE_PIXMAP_H_ | 5 #ifndef GPU_IPC_CLIENT_GPU_MEMORY_BUFFER_IMPL_NATIVE_PIXMAP_H_ |
| 6 #define GPU_IPC_CLIENT_GPU_MEMORY_BUFFER_IMPL_OZONE_NATIVE_PIXMAP_H_ | 6 #define GPU_IPC_CLIENT_GPU_MEMORY_BUFFER_IMPL_NATIVE_PIXMAP_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 | 11 |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "gpu/gpu_export.h" | 13 #include "gpu/gpu_export.h" |
| 14 #include "gpu/ipc/client/gpu_memory_buffer_impl.h" | 14 #include "gpu/ipc/client/gpu_memory_buffer_impl.h" |
| 15 | 15 |
| 16 namespace gfx { | 16 namespace gfx { |
| 17 class ClientNativePixmap; | 17 class ClientNativePixmap; |
| 18 } | 18 } |
| 19 | 19 |
| 20 namespace gpu { | 20 namespace gpu { |
| 21 | 21 |
| 22 // Implementation of GPU memory buffer based on Ozone native pixmap. | 22 // Implementation of GPU memory buffer based on Ozone native pixmap. |
| 23 class GPU_EXPORT GpuMemoryBufferImplOzoneNativePixmap | 23 class GPU_EXPORT GpuMemoryBufferImplNativePixmap : public GpuMemoryBufferImpl { |
| 24 : public GpuMemoryBufferImpl { | |
| 25 public: | 24 public: |
| 26 ~GpuMemoryBufferImplOzoneNativePixmap() override; | 25 ~GpuMemoryBufferImplNativePixmap() override; |
| 27 | 26 |
| 28 static std::unique_ptr<GpuMemoryBufferImplOzoneNativePixmap> CreateFromHandle( | 27 static std::unique_ptr<GpuMemoryBufferImplNativePixmap> CreateFromHandle( |
| 29 const gfx::GpuMemoryBufferHandle& handle, | 28 const gfx::GpuMemoryBufferHandle& handle, |
| 30 const gfx::Size& size, | 29 const gfx::Size& size, |
| 31 gfx::BufferFormat format, | 30 gfx::BufferFormat format, |
| 32 gfx::BufferUsage usage, | 31 gfx::BufferUsage usage, |
| 33 const DestructionCallback& callback); | 32 const DestructionCallback& callback); |
| 34 | 33 |
| 35 static bool IsConfigurationSupported(gfx::BufferFormat format, | 34 static bool IsConfigurationSupported(gfx::BufferFormat format, |
| 36 gfx::BufferUsage usage); | 35 gfx::BufferUsage usage); |
| 37 | 36 |
| 38 static base::Closure AllocateForTesting(const gfx::Size& size, | 37 static base::Closure AllocateForTesting(const gfx::Size& size, |
| 39 gfx::BufferFormat format, | 38 gfx::BufferFormat format, |
| 40 gfx::BufferUsage usage, | 39 gfx::BufferUsage usage, |
| 41 gfx::GpuMemoryBufferHandle* handle); | 40 gfx::GpuMemoryBufferHandle* handle); |
| 42 | 41 |
| 43 // Overridden from gfx::GpuMemoryBuffer: | 42 // Overridden from gfx::GpuMemoryBuffer: |
| 44 bool Map() override; | 43 bool Map() override; |
| 45 void* memory(size_t plane) override; | 44 void* memory(size_t plane) override; |
| 46 void Unmap() override; | 45 void Unmap() override; |
| 47 int stride(size_t plane) const override; | 46 int stride(size_t plane) const override; |
| 48 gfx::GpuMemoryBufferHandle GetHandle() const override; | 47 gfx::GpuMemoryBufferHandle GetHandle() const override; |
| 49 | 48 |
| 50 private: | 49 private: |
| 51 GpuMemoryBufferImplOzoneNativePixmap( | 50 GpuMemoryBufferImplNativePixmap( |
| 52 gfx::GpuMemoryBufferId id, | 51 gfx::GpuMemoryBufferId id, |
| 53 const gfx::Size& size, | 52 const gfx::Size& size, |
| 54 gfx::BufferFormat format, | 53 gfx::BufferFormat format, |
| 55 const DestructionCallback& callback, | 54 const DestructionCallback& callback, |
| 56 std::unique_ptr<gfx::ClientNativePixmap> native_pixmap, | 55 std::unique_ptr<gfx::ClientNativePixmap> native_pixmap, |
| 57 const std::vector<gfx::NativePixmapPlane>& planes, | 56 const std::vector<gfx::NativePixmapPlane>& planes, |
| 58 base::ScopedFD fd); | 57 base::ScopedFD fd); |
| 59 | 58 |
| 60 std::unique_ptr<gfx::ClientNativePixmap> pixmap_; | 59 std::unique_ptr<gfx::ClientNativePixmap> pixmap_; |
| 61 std::vector<gfx::NativePixmapPlane> planes_; | 60 std::vector<gfx::NativePixmapPlane> planes_; |
| 62 base::ScopedFD fd_; | 61 base::ScopedFD fd_; |
| 63 | 62 |
| 64 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferImplOzoneNativePixmap); | 63 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferImplNativePixmap); |
| 65 }; | 64 }; |
| 66 | 65 |
| 67 } // namespace gpu | 66 } // namespace gpu |
| 68 | 67 |
| 69 #endif // GPU_IPC_CLIENT_GPU_MEMORY_BUFFER_IMPL_OZONE_NATIVE_PIXMAP_H_ | 68 #endif // GPU_IPC_CLIENT_GPU_MEMORY_BUFFER_IMPL_NATIVE_PIXMAP_H_ |
| OLD | NEW |