Chromium Code Reviews| 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/gfx_export.h" | 12 #include "ui/gfx/gfx_export.h" |
| 13 | 13 |
| 14 #if defined(USE_OZONE) | |
| 15 #include "ui/gfx/native_pixmap_handle_ozone.h" | |
| 16 #endif | |
| 17 | |
| 14 extern "C" typedef struct _ClientBuffer* ClientBuffer; | 18 extern "C" typedef struct _ClientBuffer* ClientBuffer; |
| 15 | 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 SURFACE_TEXTURE_BUFFER, | 26 SURFACE_TEXTURE_BUFFER, |
| 23 OZONE_NATIVE_PIXMAP, | 27 OZONE_NATIVE_PIXMAP, |
| 24 GPU_MEMORY_BUFFER_TYPE_LAST = OZONE_NATIVE_PIXMAP | 28 GPU_MEMORY_BUFFER_TYPE_LAST = OZONE_NATIVE_PIXMAP |
| 25 }; | 29 }; |
| 26 | 30 |
| 27 using GpuMemoryBufferId = int32; | 31 using GpuMemoryBufferId = int32; |
| 28 | 32 |
| 29 struct GFX_EXPORT GpuMemoryBufferHandle { | 33 struct GFX_EXPORT GpuMemoryBufferHandle { |
| 30 GpuMemoryBufferHandle(); | 34 GpuMemoryBufferHandle(); |
| 31 bool is_null() const { return type == EMPTY_BUFFER; } | 35 bool is_null() const { return type == EMPTY_BUFFER; } |
| 32 GpuMemoryBufferType type; | 36 GpuMemoryBufferType type; |
| 33 GpuMemoryBufferId id; | 37 GpuMemoryBufferId id; |
| 34 base::SharedMemoryHandle handle; | 38 base::SharedMemoryHandle handle; |
| 39 #if defined(USE_OZONE) | |
| 40 NativePixmapHandle native_pixmap_handle; | |
|
dshwang
2015/08/05 13:30:10
we can pass |dmabuf_fd| via GpuMemoryBufferHandle:
reveman
2015/08/05 13:58:52
I prefer having the fd as part of |native_pixmap_h
dshwang
2015/08/05 14:12:51
I see. lgtm
| |
| 41 #endif | |
| 35 }; | 42 }; |
| 36 | 43 |
| 37 base::trace_event::MemoryAllocatorDumpGuid GFX_EXPORT | 44 base::trace_event::MemoryAllocatorDumpGuid GFX_EXPORT |
| 38 GetGpuMemoryBufferGUIDForTracing(uint64 tracing_process_id, | 45 GetGpuMemoryBufferGUIDForTracing(uint64 tracing_process_id, |
| 39 GpuMemoryBufferId buffer_id); | 46 GpuMemoryBufferId buffer_id); |
| 40 | 47 |
| 41 // This interface typically correspond to a type of shared memory that is also | 48 // This interface typically correspond to a type of shared memory that is also |
| 42 // shared with the GPU. A GPU memory buffer can be written to directly by | 49 // shared with the GPU. A GPU memory buffer can be written to directly by |
| 43 // regular CPU code, but can also be read by the GPU. | 50 // regular CPU code, but can also be read by the GPU. |
| 44 class GFX_EXPORT GpuMemoryBuffer { | 51 class GFX_EXPORT GpuMemoryBuffer { |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 72 // Returns a platform specific handle for this buffer. | 79 // Returns a platform specific handle for this buffer. |
| 73 virtual GpuMemoryBufferHandle GetHandle() const = 0; | 80 virtual GpuMemoryBufferHandle GetHandle() const = 0; |
| 74 | 81 |
| 75 // Type-checking downcast routine. | 82 // Type-checking downcast routine. |
| 76 virtual ClientBuffer AsClientBuffer() = 0; | 83 virtual ClientBuffer AsClientBuffer() = 0; |
| 77 }; | 84 }; |
| 78 | 85 |
| 79 } // namespace gfx | 86 } // namespace gfx |
| 80 | 87 |
| 81 #endif // UI_GFX_GPU_MEMORY_BUFFER_H_ | 88 #endif // UI_GFX_GPU_MEMORY_BUFFER_H_ |
| OLD | NEW |