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" |
11 | 11 |
12 #if defined(OS_ANDROID) | 12 //#if defined(OS_ANDROID) |
13 #include <third_party/khronos/EGL/egl.h> | 13 #include <third_party/khronos/EGL/egl.h> |
14 #endif | 14 //#endif |
15 | 15 |
16 namespace gfx { | 16 namespace gfx { |
17 | 17 |
18 enum GpuMemoryBufferType { | 18 enum GpuMemoryBufferType { |
19 EMPTY_BUFFER, | 19 EMPTY_BUFFER, |
20 SHARED_MEMORY_BUFFER, | 20 SHARED_MEMORY_BUFFER, |
21 EGL_CLIENT_BUFFER, | 21 EGL_CLIENT_BUFFER, |
22 IO_SURFACE_BUFFER | 22 IO_SURFACE_BUFFER |
23 }; | 23 }; |
24 | 24 |
25 struct GpuMemoryBufferHandle { | 25 struct GpuMemoryBufferHandle { |
26 GpuMemoryBufferHandle() | 26 GpuMemoryBufferHandle() |
27 : type(EMPTY_BUFFER), | 27 : type(EMPTY_BUFFER), |
28 handle(base::SharedMemory::NULLHandle()) | 28 handle(base::SharedMemory::NULLHandle()) |
29 #if defined(OS_ANDROID) | 29 //#if defined(OS_ANDROID) || defined(OZONE) |
30 , native_buffer(NULL) | 30 , |
31 #endif | 31 native_buffer(NULL) |
| 32 //#endif |
32 #if defined(OS_MACOSX) | 33 #if defined(OS_MACOSX) |
33 , io_surface_id(0) | 34 , |
| 35 io_surface_id(0) |
34 #endif | 36 #endif |
35 { | 37 { |
36 } | 38 } |
37 bool is_null() const { return type == EMPTY_BUFFER; } | 39 bool is_null() const { return type == EMPTY_BUFFER; } |
38 GpuMemoryBufferType type; | 40 GpuMemoryBufferType type; |
39 base::SharedMemoryHandle handle; | 41 base::SharedMemoryHandle handle; |
40 #if defined(OS_ANDROID) | 42 //#if defined(OS_ANDROID) || defined(OZONE) |
41 EGLClientBuffer native_buffer; | 43 EGLClientBuffer native_buffer; |
42 #endif | 44 //#endif |
43 #if defined(OS_MACOSX) | 45 #if defined(OS_MACOSX) |
44 uint32 io_surface_id; | 46 uint32 io_surface_id; |
45 #endif | 47 #endif |
46 | 48 |
47 }; | 49 }; |
48 | 50 |
49 // Interface for creating and accessing a zero-copy GPU memory buffer. | 51 // Interface for creating and accessing a zero-copy GPU memory buffer. |
50 // This design evolved from the generalization of GraphicBuffer API | 52 // This design evolved from the generalization of GraphicBuffer API |
51 // of Android framework. | 53 // of Android framework. |
52 // | 54 // |
(...skipping 28 matching lines...) Expand all Loading... |
81 // Returns the stride in bytes for the buffer. | 83 // Returns the stride in bytes for the buffer. |
82 virtual uint32 GetStride() const = 0; | 84 virtual uint32 GetStride() const = 0; |
83 | 85 |
84 // Returns a platform specific handle for this buffer. | 86 // Returns a platform specific handle for this buffer. |
85 virtual GpuMemoryBufferHandle GetHandle() const = 0; | 87 virtual GpuMemoryBufferHandle GetHandle() const = 0; |
86 }; | 88 }; |
87 | 89 |
88 } // namespace gfx | 90 } // namespace gfx |
89 | 91 |
90 #endif // UI_GFX_GPU_MEMORY_BUFFER_H_ | 92 #endif // UI_GFX_GPU_MEMORY_BUFFER_H_ |
OLD | NEW |