OSDN Git Service

[automerger skipped] Revert "Merge Android R" am: 56e3e9014e -s ours
[android-x86/external-minigbm.git] / cros_gralloc / cros_gralloc_handle.h
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 {
17         native_handle_t base;
18         /*
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().
22          *
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.
25          */
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];
30         uint32_t id;
31         uint32_t width;
32         uint32_t height;
33         uint32_t format; /* DRM format */
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