OSDN Git Service

minigbm: cros_gralloc: Use pkg-config
[android-x86/external-minigbm.git] / cros_gralloc / cros_gralloc.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 GBM_GRALLOC_H
8 #define GBM_GRALLOC_H
9
10 #include "cros_gralloc_helpers.h"
11
12 #include <mutex>
13 #include <unordered_map>
14 #include <unordered_set>
15
16 struct cros_gralloc_bo {
17         struct bo *bo;
18         int32_t refcount;
19         struct cros_gralloc_handle *hnd;
20         struct map_info *map_data;
21         int32_t lockcount;
22 };
23
24 struct handle_info {
25         cros_gralloc_bo *bo;
26         int32_t registrations;
27 };
28
29 struct cros_gralloc_module {
30         gralloc_module_t base;
31         struct driver *drv;
32         std::mutex mutex;
33         std::unordered_map<cros_gralloc_handle *, handle_info> handles;
34         std::unordered_map<uint32_t, cros_gralloc_bo *> buffers;
35 };
36
37 int cros_gralloc_open(const struct hw_module_t *mod, const char *name, struct hw_device_t **dev);
38
39 int cros_gralloc_validate_reference(struct cros_gralloc_module *mod,
40                                     struct cros_gralloc_handle *hnd, struct cros_gralloc_bo **obj);
41
42 int cros_gralloc_decrement_reference_count(struct cros_gralloc_module *mod,
43                                            struct cros_gralloc_bo *obj);
44
45 #endif