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_SURFACE_TEXTURE_H_ | 5 #ifndef CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_SURFACE_TEXTURE_H_ |
6 #define CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_SURFACE_TEXTURE_H_ | 6 #define CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_SURFACE_TEXTURE_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 ANativeWindow; | 10 struct ANativeWindow; |
11 | 11 |
12 namespace content { | 12 namespace content { |
13 | 13 |
14 // Implementation of GPU memory buffer based on SurfaceTextures. | 14 // Implementation of GPU memory buffer based on SurfaceTextures. |
15 class GpuMemoryBufferImplSurfaceTexture : public GpuMemoryBufferImpl { | 15 class GpuMemoryBufferImplSurfaceTexture : public GpuMemoryBufferImpl { |
16 public: | 16 public: |
17 static void Create(const gfx::Size& size, | 17 static void Create(gfx::GpuMemoryBufferId id, |
| 18 const gfx::Size& size, |
18 Format format, | 19 Format format, |
19 int client_id, | 20 int client_id, |
20 const CreationCallback& callback); | 21 const CreationCallback& callback); |
21 | 22 |
22 static void AllocateForChildProcess(const gfx::Size& size, | 23 static void AllocateForChildProcess(gfx::GpuMemoryBufferId id, |
| 24 const gfx::Size& size, |
23 Format format, | 25 Format format, |
24 int child_client_id, | 26 int child_client_id, |
25 const AllocationCallback& callback); | 27 const AllocationCallback& callback); |
26 | 28 |
27 static scoped_ptr<GpuMemoryBufferImpl> CreateFromHandle( | 29 static scoped_ptr<GpuMemoryBufferImpl> CreateFromHandle( |
28 const gfx::GpuMemoryBufferHandle& handle, | 30 const gfx::GpuMemoryBufferHandle& handle, |
29 const gfx::Size& size, | 31 const gfx::Size& size, |
30 Format format, | 32 Format format, |
31 const DestructionCallback& callback); | 33 const DestructionCallback& callback); |
32 | 34 |
33 static void DeletedByChildProcess(const gfx::GpuMemoryBufferId& id, | 35 static void DeletedByChildProcess(gfx::GpuMemoryBufferId id, |
| 36 int child_client_id, |
34 uint32_t sync_point); | 37 uint32_t sync_point); |
35 | 38 |
36 static bool IsFormatSupported(Format format); | 39 static bool IsFormatSupported(Format format); |
37 static bool IsUsageSupported(Usage usage); | 40 static bool IsUsageSupported(Usage usage); |
38 static bool IsConfigurationSupported(Format format, Usage usage); | 41 static bool IsConfigurationSupported(Format format, Usage usage); |
39 static int WindowFormat(Format format); | 42 static int WindowFormat(Format format); |
40 | 43 |
41 // Overridden from gfx::GpuMemoryBuffer: | 44 // Overridden from gfx::GpuMemoryBuffer: |
42 virtual void* Map() override; | 45 virtual void* Map() override; |
43 virtual void Unmap() override; | 46 virtual void Unmap() override; |
44 virtual gfx::GpuMemoryBufferHandle GetHandle() const override; | 47 virtual gfx::GpuMemoryBufferHandle GetHandle() const override; |
45 virtual uint32 GetStride() const override; | 48 virtual uint32 GetStride() const override; |
46 | 49 |
47 private: | 50 private: |
48 GpuMemoryBufferImplSurfaceTexture(const gfx::Size& size, | 51 GpuMemoryBufferImplSurfaceTexture(gfx::GpuMemoryBufferId id, |
| 52 const gfx::Size& size, |
49 Format format, | 53 Format format, |
50 const DestructionCallback& callback, | 54 const DestructionCallback& callback, |
51 const gfx::GpuMemoryBufferId& id, | |
52 ANativeWindow* native_window); | 55 ANativeWindow* native_window); |
53 virtual ~GpuMemoryBufferImplSurfaceTexture(); | 56 virtual ~GpuMemoryBufferImplSurfaceTexture(); |
54 | 57 |
55 gfx::GpuMemoryBufferId id_; | |
56 ANativeWindow* native_window_; | 58 ANativeWindow* native_window_; |
57 size_t stride_; | 59 size_t stride_; |
58 | 60 |
59 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferImplSurfaceTexture); | 61 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferImplSurfaceTexture); |
60 }; | 62 }; |
61 | 63 |
62 } // namespace content | 64 } // namespace content |
63 | 65 |
64 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_SURFACE_TEXTURE_H_ | 66 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_SURFACE_TEXTURE_H_ |
OLD | NEW |