OSDN Git Service

Merge 'aosp/upstream-master' into 'aosp/master'
[android-x86/external-minigbm.git] / cros_gralloc / cros_gralloc_buffer.h
1 /*
2  * Copyright 2017 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_BUFFER_H
8 #define CROS_GRALLOC_BUFFER_H
9
10 #include "../drv.h"
11 #include "cros_gralloc_helpers.h"
12
13 class cros_gralloc_buffer
14 {
15       public:
16         cros_gralloc_buffer(uint32_t id, struct bo *acquire_bo,
17                             struct cros_gralloc_handle *acquire_handle);
18         ~cros_gralloc_buffer();
19
20         uint32_t get_id() const;
21
22         /* The new reference count is returned by both these functions. */
23         int32_t increase_refcount();
24         int32_t decrease_refcount();
25
26         int32_t lock(const struct rectangle *rect, uint32_t map_flags,
27                      uint8_t *addr[DRV_MAX_PLANES]);
28         int32_t unlock();
29         int32_t resource_info(uint32_t strides[DRV_MAX_PLANES], uint32_t offsets[DRV_MAX_PLANES]);
30
31       private:
32         cros_gralloc_buffer(cros_gralloc_buffer const &);
33         cros_gralloc_buffer operator=(cros_gralloc_buffer const &);
34
35         uint32_t id_;
36         struct bo *bo_;
37         struct cros_gralloc_handle *hnd_;
38
39         int32_t refcount_;
40         int32_t lockcount_;
41         uint32_t num_planes_;
42
43         struct mapping *lock_data_[DRV_MAX_PLANES];
44 };
45
46 #endif