OSDN Git Service

minigbm: stop faking the protected buffers
[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         uint32_t tiling;
35         uint64_t format_modifier;
36         uint64_t use_flags; /* Buffer creation flags */
37         uint32_t magic;
38         uint32_t pixel_stride;
39         int32_t droid_format;
40         int32_t usage; /* Android usage. */
41         uint32_t num_planes;
42         uint64_t reserved_region_size;
43         uint64_t total_size; /* Total allocation size */
44         /*
45          * Name is a null terminated char array located at handle->base.data[handle->name_offset].
46          */
47         uint32_t name_offset;
48 } __attribute__((packed));
49
50 typedef const struct cros_gralloc_handle *cros_gralloc_handle_t;
51
52 #endif