| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 RGBA_8888, | 53 RGBA_8888, |
| 54 RGBX_8888, | 54 RGBX_8888, |
| 55 BGRA_8888, | 55 BGRA_8888, |
| 56 YUV_420, | 56 YUV_420, |
| 57 | 57 |
| 58 FORMAT_LAST = YUV_420 | 58 FORMAT_LAST = YUV_420 |
| 59 }; | 59 }; |
| 60 | 60 |
| 61 // The usage mode affects how a buffer can be used. Only buffers created with | 61 // The usage mode affects how a buffer can be used. Only buffers created with |
| 62 // MAP can be mapped into the client's address space and accessed by the CPU. | 62 // MAP can be mapped into the client's address space and accessed by the CPU. |
| 63 enum Usage { MAP, SCANOUT, USAGE_LAST = SCANOUT }; | 63 // PERSISTENT_MAP adds the additional condition that successive Map() calls |
| 64 // (with Unmap() calls between) will return a pointer to the same memory |
| 65 // contents. |
| 66 enum Usage { MAP, PERSISTENT_MAP, SCANOUT, USAGE_LAST = SCANOUT }; |
| 64 | 67 |
| 65 virtual ~GpuMemoryBuffer() {} | 68 virtual ~GpuMemoryBuffer() {} |
| 66 | 69 |
| 67 // Maps each plane of the buffer into the client's address space so it can be | 70 // Maps each plane of the buffer into the client's address space so it can be |
| 68 // written to by the CPU. A pointer to plane K is stored at index K-1 of the | 71 // written to by the CPU. A pointer to plane K is stored at index K-1 of the |
| 69 // |data| array. This call may block, for instance if the GPU needs to finish | 72 // |data| array. This call may block, for instance if the GPU needs to finish |
| 70 // accessing the buffer or if CPU caches need to be synchronized. Returns | 73 // accessing the buffer or if CPU caches need to be synchronized. Returns |
| 71 // false on failure. | 74 // false on failure. |
| 72 virtual bool Map(void** data) = 0; | 75 virtual bool Map(void** data) = 0; |
| 73 | 76 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 88 // Returns a platform specific handle for this buffer. | 91 // Returns a platform specific handle for this buffer. |
| 89 virtual GpuMemoryBufferHandle GetHandle() const = 0; | 92 virtual GpuMemoryBufferHandle GetHandle() const = 0; |
| 90 | 93 |
| 91 // Type-checking downcast routine. | 94 // Type-checking downcast routine. |
| 92 virtual ClientBuffer AsClientBuffer() = 0; | 95 virtual ClientBuffer AsClientBuffer() = 0; |
| 93 }; | 96 }; |
| 94 | 97 |
| 95 } // namespace gfx | 98 } // namespace gfx |
| 96 | 99 |
| 97 #endif // UI_GFX_GPU_MEMORY_BUFFER_H_ | 100 #endif // UI_GFX_GPU_MEMORY_BUFFER_H_ |
| OLD | NEW |