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 "base/trace_event/memory_dump_manager.h" | 9 #include "base/trace_event/memory_dump_manager.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 27 matching lines...) Expand all Loading... | |
38 GetGpuMemoryBufferGUIDForTracing(uint64 tracing_process_id, | 38 GetGpuMemoryBufferGUIDForTracing(uint64 tracing_process_id, |
39 GpuMemoryBufferId buffer_id); | 39 GpuMemoryBufferId buffer_id); |
40 | 40 |
41 // This interface typically correspond to a type of shared memory that is also | 41 // This interface typically correspond to a type of shared memory that is also |
42 // shared with the GPU. A GPU memory buffer can be written to directly by | 42 // shared with the GPU. A GPU memory buffer can be written to directly by |
43 // regular CPU code, but can also be read by the GPU. | 43 // regular CPU code, but can also be read by the GPU. |
44 class GFX_EXPORT GpuMemoryBuffer { | 44 class GFX_EXPORT GpuMemoryBuffer { |
45 public: | 45 public: |
46 virtual ~GpuMemoryBuffer() {} | 46 virtual ~GpuMemoryBuffer() {} |
47 | 47 |
48 // Returns the number of planes based on the format of the buffer. | |
49 static size_t NumberOfPlanes(BufferFormat format); | |
reveman
2015/08/10 23:08:28
How about we add a gpu_memory_buffer_util.h file f
Andre
2015/08/11 03:50:03
Done.
| |
50 | |
48 // Maps each plane of the buffer into the client's address space so it can be | 51 // Maps each plane of the buffer into the client's address space so it can be |
49 // written to by the CPU. A pointer to plane K is stored at index K-1 of the | 52 // written to by the CPU. A pointer to plane K is stored at index K-1 of the |
50 // |data| array. This call may block, for instance if the GPU needs to finish | 53 // |data| array. This call may block, for instance if the GPU needs to finish |
51 // accessing the buffer or if CPU caches need to be synchronized. Returns | 54 // accessing the buffer or if CPU caches need to be synchronized. Returns |
52 // false on failure. | 55 // false on failure. |
53 virtual bool Map(void** data) = 0; | 56 virtual bool Map(void** data) = 0; |
54 | 57 |
55 // Unmaps the buffer. It's illegal to use the pointer returned by Map() after | 58 // Unmaps the buffer. It's illegal to use the pointer returned by Map() after |
56 // this has been called. | 59 // this has been called. |
57 virtual void Unmap() = 0; | 60 virtual void Unmap() = 0; |
(...skipping 14 matching lines...) Expand all Loading... | |
72 // Returns a platform specific handle for this buffer. | 75 // Returns a platform specific handle for this buffer. |
73 virtual GpuMemoryBufferHandle GetHandle() const = 0; | 76 virtual GpuMemoryBufferHandle GetHandle() const = 0; |
74 | 77 |
75 // Type-checking downcast routine. | 78 // Type-checking downcast routine. |
76 virtual ClientBuffer AsClientBuffer() = 0; | 79 virtual ClientBuffer AsClientBuffer() = 0; |
77 }; | 80 }; |
78 | 81 |
79 } // namespace gfx | 82 } // namespace gfx |
80 | 83 |
81 #endif // UI_GFX_GPU_MEMORY_BUFFER_H_ | 84 #endif // UI_GFX_GPU_MEMORY_BUFFER_H_ |
OLD | NEW |