OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_IO_SURFACE_H_ | |
6 #define CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_IO_SURFACE_H_ | |
7 | |
8 #include <IOSurface/IOSurface.h> | |
9 #include <stddef.h> | |
10 #include <stdint.h> | |
11 | |
12 #include "base/mac/scoped_cftyperef.h" | |
13 #include "base/macros.h" | |
14 #include "content/common/content_export.h" | |
15 #include "content/common/gpu/client/gpu_memory_buffer_impl.h" | |
16 | |
17 namespace content { | |
18 | |
19 // Implementation of GPU memory buffer based on IO surfaces. | |
20 class CONTENT_EXPORT GpuMemoryBufferImplIOSurface : public GpuMemoryBufferImpl { | |
21 public: | |
22 ~GpuMemoryBufferImplIOSurface() override; | |
23 | |
24 static scoped_ptr<GpuMemoryBufferImplIOSurface> CreateFromHandle( | |
25 const gfx::GpuMemoryBufferHandle& handle, | |
26 const gfx::Size& size, | |
27 gfx::BufferFormat format, | |
28 gfx::BufferUsage usage, | |
29 const DestructionCallback& callback); | |
30 | |
31 static bool IsConfigurationSupported(gfx::BufferFormat format, | |
32 gfx::BufferUsage usage); | |
33 | |
34 static base::Closure AllocateForTesting(const gfx::Size& size, | |
35 gfx::BufferFormat format, | |
36 gfx::BufferUsage usage, | |
37 gfx::GpuMemoryBufferHandle* handle); | |
38 | |
39 // Overridden from gfx::GpuMemoryBuffer: | |
40 bool Map() override; | |
41 void* memory(size_t plane) override; | |
42 void Unmap() override; | |
43 bool IsInUseByMacOSWindowServer() const override; | |
44 int stride(size_t plane) const override; | |
45 gfx::GpuMemoryBufferHandle GetHandle() const override; | |
46 | |
47 private: | |
48 GpuMemoryBufferImplIOSurface(gfx::GpuMemoryBufferId id, | |
49 const gfx::Size& size, | |
50 gfx::BufferFormat format, | |
51 const DestructionCallback& callback, | |
52 IOSurfaceRef io_surface, | |
53 uint32_t lock_flags); | |
54 | |
55 base::ScopedCFTypeRef<IOSurfaceRef> io_surface_; | |
56 uint32_t lock_flags_; | |
57 | |
58 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferImplIOSurface); | |
59 }; | |
60 | |
61 } // namespace content | |
62 | |
63 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_IO_SURFACE_H_ | |
OLD | NEW |