| 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 }; | |
| 69 | |
| 70 GpuMemoryBuffer(); | 68 GpuMemoryBuffer(); |
| 71 virtual ~GpuMemoryBuffer(); | 69 virtual ~GpuMemoryBuffer(); |
| 72 | 70 |
| 73 // Maps the buffer into the client's address space so it can be written to by | 71 // 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 | 72 // 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| | 73 // accessing the buffer or if CPU caches need to be synchronized. Returns NULL |
| 76 // indicate how the client intends to use the mapped buffer. Returns NULL on | 74 // on failure. |
| 77 // failure. | 75 virtual void* Map() = 0; |
| 78 virtual void* Map(AccessMode mode) = 0; | |
| 79 | 76 |
| 80 // Unmaps the buffer. It's illegal to use the pointer returned by Map() after | 77 // Unmaps the buffer. It's illegal to use the pointer returned by Map() after |
| 81 // this has been called. | 78 // this has been called. |
| 82 virtual void Unmap() = 0; | 79 virtual void Unmap() = 0; |
| 83 | 80 |
| 84 // Returns true iff the buffer is mapped. | 81 // Returns true iff the buffer is mapped. |
| 85 virtual bool IsMapped() const = 0; | 82 virtual bool IsMapped() const = 0; |
| 86 | 83 |
| 87 // Returns the stride in bytes for the buffer. | 84 // Returns the stride in bytes for the buffer. |
| 88 virtual uint32 GetStride() const = 0; | 85 virtual uint32 GetStride() const = 0; |
| 89 | 86 |
| 90 // Returns a platform specific handle for this buffer. | 87 // Returns a platform specific handle for this buffer. |
| 91 virtual GpuMemoryBufferHandle GetHandle() const = 0; | 88 virtual GpuMemoryBufferHandle GetHandle() const = 0; |
| 92 }; | 89 }; |
| 93 | 90 |
| 94 } // namespace gfx | 91 } // namespace gfx |
| 95 | 92 |
| 96 #endif // UI_GFX_GPU_MEMORY_BUFFER_H_ | 93 #endif // UI_GFX_GPU_MEMORY_BUFFER_H_ |
| OLD | NEW |