| 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" | 12 #include "base/trace_event/memory_dump_manager.h" |
| 13 #include "build/build_config.h" | 13 #include "build/build_config.h" |
| 14 #include "ui/gfx/buffer_types.h" | 14 #include "ui/gfx/buffer_types.h" |
| 15 #include "ui/gfx/generic_shared_memory_id.h" | 15 #include "ui/gfx/generic_shared_memory_id.h" |
| 16 #include "ui/gfx/geometry/rect.h" | 16 #include "ui/gfx/geometry/rect.h" |
| 17 #include "ui/gfx/gfx_export.h" | 17 #include "ui/gfx/gfx_export.h" |
| 18 | 18 |
| 19 #if defined(USE_OZONE) | 19 #if defined(USE_OZONE) |
| 20 #include "ui/gfx/native_pixmap_handle_ozone.h" | 20 #include "ui/gfx/native_pixmap_handle_ozone.h" |
| 21 #elif defined(OS_MACOSX) && !defined(OS_IOS) | 21 #elif defined(OS_MACOSX) && !defined(OS_IOS) |
| 22 #include "ui/gfx/mac/io_surface.h" | 22 #include "ui/gfx/mac/io_surface.h" |
| 23 #endif | 23 #endif |
| 24 | 24 |
| 25 extern "C" typedef struct _ClientBuffer* ClientBuffer; | 25 extern "C" typedef struct _ClientBuffer* ClientBuffer; |
| 26 | 26 |
| 27 namespace gfx { | 27 namespace gfx { |
| 28 | 28 |
| 29 class ColorSpace; |
| 30 |
| 29 enum GpuMemoryBufferType { | 31 enum GpuMemoryBufferType { |
| 30 EMPTY_BUFFER, | 32 EMPTY_BUFFER, |
| 31 SHARED_MEMORY_BUFFER, | 33 SHARED_MEMORY_BUFFER, |
| 32 IO_SURFACE_BUFFER, | 34 IO_SURFACE_BUFFER, |
| 33 SURFACE_TEXTURE_BUFFER, | 35 SURFACE_TEXTURE_BUFFER, |
| 34 OZONE_NATIVE_PIXMAP, | 36 OZONE_NATIVE_PIXMAP, |
| 35 GPU_MEMORY_BUFFER_TYPE_LAST = OZONE_NATIVE_PIXMAP | 37 GPU_MEMORY_BUFFER_TYPE_LAST = OZONE_NATIVE_PIXMAP |
| 36 }; | 38 }; |
| 37 | 39 |
| 38 using GpuMemoryBufferId = GenericSharedMemoryId; | 40 using GpuMemoryBufferId = GenericSharedMemoryId; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 // Returns the size for the buffer. | 84 // Returns the size for the buffer. |
| 83 virtual Size GetSize() const = 0; | 85 virtual Size GetSize() const = 0; |
| 84 | 86 |
| 85 // Returns the format for the buffer. | 87 // Returns the format for the buffer. |
| 86 virtual BufferFormat GetFormat() const = 0; | 88 virtual BufferFormat GetFormat() const = 0; |
| 87 | 89 |
| 88 // Fills the stride in bytes for each plane of the buffer. The stride of | 90 // Fills the stride in bytes for each plane of the buffer. The stride of |
| 89 // plane K is stored at index K-1 of the |stride| array. | 91 // plane K is stored at index K-1 of the |stride| array. |
| 90 virtual int stride(size_t plane) const = 0; | 92 virtual int stride(size_t plane) const = 0; |
| 91 | 93 |
| 94 // Set the color space in which this buffer should be interpreted when used |
| 95 // for scanout. Note that this will not impact texturing from the buffer. |
| 96 virtual void SetColorSpaceForScanout(const gfx::ColorSpace& color_space); |
| 97 |
| 92 // Returns a unique identifier associated with buffer. | 98 // Returns a unique identifier associated with buffer. |
| 93 virtual GpuMemoryBufferId GetId() const = 0; | 99 virtual GpuMemoryBufferId GetId() const = 0; |
| 94 | 100 |
| 95 // Returns a platform specific handle for this buffer. | 101 // Returns a platform specific handle for this buffer. |
| 96 virtual GpuMemoryBufferHandle GetHandle() const = 0; | 102 virtual GpuMemoryBufferHandle GetHandle() const = 0; |
| 97 | 103 |
| 98 // Type-checking downcast routine. | 104 // Type-checking downcast routine. |
| 99 virtual ClientBuffer AsClientBuffer() = 0; | 105 virtual ClientBuffer AsClientBuffer() = 0; |
| 100 }; | 106 }; |
| 101 | 107 |
| 102 } // namespace gfx | 108 } // namespace gfx |
| 103 | 109 |
| 104 #endif // UI_GFX_GPU_MEMORY_BUFFER_H_ | 110 #endif // UI_GFX_GPU_MEMORY_BUFFER_H_ |
| OLD | NEW |