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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 #endif | 49 #endif |
50 }; | 50 }; |
51 | 51 |
52 // This interface typically correspond to a type of shared memory that is also | 52 // This interface typically correspond to a type of shared memory that is also |
53 // shared with the GPU. A GPU memory buffer can be written to directly by | 53 // shared with the GPU. A GPU memory buffer can be written to directly by |
54 // regular CPU code, but can also be read by the GPU. | 54 // regular CPU code, but can also be read by the GPU. |
55 class GFX_EXPORT GpuMemoryBuffer { | 55 class GFX_EXPORT GpuMemoryBuffer { |
56 public: | 56 public: |
57 // The format needs to be taken into account when mapping a buffer into the | 57 // The format needs to be taken into account when mapping a buffer into the |
58 // client's address space. | 58 // client's address space. |
59 enum Format { RGBA_8888, RGBX_8888, BGRA_8888, FORMAT_LAST = BGRA_8888 }; | 59 enum Format { |
| 60 ATC, |
| 61 ATCIA, |
| 62 DXT1, |
| 63 DXT5, |
| 64 ETC1, |
| 65 RGBA_8888, |
| 66 RGBX_8888, |
| 67 BGRA_8888, |
| 68 FORMAT_LAST = BGRA_8888 |
| 69 }; |
60 | 70 |
61 // The usage mode affects how a buffer can be used. Only buffers created with | 71 // 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. | 72 // MAP can be mapped into the client's address space and accessed by the CPU. |
63 enum Usage { MAP, SCANOUT, USAGE_LAST = SCANOUT }; | 73 enum Usage { MAP, SCANOUT, USAGE_LAST = SCANOUT }; |
64 | 74 |
65 virtual ~GpuMemoryBuffer() {} | 75 virtual ~GpuMemoryBuffer() {} |
66 | 76 |
67 // Maps the buffer into the client's address space so it can be written to by | 77 // Maps the buffer into the client's address space so it can be written to by |
68 // the CPU. This call may block, for instance if the GPU needs to finish | 78 // the CPU. This call may block, for instance if the GPU needs to finish |
69 // accessing the buffer or if CPU caches need to be synchronized. Returns NULL | 79 // accessing the buffer or if CPU caches need to be synchronized. Returns NULL |
(...skipping 16 matching lines...) Expand all Loading... |
86 // Returns a platform specific handle for this buffer. | 96 // Returns a platform specific handle for this buffer. |
87 virtual GpuMemoryBufferHandle GetHandle() const = 0; | 97 virtual GpuMemoryBufferHandle GetHandle() const = 0; |
88 | 98 |
89 // Type-checking downcast routine. | 99 // Type-checking downcast routine. |
90 virtual ClientBuffer AsClientBuffer() = 0; | 100 virtual ClientBuffer AsClientBuffer() = 0; |
91 }; | 101 }; |
92 | 102 |
93 } // namespace gfx | 103 } // namespace gfx |
94 | 104 |
95 #endif // UI_GFX_GPU_MEMORY_BUFFER_H_ | 105 #endif // UI_GFX_GPU_MEMORY_BUFFER_H_ |
OLD | NEW |