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.
7 #ifndef CROS_GRALLOC_DRIVER_H
8 #define CROS_GRALLOC_DRIVER_H
10 #include "cros_gralloc_buffer.h"
13 #include <unordered_map>
15 class cros_gralloc_driver
18 cros_gralloc_driver();
19 ~cros_gralloc_driver();
22 bool is_supported(const struct cros_gralloc_buffer_descriptor *descriptor);
23 int32_t allocate(const struct cros_gralloc_buffer_descriptor *descriptor,
24 buffer_handle_t *out_handle);
26 int32_t retain(buffer_handle_t handle);
27 int32_t release(buffer_handle_t handle);
29 int32_t lock(buffer_handle_t handle, int32_t acquire_fence, uint64_t flags,
30 uint8_t *addr[DRV_MAX_PLANES]);
31 int32_t unlock(buffer_handle_t handle, int32_t *release_fence);
33 int32_t get_backing_store(buffer_handle_t handle, uint64_t *out_store);
36 cros_gralloc_driver(cros_gralloc_driver const &);
37 cros_gralloc_driver operator=(cros_gralloc_driver const &);
38 cros_gralloc_buffer *get_buffer(cros_gralloc_handle_t hnd);
42 std::unordered_map<uint32_t, cros_gralloc_buffer *> buffers_;
43 std::unordered_map<cros_gralloc_handle_t, std::pair<cros_gralloc_buffer *, int32_t>>