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/geometry/rect.h" | 13 #include "ui/gfx/geometry/rect.h" |
14 #include "ui/gfx/gfx_export.h" | 14 #include "ui/gfx/gfx_export.h" |
15 | 15 |
16 #if defined(USE_OZONE) | 16 #if defined(USE_OZONE) |
17 #include "ui/gfx/native_pixmap_handle_ozone.h" | 17 #include "ui/gfx/native_pixmap_handle_ozone.h" |
18 #elif defined(OS_MACOSX) | |
19 #include "base/mac/scoped_mach_port.h" | |
18 #endif | 20 #endif |
19 | 21 |
20 extern "C" typedef struct _ClientBuffer* ClientBuffer; | 22 extern "C" typedef struct _ClientBuffer* ClientBuffer; |
21 | 23 |
22 namespace gfx { | 24 namespace gfx { |
23 | 25 |
24 enum GpuMemoryBufferType { | 26 enum GpuMemoryBufferType { |
25 EMPTY_BUFFER, | 27 EMPTY_BUFFER, |
26 SHARED_MEMORY_BUFFER, | 28 SHARED_MEMORY_BUFFER, |
27 IO_SURFACE_BUFFER, | 29 IO_SURFACE_BUFFER, |
28 SURFACE_TEXTURE_BUFFER, | 30 SURFACE_TEXTURE_BUFFER, |
29 OZONE_NATIVE_PIXMAP, | 31 OZONE_NATIVE_PIXMAP, |
30 GPU_MEMORY_BUFFER_TYPE_LAST = OZONE_NATIVE_PIXMAP | 32 GPU_MEMORY_BUFFER_TYPE_LAST = OZONE_NATIVE_PIXMAP |
31 }; | 33 }; |
32 | 34 |
33 using GpuMemoryBufferId = GenericSharedMemoryId; | 35 using GpuMemoryBufferId = GenericSharedMemoryId; |
34 | 36 |
35 struct GFX_EXPORT GpuMemoryBufferHandle { | 37 struct GFX_EXPORT GpuMemoryBufferHandle { |
36 GpuMemoryBufferHandle(); | 38 GpuMemoryBufferHandle(); |
39 ~GpuMemoryBufferHandle(); | |
37 bool is_null() const { return type == EMPTY_BUFFER; } | 40 bool is_null() const { return type == EMPTY_BUFFER; } |
38 GpuMemoryBufferType type; | 41 GpuMemoryBufferType type; |
39 GpuMemoryBufferId id; | 42 GpuMemoryBufferId id; |
40 base::SharedMemoryHandle handle; | 43 base::SharedMemoryHandle handle; |
41 uint32_t offset; | 44 uint32_t offset; |
42 int32_t stride; | 45 int32_t stride; |
43 #if defined(USE_OZONE) | 46 #if defined(USE_OZONE) |
44 NativePixmapHandle native_pixmap_handle; | 47 NativePixmapHandle native_pixmap_handle; |
48 #elif defined(OS_MACOSX) | |
49 base::mac::ScopedRefCountedMachSendRight mach_port; | |
ccameron
2015/12/21 19:30:14
The existence of this port will result in the IOSu
| |
45 #endif | 50 #endif |
46 }; | 51 }; |
47 | 52 |
48 base::trace_event::MemoryAllocatorDumpGuid GFX_EXPORT | 53 base::trace_event::MemoryAllocatorDumpGuid GFX_EXPORT |
49 GetGpuMemoryBufferGUIDForTracing(uint64 tracing_process_id, | 54 GetGpuMemoryBufferGUIDForTracing(uint64 tracing_process_id, |
50 GpuMemoryBufferId buffer_id); | 55 GpuMemoryBufferId buffer_id); |
51 | 56 |
52 // This interface typically correspond to a type of shared memory that is also | 57 // 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 | 58 // 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. | 59 // regular CPU code, but can also be read by the GPU. |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
86 // Returns a platform specific handle for this buffer. | 91 // Returns a platform specific handle for this buffer. |
87 virtual GpuMemoryBufferHandle GetHandle() const = 0; | 92 virtual GpuMemoryBufferHandle GetHandle() const = 0; |
88 | 93 |
89 // Type-checking downcast routine. | 94 // Type-checking downcast routine. |
90 virtual ClientBuffer AsClientBuffer() = 0; | 95 virtual ClientBuffer AsClientBuffer() = 0; |
91 }; | 96 }; |
92 | 97 |
93 } // namespace gfx | 98 } // namespace gfx |
94 | 99 |
95 #endif // UI_GFX_GPU_MEMORY_BUFFER_H_ | 100 #endif // UI_GFX_GPU_MEMORY_BUFFER_H_ |
OLD | NEW |