1 /*
2  * Copyright 2016 The Chromium OS Authors. All rights reserved.
3  * Use of this source code is governed by a BSD-style license that can be
4  * found in the LICENSE file.
5  */
6 
7 #ifndef CROS_GRALLOC_HANDLE_H
8 #define CROS_GRALLOC_HANDLE_H
9 
10 #include <cstdint>
11 #include <cutils/native_handle.h>
12 
13 #define DRV_MAX_PLANES 4
14 
15 /*
16  * Only use 32-bit integers in the handle. This guarantees that the handle is
17  * densely packed (i.e, the compiler does not insert any padding).
18  */
19 
20 struct cros_gralloc_handle {
21 	native_handle_t base;
22 	int32_t fds[DRV_MAX_PLANES];
23 	uint32_t strides[DRV_MAX_PLANES];
24 	uint32_t offsets[DRV_MAX_PLANES];
25 	uint32_t format_modifiers[2 * DRV_MAX_PLANES];
26 	uint32_t width;
27 	uint32_t height;
28 	uint32_t format;       /* DRM format */
29 	uint32_t use_flags[2]; /* Buffer creation flags */
30 	uint32_t magic;
31 	uint32_t pixel_stride;
32 	int32_t droid_format;
33 	int32_t usage; /* Android usage. */
34 };
35 
36 typedef const struct cros_gralloc_handle *cros_gralloc_handle_t;
37 
38 #endif
39