| 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 "base/trace_event/memory_dump_manager.h" | |
| 13 #include "build/build_config.h" | 12 #include "build/build_config.h" |
| 14 #include "ui/gfx/buffer_types.h" | 13 #include "ui/gfx/buffer_types.h" |
| 15 #include "ui/gfx/generic_shared_memory_id.h" | 14 #include "ui/gfx/generic_shared_memory_id.h" |
| 16 #include "ui/gfx/geometry/rect.h" | 15 #include "ui/gfx/geometry/rect.h" |
| 17 #include "ui/gfx/gfx_export.h" | 16 #include "ui/gfx/gfx_export.h" |
| 18 | 17 |
| 19 #if defined(USE_OZONE) | 18 #if defined(USE_OZONE) |
| 20 #include "ui/gfx/native_pixmap_handle.h" | 19 #include "ui/gfx/native_pixmap_handle.h" |
| 21 #elif defined(OS_MACOSX) && !defined(OS_IOS) | 20 #elif defined(OS_MACOSX) && !defined(OS_IOS) |
| 22 #include "ui/gfx/mac/io_surface.h" | 21 #include "ui/gfx/mac/io_surface.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 49 base::SharedMemoryHandle handle; | 48 base::SharedMemoryHandle handle; |
| 50 uint32_t offset; | 49 uint32_t offset; |
| 51 int32_t stride; | 50 int32_t stride; |
| 52 #if defined(USE_OZONE) | 51 #if defined(USE_OZONE) |
| 53 NativePixmapHandle native_pixmap_handle; | 52 NativePixmapHandle native_pixmap_handle; |
| 54 #elif defined(OS_MACOSX) && !defined(OS_IOS) | 53 #elif defined(OS_MACOSX) && !defined(OS_IOS) |
| 55 ScopedRefCountedIOSurfaceMachPort mach_port; | 54 ScopedRefCountedIOSurfaceMachPort mach_port; |
| 56 #endif | 55 #endif |
| 57 }; | 56 }; |
| 58 | 57 |
| 59 base::trace_event::MemoryAllocatorDumpGuid GFX_EXPORT | |
| 60 GetGpuMemoryBufferGUIDForTracing(uint64_t tracing_process_id, | |
| 61 GpuMemoryBufferId buffer_id); | |
| 62 | |
| 63 // This interface typically correspond to a type of shared memory that is also | 58 // This interface typically correspond to a type of shared memory that is also |
| 64 // shared with the GPU. A GPU memory buffer can be written to directly by | 59 // shared with the GPU. A GPU memory buffer can be written to directly by |
| 65 // regular CPU code, but can also be read by the GPU. | 60 // regular CPU code, but can also be read by the GPU. |
| 66 class GFX_EXPORT GpuMemoryBuffer { | 61 class GFX_EXPORT GpuMemoryBuffer { |
| 67 public: | 62 public: |
| 68 virtual ~GpuMemoryBuffer() {} | 63 virtual ~GpuMemoryBuffer() {} |
| 69 | 64 |
| 70 // Maps each plane of the buffer into the client's address space so it can be | 65 // Maps each plane of the buffer into the client's address space so it can be |
| 71 // written to by the CPU. This call may block, for instance if the GPU needs | 66 // written to by the CPU. This call may block, for instance if the GPU needs |
| 72 // to finish accessing the buffer or if CPU caches need to be synchronized. | 67 // to finish accessing the buffer or if CPU caches need to be synchronized. |
| (...skipping 28 matching lines...) Expand all Loading... |
| 101 // Returns a platform specific handle for this buffer. | 96 // Returns a platform specific handle for this buffer. |
| 102 virtual GpuMemoryBufferHandle GetHandle() const = 0; | 97 virtual GpuMemoryBufferHandle GetHandle() const = 0; |
| 103 | 98 |
| 104 // Type-checking downcast routine. | 99 // Type-checking downcast routine. |
| 105 virtual ClientBuffer AsClientBuffer() = 0; | 100 virtual ClientBuffer AsClientBuffer() = 0; |
| 106 }; | 101 }; |
| 107 | 102 |
| 108 } // namespace gfx | 103 } // namespace gfx |
| 109 | 104 |
| 110 #endif // UI_GFX_GPU_MEMORY_BUFFER_H_ | 105 #endif // UI_GFX_GPU_MEMORY_BUFFER_H_ |
| OLD | NEW |