OSDN Git Service

796f4f73dcfffccec1f681c7eeaf7a5b9928b31b
[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_set>
14 #include <unordered_map>
15
16 struct cros_gralloc_bo {
17         struct bo *bo;
18         int32_t refcount;
19         struct cros_gralloc_handle *hnd;
20         void *map_data;
21 };
22
23 struct cros_gralloc_module {
24         gralloc_module_t base;
25         struct driver *drv;
26         std::mutex mutex;
27         std::unordered_set<uint64_t> handles;
28         std::unordered_map<uint32_t, cros_gralloc_bo*> buffers;
29 };
30
31 int cros_gralloc_open(const struct hw_module_t *mod, const char *name,
32                       struct hw_device_t **dev);
33
34 int cros_gralloc_validate_reference(struct cros_gralloc_module *mod,
35                                     struct cros_gralloc_handle *hnd,
36                                     struct cros_gralloc_bo **obj);
37
38 int cros_gralloc_decrement_reference_count(struct cros_gralloc_module *mod,
39                                            struct cros_gralloc_bo *obj);
40
41 #endif