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 <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
11 #include "base/memory/shared_memory.h" | 11 #include "base/memory/shared_memory.h" |
12 #include "build/build_config.h" | 12 #include "build/build_config.h" |
13 #include "ui/gfx/buffer_types.h" | 13 #include "ui/gfx/buffer_types.h" |
14 #include "ui/gfx/generic_shared_memory_id.h" | 14 #include "ui/gfx/generic_shared_memory_id.h" |
15 #include "ui/gfx/geometry/rect.h" | 15 #include "ui/gfx/geometry/rect.h" |
16 #include "ui/gfx/gfx_export.h" | 16 #include "ui/gfx/gfx_export.h" |
17 | 17 |
18 #if defined(USE_OZONE) | 18 #if defined(OS_LINUX) |
19 #include "ui/gfx/native_pixmap_handle.h" | 19 #include "ui/gfx/native_pixmap_handle.h" |
20 #elif defined(OS_MACOSX) && !defined(OS_IOS) | 20 #elif defined(OS_MACOSX) && !defined(OS_IOS) |
21 #include "ui/gfx/mac/io_surface.h" | 21 #include "ui/gfx/mac/io_surface.h" |
22 #endif | 22 #endif |
23 | 23 |
24 extern "C" typedef struct _ClientBuffer* ClientBuffer; | 24 extern "C" typedef struct _ClientBuffer* ClientBuffer; |
25 | 25 |
26 namespace gfx { | 26 namespace gfx { |
27 | 27 |
28 class ColorSpace; | 28 class ColorSpace; |
(...skipping 11 matching lines...) Expand all Loading... |
40 struct GFX_EXPORT GpuMemoryBufferHandle { | 40 struct GFX_EXPORT GpuMemoryBufferHandle { |
41 GpuMemoryBufferHandle(); | 41 GpuMemoryBufferHandle(); |
42 GpuMemoryBufferHandle(const GpuMemoryBufferHandle& other); | 42 GpuMemoryBufferHandle(const GpuMemoryBufferHandle& other); |
43 ~GpuMemoryBufferHandle(); | 43 ~GpuMemoryBufferHandle(); |
44 bool is_null() const { return type == EMPTY_BUFFER; } | 44 bool is_null() const { return type == EMPTY_BUFFER; } |
45 GpuMemoryBufferType type; | 45 GpuMemoryBufferType type; |
46 GpuMemoryBufferId id; | 46 GpuMemoryBufferId id; |
47 base::SharedMemoryHandle handle; | 47 base::SharedMemoryHandle handle; |
48 uint32_t offset; | 48 uint32_t offset; |
49 int32_t stride; | 49 int32_t stride; |
50 #if defined(USE_OZONE) | 50 #if defined(OS_LINUX) |
51 NativePixmapHandle native_pixmap_handle; | 51 NativePixmapHandle native_pixmap_handle; |
52 #elif defined(OS_MACOSX) && !defined(OS_IOS) | 52 #elif defined(OS_MACOSX) && !defined(OS_IOS) |
53 ScopedRefCountedIOSurfaceMachPort mach_port; | 53 ScopedRefCountedIOSurfaceMachPort mach_port; |
54 #endif | 54 #endif |
55 }; | 55 }; |
56 | 56 |
57 // 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 |
58 // 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 |
59 // regular CPU code, but can also be read by the GPU. | 59 // regular CPU code, but can also be read by the GPU. |
60 class GFX_EXPORT GpuMemoryBuffer { | 60 class GFX_EXPORT GpuMemoryBuffer { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 | 101 |
102 // Returns an instance of |handle| which can be sent over IPC. This duplicates | 102 // Returns an instance of |handle| which can be sent over IPC. This duplicates |
103 // the file-handles as appropriate, so that the IPC code take ownership of them, | 103 // the file-handles as appropriate, so that the IPC code take ownership of them, |
104 // without invalidating |handle| itself. | 104 // without invalidating |handle| itself. |
105 GFX_EXPORT GpuMemoryBufferHandle | 105 GFX_EXPORT GpuMemoryBufferHandle |
106 CloneHandleForIPC(const GpuMemoryBufferHandle& handle); | 106 CloneHandleForIPC(const GpuMemoryBufferHandle& handle); |
107 | 107 |
108 } // namespace gfx | 108 } // namespace gfx |
109 | 109 |
110 #endif // UI_GFX_GPU_MEMORY_BUFFER_H_ | 110 #endif // UI_GFX_GPU_MEMORY_BUFFER_H_ |
OLD | NEW |