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