OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_NATIVE_PIXMAP_HANDLE_H_ | 5 #ifndef UI_GFX_NATIVE_PIXMAP_HANDLE_H_ |
6 #define UI_GFX_NATIVE_PIXMAP_HANDLE_H_ | 6 #define UI_GFX_NATIVE_PIXMAP_HANDLE_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stdint.h> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "ui/gfx/gfx_export.h" | 11 #include "ui/gfx/gfx_export.h" |
12 | 12 |
13 #if defined(USE_OZONE) | 13 #if defined(USE_OZONE) |
14 #include "base/file_descriptor_posix.h" | 14 #include "base/file_descriptor_posix.h" |
15 #endif | 15 #endif |
16 | 16 |
17 namespace gfx { | 17 namespace gfx { |
18 | 18 |
19 // NativePixmapPlane is used to carry the plane related information for GBM | 19 // NativePixmapPlane is used to carry the plane related information for GBM |
20 // buffer. More fields can be added if they are plane specific. | 20 // buffer. More fields can be added if they are plane specific. |
21 struct GFX_EXPORT NativePixmapPlane { | 21 struct GFX_EXPORT NativePixmapPlane { |
22 NativePixmapPlane(); | 22 NativePixmapPlane(); |
23 NativePixmapPlane(int stride, int offset, size_t size, uint64_t modifier); | 23 NativePixmapPlane(int stride, int offset, uint64_t modifier); |
24 NativePixmapPlane(const NativePixmapPlane& other); | 24 NativePixmapPlane(const NativePixmapPlane& other); |
25 ~NativePixmapPlane(); | 25 ~NativePixmapPlane(); |
26 | 26 |
27 // The strides and offsets in bytes to be used when accessing the buffers via | 27 // The strides and offsets in bytes to be used when accessing the buffers via |
28 // a memory mapping. One per plane per entry. | 28 // a memory mapping. One per plane per entry. |
29 int stride; | 29 int stride; |
30 int offset; | 30 int offset; |
31 // Size in bytes of the plane. | |
32 // This is necessary to map the buffers. | |
33 size_t size; | |
34 // The modifier is retrieved from GBM library and passed to EGL driver. | 31 // The modifier is retrieved from GBM library and passed to EGL driver. |
35 // Generally it's platform specific, and we don't need to modify it in | 32 // Generally it's platform specific, and we don't need to modify it in |
36 // Chromium code. Also one per plane per entry. | 33 // Chromium code. Also one per plane per entry. |
37 uint64_t modifier; | 34 uint64_t modifier; |
38 }; | 35 }; |
39 | 36 |
40 struct GFX_EXPORT NativePixmapHandle { | 37 struct GFX_EXPORT NativePixmapHandle { |
41 NativePixmapHandle(); | 38 NativePixmapHandle(); |
42 NativePixmapHandle(const NativePixmapHandle& other); | 39 NativePixmapHandle(const NativePixmapHandle& other); |
43 | 40 |
44 ~NativePixmapHandle(); | 41 ~NativePixmapHandle(); |
45 | 42 |
46 #if defined(USE_OZONE) | 43 #if defined(USE_OZONE) |
47 // File descriptors for the underlying memory objects (usually dmabufs). | 44 // File descriptors for the underlying memory objects (usually dmabufs). |
48 std::vector<base::FileDescriptor> fds; | 45 std::vector<base::FileDescriptor> fds; |
49 #endif | 46 #endif |
50 std::vector<NativePixmapPlane> planes; | 47 std::vector<NativePixmapPlane> planes; |
51 }; | 48 }; |
52 | 49 |
53 } // namespace gfx | 50 } // namespace gfx |
54 | 51 |
55 #endif // UI_GFX_NATIVE_PIXMAP_HANDLE_H_ | 52 #endif // UI_GFX_NATIVE_PIXMAP_HANDLE_H_ |
OLD | NEW |