blob: cbe92565a13f43c3c05be3229199485c56f07b0e [file] [log] [blame]
Amit Pundirc738b812019-06-19 16:13:49 +05301/*
2 * Copyright (C) 2010-2011 Chia-I Wu <olvaffe@gmail.com>
3 * Copyright (C) 2010-2011 LunarG Inc.
4 * Copyright (C) 2016 Linaro, Ltd., Rob Herring <robh@kernel.org>
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included
14 * in all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
23 */
24
25#ifndef _GRALLOC_GBM_PRIV_H_
26#define _GRALLOC_GBM_PRIV_H_
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
32struct gbm_device;
33struct gbm_bo;
34
35int gralloc_gbm_handle_register(buffer_handle_t handle, struct gbm_device *gbm);
36int gralloc_gbm_handle_unregister(buffer_handle_t handle);
37
38buffer_handle_t gralloc_gbm_bo_create(struct gbm_device *gbm,
39 int width, int height, int format, int usage, int *stride);
40void gbm_free(buffer_handle_t handle);
41
42struct gbm_bo *gralloc_gbm_bo_from_handle(buffer_handle_t handle);
43buffer_handle_t gralloc_gbm_bo_get_handle(struct gbm_bo *bo);
44int gralloc_gbm_get_gem_handle(buffer_handle_t handle);
45
Shawn Guo08ad5762020-06-09 09:30:40 +080046int gralloc_gbm_bo_lock(buffer_handle_t handle, int usage, int x, int y, int w, int h, void **addr);
Amit Pundirc738b812019-06-19 16:13:49 +053047int gralloc_gbm_bo_unlock(buffer_handle_t handle);
Shawn Guo968b4662020-06-09 21:33:13 +080048int gralloc_gbm_bo_lock_ycbcr(buffer_handle_t handle, int usage,
49 int x, int y, int w, int h, struct android_ycbcr *ycbcr);
Amit Pundirc738b812019-06-19 16:13:49 +053050
51struct gbm_device *gbm_dev_create(void);
52void gbm_dev_destroy(struct gbm_device *gbm);
53
54#ifdef __cplusplus
55}
56#endif
57#endif /* _GRALLOC_GBM_PRIV_H_ */