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