| 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 #if defined(USE_X11) |
| 17 #include "ui/gfx/x/x11_types.h" |
| 18 #endif |
| 19 |
| 16 namespace gfx { | 20 namespace gfx { |
| 17 | 21 |
| 18 enum GpuMemoryBufferType { | 22 enum GpuMemoryBufferType { |
| 19 EMPTY_BUFFER, | 23 EMPTY_BUFFER, |
| 20 SHARED_MEMORY_BUFFER, | 24 SHARED_MEMORY_BUFFER, |
| 21 IO_SURFACE_BUFFER, | 25 IO_SURFACE_BUFFER, |
| 22 ANDROID_NATIVE_BUFFER, | 26 ANDROID_NATIVE_BUFFER, |
| 23 SURFACE_TEXTURE_BUFFER, | 27 SURFACE_TEXTURE_BUFFER, |
| 28 X11_PIXMAP_BUFFER, |
| 24 GPU_MEMORY_BUFFER_TYPE_LAST = SURFACE_TEXTURE_BUFFER | 29 GPU_MEMORY_BUFFER_TYPE_LAST = SURFACE_TEXTURE_BUFFER |
| 25 }; | 30 }; |
| 26 | 31 |
| 27 // TODO(alexst): Merge this with GpuMemoryBufferId as part of switchover to | 32 // TODO(alexst): Merge this with GpuMemoryBufferId as part of switchover to |
| 28 // the new API for GpuMemoryBuffer allocation when it's done. | 33 // the new API for GpuMemoryBuffer allocation when it's done. |
| 29 #if defined(OS_ANDROID) | 34 #if defined(OS_ANDROID) |
| 30 struct SurfaceTextureId { | 35 struct SurfaceTextureId { |
| 31 SurfaceTextureId() : primary_id(0), secondary_id(0) {} | 36 SurfaceTextureId() : primary_id(0), secondary_id(0) {} |
| 32 SurfaceTextureId(int32 primary_id, int32 secondary_id) | 37 SurfaceTextureId(int32 primary_id, int32 secondary_id) |
| 33 : primary_id(primary_id), secondary_id(secondary_id) {} | 38 : primary_id(primary_id), secondary_id(secondary_id) {} |
| (...skipping 16 matching lines...) Expand all Loading... |
| 50 GpuMemoryBufferType type; | 55 GpuMemoryBufferType type; |
| 51 base::SharedMemoryHandle handle; | 56 base::SharedMemoryHandle handle; |
| 52 GpuMemoryBufferId global_id; | 57 GpuMemoryBufferId global_id; |
| 53 #if defined(OS_MACOSX) | 58 #if defined(OS_MACOSX) |
| 54 uint32 io_surface_id; | 59 uint32 io_surface_id; |
| 55 #endif | 60 #endif |
| 56 #if defined(OS_ANDROID) | 61 #if defined(OS_ANDROID) |
| 57 EGLClientBuffer native_buffer; | 62 EGLClientBuffer native_buffer; |
| 58 SurfaceTextureId surface_texture_id; | 63 SurfaceTextureId surface_texture_id; |
| 59 #endif | 64 #endif |
| 65 #if defined(USE_X11) |
| 66 XID pixmap; |
| 67 #endif |
| 60 }; | 68 }; |
| 61 | 69 |
| 62 // This interface typically correspond to a type of shared memory that is also | 70 // This interface typically correspond to a type of shared memory that is also |
| 63 // shared with the GPU. A GPU memory buffer can be written to directly by | 71 // shared with the GPU. A GPU memory buffer can be written to directly by |
| 64 // regular CPU code, but can also be read by the GPU. | 72 // regular CPU code, but can also be read by the GPU. |
| 65 class GFX_EXPORT GpuMemoryBuffer { | 73 class GFX_EXPORT GpuMemoryBuffer { |
| 66 public: | 74 public: |
| 67 GpuMemoryBuffer(); | 75 GpuMemoryBuffer(); |
| 68 virtual ~GpuMemoryBuffer(); | 76 virtual ~GpuMemoryBuffer(); |
| 69 | 77 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 83 // Returns the stride in bytes for the buffer. | 91 // Returns the stride in bytes for the buffer. |
| 84 virtual uint32 GetStride() const = 0; | 92 virtual uint32 GetStride() const = 0; |
| 85 | 93 |
| 86 // Returns a platform specific handle for this buffer. | 94 // Returns a platform specific handle for this buffer. |
| 87 virtual GpuMemoryBufferHandle GetHandle() const = 0; | 95 virtual GpuMemoryBufferHandle GetHandle() const = 0; |
| 88 }; | 96 }; |
| 89 | 97 |
| 90 } // namespace gfx | 98 } // namespace gfx |
| 91 | 99 |
| 92 #endif // UI_GFX_GPU_MEMORY_BUFFER_H_ | 100 #endif // UI_GFX_GPU_MEMORY_BUFFER_H_ |
| OLD | NEW |