| 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/files/file.h" |
| 8 #include "base/memory/shared_memory.h" | 9 #include "base/memory/shared_memory.h" |
| 9 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| 10 #include "ui/gfx/gfx_export.h" | 11 #include "ui/gfx/gfx_export.h" |
| 11 | 12 |
| 12 extern "C" typedef struct _ClientBuffer* ClientBuffer; | 13 extern "C" typedef struct _ClientBuffer* ClientBuffer; |
| 13 | 14 |
| 14 namespace gfx { | 15 namespace gfx { |
| 15 | 16 |
| 16 enum GpuMemoryBufferType { | 17 enum GpuMemoryBufferType { |
| 17 EMPTY_BUFFER, | 18 EMPTY_BUFFER, |
| 18 SHARED_MEMORY_BUFFER, | 19 SHARED_MEMORY_BUFFER, |
| 19 IO_SURFACE_BUFFER, | 20 IO_SURFACE_BUFFER, |
| 20 SURFACE_TEXTURE_BUFFER, | 21 SURFACE_TEXTURE_BUFFER, |
| 21 OZONE_NATIVE_BUFFER, | 22 OZONE_NATIVE_BUFFER, |
| 22 GPU_MEMORY_BUFFER_TYPE_LAST = OZONE_NATIVE_BUFFER | 23 GPU_MEMORY_BUFFER_TYPE_LAST = OZONE_NATIVE_BUFFER |
| 23 }; | 24 }; |
| 24 | 25 |
| 25 using GpuMemoryBufferId = int32; | 26 using GpuMemoryBufferId = int32; |
| 26 | 27 |
| 27 struct GFX_EXPORT GpuMemoryBufferHandle { | 28 struct GFX_EXPORT GpuMemoryBufferHandle { |
| 28 GpuMemoryBufferHandle(); | 29 GpuMemoryBufferHandle(); |
| 29 bool is_null() const { return type == EMPTY_BUFFER; } | 30 bool is_null() const { return type == EMPTY_BUFFER; } |
| 30 GpuMemoryBufferType type; | 31 GpuMemoryBufferType type; |
| 31 GpuMemoryBufferId id; | 32 GpuMemoryBufferId id; |
| 32 base::SharedMemoryHandle handle; | 33 base::SharedMemoryHandle handle; |
| 34 base::PlatformFile fd; |
| 33 #if defined(OS_MACOSX) | 35 #if defined(OS_MACOSX) |
| 34 uint32 io_surface_id; | 36 uint32 io_surface_id; |
| 35 #endif | 37 #endif |
| 36 }; | 38 }; |
| 37 | 39 |
| 38 // This interface typically correspond to a type of shared memory that is also | 40 // This interface typically correspond to a type of shared memory that is also |
| 39 // shared with the GPU. A GPU memory buffer can be written to directly by | 41 // shared with the GPU. A GPU memory buffer can be written to directly by |
| 40 // regular CPU code, but can also be read by the GPU. | 42 // regular CPU code, but can also be read by the GPU. |
| 41 class GFX_EXPORT GpuMemoryBuffer { | 43 class GFX_EXPORT GpuMemoryBuffer { |
| 42 public: | 44 public: |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 // Returns a platform specific handle for this buffer. | 89 // Returns a platform specific handle for this buffer. |
| 88 virtual GpuMemoryBufferHandle GetHandle() const = 0; | 90 virtual GpuMemoryBufferHandle GetHandle() const = 0; |
| 89 | 91 |
| 90 // Type-checking downcast routine. | 92 // Type-checking downcast routine. |
| 91 virtual ClientBuffer AsClientBuffer() = 0; | 93 virtual ClientBuffer AsClientBuffer() = 0; |
| 92 }; | 94 }; |
| 93 | 95 |
| 94 } // namespace gfx | 96 } // namespace gfx |
| 95 | 97 |
| 96 #endif // UI_GFX_GPU_MEMORY_BUFFER_H_ | 98 #endif // UI_GFX_GPU_MEMORY_BUFFER_H_ |
| OLD | NEW |