android_external_minigbm/cros_gralloc/cros_gralloc.h
Gurchetan Singh 1b1d56ae40 minigbm: add clang-format and presubmit hooks
Running the presubmit.sh script will apply our rules to every file in
the repo. Exclude gbm.h from the formatting requirements since this file
was taken from other open-source projects, and diffing will be easier
without our formatting rules.

In addition, special case drivers where the order of includes matters.

BUG=none
TEST=Verified the following commands succeed:

emerge-cyan minigbm/arc-cros-gralloc
emerge-oak minigbm/arc-cros-gralloc
emerge-veyron_minnie-cheets minigbm/arc-cros-gralloc
emerge-peach_pi minigbm
emerge-nyan_big minigbm
emerge-jadeite minigbm

Change-Id: I6ce93fb1930da254d13d5017766c17341870ccc9
Reviewed-on: https://chromium-review.googlesource.com/447319
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2017-03-31 10:40:27 -07:00

45 lines
1.1 KiB
C++

/*
* Copyright 2016 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef GBM_GRALLOC_H
#define GBM_GRALLOC_H
#include "cros_gralloc_helpers.h"
#include <mutex>
#include <unordered_map>
#include <unordered_set>
struct cros_gralloc_bo {
struct bo *bo;
int32_t refcount;
struct cros_gralloc_handle *hnd;
struct map_info *map_data;
int32_t lockcount;
};
struct handle_info {
cros_gralloc_bo *bo;
int32_t registrations;
};
struct cros_gralloc_module {
gralloc_module_t base;
struct driver *drv;
std::mutex mutex;
std::unordered_map<cros_gralloc_handle *, handle_info> handles;
std::unordered_map<uint32_t, cros_gralloc_bo *> buffers;
};
int cros_gralloc_open(const struct hw_module_t *mod, const char *name, struct hw_device_t **dev);
int cros_gralloc_validate_reference(struct cros_gralloc_module *mod,
struct cros_gralloc_handle *hnd, struct cros_gralloc_bo **obj);
int cros_gralloc_decrement_reference_count(struct cros_gralloc_module *mod,
struct cros_gralloc_bo *obj);
#endif