OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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 UI_GFX_GPU_MEMORY_BUFFER_H_ | 5 #ifndef UI_GFX_GPU_MEMORY_BUFFER_H_ |
6 #define UI_GFX_GPU_MEMORY_BUFFER_H_ | 6 #define UI_GFX_GPU_MEMORY_BUFFER_H_ |
7 | 7 |
8 #include "base/memory/shared_memory.h" | 8 #include "base/memory/shared_memory.h" |
9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
10 #include "ui/gfx/gfx_export.h" | 10 #include "ui/gfx/gfx_export.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
58 EGLClientBuffer native_buffer; | 58 EGLClientBuffer native_buffer; |
59 SurfaceTextureId surface_texture_id; | 59 SurfaceTextureId surface_texture_id; |
60 #endif | 60 #endif |
61 }; | 61 }; |
62 | 62 |
63 // This interface typically correspond to a type of shared memory that is also | 63 // This interface typically correspond to a type of shared memory that is also |
64 // shared with the GPU. A GPU memory buffer can be written to directly by | 64 // shared with the GPU. A GPU memory buffer can be written to directly by |
65 // regular CPU code, but can also be read by the GPU. | 65 // regular CPU code, but can also be read by the GPU. |
66 class GFX_EXPORT GpuMemoryBuffer { | 66 class GFX_EXPORT GpuMemoryBuffer { |
67 public: | 67 public: |
68 enum AccessMode { READ_ONLY, WRITE_ONLY, READ_WRITE }; | 68 enum Usage { READ_WRITE, SCANOUT, USAGE_LAST = SCANOUT }; |
reveman
2014/04/30 11:31:28
I don't think this needs to be part of this interf
| |
69 | |
70 GpuMemoryBuffer(); | 69 GpuMemoryBuffer(); |
71 virtual ~GpuMemoryBuffer(); | 70 virtual ~GpuMemoryBuffer(); |
72 | 71 |
73 // Maps the buffer into the client's address space so it can be written to by | 72 // Maps the buffer into the client's address space so it can be written to by |
74 // the CPU. This call may block, for instance if the GPU needs to finish | 73 // the CPU. This call may block, for instance if the GPU needs to finish |
75 // accessing the buffer or if CPU caches need to be synchronized. |mode| | 74 // accessing the buffer or if CPU caches need to be synchronized. |mode| |
reveman
2014/04/30 11:31:28
Please update this comment.
| |
76 // indicate how the client intends to use the mapped buffer. Returns NULL on | 75 // indicate how the client intends to use the mapped buffer. Returns NULL on |
77 // failure. | 76 // failure. |
78 virtual void* Map(AccessMode mode) = 0; | 77 virtual void* Map() = 0; |
79 | 78 |
80 // Unmaps the buffer. It's illegal to use the pointer returned by Map() after | 79 // Unmaps the buffer. It's illegal to use the pointer returned by Map() after |
81 // this has been called. | 80 // this has been called. |
82 virtual void Unmap() = 0; | 81 virtual void Unmap() = 0; |
83 | 82 |
84 // Returns true iff the buffer is mapped. | 83 // Returns true iff the buffer is mapped. |
85 virtual bool IsMapped() const = 0; | 84 virtual bool IsMapped() const = 0; |
86 | 85 |
87 // Returns the stride in bytes for the buffer. | 86 // Returns the stride in bytes for the buffer. |
88 virtual uint32 GetStride() const = 0; | 87 virtual uint32 GetStride() const = 0; |
89 | 88 |
90 // Returns a platform specific handle for this buffer. | 89 // Returns a platform specific handle for this buffer. |
91 virtual GpuMemoryBufferHandle GetHandle() const = 0; | 90 virtual GpuMemoryBufferHandle GetHandle() const = 0; |
92 }; | 91 }; |
93 | 92 |
94 } // namespace gfx | 93 } // namespace gfx |
95 | 94 |
96 #endif // UI_GFX_GPU_MEMORY_BUFFER_H_ | 95 #endif // UI_GFX_GPU_MEMORY_BUFFER_H_ |
OLD | NEW |