• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #define DRV_MAX_FDS (DRV_MAX_PLANES + 1)
15 
16 struct cros_gralloc_handle : public native_handle_t {
17 	/*
18 	 * File descriptors must immediately follow the native_handle_t base and used file
19 	 * descriptors must be packed at the beginning of this array to work with
20 	 * native_handle_clone().
21 	 *
22 	 * This field contains 'num_planes' plane file descriptors followed by an optional metadata
23 	 * reserved region file descriptor if 'reserved_region_size' is greater than zero.
24 	 */
25 	int32_t fds[DRV_MAX_FDS];
26 	uint32_t strides[DRV_MAX_PLANES];
27 	uint32_t offsets[DRV_MAX_PLANES];
28 	uint32_t sizes[DRV_MAX_PLANES];
29 	uint32_t id;
30 	uint32_t width;
31 	uint32_t height;
32 	uint32_t format; /* DRM format */
33 	uint32_t tiling;
34 	uint64_t format_modifier;
35 	uint64_t use_flags; /* Buffer creation flags */
36 	uint32_t magic;
37 	uint32_t pixel_stride;
38 	int32_t droid_format;
39 	int32_t usage; /* Android usage. */
40 	uint32_t num_planes;
41 	uint64_t reserved_region_size;
42 	uint64_t total_size; /* Total allocation size */
43 	/*
44 	 * Name is a null terminated char array located at handle->base.data[handle->name_offset].
45 	 */
46 	uint32_t name_offset;
47 } __attribute__((packed));
48 
49 typedef const struct cros_gralloc_handle *cros_gralloc_handle_t;
50 
51 #endif
52