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.
7 #ifndef CROS_GRALLOC_HANDLE_H
8 #define CROS_GRALLOC_HANDLE_H
11 #include <cutils/native_handle.h>
13 #define DRV_MAX_PLANES 4
14 #define DRV_MAX_FDS (DRV_MAX_PLANES + 1)
16 struct cros_gralloc_handle {
19 * File descriptors must immediately follow the native_handle_t base and used file
20 * descriptors must be packed at the beginning of this array to work with
21 * native_handle_clone().
23 * This field contains 'num_planes' plane file descriptors followed by an optional metadata
24 * reserved region file descriptor if 'reserved_region_size' is greater than zero.
26 int32_t fds[DRV_MAX_FDS];
27 uint32_t strides[DRV_MAX_PLANES];
28 uint32_t offsets[DRV_MAX_PLANES];
29 uint32_t sizes[DRV_MAX_PLANES];
33 uint32_t format; /* DRM format */
34 uint64_t format_modifier;
35 uint64_t use_flags; /* Buffer creation flags */
37 uint32_t pixel_stride;
39 int32_t usage; /* Android usage. */
41 uint64_t reserved_region_size;
42 uint64_t total_size; /* Total allocation size */
44 * Name is a null terminated char array located at handle->base.data[handle->name_offset].
47 } __attribute__((packed));
49 typedef const struct cros_gralloc_handle *cros_gralloc_handle_t;