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 "base/trace_event/memory_dump_manager.h" | 9 #include "base/trace_event/memory_dump_manager.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
11 #include "ui/gfx/buffer_types.h" | 11 #include "ui/gfx/buffer_types.h" |
12 #include "ui/gfx/generic_shared_memory_id.h" | 12 #include "ui/gfx/generic_shared_memory_id.h" |
13 #include "ui/gfx/gfx_export.h" | 13 #include "ui/gfx/gfx_export.h" |
14 | 14 |
| 15 #if defined(USE_OZONE) |
| 16 #include "ui/gfx/native_pixmap_handle_ozone.h" |
| 17 #endif |
| 18 |
15 extern "C" typedef struct _ClientBuffer* ClientBuffer; | 19 extern "C" typedef struct _ClientBuffer* ClientBuffer; |
16 | 20 |
17 namespace gfx { | 21 namespace gfx { |
18 | 22 |
19 enum GpuMemoryBufferType { | 23 enum GpuMemoryBufferType { |
20 EMPTY_BUFFER, | 24 EMPTY_BUFFER, |
21 SHARED_MEMORY_BUFFER, | 25 SHARED_MEMORY_BUFFER, |
22 IO_SURFACE_BUFFER, | 26 IO_SURFACE_BUFFER, |
23 SURFACE_TEXTURE_BUFFER, | 27 SURFACE_TEXTURE_BUFFER, |
24 OZONE_NATIVE_PIXMAP, | 28 OZONE_NATIVE_PIXMAP, |
25 GPU_MEMORY_BUFFER_TYPE_LAST = OZONE_NATIVE_PIXMAP | 29 GPU_MEMORY_BUFFER_TYPE_LAST = OZONE_NATIVE_PIXMAP |
26 }; | 30 }; |
27 | 31 |
28 using GpuMemoryBufferId = gfx::GenericSharedMemoryId; | 32 using GpuMemoryBufferId = gfx::GenericSharedMemoryId; |
29 | 33 |
30 struct GFX_EXPORT GpuMemoryBufferHandle { | 34 struct GFX_EXPORT GpuMemoryBufferHandle { |
31 GpuMemoryBufferHandle(); | 35 GpuMemoryBufferHandle(); |
32 bool is_null() const { return type == EMPTY_BUFFER; } | 36 bool is_null() const { return type == EMPTY_BUFFER; } |
33 GpuMemoryBufferType type; | 37 GpuMemoryBufferType type; |
34 GpuMemoryBufferId id; | 38 GpuMemoryBufferId id; |
35 base::SharedMemoryHandle handle; | 39 base::SharedMemoryHandle handle; |
| 40 #if defined(USE_OZONE) |
| 41 NativePixmapHandle native_pixmap_handle; |
| 42 #endif |
36 }; | 43 }; |
37 | 44 |
38 base::trace_event::MemoryAllocatorDumpGuid GFX_EXPORT | 45 base::trace_event::MemoryAllocatorDumpGuid GFX_EXPORT |
39 GetGpuMemoryBufferGUIDForTracing(uint64 tracing_process_id, | 46 GetGpuMemoryBufferGUIDForTracing(uint64 tracing_process_id, |
40 GpuMemoryBufferId buffer_id); | 47 GpuMemoryBufferId buffer_id); |
41 | 48 |
42 // This interface typically correspond to a type of shared memory that is also | 49 // This interface typically correspond to a type of shared memory that is also |
43 // shared with the GPU. A GPU memory buffer can be written to directly by | 50 // shared with the GPU. A GPU memory buffer can be written to directly by |
44 // regular CPU code, but can also be read by the GPU. | 51 // regular CPU code, but can also be read by the GPU. |
45 class GFX_EXPORT GpuMemoryBuffer { | 52 class GFX_EXPORT GpuMemoryBuffer { |
(...skipping 27 matching lines...) Expand all Loading... |
73 // Returns a platform specific handle for this buffer. | 80 // Returns a platform specific handle for this buffer. |
74 virtual GpuMemoryBufferHandle GetHandle() const = 0; | 81 virtual GpuMemoryBufferHandle GetHandle() const = 0; |
75 | 82 |
76 // Type-checking downcast routine. | 83 // Type-checking downcast routine. |
77 virtual ClientBuffer AsClientBuffer() = 0; | 84 virtual ClientBuffer AsClientBuffer() = 0; |
78 }; | 85 }; |
79 | 86 |
80 } // namespace gfx | 87 } // namespace gfx |
81 | 88 |
82 #endif // UI_GFX_GPU_MEMORY_BUFFER_H_ | 89 #endif // UI_GFX_GPU_MEMORY_BUFFER_H_ |
OLD | NEW |